Application Development 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: 

Performance issue

Former Member
0 Kudos

Hi friends,

Please See the below code.It is not taking much time to exicute but when we done run time analysis, the database utillization is neary 60% So it should be reduced.

I have done my best but still it not reduced.

Can any body tell me what changes need to be done.

I am sure of reward points.

REPORT ZPSPAR12_SER_ORD

NO STANDARD PAGE HEADING

MESSAGE-ID ZPS

LINE-COUNT 65

LINE-SIZE 120.

&----


*& TABLES

&----


TABLES: AUFK, "Order master data

VIQMEL, "Notification Header

KNA1, "General Data in Customer Master

IHPA, "Plant Maintenance: Partners

PMCO, "Cost structure of maintenance order

T003O, "Order Types

T001W, "Plant

AFKO. "Order header data PP orders

&----


*& TYPE POOLS

&----


TYPE-POOLS SLIS. "Global types for generic building blocks

&----


*& PROGRAM VARIABLES

&----


DATA: G_COL TYPE I, "Column position for fieldcat

G_REVENUE LIKE PMCO-WRT00, "Revenues

G_ACTCOST LIKE PMCO-WRT01, "Actual Costs

G_PLCOST LIKE PMCO-WRT02, "Plan Costs

lv_lines type i.

&----


*& STRUCTURES

&----


DATA: I_FIELDCATTAB_WA TYPE SLIS_FIELDCAT_ALV, "Fieldcat Work Area for ALV

I_TITLE_WA TYPE SLIS_LISTHEADER, "Title Work Area for ALV

GT_LAYOUT TYPE SLIS_LAYOUT_ALV. "Layout Settings for Color

&----


*& INTERNAL TABLES

&----


  • Internal table of plants for auth check

DATA: BEGIN OF it_plant OCCURS 0,

werks like t001w-werks,

END OF it_plant.

" Internal table containing AUFK table contents

DATA I_AUFKTAB LIKE AUFK OCCURS 0 WITH HEADER LINE.

" Internal table containing final data for the Report screen

DATA: BEGIN OF I_FINTAB OCCURS 0,

AUFNR LIKE AUFK-AUFNR,

KTEXT LIKE AUFK-KTEXT,

KUNUM LIKE VIQMEL-KUNUM,

NAME1 LIKE KNA1-NAME1,

I_PARNR LIKE IHPA-PARNR,

WRT00 LIKE PMCO-WRT00,

WRT01 LIKE PMCO-WRT01,

USER4 LIKE AUFK-USER4,

WRT02 LIKE PMCO-WRT01,

PROFIT(10) TYPE P DECIMALS 2,

PROFITP(5) TYPE P DECIMALS 2,

GSTRP LIKE AFKO-GSTRP,

LINE_COL(4) TYPE C,

END OF I_FINTAB.

" Internal table containing PMCO table contents

DATA: I_PMCO LIKE PMCO OCCURS 0 WITH HEADER LINE,

" Internal table containing final data for the Report screen

" with selection screen criteria

I_FINALTAB LIKE I_FINTAB OCCURS 0 WITH HEADER LINE,

" Fieldcat Internal table for ALV

I_FIELDCATTAB TYPE SLIS_T_FIELDCAT_ALV ,

" Title Internal table for ALV

I_TITLE TYPE SLIS_T_LISTHEADER .

&----


*& SELECT-OPTIONS

&----


SELECT-OPTIONS: S_AUFNR FOR AUFK-AUFNR, "Job Number

S_KTEXT FOR AUFK-KTEXT, "Job Description

S_KUNUM FOR VIQMEL-KUNUM, "Customer Number

S_NAME1 FOR KNA1-NAME1, "Customer Name

S_PARNR FOR IHPA-PARNR NO INTERVALS

NO-EXTENSION MATCHCODE OBJECT USER_COMP, "Supervisor

S_WRT00 FOR PMCO-WRT00 , "Actual Costs

S_WRT01 FOR PMCO-WRT01 , "Plan Costs

S_USER4 FOR AUFK-USER4 , "Estimated Costs

