Skip to Content
0

Looping field symbol

Oct 22, 2016 at 03:58 PM

103

avatar image

Hello

LOOP AT <datatable> ASSIGNING/Into <wa_datatable>.

Endloop.

<datatable> having multiple records of matnr.

I want to get each value of matnr(<wa_datatable>-matnr and used for futher processing.

I am trying to access using <wa_datatable>-matnr but showing error.

error.png (8.9 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Ramesh T Oct 22, 2016 at 07:43 PM
0

Hi Mohan,

Use Assign statement like below

TYPES : BEGIN OF ty_makt,
matnr TYPE makt-matnr,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
maktg TYPE makt-maktg,
END OF ty_makt.

DATA : lt_makt TYPE TABLE OF ty_makt.

FIELD-SYMBOLS : <fs_makt> TYPE any,
<fs_matnr> TYPE any.

SELECT matnr
spras
maktx
maktg
FROM makt
INTO TABLE lt_makt
UP TO 10 ROWS.

LOOP AT lt_makt ASSIGNING <fs_makt>.
IF <fs_makt> IS ASSIGNED.

ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_makt> TO <fs_matnr>.
IF <fs_matnr> IS ASSIGNED.
IF <fs_matnr> = '10000010013'.

ENDIF.
ENDIF.
ENDIF.
ENDLOOP.

Share
10 |10000 characters needed characters left characters exceeded
flavio ciotola Oct 22, 2016 at 05:19 PM
0

Hi Mohan,

I believe the field-symbol <wa_datatable> shall be declared as follows:

FIELD-SYMBOLS: <wa_datatable> LIKE LINE OF <datatable>.

Please try it out and let us known.

Thanks and bye,

Flavio

Share
10 |10000 characters needed characters left characters exceeded