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: 

Change column name of internal table dynamically

ashok2021
Explorer
0 Kudos
2,358

Hi,

I know this is a basic abap question but please let me know how to change the field names of a internal table with field symbols in runtime. In the past I have done creating dynamic internal tables, assign values based on internal table field names but I have never done changing the field names on a internal table dynamically.

Example would be I have a internal table coming from an external app with the following structure:

I want the field names to be renamed as below dynamically at runtime:

Please let me know how to solve this.

Thanks,

Ashok

6 REPLIES 6

zeshanshafqat79
Active Participant
0 Kudos
1,470

1. go and find the structure table from your code

2. and then edit the field names of your structure table and also text if needed.

3. save and active your structure table.

4. replace your changed fields from your code then save and active.

if any issues then never hasitate to contact me.

Deputy Manager (SAP BI/BW and SAP Analytics Cloud)

ashok2021
Explorer
0 Kudos
1,470

Hi Zeshan,

Thanks for the reply but all the changes like the field names need to be changed dynamically. There is no DD structure involved here. Its all at runtime. As I mentioned the first structure (refer screenshot 1) comes from an external vendor app. Inside my code at runtime I need to change the field names and make it similar to the 2nd Screenshot.

Regards

BhargavaReddy
Active Participant
1,470

Hi Ashok,


The internal table field name cannot be changed dynamically at runtime. Instead, you can create a new internal table (dynamically if necessary) with a new structure and move the data using field symbols.

Thank you.

Best Regards,

Bhargava

Sandra_Rossi
Active Contributor
1,470

Internally, the names of variables and structure components are always upper case, dot is not permitted, etc.

If you mean changing the column headings which are output to the users (screen, print form, etc.), then it's feasible.

zeshanshafqat79
Active Participant
0 Kudos
1,470

you can also place these in another variable. The variable name can be modifiable in your code.

Deputy Manager (SAP BI/BW and SAP Analytics Cloud)

raymond_giuseppi
Active Contributor
0 Kudos
1,470

Create a second itab dynamically (but with correct field names, uppercase etc.) and then move data from first itab to this new one.

Where are you stuck?