S_WRT02 FOR PMCO-WRT02, "Revenues

S_PROFIT FOR PMCO-WRT03 , "Profit

S_PROFP FOR PMCO-WRT04 NO INTERVALS

NO-EXTENSION, "Profit %

S_GSTRP FOR AFKO-GSTRP, "Period of Time

S_WERKS FOR AUFK-WERKS, "Plant

S_AUART FOR AUFK-AUART. "Order Type

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

  • AT SELECTION-SCREEN

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

  • Event which occurs each time the user hits enter on the selection

  • screen.

AT SELECTION-SCREEN.

perform plant_authorization_check.

perform validate_select_options.

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

  • START-OF-SELECTION

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

START-OF-SELECTION.

"Retrieves the data from the table AUFK into internal table I_AUFKTAB

PERFORM SUB_SELECTION_AUFKTAB.

"Final Internal table containing the report fields

PERFORM SUB_SELECTION_FINALTAB.

"Defining the fieldcatalog to be used for the report

PERFORM SUB_FIELDCAT_BUILD.

"Define the Top-Of-Page contents

PERFORM SUB_FIELDCAT_TITLE.

"Mapping the internal table I_FINALTAB with fieldcat

PERFORM SUB_FIELDCAT_DISPLAY.

&----


*& Form SUB_SELECTION_AUFKTAB

&----


  • Retrieves the data from the table AUFK into internal table I_AUFKTAB

----


FORM SUB_SELECTION_AUFKTAB.

SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB

FROM AUFK

FOR ALL ENTRIES IN it_plant

WHERE AUFNR IN S_AUFNR AND

KTEXT IN S_KTEXT AND

  • WERKS IN S_WERKS AND

AUART IN S_AUART AND

USER4 IN S_USER4 AND

werks eq it_plant-werks.

ENDFORM. "SUB_SELECTION_AUFKTAB

&----


*& Form SUB_SELECTION_FINALTAB

&----


  • Final Internal table containing the report fields

----


FORM SUB_SELECTION_FINALTAB.

LOOP AT I_AUFKTAB.

I_FINTAB-AUFNR = I_AUFKTAB-AUFNR.

I_FINTAB-KTEXT = I_AUFKTAB-KTEXT.

I_FINTAB-USER4 = I_AUFKTAB-USER4.

SELECT SINGLE * FROM IHPA WHERE OBJNR = I_AUFKTAB-OBJNR AND PARVW = 'AG' .

IF SY-SUBRC = 0.

"Retrieving customer number from VIQMEL into final internal table

I_FINTAB-KUNUM = IHPA-PARNR.

ENDIF.

SELECT SINGLE * FROM KNA1 WHERE KUNNR = I_FINTAB-KUNUM .

IF SY-SUBRC = 0.

"Retrieving customer name from KNA1 into final internal table

I_FINTAB-NAME1 = KNA1-NAME1.

ENDIF.

SELECT SINGLE * FROM IHPA WHERE OBJNR = I_AUFKTAB-OBJNR AND PARVW = 'VU'.

IF SY-SUBRC = 0.

"Retrieving supervisor from IHPA into final internal table

I_FINTAB-I_PARNR = IHPA-PARNR.

ENDIF.

"Clearing the internal table contents I_PMCO

CLEAR I_PMCO[].

SELECT * FROM PMCO INTO TABLE I_PMCO WHERE OBJNR = I_AUFKTAB-OBJNR.

CLEAR: G_REVENUE,G_ACTCOST,G_PLCOST.

LOOP AT I_PMCO .

"Calculating the Plancosts, Actual Costs and Revenues depending on Type

"and Category

IF I_PMCO-BELTP = '2' .

G_REVENUE = G_REVENUE + I_PMCO-WRT00 + I_PMCO-WRT01 + I_PMCO-WRT02 +

I_PMCO-WRT03 + I_PMCO-WRT04 + I_PMCO-WRT05 + I_PMCO-WRT06 + I_PMCO-WRT07 +

I_PMCO-WRT08 + I_PMCO-WRT09 + I_PMCO-WRT10 + I_PMCO-WRT11 + I_PMCO-WRT12 +

