Hi ,
select MARA~matnr
MAKTX
from mara join marc on maramatnr = marcmatnr
JOIN makt on maramatnr = maktmatnr
into table itab
where mtart = 'FERT' AND
WERKS = P_PLANT .
LOOP AT ITAB.
CALCULATING PENDING ORDERS
select SUM( EKET~MENGE )
SUM( EKET~GLMNG )
INTO (ITAB-MENGE ,ITAB-GLMNG )
from
EKKO JOIN EKPO ON EKPOEBELN = EKKOEBELN
JOIN EKET ON EKKOEBELN = EKETEBELN
where
EKET~EINDT LE ZFDATE and
EKET~EINDT GE P_DATE AND
EKPO~MATNR = ITAB-MATNR and
EKPO~WERKS = P_PLANT and
EKKO~BSART = 'UB' .
IF SY-SUBRC = 0.
*******************************************
UNIT CONVERSION OF PENDING ORDERS added by k srinivas
select SINGLE EKPO~MEINS "ORDER UNIT
EKPO~UMREZ "1 PACK = 'UMREZ' LITRES
EKPO~LMEIN "BASE UNIT OF MEASURE
INTO (V_ORDER_UNIT,V_CONVERSION,V_BASE_UNIT)
from
EKKO JOIN EKPO ON EKPOEBELN = EKKOEBELN
JOIN EKET ON EKKOEBELN = EKETEBELN
where
EKET~EINDT LE ZFDATE and
EKET~EINDT GE P_DATE AND
EKPO~MATNR = ITAB-MATNR and
EKPO~WERKS = P_PLANT and
EKKO~BSART = 'UB' .
*CONVERSION OF QUANTITY INTO LITRES
IF V_ORDER_UNIT = 'PAK' AND V_BASE_UNIT = 'L'.
ITAB-MENGE = ITAB-MENGE * V_CONVERSION.
ITAB-GLMNG = ITAB-GLMNG * V_CONVERSION.
ENDIF.
IF ITAB-MENGE > ITAB-GLMNG .
ITAB-PENDO = ITAB-MENGE - ITAB-GLMNG.
ENDIF.
ENDIF.
ENDLOOP.
Because of the 'Select' statement inside the loop im getting
Performance issue and going to dump.
Please suggest how to bring the Select statement outside the loop and still get the same output.
Thanks
K Srinivas