‎2010 Dec 20 9:49 PM
in the idoc,
E1SEG NAME1
E2SEG 0
E3SEG NAME2
E4SEG 10
E5SEG NAME3
E6SEG 20
E7SEG NAME4
E8SEG 50
NOW I Need to move the number up....it should be like this
E1SEG NAME1
E2SEG 10
E3SEG NAME2
E4SEG 20
E5SEG NAME3
E6SEG 50
E7SEG NAME4
E8SEG 0
how can i code this for an internal table ?
kindly help
Edited by: JaiKarthik on Dec 20, 2010 10:50 PM
‎2010 Dec 20 10:17 PM
Hi Jai,
there are several possible ways to create the necessary code. It depends also on the structure of your internal table and if there is a general rule.
Here the symbolic code as my personal christamas present for you.
loop at itab assigning <sourceval>.
case <sourceval>-segment.
when 'E4SEG
or 'E6SEG
or 'E8SEG.
lv_tabix = sy-tabix - 2.
read table itab assigning <target> index lv_tabix.
<target>-value = <sourceval>-value.
clear <sourceval>-value.
endcase.
endloop.
Regards,
Clemens
‎2010 Dec 20 10:17 PM
Hi Jai,
there are several possible ways to create the necessary code. It depends also on the structure of your internal table and if there is a general rule.
Here the symbolic code as my personal christamas present for you.
loop at itab assigning <sourceval>.
case <sourceval>-segment.
when 'E4SEG
or 'E6SEG
or 'E8SEG.
lv_tabix = sy-tabix - 2.
read table itab assigning <target> index lv_tabix.
<target>-value = <sourceval>-value.
clear <sourceval>-value.
endcase.
endloop.
Regards,
Clemens