Skip to Content
0
Former Member
Sep 02, 2008 at 05:17 AM

nested loop

17 Views

i want to removed nested loop in my program and loop in select how it removed. Below is my code.

LOOP AT IST_EKPO.

READ TABLE IST_EKKO WITH KEY EBELN = IST_EKPO-EBELN.

ELECT PACKNO

INTROW

SRVPOS

MENGE

NETWR

MEINS

KTEXT1

USERF2_NUM

USERF2_TXT

INTO CORRESPONDING FIELDS OF TABLE IST_ESLL

FROM ESLL

WHERE PACKNO = IST_ESLL-SUB_PACKNO.

TMP_PACKNO = IST_ESLL-SUB_PACKNO.

*END

LOOP AT IST_ESLL.

IF SY-SUBRC = 0.

ITAB-SRVPOS = IST_ESLL-SRVPOS.

ITAB-MENGE = IST_ESLL-MENGE.

ITAB-NETWR = IST_ESLL-NETWR.

ITAB-MEINS = IST_ESLL-MEINS.

ITAB-KTEXT1 = IST_ESLL-KTEXT1.

ITAB-EBELN = IST_EKPO-EBELN.

ITAB-EBELP = IST_EKPO-EBELP.

ITAB-WERKS = IST_EKPO-WERKS.

ITAB-PACKNO = TMP_PACKNO.

ITAB-INTROW = IST_ESLL-INTROW.

**END

ITAB-TXZ01 = IST_EKPO-TXZ01.

ITAB-BEDAT = IST_EKKO-BEDAT.

ITAB-LIFNR = IST_EKKO-LIFNR.

ITAB-WAERS = IST_EKKO-WAERS.

ITAB-ERNAM = IST_EKKO-ERNAM.

ITAB-WKURS = IST_EKKO-WKURS.

ITAB-AFNAM = IST_EKPO-AFNAM.

ITAB-BANFN = IST_EKPO-BANFN.

ITAB-FISTL = IST_EKPO-FISTL.

ITAB-USERF2_NUM = IST_ESLL-USERF2_NUM.

ITAB-USERF2_TXT = IST_ESLL-USERF2_TXT.

ITAB-LOC_CURR = IST_EKKO-WKURS * IST_ESLL-NETWR.

To correctly display the PO value in Foriegn

  • Currencies like JPY,LUF,ITL,ESp and BEF**

IF IST_EKKO-WAERS = 'JPY' OR

IST_EKKO-WAERS = 'LUF' OR

IST_EKKO-WAERS = 'ITL' OR

IST_EKKO-WAERS = 'ESP'.

ITAB-NETWR = IST_ESLL-NETWR.

ITAB-NETWR = ITAB-NETWR * 100.

ELSEIF IST_EKKO-WAERS = 'BEF'.

ITAB-NETWR = IST_ESLL-NETWR.

ITAB-NETWR = ITAB-NETWR / 10.

ENDIF.

End of correct display foriegn

APPEND ITAB.

CLEAR ITAB.

ENDIF.

ENDLOOP.

CLEAR: IST_EKPO, IST_EKKO,IST_ESLL,IST_EBKN.

ENDLOOP.