Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Symbols

Former Member
0 Likes
678

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

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
653

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

4 REPLIES 4
Read only

Former Member
0 Likes
653

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.

Read only

Former Member
0 Likes
653

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...

Read only

former_member156446
Active Contributor
0 Likes
654

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.

Read only

former_member376453
Contributor
0 Likes
653

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