Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Performance Issues

Hi all,

I am posting my sample code for subroutine. Can anyone please suggest me some means to improve the performance of this code. This program takes almost 17 hours in our DR and PR. So using se30 wont help me to analyze it immediately . Also I know I need to eliminate the nested selects and select * statement. Can anyone suggest me any other tips to improve the performance of this program. Will secondary indexes help me in this regard ?

Code sample :

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

FORM get_data_no_sobsk.

  • Extract the material by plant, then corresponding details-----

SELECT *

FROM marc

WHERE werks IN s_werks.

  • and sobsk ne space.

  • check marc-sobsk ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

  • Material Descriptions

CLEAR makt.

SELECT *

FROM makt

WHERE matnr = marc-matnr

AND spras IN s_spras.

  • General Material Data

CLEAR mara.

SELECT *

FROM mara

WHERE matnr = marc-matnr

AND mtart IN s_mtart.

  • Plant description for destination company

CLEAR t001w-name1.

SELECT name1

UP TO 1 ROWS

INTO t_material-dstcomp

FROM t001w

WHERE werks = marc-werks.

ENDSELECT.

  • Material Valuation

CLEAR mbew.

SELECT *

UP TO 1 ROWS

FROM mbew

WHERE matnr = marc-matnr

AND bwkey = marc-werks.

ENDSELECT.

  • Material Valuation

CLEAR t460t-ltext.

SELECT SINGLE ltext

INTO t_material-ltext

FROM t460t

WHERE werks = marc-werks

AND sobsl = marc-sobsk

AND spras IN s_spras.

  • format internal table with fields ready for unix

MOVE-CORRESPONDING mara TO t_material.

MOVE-CORRESPONDING marc TO t_material.

MOVE-CORRESPONDING mbew TO t_material.

MOVE-CORRESPONDING makt TO t_material.

t_material-cr = w_eor.

  • insert cariage return and tabs

t_material-cr = w_eor.

t_material-tab1 = w_tab.

t_material-tab2 = w_tab.

t_material-tab3 = w_tab.

t_material-tab4 = w_tab.

t_material-tab5 = w_tab.

t_material-tab6 = w_tab.

t_material-tab7 = w_tab.

t_material-tab8 = w_tab.

t_material-tab9 = w_tab.

t_material-tab10 = w_tab.

t_material-tab11 = w_tab.

t_material-tab12 = w_tab.

t_material-tab13 = w_tab.

t_material-tab14 = w_tab.

t_material-tab15 = w_tab.

t_material-tab16 = w_tab.

t_material-tab17 = w_tab.

t_material-tab18 = w_tab.

t_material-tab19 = w_tab.

t_material-tab20 = w_tab. " PRS #1386042

t_material-tab21 = w_tab. "TAG 5013

WRITE mbew-bwprh TO t_material-bwprh NO-GROUPING.

  • WRITE mbew-stprs TO t_material-stprs NO-GROUPING.

  • Create the internal table with extracted data

APPEND t_material.

ENDSELECT.

ENDSELECT.

ENDSELECT.

ENDFORM. " get_Data_no_sobsk

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

<b>Note : I am not the edeveloper of this code.</b>

Regards,

Ben.

Tags:
replied

Hi Daniel,

Send me ur email id. I will send u a doc which would indicate how to use SDBE - Explain Sql transaction.

Cheers

VJ

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question