2009 Aug 12 10:29 AM
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
2009 Aug 12 10:35 AM
Hi
It depends on how u've created the dynamic table: let's know more information
Max
2009 Aug 12 10:43 AM
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
2009 Aug 12 10:50 AM
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
2009 Aug 12 1:57 PM
2009 Aug 12 7:06 PM
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!
2009 Aug 13 8:27 AM
Hi,
I am abe to read the dynamic field symbol using format
read <fs> assigning <fs> with key ('FIELD') = Value1 ('FIELD2') = value2.
Thanks