Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the column name alias from another table in a query

0 Kudos

Hi everyone,

Maybe it is a begginer question, please be kind! 🙂

I am making a simple query in SAPB1 version 10, and I would like to modify the name of one column. I know that I could use the method 'AS' to create an alias for the column, but that alias is permanent, if I needed to change it I would have to edit the code every time.

So I would like to use an specific value from another table for the column name.

Is it possible? If not, how can I use dynamic column names instead?

Here an example of my original code for your reference:

SELECT 
T0.Atrib_1  as "ITEM COLOR"
FROM ATRIBUTES T0
WHERE T0.ITEMCODE = 'MP1001'

Here what I've tried unsuccessfully:

SELECT 
T0.Atrib_1  as (SELECT T1.NAME FROM ATRIBUTESLIST T1 WHERE T1.CODE = 'ATR001') -- it should return "ITEM COLOR"
FROM ATRIBUTES T0
WHERE T0.ITEMCODE = 'MP1001'

Thanks in advance!!

  • SAP Managed Tags:
0 REPLIES 0