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

Index value changed

Former Member
0 Likes
700

Dear All

In Bellow code i modify one internal table at a same i will check condition check the condition matching append second table

my problem is index value changed

how to rectify?

LOOP AT IBS.

SELECT single ekkn~vbeln into ibs-vbeln from ekkn

WHERE ebeln = ibs-ebeln.

SELECT Single lfa1~name1 into ibs-name1 from lfa1

WHERE lifnr = ibs-lifnr.

SELECT BELNR LFBNR INTO (MATDOC, REFDOC) FROM EKBE WHERE

EBELN EQ IBS-EBELN AND

EBELP EQ IBS-EBELP.

IF MATDOC NE REFDOC.

INS-BELNR = MATDOC.

INS-LFBNR = REFDOC.

APPEND INS.

ENDIF.

CLEAR: MATDOC, REFDOC.

ENDSELECT.

modify ibs index sy-tabix.

Thanks and regards

Suresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
669

Plz do like that

Data idx type sy-tabix.

LOOP AT IBS.

idx = sy-tabix.

SELECT single ekkn~vbeln into ibs-vbeln from ekkn

WHERE ebeln = ibs-ebeln.

SELECT Single lfa1~name1 into ibs-name1 from lfa1

WHERE lifnr = ibs-lifnr.

SELECT BELNR LFBNR INTO (MATDOC, REFDOC) FROM EKBE WHERE

EBELN EQ IBS-EBELN AND

EBELP EQ IBS-EBELP.

IF MATDOC NE REFDOC.

INS-BELNR = MATDOC.

INS-LFBNR = REFDOC.

APPEND INS.

ENDIF.

CLEAR: MATDOC, REFDOC.

ENDSELECT.

MODIFY ibs INDEX idx.

rgds

rajesh

4 REPLIES 4
Read only

Former Member
0 Likes
669

try with sy-index instead of sy-tabix

hope it helps

Read only

Former Member
0 Likes
670

Plz do like that

Data idx type sy-tabix.

LOOP AT IBS.

idx = sy-tabix.

SELECT single ekkn~vbeln into ibs-vbeln from ekkn

WHERE ebeln = ibs-ebeln.

SELECT Single lfa1~name1 into ibs-name1 from lfa1

WHERE lifnr = ibs-lifnr.

SELECT BELNR LFBNR INTO (MATDOC, REFDOC) FROM EKBE WHERE

EBELN EQ IBS-EBELN AND

EBELP EQ IBS-EBELP.

IF MATDOC NE REFDOC.

INS-BELNR = MATDOC.

INS-LFBNR = REFDOC.

APPEND INS.

ENDIF.

CLEAR: MATDOC, REFDOC.

ENDSELECT.

MODIFY ibs INDEX idx.

rgds

rajesh

Read only

Former Member
0 Likes
669

Hi,

Each Select statement when executed will change the Index value.

Declare one more variable of this index and use this index in your loop accordingly.

Same applies with the Read statement also.

Regards

Lekha

Read only

Former Member
0 Likes
669

Thanks for all reply

my problem Solved