I_PMCO-WRT13 + I_PMCO-WRT14 + I_PMCO-WRT15 + I_PMCO-WRT16.

ENDIF.

IF I_PMCO-BELTP = '1' and I_PMCO-WRTTP = '04'.

G_ACTCOST = G_ACTCOST + I_PMCO-WRT00 + I_PMCO-WRT01 + I_PMCO-WRT02 +

I_PMCO-WRT03 + I_PMCO-WRT04 + I_PMCO-WRT05 + I_PMCO-WRT06 + I_PMCO-WRT07 +

I_PMCO-WRT08 + I_PMCO-WRT09 + I_PMCO-WRT10 + I_PMCO-WRT11 + I_PMCO-WRT12 +

I_PMCO-WRT13 + I_PMCO-WRT14 + I_PMCO-WRT15 + I_PMCO-WRT16.

ELSEIF I_PMCO-BELTP = '1' and I_PMCO-WRTTP = '01'.

G_PLCOST = G_PLCOST + I_PMCO-WRT00 + I_PMCO-WRT01 + I_PMCO-WRT02 +

I_PMCO-WRT03 + I_PMCO-WRT04 + I_PMCO-WRT05 + I_PMCO-WRT06 + I_PMCO-WRT07 +

I_PMCO-WRT08 + I_PMCO-WRT09 + I_PMCO-WRT10 + I_PMCO-WRT11 + I_PMCO-WRT12 +

I_PMCO-WRT13 + I_PMCO-WRT14 + I_PMCO-WRT15 + I_PMCO-WRT16.

ENDIF.

ENDLOOP.

SELECT SINGLE * FROM AFKO WHERE AUFNR = I_AUFKTAB-AUFNR.

" Retrieving the time period.

IF SY-SUBRC = 0.

I_FINTAB-GSTRP = AFKO-GSTRP.

ENDIF.

I_FINTAB-WRT00 = G_ACTCOST.

I_FINTAB-WRT01 = G_PLCOST.

I_FINTAB-WRT02 = G_REVENUE.

IF G_REVENUE < '0.00'.

G_REVENUE = - G_REVENUE.

I_FINTAB-WRT02 = G_REVENUE.

ENDIF.

I_FINTAB-PROFIT = I_FINTAB-WRT02 - I_FINTAB-WRT00.

IF I_FINTAB-WRT02 IS INITIAL.

I_FINALTAB-PROFITP = 0.

ELSE.

I_FINTAB-PROFITP = I_FINTAB-PROFIT * 100 / I_FINTAB-WRT02.

ENDIF.

APPEND I_FINTAB.

CLEAR I_FINTAB.

ENDLOOP.

" Moving to final internal table for the corresponding selection screen “values.

LOOP AT I_FINTAB WHERE WRT00 IN S_WRT00 AND WRT01 IN S_WRT01 AND WRT02 IN S_WRT02

AND PROFIT IN S_PROFIT AND GSTRP IN S_GSTRP AND KUNUM IN S_KUNUM AND NAME1 IN S_NAME1

AND I_PARNR IN S_PARNR.

I_FINALTAB = I_FINTAB.

APPEND I_FINALTAB.

CLEAR I_FINALTAB.

ENDLOOP.

" Final Internal Table is empty

IF ( I_FINALTAB[] IS INITIAL ).

MESSAGE S010.

ENDIF..

" Color handling depending on the Profit Percentage

LOOP AT I_FINALTAB.

IF I_FINALTAB-PROFITP < S_PROFP-LOW.

I_FINALTAB-LINE_COL = 'C610'.

ELSE.

I_FINALTAB-LINE_COL = 'C300'.

ENDIF.

MODIFY I_FINALTAB.

CLEAR I_FINALTAB.

ENDLOOP.

" Default sort order - Order Number

SORT I_FINALTAB BY AUFNR.

ENDFORM. "SUB_SELECTION_FINALTAB

&----


*& Form SUB_FIELDCAT_BUILD

&----


  • Defining the fieldcatalog to be used for the report

----


