Skip to Content

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

Loop at...where problem

Hi,

SELECT-OPTIONS: SO_KUNNR FOR KNA1-KUNNR OBLIGATORY.

SORT IT_BSID1 BY KUNNR.

SORT IT_KNA1 BY KUNNR.

SORT IT_OPBAL BY KUNNR.

LOOP AT IT_KNA1 INTO WA_KNA1.

CLEAR : WA_OUTPUT.

WA_OUTPUT-KUNNR = WA_KNA1-KUNNR.

WA_OUTPUT-NAME1 = WA_KNA1-NAME1.

READ TABLE IT_OPBAL WITH KEY KUNNR = WA_KNA1-KUNNR

BINARY SEARCH.

IF SY-SUBRC = 0.

WA_OUTPUT-OPNBAL = IT_OPBAL-LC_BAL.

ENDIF.

LOOP AT IT_BSID1 INTO WA_BSID1 WHERE KUNNR = WA_KNA1-KUNNR.

IF SY-SUBRC = 0.

CASE WA_BSID1-BLART.

WHEN 'RV'.

IF WA_BSID1-SHKZG = 'S'.

WA_OUTPUT-SALE = WA_BSID1-DMBTR.

ENDIF.

ENDLOOP.

ENDLOOP.

Both WA_KNA1 AND WA_BSID1 contains the same KUNNR .

But after LOOP AT .....WHERE i am not getting SY-SUBRC = 0.

For example if i give the KUNNR = 2 in the selection-screen everything is fine but if i give KUNNR = 7002 in the selection-screen the above problem is arising.

when i checked in debugging at

LOOP AT ...WHERE statement

wa_kna1-kunnr = 0000007002 and wa_bsid1-kunnr = 0000007002.But iam getting sy-subrc = 8. Please suggest soln .

Thanks and Regards

Venkat

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