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

Performance tuning

Former Member
0 Likes
682

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.........

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

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

Rob

4 REPLIES 4
Read only

Former Member
0 Likes
646

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.

Read only

0 Likes
646

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 ...........

Read only

Former Member
0 Likes
647

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

Rob

Read only

Former Member
0 Likes
646

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