09-12-2011 7:18 PM
I have below Select Query which is written in Remote Enabled Function Module. This RFC is called by Thrid party application and it gives "TIME_OUT" runtime error.
I need your suggestions to Improve the performance of this query or if there is any way to run the RFC in background.
SELECT t1~avm_nr "Order number
t1~gpag "Sold to party
t2~pos_nr "Line item number
t5~upos_nr "Sub-item
t3~inhk_kfm "Business Content component
t5~ur_beleinh "Initial booking Unit
t5~belegeinh "Basic Booking Unit
t2~pstyv "Item categories
t4~ein_nr "Schedule line number
t4~aendate "Sched line last change date
t4~aentime "Sched line last Change time
t5~s_termin "Publication date
t5~webpubl_date_frm "Web Pub start date
t5~webpubl_date_to "Web Pub end date
t7~motivid "Technical spec id
t7~motiv "Ad spec no.
t7~azart_gest "Design Type
t2~bsark "PO type
t3~chiffre_nr "IS-M/AM: Box Number
APPENDING TABLE it_bcc_list
FROM jhak AS t1
INNER JOIN jhap AS t2
ON t2~avm_nr = t1~avm_nr
INNER JOIN jhapa AS t3
ON t3~avm_nr = t1~avm_nr
AND t3~pos_nr = t2~pos_nr
INNER JOIN jhae AS t4
ON t4~avm_nr = t1~avm_nr
AND t4~pos_nr = t2~pos_nr
INNER JOIN jhaea AS t5
ON t5~avm_nr = t1~avm_nr
AND t5~pos_nr = t2~pos_nr
AND t5~ein_nr = t4~ein_nr
INNER JOIN jhamot AS t7
ON t7~avm_nr = t1~avm_nr
INNER JOIN jhamoz AS t8
ON t8~avm_nr = t1~avm_nr
AND t8~pos_nr = t2~pos_nr
AND t8~ein_nr = t4~ein_nr
AND t8~motiv = t7~motiv
WHERE
(
t1~avm_nr IN it_sel_order_no_loop "Order no.
AND
(
* Selection based on Content Component and Booking Unit
* and Web publication date from & to and record change date
* and time from & to
(
t3~inhk_kfm IN it_sel_bus_cc
AND
t5~belegeinh IN it_sel_book_unit
AND
(
NOT
(
t5~webpubl_date_frm > pub_end_date
OR
t5~webpubl_date_to < pub_start_date
)
)
)
)
)
AND t2~pstyv IN it_pstyv
AND t2~statusk <> '01' "-- Line item not deleted
AND t4~statusk <> '01' "-- Schedule line not deleted
AND t4~upos_nr <> '0000'
AND t5~belegeinh > ''
AND t5~merkmal8 <> 'X' "-- Schedule line not unpublishable
AND t5~upos_nr <> '0000'
AND t5~xersch IN (v_pubd,v_unpubd) "-- Published indicator
AND t7~motivstat <> '01' "-- Ad spec not deleted
AND t8~upos_nr <> '0000'.
ENDIF.
Regards,
CJ
09-12-2011 7:27 PM
Hi
Remove Appending Lines in select statement. Move the values to another table then use append lines of ITAB1 to ITAB2.
Also remove NE comparison in where condition, later delete ITAB where NE.
Also check for the JOIN conditions which tables are taking more time.
Check runtime analysis and performance analysis.
Shiva
09-12-2011 7:39 PM
@Shiva - the <> is not on an index field, so it would be better to leave it in.
@CJ - have you first analyzed this using ST05?
Rob
Edited by: Rob Burbank on Sep 12, 2011 2:40 PM