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

Runtime error "Time_out"

Former Member
0 Likes
1,536

Hi all

I have an issue regarding purchase register zreport.

Actually client have 3 company codes so when we give 1st

and 2nd comapny code as input to zreport then report takes more time

to display,but there is no problem for 1st and 2nd.But when i choose

3rd company code from date 1 to 30 then short dump comes.

In dump , short text  comes as "Time Limit exceeded" .

please tell if any one knows. Is there any need of indexing in program?

Thanks ,

Regards

Abhijeet

Hi all

I have an issue regarding purchase register zreport.

Actually client have 3 company codes so when we give 1st

and 2nd comapny code as input to zreport then report takes more time

to display,but there is no problem for 1st and 2nd.But when i choose

3rd company code from date 1 to 30 then short dump comes.

In dump , short text  comes as "Time Limit exceeded" .

please tell if any one knows. Is there any need of indexing in program?

Thanks ,

Regards

Abhijeet

8 REPLIES 8
Read only

vinoth_rajendran2
Product and Topic Expert
Product and Topic Expert
0 Likes
1,448

Hi,

I hope your taking data from MKPF and MSEG if so then you need to do code optimization.

Let me know how the logic is performed.Put the code for which you get time limit exceed.

Read only

0 Likes
1,448

Hi...see below code.

form GETDATA .

if r1 = 'X'.

SELECT

   belnr

   gjahr

   budat

   rmwwr

   lifnr

   werks_i

   matnr_i

   bukrs

   buzei_i

   bklas_i

   lfbnr_i

   lfgja_i

   lfpos_i

   ebeln_i

   ebelp_i

   kschl_i

   wrbtr_i

   tcode

   stblg

   xblnr

   MWSKZ_I

   menge_i

   FROM WB2_V_RBKP_RSEG2

   INTO TABLE it_rseg

   WHERE bukrs = p_bukrs

   AND gjahr = p_gjahr

   AND budat in S_BUDAT

   AND lifnr In s_lifnr

   AND matnr_i in s_matnr

   AND bklas_i in s_bklas

   AND SHKZG_I = 'S'

   AND MWSKZ_I in s_mwskz1.

   loop at it_rseg INTO wa_rseg.

     MOVE-CORRESPONDING wa_rseg to wa_temp.

     APPEND wa_temp to it_temp.

     count = sy-tabix.

     CONCATENATE wa_rseg-belnr wa_rseg-gjahr INTO wa_temp1-awkey.

     wa_temp1-bukrs = wa_rseg-bukrs.

     APPEND wa_temp1 to it_temp1.

*    if wa_rseg-tcode = 'MR8M'.

*      delete it_rseg WHERE belnr = wa_rseg-stblg.

*      delete it_rseg INDEX count.

*    ENDIF.

   ENDLOOP.

   if it_rseg[] IS INITIAL.

     flag = 1.

     MESSAGE 'No Data Found' TYPE 'E' DISPLAY LIKE 'S'.

     exit.

   ENDIF.

*  it_temp[] = it_rseg[].

if it_rseg is NOT INITIAL.

SELECT

     mblnr

     mjahr

     zeile

     bwart

     ebeln

     ebelp

     LFBJA

     LFBNR

     LFPOS

     bukrs

     FROM mseg

     INTO TABLE it_mseg

     FOR ALL ENTRIES IN it_rseg

     WHERE LFBNR = it_rseg-LFBNR_I

     and  LFBJA = it_rseg-lfgja_i

     and LFPOS = IT_rseg-LFPOS_i

     and ebeln = it_rseg-ebeln_i

     AND ebelp = it_rseg-ebelp_i

     AND bukrs = it_rseg-bukrs and bwart not in ('122','161')

    %_HINTS ORACLE 'INDEX("MSEG" "MSEG~ZMR")'.

endif.

Read only

0 Likes
1,448

Hi,

Try to create secondary index for MSEG with respect to first internal table key fields.

Also run the same report in Background and check how long it takes to complete.

Read only

0 Likes
1,448

hi

check which select is causing time out.

how many records does it_rseg contains ? as you have used a for all entries on it.

Try with JOINS once and check the time executed.

Read only

Former Member
0 Likes
1,448

Hello Abhijeet,

You need to improve performance of your report. Please check following :

1. As index is not properly utilised , I would say rather than using View WB2_V_RBKP_RSEG2, cannt you fetch header data from RBKP first and then extract items entries from RSEG based on records that you get from RBKP.

2.   I am not sure what fields in your index ZMR but there is a standard secondary index which you can use on fields EBELN/EBELP while extracting records from MSEG.

3. Its best practice not to use negative condition in select query because processor takes lot of time in negative clause. remove this from your query bwart not in ('122','161')

Once data is extracted from MSEG,  build logic in internal table to filter based on BWART not in 122 & 161.

Regards,

Deepti

Read only

former_member214709
Participant
0 Likes
1,448

Dear Abhijeet,

You must include SAP_GUI_PROGRESS_INDICATOR FM in your report.

Also always use primary keys to Select data from the tables as well as SORT the tables wherever required.

Use Validations whereever necessary, READ statement with Sy-Subrc checks.

Regards

Dinesh

Read only

Former Member
0 Likes
1,448

Hi Abhijeet,

Short Dump indicate that your report is taking more time then the timeout period.

So you surely need performance optimization.

For the 1st Select Query no performance Optimization is done

The table WB2_V_RBKP_RSEG2(used in 1st query) contains lot of data(In millions) and in the above code snippet there is no perfomance optimization done on table WB2_V_RBKP_RSEG2.

You can do following steps:

Step 1:Create secondary index on fields

budat

lifnr

matnr

BKLAS_I

MWSKZ_I

SHKZG_I

of table WB2_V_RBKP_RSEG2,since you have included these fileds in Selection Criteria which are not primary key by default.

Step 2:To enforce the index that you have created you can modify the above query as:

SELECT

   belnr

   gjahr

   budat

   rmwwr

   lifnr

   werks_i

   matnr_i

   bukrs

   buzei_i

   bklas_i

   lfbnr_i

   lfgja_i

   lfpos_i

   ebeln_i

   ebelp_i

   kschl_i

   wrbtr_i

   tcode

   stblg

   xblnr

   MWSKZ_I

   menge_i

   FROM WB2_V_RBKP_RSEG2

   INTO TABLE it_rseg

   WHERE bukrs = p_bukrs

   AND gjahr = p_gjahr

   AND budat in S_BUDAT

   AND lifnr In s_lifnr

   AND matnr_i in s_matnr

   AND bklas_i in s_bklas

   AND SHKZG_I = 'S'

   AND MWSKZ_I in s_mwskz1

  

%_HINTS ORACLE 'INDEX("MSEG" "MSEG~Z1")'.

Hope this works.

Regards,

Vikas

Read only

0 Likes
1,448

Well,

disagree on the index suggestion without knowing if the SELECT OPTIONs from ABAP

are really fed to the DB. Makes no sense at all without knowing exactly.

If access is known (and preferably verified in SQL trace), create corresponding index

with respect to the specified comparison.

Since the OP already stated BUKRS is given, it should surely be part of that index,

probably with the first field, while BUDAT due to high probability of range condition

should surely NOT be the first field in that index.

Hinting a select on WB2_V_RBKP_RSEG2 to use an index on MSEG will not work as well.

Never create indexes only on SELECT-options given in OPEN SQL, but only on verified

specified conditions of the SQL join and WHERE clauses.

Volker