in internal tables,

Question:
Hi !
i hava an internal table.
data: begin of itab occurs 0,
var1 type i,
var2 type i,
..
..
...
end of itab.
data str(4) type c value 'XXXX'.
here XXXX may by var1 or
var2 or
var3 or ...........
in the run time i am getting field name of itab in STR ie (var1 or var2, etc)
now i want to access itab with STR
based on STR value(coloum name)
var1 or var2 or ........
^
|
itab- (STR) = 10.
append itab.
Pls try to help me
Answer:
Hi
Hope the following code will help solve ur problem...
data : begin of itab occurs 0,
field1(3) type c,
field2 type i,
end of itab.
data : field_name(15) type c.
field-symbols <fs>.
field_name = 'FIELD1'.
assign component field_name of structure itab to <fs>.
* Now you can assign what ever u want to that field
<fs> = 'ABC'.
append itab.
loop at itab.
* display.....
endloop.
Cheers
Deepak

More Articles:

SET PF-STATUS 'GRAF'?
development class?
Create Functional Area?
Grid - How to make header like this?
How to find Enchancement name?
Problem in Element label Urgent?