FORM SUB_FIELDCAT_BUILD.

PERFORM SUB_FIELDCAT USING '' 'AUFNR' text-001 G_COL 'X'.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'KTEXT' text-002 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'KUNUM' text-003 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'NAME1' text-004 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'I_PARNR' text-005 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'WRT00' text-006 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'WRT01' text-007 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'USER4' text-008 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'WRT02' text-009 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'PROFIT' text-010 G_COL ''.

ADD 1 TO G_COL.

PERFORM SUB_FIELDCAT USING '' 'PROFITP' text-011 G_COL ''.

ADD 1 TO G_COL.

ENDFORM. "SUB_FIELDCAT_BUILD

&----


*& Form SUB_FIELDCAT

&----


  • Defining the fields in the fieldcatalog used for the report

----


  • --> L_TABNAME : Table name for the fieldcat

  • --> L_FNAME : Field name for the fieldcat

  • --> L_SEL : Field Description for the fieldcat

  • --> L_COL : Column position for the fieldcat

  • --> L_KEY : Key for the fieldcat

----


FORM SUB_FIELDCAT USING L_TABNAME TYPE SLIS_TABNAME

L_FNAME TYPE SLIS_FIELDNAME

L_SEL TYPE DD03P-SCRTEXT_L

L_COL TYPE I

L_KEY TYPE C.

I_FIELDCATTAB_WA-REF_TABNAME = L_TABNAME.

I_FIELDCATTAB_WA-FIELDNAME = L_FNAME.

I_FIELDCATTAB_WA-SELTEXT_L = L_SEL.

I_FIELDCATTAB_WA-COL_POS = L_COL.

I_FIELDCATTAB_WA-KEY = L_KEY.

APPEND I_FIELDCATTAB_WA TO I_FIELDCATTAB.

ENDFORM. " SUB_FIELDCAT

&----


*& Form SUB_FIELDCAT_DISPLAY

&----


  • Mapping the internal table I_FINALTAB with fieldcat

----


FORM SUB_FIELDCAT_DISPLAY.

GT_LAYOUT-ZEBRA = 'X'.

GT_LAYOUT-DETAIL_POPUP = ' '.

GT_LAYOUT-INFO_FIELDNAME = 'LINE_COL'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'ZPSPAR12_SER_ORD'

IT_FIELDCAT = I_FIELDCATTAB

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

IS_LAYOUT = GT_LAYOUT

I_SAVE = 'A'

TABLES

T_OUTTAB = I_FINALTAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

ENDFORM. "SUB_FIELDCAT_DISPLAY

&----


*& Form SUB_FIELDCAT_TITLE

&----


  • Define the Top-Of-Page contents

----


FORM SUB_FIELDCAT_TITLE.

I_TITLE_WA-TYP = 'H'.

I_TITLE_WA-INFO = text-014.

APPEND I_TITLE_WA TO I_TITLE.

I_TITLE_WA-TYP = 'S'.

I_TITLE_WA-KEY = text-012.

I_TITLE_WA-INFO = SY-UNAME.

APPEND I_TITLE_WA TO I_TITLE.

I_TITLE_WA-TYP = 'S'.

I_TITLE_WA-KEY = text-013.

I_TITLE_WA-INFO0(2) = SY-DATUM6(2).

I_TITLE_WA-INFO+2(1) = '.'.

I_TITLE_WA-INFO3(2) = SY-DATUM4(2).

I_TITLE_WA-INFO+5(1) = '.'.

I_TITLE_WA-INFO6(4) = SY-DATUM0(4).

APPEND I_TITLE_WA TO I_TITLE.

ENDFORM. "SUB_FIELDCAT_TITLE

&----


*& Form TOP_OF_PAGE

&----


  • TOP-OF-PAGE

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_TITLE.

ENDFORM. "TOP_OF_PAGE

INCLUDE ZPSPAR12_FORMS_F01.

include:

----


***INCLUDE ZPSPAR12_FORMS_F01 .

----


&----


*& Form plant_authorization_check

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM plant_authorization_check .

refresh it_plant[].

      • Populate internal table with all plants

