Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Inputs for Fine tuning the program

Former Member
0 Likes
400

Hi All,

Following code is taking lot of time... No i need to fine tune the same ,,,

Please give some inputs..

SELECT VBELN INTO VBUK-VBELN FROM VBUK

WHERE ( CMGST EQ 'B' OR CMGST EQ 'C' )

AND VBELN IN S_VBELN.

SELECT * FROM VBAP WHERE VSTEL IN SHP_PT

AND VBELN EQ VBUK-VBELN

AND VKGRU '101'.

SELECT VBELN POSNR EDATU FROM VBEP

INTO (VBEP-VBELN,VBEP-POSNR,VBEP-EDATU)

WHERE VBELN EQ VBAP-VBELN AND POSNR EQ VBAP-POSNR

AND LFREL EQ 'X' AND BMENG GT 0

AND EDATU BETWEEN DATE_LOW

AND DAT_HIGH

ORDER BY EDATU VBELN POSNR.

CLEAR LIPS.

PERFORM APPEND_DATA_TO_ITAB1 TABLES ITAB1

USING VBEP-VBELN VBEP-POSNR

VBEP-EDATU LIPS-VBELN

LIPS-POSNR vbap-VSTEL.

ENDSELECT.

ENDSELECT.

ENDSELECT.

Regards,

Chan

Moderator message:

Edited by: Thomas Zloch on Nov 24, 2010 1:17 PM

2 REPLIES 2
Read only

Former Member
0 Likes
365

Hi Chan

try to avoid nested selects and select *.

try the same by using joins or by using for all entries.

hope this is helpful

best regards

tiru

Read only

Former Member
0 Likes
365

HI,

Remove the select endselect the select all the entries into internal table then from tat internal table select by using for all entries into another internal table. for eq -

IF NOT s_vbeln[] IS INITIAL.
  SELECT vbeln cmgst
        INTO TABLE itvbuk
        FROM vbuk
        WHERE vbeln IN s_vbeln.
  DELETE itvbuk WHERE  cmgst NE 'B' AND cmgst NE 'C' .
ENDIF.

IF NOT itvbuk[] IS INITIAL.
  SELECT *
         FROM vbap
         INTO TABLE itvbap
         FOR ALL ENTRIES IN itvbuk
         WHERE vbeln EQ itvbuk-vbeln.
  DELETE itvbap WHERE vkgru NE '101' AND NOT vstel IN shp_pt.
ENDIF.

Like wise modify the logic and check the secondary index is available for the where clause which you will be specifing.

Regards,

Madhukar Shetty