2016 Apr 19 1:24 PM
Folks,
Is it the right way to unassign a field symbol of the concerned loop ie <fs_itab1>?
If I Unassign within the loop it is going for dump whereas outside the loop it is not.
Do we have any other better ways to clear ie unassign the field symbol of loop within the loop at the end of every iteration.?
Is it wrong to unassign the field symbol of the concerned loop within the loop at the end of every iteration ?
DATA:itab1 TYPE STANDARD TABLE OF ztable1,
itab2 TYPE STANDARD TABLE OF ztable2.
FIELD-SYMBOLS:<fs_itab1> TYPE ztable1,
<fs_itab2> TYPE ztable2,
LOOP AT itab1 ASSIGNING <fs_itab1>.
READ TABLE itab2 ASSIGNING <fs_itab2> WITH KEY fp_irn = <fs_itab1>-fp_irn
pspid = iv_pspid
grp_taskid = iv_task_id.
IF sy-subrc = 0.
<fs_itab1>-upd_user = sy-uname.
ENDIF.
UNASSIGN:<fs_itab2>.
ENDLOOP.
UNASSIGN:<fs_itab1>.
Thanks,
K.Kiran.
2016 Apr 19 1:28 PM
Why do you want to unassign it inside loop?
Field symbol is re-assigned at each itteration so you do not need worry about manual unassig.
2016 Apr 19 1:32 PM
Hi,
one thing could be to have the unassign inside the if statement, so the <fs_itab2> only gets assigned if the read table returns a value. Otherwise it is not assigned and it will dump I suppose.
Br,
Tim
2016 Apr 19 1:34 PM
clear ie unassign the field symbol of loop
CLEAR & UNASSIGN are not the same for FIELD-SYMBOL.
2016 Apr 19 1:39 PM
Yes Suhas.I realised that while debugging.
But,why shouldn't we unassign a field symbol of the loop at the end of every iteration when anyway we are assigning it again at the start of every iteration ?
Thanks,
K.Kiran.
2016 Apr 19 1:52 PM
2016 Apr 19 2:21 PM