Application Development and Automation 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: 
Read only

Finding column Name in structure

Former Member
0 Likes
599

Hi All

I have a requirement where i have the field names ( matnr, ekorg) etc., in an intenal table. eg., . using those names I need to read another internal table which carries values for the fields. I need to write a program to check if a particular field in table 1 has an initial value in table 2 or not.

for my logic, I am looping on tab1( since it will contan only few fields) and assigning it to field symbols. but since the values from tab1 are dynamic, i cant hard code to assign field name like Matnr. So I am unable to figure out who to read tab2 with the field names i find in tab1.

I used cl_abap_tabledescr=>describe_by_data (itab2) to columize the fields of itab2. but this method doesnt fetch me the field values? I was wondering if my approach was correct and if there is any way to use fields from itab1 to read values from itab2.

I am not an ABAP expert, so any help is appreciated

Regards

Ruel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
420

Hi,

You can use this to get the field values.


ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.

[Here|http://help.sap.com/saphelp_470/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/content.htm] is the link to documentation.

2 REPLIES 2
Read only

Former Member
0 Likes
421

Hi,

You can use this to get the field values.


ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.

[Here|http://help.sap.com/saphelp_470/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/content.htm] is the link to documentation.

Read only

0 Likes
420

Thank you nitwick for your quick help. i am able to read the value using fs.

assigned full points. thanks again