Skip to Content
author's profile photo Former Member
Former Member

Performance tuning

Hi,

I've got four selection screen fileds like SO document , SO creation date, Delivery document and delivery date.The end user uses any one among this which is why i've got performance issue here in my queries...........

SELECT vbeln

erdat

kunnr

FROM vbak INTO TABLE g_tab_so_head

WHERE vbeln IN s_vbeln AND

erdat IN s_erdat AND

kunnr IN s_kunnr.

IF sy-subrc = 0.

SORT g_tab_so_head BY vbeln.

SELECT vbeln

posnr FROM vbap INTO TABLE g_tab_so_item

FOR ALL ENTRIES IN g_tab_so_head

WHERE vbeln = g_tab_so_head-vbeln.

IF sy-subrc = 0.

SORT g_tab_so_item BY vbeln posnr.

SELECT vbeln

posnr

vgbel

vgpos

vgtyp FROM lips

INTO TABLE g_tab_deliv_item

FOR ALL ENTRIES IN g_tab_so_item

WHERE vgbel = g_tab_so_item-vbeln AND

vgpos = g_tab_so_item-posnr AND

vgtyp = 'C'.

IF sy-subrc = 0.

SORT g_tab_deliv_item BY vbeln posnr.

SELECT vbeln

erdat

FROM likp INTO TABLE g_tab_deliv_head

FOR ALL ENTRIES IN g_tab_deliv_item

WHERE vbeln = g_tab_deliv_item-vbeln AND

erdat IN s_date.

IF sy-subrc = 0.

SORT g_tab_deliv_head BY vbeln.

SELECT vbeln

posnr

bktxt FROM zvlxxtr

INTO TABLE g_tab_track

FOR ALL ENTRIES IN g_tab_deliv_item

WHERE vbeln = g_tab_deliv_item-vbeln AND

posnr = g_tab_deliv_item-posnr AND

bktxt IN s_track.

SORT g_tab_track BY vbeln posnr.

The entries in LIPS table are taking lot of time to fetch data......i dont know why........can any one please come up with solution to get this done.........

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2008 at 03:43 PM

    What document does VGBEL refer to? If it is a sales order, you can use table VBFA (sales document flow).

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2008 at 03:29 PM

    Try out....

    First try to get data from LIKP as this is header table... then using this data fetch data from LIPS as this is line item table.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ramesh,

      Purposefully i've writen a query first for the line item table LIPS before LIKP so that i can get exact entries based on the sales order number .....as told my end user will only be giving sales order number or its creation date or delivery document number or delivery creation date......

      so i should fetch the entries from LIKP or LIPS based on the sales order number given if the user enters only sales order number in case......and i have problem only when user enters sales order number or date.........but the logic wokrs gud when user enters only delivery date or delivery document......

      Hope u've got me ...........

  • Posted on Feb 20, 2008 at 03:45 PM

    You should check the number of lines in g_tab_so_item (debugger), and whether the index LIPS~M05 exists on the database and has up-to-date statistics (ST05 - SQL Trace).

    You can skip the sorts, the do not help.

    The sorts should be done, if there are duplicates, but then you should also execute

    delete adjescent duplicates.

    But do it only if there are duplicates

    Siegfried

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.