Application Development 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: 

Field symbol Runtime error

Former Member
0 Kudos

Hi,

I am using field symbol which has data already. I want to move that into a structure.. HOw do i acheive this ? I was trying the following but it is giving me a runtime error: "In unicode, the two structures have to be same structure"

FIELD-SYMBOLS: <ITAB> TYPE STANDARD TABLE,

DATA: LT_TAB TYPE TABLE OF mara,

LS_TAB LIKE LINE OF LT_TAB.

LOOP AT <ITAB> INTO LS_TAB.

APPEND LS_TAB TO LT_TAB.

ENDLOOP.

I had asked this ques earlier in the day as well and I recvd an answer "try assigning the value before the loop" but could not get it ?

any pointer to resolve this issue ??

6 REPLIES 6

0 Kudos

you have to say loop at ls_tab assigning <itab>. That is the reason you would be getting an exception.

0 Kudos

Hi,

Try this

FIELD-SYMBOLS: <ITAB> TYPE STANDARD TABLE,

DATA: LT_TAB TYPE TABLE OF mara,

LS_TAB LIKE LINE OF LT_TAB.

FIELD-SYMBOLS: <itab_line> TYPE ANY.

LOOP AT <ITAB> ASSIGNING <ITAB_LINE>.

LS_TAB = <ITAB_LINE>.

APPEND LS_TAB TO LT_TAB.

ENDLOOP.

Regards,

Sesh

Former Member
0 Kudos

hi dhruv,

use assign statement

like

FIELD-SYMBOLS: <ITAB> TYPE STANDARD TABLE,

DATA: LT_TAB TYPE TABLE OF mara,

LS_TAB LIKE LINE OF LT_TAB.

LOOP AT ls_tab assinging <ITAB>.

.....

ENDLOOP.

<b>Reward pts if found usefull:)</b>

Regards

Sathish

former_member191391
Participant
0 Kudos

Hi,

I dont Think u can place loop over Field symbols.

With Regards,

Manmeet Singh

Former Member
0 Kudos

Hi Dhruv,

Sorry i made post earlier wrongly pls correct ur code as follows

FIELD-SYMBOLS: <ITAB> TYPE any TABLE.
DATA: LT_TAB TYPE TABLE OF mara,
LS_TAB LIKE LINE OF LT_TAB.

ASSIGN lt_tab TO <itab>.

<b>reward pts if found usefull:)</b>

regards

Sathish

Former Member
0 Kudos

Here is the Code for moving the data from internal table to field-symbol ....

REPORT  zprogram_one                            .
FIELD-SYMBOLS: <ITAB> like  mara. 
DATA: LT_TAB TYPE TABLE OF mara.

select *  from  mara   into  table LT_TAB .
break-point.
LOOP AT LT_TAB assigning <ITAB>.
.....
ENDLOOP.

reward points if it is usefull...

Girish