Application Development and Automation 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: 
Read only

internal table manipulation

Former Member
0 Likes
418

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

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
388

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

1 REPLY 1
Read only

Clemenss
Active Contributor
0 Likes
389

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