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: 

internal table

Former Member
0 Kudos

hi pls help me .

i am looping internal table presently i am now at 5th line so sy-tabix = 5

based on one field in line 5 i need to modify some other field in line 4

i mean sy-tabix = 4.

so how we can dynamically do this pls help me any one regarding this pls

is it my statement correct

lt_ekbe [sy-tabix-1]-menge = lt_ekbe [sy-tabix]-menge.

like this

1 ACCEPTED SOLUTION

former_member386202
Active Contributor
0 Kudos

Hi,

Declare Lv_index like sy-tabix.

store lv_index = sy-tabix - 1.

at the time of modifying table use index as lv_index

modify itab from wa index lv_index transporting field.

Regards,

Prashant

6 REPLIES 6

Former Member
0 Kudos

LOOP AT ITAB INTO WA.

IF SY-TABIX = 4.

MODIFY.

ENDIF.

ENDLOOP.

former_member386202
Active Contributor
0 Kudos

Hi,

Declare Lv_index like sy-tabix.

store lv_index = sy-tabix - 1.

at the time of modifying table use index as lv_index

modify itab from wa index lv_index transporting field.

Regards,

Prashant

Former Member
0 Kudos

Hi,

See if in the 5th record ur condition satisfied means u wnt to modify 4th record right

Inside the loop u can use read stmt with the condition of sy-tabix = 4,when the previous condition satisfied....

It will retrieve the 4th record and u can modify tht..

Try this

Reward if useful

Former Member
0 Kudos

loop at itab.

l_tabix = sy-tabix.

read itab (based on your condition)

if sy-subrc eq 0.

pass your value

modify itab index l_index.

endif.

endloop.

Former Member
0 Kudos

hi

try following code,

loop at itab into wa.

if sy-tabix = 5.

wa_tabix = sy-tabix - 1.

wa-menge = 10.

modify itab from wa index wa_tabix.

endif.

endloop.

L.Velu

Former Member
0 Kudos

take data in the work area into some temp. work area ( wa_temp) before going on to the next record.

loop at itab into wa_tab.

if not sy-tabix Eq 1.

if (check condition).

wa_temp-menge = wa_tab-menge.

modify i_tab from wa_temp.

endif.

endif.

wa_temp = wa_tab.

endloop.

reward if helpful.