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 increment

Former Member
0 Likes
733

Moved to correct forum by moderator. Next time please post in the correct forum AND use a meaningful subject

IF ba_sched_items[] IS NOT INITIAL.

*Get the appropriate condition record from A016

SELECT evrtn evrtp kappl knumh

FROM a016

INTO TABLE it_a016

FOR ALL ENTRIES IN ba_sched_items

WHERE evrtn = ba_sched_items-ebeln AND

kappl = c_purchasing AND

evrtp = ba_sched_items-ebelp AND

datbi >= sy-datum AND

datab <= sy-datum.

IF it_a016[] IS NOT INITIAL.

SORT it_a016 BY kappl knumh.

*Get the appropriate values from KONP table

SELECT kbetr meins kpein kmein konwa kappl knumh

FROM konp

INTO corresponding fields of table it_konp

FOR ALL ENTRIES IN it_a016

WHERE kappl = it_a016-kappl AND

knumh = it_a016-knumh.

LOOP AT it_konp.

READ TABLE it_a016

WITH KEY kappl = it_konp-kappl

knumh = it_konp-knumh.

IF sy-subrc = 0.

it_konp-evrtn = it_a016-evrtn.

it_konp-evrtp = it_a016-evrtp.

"Modify konp table with PO number

"and item number

MODIFY it_konp TRANSPORTING evrtn evrtp.

ENDIF.

ENDLOOP.

ENDIF.

SORT it_konp BY evrtn evrtp knumh.

ENDIF.

*End Of Changes

********************************************************************

For the 1st select statement and comparing to 2nd select statement it is taking lot of time to execute nearly 20 minutes it is taking ,

And i checked all the condition statements are primary key fields only and please verify and let me know whats the mistake

Thanks in Advance

4 REPLIES 4
Read only

Former Member
0 Likes
682

Hi,

In the First select statement you missed KEY Fields KSCHL EVRTN and the order also different in the where condition.

In the second select statement you missed one keyField KOPOS and also you used CORRESPONDING FIELDS.

and also in the Loop you are reading the table without all the KEY fields..these all factors are consuming more time and performance is poor.

check the above mention points and correct it...

hope it will perform better than previous one.

Regards

R

Read only

Former Member
0 Likes
682

Hi..

Do the following changes it will improve the performance ...



sort ba_sched_items by ebeln.
delete adjacent duplicates from ba_sched_item comparing ebeln.

*Get the appropriate condition record from A016 
SELECT evrtn evrtp kappl knumh
FROM a016
INTO TABLE it_a016
FOR ALL ENTRIES IN ba_sched_items
WHERE evrtn = ba_sched_items-ebeln AND
kappl = c_purchasing AND
evrtp = ba_sched_items-ebelp AND
datbi >= sy-datum AND
datab <= sy-datum.

Do the same before the second select query as well. Also read using BINARY SEARCH. Also ensure that before using BINARY SEARCH in read... the internal table which you are reading is SORTED based on the fields using which you are reading.

Regards.

Read only

0 Likes
682

And ya.. incase.. if you cant delete the duplicates present in the temporary table, then move the content of this internal table to another internal table of same type and delete the duplicates there...

Regards.

Read only

Former Member
0 Likes
682

l