2009 Mar 06 5:54 PM
I'm not sure how to use field symbols. Can someone help me in this situation ?
I have a tab with fields qty1 to qty40.
I would like to affect those variables according to the sy-tabix.
Something like this:
LOOP AT tab.
idx = sy-tabix.
tab-qty<idx??> = value.
ENDLOOP.
Can anyone help me ?
Thank you in advance.
Nuno
2009 Mar 06 6:27 PM
Hi check this sample code... for a beginning:
FIELD-SYMBOLS: <fs> TYPE ANY.
LOOP AT itab INTO <fs_wa>.
CONCATENATE 'wa-' sy-tabix INTO lv_temp.
ASSIGN lv_temp TO <fs>.
<fs> = <fs_wa>-data.
ENDLOOP.
I'm not sure how to use field symbols. Can someone help me in this situation ?
I have a tab with fields qty1 to qty40.
I would like to affect those variables according to the sy-tabix.
Something like this:
LOOP AT tab.
idx = sy-tabix.
tab-qty<idx??> = value.
ENDLOOP.
Can anyone help me ?
Thank you in advance.
Nuno
2009 Mar 06 6:06 PM
Hi,
You can do this way..
Data : quant type itab-qty01.
Data : quantity type itab-qty01.
LOOP AT tab.
DO 40 TIME VARYING quant FROM QTY01 NEXT QTY40.
" quant hold the value of qty01 in fist loop and next in secod loop and so on..
quantity = quantity + quant. " u get the sum of all quantuity form qty01 to qty40
ENDDO.
ENDLOOP.
2009 Mar 06 6:23 PM
hi,
field-symbols: <fs> like itab-qty1.
data:
qty_field type string.
loop at itab.
concatenate 'itab-qty' sy-tabix into qty_field.
assign (qty_field) into <fs>.
<fs> = value.
endloop.
This will work...
2009 Mar 06 6:27 PM
Hi check this sample code... for a beginning:
FIELD-SYMBOLS: <fs> TYPE ANY.
LOOP AT itab INTO <fs_wa>.
CONCATENATE 'wa-' sy-tabix INTO lv_temp.
ASSIGN lv_temp TO <fs>.
<fs> = <fs_wa>-data.
ENDLOOP.
2009 Mar 06 6:35 PM
Check this one :
LOOP AT tab assigning <fs>.
<fs>-idx = sy-tabix.
ENDLOOP.
If your field sysmbol have same structure, then you can just assign update the <fs> in each loop. It will update the internal table, with required data.
Kuntal.
Edited by: Kuntal Nandi on Mar 6, 2009 12:35 PM