2010 Sep 22 11:36 AM
Hello Experts,
How to match a certain value fetched from table to the internal table field.
For instance: transparent table has a column containing values as
AMOUNT
QUANTITY
there is another work area structure associated with different internal table consisting of amount and quantity fields.
Now depending on whether the record from transparent table has fetched AMOUNT or QUANTITY, i have to read either the amount or quantity value from the work area.
Can any one please suggest a technique to do it?
Thanks,
Pankaj
2010 Sep 22 11:43 AM
You can do this using field symbols
field-symbols <comp>.
assign component 'AMOUNT' of structure wa_some_structure to <comp>.
if sy-subrc = 0.
"here <comp> holds value of AMOUNT
endif.
You can replace 'AMOUNT' with any variable which holds the name of component you want to access.
Regards
Marcin
Hello Experts,
How to match a certain value fetched from table to the internal table field.
For instance: transparent table has a column containing values as
AMOUNT
QUANTITY
there is another work area structure associated with different internal table consisting of amount and quantity fields.
Now depending on whether the record from transparent table has fetched AMOUNT or QUANTITY, i have to read either the amount or quantity value from the work area.
Can any one please suggest a technique to do it?
Thanks,
Pankaj
2010 Sep 22 11:43 AM
You can do this using field symbols
field-symbols <comp>.
assign component 'AMOUNT' of structure wa_some_structure to <comp>.
if sy-subrc = 0.
"here <comp> holds value of AMOUNT
endif.
You can replace 'AMOUNT' with any variable which holds the name of component you want to access.
Regards
Marcin
2010 Sep 22 3:31 PM
Thanks Marcin,
Problem resolved with field symbols.
Assigning points
Best Regards,
Pankaj
2010 Sep 22 11:44 AM
Hi
Try This:
suppose you have zitab table as trans. Table and another table itab1 with work area wa.
First you need to select values from Zitab to an internal table say itab.
sort itab by <field name>
loop at itab.
read table itab1 into wa with key quantity = itab-quantity
amount = itab-amount.
endloop.
This will read table itab1 where quantity and amount from itab table matches.
hope this will work for you.
thanks
Lalit Gupta