Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with SY-TABIX?

Hi all,

I am using one FM in my application, at one place i am reading table using sy-tabix. But it is showing 0 even table contains values.

In some other place in this code tabix is working. perticular in that place it is not working.

And i check this by executing se37 there it is working fine...

Here the code..

SELECT vbeln vkorg vtweg kunnr spart FROM vbak INTO TABLE it_vbak

where vbeln in s_vbeln.

IF it_vbak[] IS NOT INITIAL.

SELECT kunnr "Customer Number 1

adrnr "Address

FROM kna1 INTO CORRESPONDING FIELDS OF TABLE it_kna1

FOR ALL ENTRIES IN it_vbak

WHERE kunnr = it_vbak-kunnr.

//Here sy-tabix always showing 0.

READ TABLE it_kna1 INTO wa_kna1 INDEX sy-tabix.

IF sy-subrc = 0.

gv_kunnr = wa_kna1-kunnr.

ENDIF.

In some other place it is working...

SELECT lifnr "ACCOUNT NUMBER OF VENDOR OR CREDITOR

adrnr "ADDRESS

FROM lfa1

INTO CORRESPONDING FIELDS OF TABLE it_lfa1

FOR ALL ENTRIES IN it_knvp

WHERE lifnr = it_knvp-lifnr.

ENDIF.

READ TABLE it_lfa1 INTO wa_lfa1 INDEX sy-tabix. // Here it is working.

IF sy-subrc = 0.

gv_lifnr = wa_lfa1-lifnr.

ENDIF.

Can anyone give me any suggetions.. i think code is correct, any fault is there...

Tahnks,

Venkat.

Former Member
Former Member replied

Hi,

I Think you are reading based on kunnr you can use index also.

Check This..

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm

Cheers,

Kris.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question