06-19-2010 9:07 AM
i am new to field symbols, pls help
i want to know which is the right way of declaration ?
types: begin of typ_tab,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
- - - - -
end of typ_tab.
data: itab type standard table of typ_tab,
wa type typ_tab.
field-symbols: <f_t> type standard table,
<f_w> type any, or <f_w> like line of typ_tab, ??
<f_s> type any.
select vbeln posnr ....... into itab......
assign itab to <f_t>.
assign wa to <f_w>.
loop at <f_t> assigning <f_w>.
assign component 'vbeln' of structure <f_w> to <f_s>.
write : / <f_s>.
endloop.
OR
loop at itab assigning <f_w>.
write: / <f_w>-vbeln.
endloop.
r these 2 statements correctt ? if so then which one to use, pls show with an example. wats the diff btwn above 2 types of looping statements ? how to use read statement on this ?
06-19-2010 12:19 PM
Hello Saurajit,
Both the way are correct. And it depends on the requirement, which one to use.
<f_w> TYPE ty_tab - is TYPED field symbol - if you know TYPE before runtime you can use this. It will just work like a static work area.
<f_w> TYPE any - is not TYPED and structure of this field symbol is defined during runtime using ASSIGN statement. And fields of the structure is read by ASSIGN COMPONENT <<field name>> statement.