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

problem regarding tables

Former Member
0 Likes
439

In a sorted table how to add a record without using indexes

if there are 10 records insert a record at 5th position. how?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
422

Hi,

Why you want to insert record without index. With index, it is one line statement. Otherwise you have to loop at internal table and insert record when sy-tabix = 5.

With index.

-


INSERT itab2 INTO itab1 INDEX 5.

Without index

-


LOOP AT itab1.
  IF sy-tabix = 5.
    INSERT itab2 INTO itab1.
  ENDIF.
ENDLOOP.

Please mention clearly what you want to do.

Regards,

RS

3 REPLIES 3
Read only

Former Member
0 Likes
422

[/deleted]

Read only

Former Member
0 Likes
423

Hi,

Why you want to insert record without index. With index, it is one line statement. Otherwise you have to loop at internal table and insert record when sy-tabix = 5.

With index.

-


INSERT itab2 INTO itab1 INDEX 5.

Without index

-


LOOP AT itab1.
  IF sy-tabix = 5.
    INSERT itab2 INTO itab1.
  ENDIF.
ENDLOOP.

Please mention clearly what you want to do.

Regards,

RS

Read only

Former Member
0 Likes
422