07-19-2007 6:30 AM
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 ??
07-19-2007 6:36 AM
you have to say loop at ls_tab assigning <itab>. That is the reason you would be getting an exception.
07-19-2007 6:40 AM
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
07-19-2007 6:41 AM
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
07-19-2007 6:45 AM
Hi,
I dont Think u can place loop over Field symbols.
With Regards,
Manmeet Singh
07-19-2007 6:47 AM
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
07-19-2007 7:07 AM
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