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

Reading a field symbol whose structure is dynamic

Former Member
0 Likes
3,575

Hi Experts,

I have used the concept of dynamic internal tables to select data from COSS/COSP for e.g.database tables.Field symbol of type " ANY TABLE" has been used to select data , as the dynamic structure is assigned directly to the field symbol.

To calculate the values of various fields I need to read the this field symbol for diferent line items , but I get a compilation error saying " Key not Found ". I understand that I am not able to read the field symbol because its structure is of type 'ANY TABLE' .How do I read this field symbol ?

The field symbol gets the structure of dynamic internal table as formed initially by using class concept.Is their any way in which I could get the structure of this field symbol or any other way to read it?

Thanks in advance.

Regards

Reetwika

Hi Experts,

I have used the concept of dynamic internal tables to select data from COSS/COSP for e.g.database tables.Field symbol of type " ANY TABLE" has been used to select data , as the dynamic structure is assigned directly to the field symbol.

To calculate the values of various fields I need to read the this field symbol for diferent line items , but I get a compilation error saying " Key not Found ". I understand that I am not able to read the field symbol because its structure is of type 'ANY TABLE' .How do I read this field symbol ?

The field symbol gets the structure of dynamic internal table as formed initially by using class concept.Is their any way in which I could get the structure of this field symbol or any other way to read it?

Thanks in advance.

Regards

Reetwika

6 REPLIES 6
Read only

Former Member
0 Likes
1,935

Hi

It depends on how u've created the dynamic table: let's know more information

Max

Read only

Former Member
0 Likes
1,935

Hi Reetwika,

For reading a field symbol you can use the code given below:

FIELD-SYMBOLS: <dynline> TYPE ANY.

FIELD-SYMBOLS: <fld> TYPE ANY.

LOOP AT <table name> ASSIGNING <DYNLINE>.

WHILE SY-SUBRC = 0.

ASSIGN COMPONENT SY-INDEX OF STRUCTURE <DYNLINE> TO <FLD>.

WRITE 😕 <FLD>.

ENDWHILE.

ENDLOOP.

Here "table name" is the name of the internal table from where you want to read.

Hope ,it might help you.

Thanks & regards,

Sarita Singh

Read only

Former Member
0 Likes
1,935

Hi Ritwika,

Even if u use the concept if dynamic internal table, u can read the each of the field of ur structure,

if u know the name of the field.

for example:

MATNR being one of the field of internal table

field-symbols : <fs> type any.

loop at <fs_it> into <fs_wa>.

ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_wa> to <fs_matnr>.

" in this case matnr field value will be assigned to the field symbol <fs_matnr>, so it can be used further.

endloop.

" do reply if still confused.

Rohit G

Edited by: Rohit Gaharwar on Aug 12, 2009 11:51 AM

Read only

Former Member
0 Likes
1,935

Hi Experts

Thanks my query is solved!!

Read only

0 Likes
1,935

A feedback would be great (explain the solution), and please give points to thank at least one person who gave his time to you (see forum rules of engagement). Don't forget to close ("answered" flag) the message too!

Read only

Former Member
0 Likes
1,935

Hi,

I am abe to read the dynamic field symbol using format

read <fs> assigning <fs> with key ('FIELD') = Value1 ('FIELD2') = value2.

Thanks