Skip to Content
0
Dec 01, 2011 at 04:54 AM

replacing innerjoin with for all entries

62 Views

hi,

i have a requirement that i have to improve the performance of report . this the code below.

SELECT  A~VBELN A~BSTNK A~AUDAT A~KUNNR B~MATNR  B~WERKS B~KWMENG
       FROM VBAK AS A INNER JOIN VBAP  AS B ON A~VBELN = B~VBELN
       INTO CORRESPONDING FIELDS OF TABLE ITEKKo WHERE  
B~MATKL IN S_MATKL AND A~AUDAT IN S_BEDAT AND 
A~VKORG IN S_VKORG AND A~VTWEG IN S_VTWEG 
   AND B~WERKS IN S_WERKS .

LOOP AT ITEKKO.
  SELECT SINGLE MVGR1 MVGR5 FROM MVKE INTO (ITEKKO-MATKL, ITEKKO-MVGR5)  WHERE 
MATNR = ITEKKO-MATNR.
  SELECT SINGLE INCO2 FROM VBKD INTO ITEKKO-NAME1 WHERe VBELN = ITEKKO-VBELN.
  SELECT SINGLE LAND1 FROM KNA1 INTO CCODE WHERE 
            KUNNR = ITEKKO-KUNNR.
  SELECT SINGLE LANDX50 FROM T005T INTO ITEKKO-CNAME WHERE 
            LAND1 = CCODE   AND SPRAS = 'E'.
  MODIFY ITEKKO.
ENDLOOP.

SELECT C~BLDAT D~VBELN D~POSNR D~VGBEL
           D~MATKL D~MFRGR D~LFIMG D~MEINS D~MATNR
       FROM LIKP AS C INNER JOIN LIPS AS D ON C~VBELN = D~VBELN
       INNER JOIN VBAK AS A ON D~VGBEL = A~VBELN
       INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
       WHERE A~AUDAT IN S_BEDAT
       ORDER BY D~VGBEL D~MFRGR.

LOOP AT IT_LIPS.
  SELECT SINGLE MVGR5 FROM MVKE INTO IT_LIPS-MVGR5 WHERE
                                  MATNR = IT_LIPS-MATNR.
  MODIFY IT_LIPS.
ENDLOOP.

it is taking very long time when the loops r executing.

can anybody please help.