if sy-ucomm eq 'ONLI'.

if s_werks is not initial.

loop at s_werks.

if s_werks-option = 'EQ'.

it_plant-werks = s_werks-low.

append it_plant.

elseif s_werks-option = 'BT'.

select werks into it_plant-werks from T001W where werks between s_werks-low and s_werks-high.

append it_plant.

endselect.

endif.

endloop.

else.

select werks into it_plant-werks from T001W.

append it_plant.

endselect.

endif.

  • Allow user to enter individual plants without initiating the authority check

loop at it_plant.

AUTHORITY-CHECK OBJECT 'I_IWERK'

ID 'TCD' FIELD SY-TCODE

ID 'IWERK' FIELD it_plant-werks.

IF SY-SUBRC ne 0. " If user has authorization

delete it_plant.

ENDIF.

endloop.

DESCRIBE TABLE it_plant LINES lv_lines.

if lv_lines eq 0.

message E155.

endif.

endif.

ENDFORM. " plant_authorization_check

&----


*& Form validate_select_options

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM validate_select_options .

SELECT SINGLE * FROM AUFK WHERE AUFNR IN S_AUFNR.

IF SY-SUBRC <> 0 AND NOT ( S_AUFNR IS INITIAL ).

*---Invalid Order Number

MESSAGE E001.

ENDIF.

SELECT SINGLE * FROM AUFK WHERE KTEXT IN S_KTEXT.

IF SY-SUBRC <> 0 AND NOT ( S_KTEXT IS INITIAL ).

*---Invalid Order Description

MESSAGE E002.

ENDIF.

SELECT SINGLE * FROM VIQMEL WHERE KUNUM IN S_KUNUM.

IF SY-SUBRC <> 0 AND NOT ( S_KUNUM IS INITIAL ).

*---Invalid Customer Number

MESSAGE E003.

ENDIF.

SELECT SINGLE * FROM KNA1 WHERE NAME1 IN S_NAME1.

IF SY-SUBRC <> 0 AND NOT ( S_NAME1 IS INITIAL ).

*---Invalid Customer Description

MESSAGE E004.

ENDIF.

SELECT SINGLE * FROM IHPA WHERE PARNR IN S_PARNR.

IF SY-SUBRC <> 0 AND NOT ( S_PARNR IS INITIAL ).

*---Invalid Supervisor

MESSAGE E005.

ENDIF.

SELECT SINGLE * FROM AUFK WHERE USER4 IN S_USER4.

IF SY-SUBRC <> 0 AND NOT ( S_USER4 IS INITIAL ).

*---Invalid Estimation Costs

MESSAGE E006.

ENDIF.

SELECT SINGLE * FROM T001W WHERE WERKS IN S_WERKS.

IF SY-SUBRC <> 0 AND NOT ( S_WERKS IS INITIAL ).

*---Invalid Plant

MESSAGE E008.

ENDIF.

SELECT SINGLE * FROM T003O WHERE AUART IN S_AUART.

IF SY-SUBRC <> 0 AND NOT ( S_AUART IS INITIAL ).

*---Invalid Order Type

MESSAGE E009.

ENDIF.

ENDFORM. " validate_select_options

Thanks in Advance.

11 REPLIES 11

Former Member
0 Kudos

Hi,

Follow below steps

1) Remove corresponding from select satement

2) Remove * from select

3) Select field in sequence as defined in database

4) Avoid unnecessary selects

i.e check for internal table not initial

5) Use all entries and sort table by key fields

6) Remove selects ferom loop and use binary search

Regards,

Amole

Regards

Amole

0 Kudos

have a look at this part.. this is really take lot of time.

if sy-ucomm eq 'ONLI'.

if s_werks is not initial.

loop at s_werks.

if s_werks-option = 'EQ'.

it_plant-werks = s_werks-low.

append it_plant.

elseif s_werks-option = 'BT'.

select werks into it_plant-werks from T001W where werks between s_werks-low and s_werks-high.

append it_plant.

endselect.

endif.

endloop.

else.

select werks into it_plant-werks from T001W.

append it_plant.

endselect.

endif.

