‎2008 Nov 04 1:28 PM
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
‎2008 Nov 04 1:36 PM
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
‎2008 Nov 04 3:15 PM
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.
‎2008 Nov 04 3:18 PM
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.
‎2008 Nov 05 8:25 AM