try to avoid select and endselect and use for all entries.

Regards

vijay

0 Kudos

Hi,

Avoid select statements in the loop. Rather than using select use read statements.

Regards,

Azaz Ali.

0 Kudos

Hi,

Thaks.I have given points.But how can we write for all entries here?..there is no another itab here.

I have an idea...instead of writting select and end select,

can we can write like this:

select werks from t001w into table it_plants where wreks between s_werks-low and s_werks-high.

in the same way

instaed of:

select werks into it_plant-werks from T001W.

append it_plant.

endselect.

can i writelike:

select werks from t001w into table it_plants.

pls give me any suggessions.

0 Kudos

Yes you are right,

but why are looping in your previous code?

you can do something like this....

<b>select werks from t001w into table it_plants where werks in s_werks</b>.

Regards

vijay

0 Kudos

hi jak,

yes u can and for the first select also give as

select werks from t001w into table it_plants where werks in s_werks.

hope this helps,

priya.

Former Member
0 Kudos

hii

use this

WHERE MATNR EQ ‘000101234567890123’.

SELECT SINGLE KUNNR

FROM KNA1

INTO V_KUNNR

WHERE KUNNR = I_FINTAB-KUNUM .

Reduce Information transfer to Application server

Specify the individual column (field) names of the data you want to retrieve in the Select/ Get statement.

In this , only 1 fields are transported back to the work area for each matching record. This greatly reduces the amount of data transfer (network traffic) – especially for tables, which have a large number of fields/large record size.

check the performance

Revert back for more help..

REGARDS

Naresh

Former Member
0 Kudos

Hi,

1) Try to use secondary index when you don't have

full key.

2) Modify internal table use transporting option

3) Avoid nested loop . Use read table and loop at itab

from sy-tabix statement.

4) free intrenal table memory wnen table is not

required for further processing.

5)

Follow below logic.

FORM SUB_SELECTION_AUFKTAB.

if not it_plant[] is initial.

it_plant1[] = it_plant[].

sort it_plant1 by werks.

delete adjacent duplicates from it_plant1 comparing werks

SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB

FROM AUFK

FOR ALL ENTRIES IN it_plant1

WHERE AUFNR IN S_AUFNR AND

KTEXT IN S_KTEXT AND

  • WERKS IN S_WERKS AND

AUART IN S_AUART AND

USER4 IN S_USER4 AND

werks eq it_plant1-werks.

free it_plant1.

Endif.

ENDFORM. "SUB_SELECTION_AUFKTAB

Regards

Amole

0 Kudos

select werks from t001w into table it_plants where wreks in s_werks

in the same way

instaed of:

select werks into it_plant-werks from T001W.

append it_plant.

endselect.

can i writelike:

select werks from t001w into table it_plants.

ya it is ok....

it increase ur performance but

also avoid to use select statement in loop it is one of the big reason for ur down performance....

Former Member
0 Kudos

Hi Jaj,

Please follow the tips below as applicable and then check if the performance (database utillization wise) improves or not.

<i>SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB

FROM AUFK</i>

1. Select the fields in the order in which it's specified in the Database Table.

2. Also try to avoid using "INTO CORRESPONDING FIELDS OF TABLE" clause.

<i>SELECT SINGLE * FROM IHPA WHERE OBJNR = I_AUFKTAB-OBJNR AND PARVW = 'AG' .

SELECT SINGLE * FROM AFKO WHERE AUFNR = I_AUFKTAB-AUFNR.</i>

1. Avoid Selects in a loop. This is a serious issue with respect to performance.

2. Use FOR ALL ENTRIES, wherever possible.

<i>select werks into it_plant-werks from T001W where werks between s_werks-low and s_werks-high.

append it_plant.

endselect.

select werks into it_plant-werks from T001W.

append it_plant.

endselect.</i>

1. Avoid using SELECT ... ENDSELECT.This is another serious issue with respect to performance.

In 90% of the practical cases, you can avoid all these typical issues by following these tips.

Regards,

Roopesh.

Former Member
0 Kudos

Please see my answer on your duplicate post.

Rob