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

itab problem

Former Member
0 Likes
1,317

Hi experts,

In the following code RESULT tab is having 4000 records and ITAB is haing 3,00,000 records.when iam trying to append into FINRESULT, why it is going to dump??


  LOOP AT <b>RESULT</b>.
    LOOP AT <b>ITAB</b> WHERE MATNR = RESULT-MATNR.
      IF SY-SUBRC = 0.
        TAMT = RESULT-LBKUM * RESULT-VERPR.
        9MTH = RESULT-QTY1 * RESULT-VERPR.
        10MTH = RESULT-QTY2 * RESULT-VERPR.
        13MTH = RESULT-QTY3 * RESULT-VERPR.
        24MTH = RESULT-FBALQTY * RESULT-VERPR.

        MOVE-CORRESPONDING: RESULT TO FINRESULT.
        MOVE: TAMT  TO FINRESULT-FTAMT,
              9MTH  TO FINRESULT-F9MTH,
              10MTH TO FINRESULT-F10MTH,
              13MTH TO FINRESULT-F13MTH,
              24MTH TO FINRESULT-F24MTH.

        APPEND <b>FINRESULT</b>.
*        CLEAR FINRESULT.
*        COLLECT FINRESULT.
      ENDIF.
    ENDLOOP.
  ENDLOOP.

14 REPLIES 14
Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,286

Hi,

in ST22 we can know the reason of the dump , what was the first statement of the dump, check this.

this is timeout problem , try to change the logic or run the program in background.

Laxman

Message was edited by: Laxmana Kumar

Read only

Former Member
0 Likes
1,286

Hi,

can you show the dump..

Regards

vijay

Read only

0 Likes
1,286

----------------------------------------------------------------------------------------------------
|Error analysis                                                                                |
|    After a certain length of time, the program is terminated. In the case                        |
|    of a work area, this means that                                                               |
|    - endless loops (DO, WHILE, ...),                                                             |
|    - database accesses producing an excessively large result set,                                |
|    - database accesses without a suitable index (full table scan)                                |
|    do not block the processing for too long.                                                     |
|                                                                                |
|    The system profile "rdisp/max_wprun_time" contains the maximum runtime of a                   |
|     program. The                                                                                |
|    current setting is 600 seconds. Once this time limit has been exceeded,                       |
|    the system tries to terminate any SQL statements that are currently                           |
|    being executed and tells the ABAP processor to terminate the current                          |
|    program. Then it waits for a maximum of 60 seconds. If the program is                         |
|    still active, the work process is restarted.                                                  |
|                                                                                |
|    successfully processed, the system gives it another 600 seconds.                              |
|    Hence the maximum runtime of a program is at least twice the value of                         |
|    the system profile parameter "rdisp/max_wprun_time".                                          |
|                                                                                |
|                                                                                |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|How to correct the error                                                                          |
|    You should usually execute long-running programs as batch jobs.                               |
|    If this is not possible, increase the system profile parameter                                |
|     "rdisp/max_wprun_time".                                                                      |
|                                                                                |
|    Depending on the cause of the error, you may have to take one of the                          |
|    following measures:                                                                           |
|    - Endless loop: Correct program;                                                              |
|    - Dataset resulting from database access is too large:                                        |
|      Instead of "SELECT * ... ENDSELECT", use "SELECT * INTO internal table                      |
|      (for example);                                                                              |
|    - Database has an unsuitable index: Check index generation.                                   |
|                                                                                |
|    You may able to find an interim solution to the problem                                       |
|    in the SAP note system. If you have access to the note system yourself,                       |
|    use the following search criteria:                                                            |
|                                                                                |
|    ------------------------------------------------------------------------                      |
|    "TIME_OUT" C                                                                                |
|    "Z_AGERPB1_CHANGE" or "Z_AGERPB1_CHANGE"                                                      |
|    "START-OF-SELECTION"                                                                          |
|    ------------------------------------------------------------------------                      |
|    If you cannot solve the problem yourself and you wish to send                                 |
|    an error message to SAP, include the following documents:                                     |
|                                                                                |
|    1. A printout of the problem description (short dump)                                         |
|       To obtain this, select in the current display "System->List->                              |
|       Save->Local File (unconverted)".                                                           |
|                                                                                |
|    2. A suitable printout of the system log                                                      |
|       To obtain this, call the system log through transaction SM21.                              |
|       Limit the time interval to 10 minutes before and 5 minutes                                 |
|       after the short dump. In the display, then select the function                             |
|       "System->List->Save->Local File (unconverted)".                                            |
|                                                                                |
|    3. If the programs are your own programs or modified SAP programs,                            |
|       supply the source code.                                                                    |
|       To do this, select the Editor function "Further Utilities->                                |
|       Upload/Download->Download".                                                                |
|                                                                                |
|    4. Details regarding the conditions under which the error occurred                            |
|       or which actions and input led to the error.   
Read only

0 Likes
1,286

The dump is not due to a syntax error, it is because the program 'timed out' during execution. Since you are looping at itab within the Result tab, for each record in the Result tab, the program loops at 3,00,000 entries in itab.

The max runtime set for an ABAP program is usually around 10 mins, and when your program took longer than that to execute, it was terminated.

You might need to re-look at your logic and optimize the performance of your report.

Sudha

Message was edited by: Sudha Mohan

Read only

FredericGirod
Active Contributor
0 Likes
1,286

In the ST22, you will see that SAP set a limit of size for internal table. You could try to ask your administrator to modify that limite (maybe with rz10)

I think, the better way, is to change your logic code

OOoops, it's a timeout, your program is too slow.

Rgd

Frédéric

Message was edited by: Frédéric Girod

Read only

0 Likes
1,286

As mentioned in the log,

The program has exceeded it runtime parameter.

As mentioned earlier you can change the rdisp/max_wprun_time parameter in RZ10 transaction EXTENDED MAINTENANCE.

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
1,286

Hi kaki,

1. TIME OUT

time out problem is happening.

2. Since your both itab contain 4000 and 3 lakh records,

the final count is

4000 X 3 lac

and it goes more than 10 minutes (600 seconds)

3. Hence, this error (this error is common)

4. Either increase the time out (by taking

help of basis team)

5. Or reduce the number of records

6. Or do in bunch of records.

regards,

amit m.

Read only

Former Member
0 Likes
1,286

sort result by matnr.

delete adjacent duplicates...

loop at itab.

read table result where matnr = itab-matnr.

if sy-subrc = 0.

move-corresponding....

append finaltab.

endif.

endloop.

the above specified code will give better performance and i hope u will not get dump.

Thanks

Eswar

Read only

Former Member
0 Likes
1,286

Hi Kaki,

Run Background Job, instead of foreground.

Regards

vijay

Read only

0 Likes
1,286

Hi Kaki,

1. I agree with Vijay.. run it in background

2. Pl make the following change to the code for some performance improvement.


sort itab by matnr.
LOOP AT RESULT.
    read table ITAB with key MATNR = RESULT-MATNR
                             binary search.
        if sy-subrc eq 0.
        TAMT = RESULT-LBKUM * RESULT-VERPR.
        9MTH = RESULT-QTY1 * RESULT-VERPR.
        10MTH = RESULT-QTY2 * RESULT-VERPR.
        13MTH = RESULT-QTY3 * RESULT-VERPR.
        24MTH = RESULT-FBALQTY * RESULT-VERPR.
 
        MOVE-CORRESPONDING: RESULT TO FINRESULT.
        MOVE: TAMT  TO FINRESULT-FTAMT,
              9MTH  TO FINRESULT-F9MTH,
              10MTH TO FINRESULT-F10MTH,
              13MTH TO FINRESULT-F13MTH,
              24MTH TO FINRESULT-F24MTH.
 
        APPEND FINRESULT.
        CLEAR FINRESULT.
       delete itab where matnr = result-matnr.
      ENDIF.
ENDLOOP.

Regards,

Suresh Datti

Read only

0 Likes
1,286

Hi

You can also try to improve the performance by using sorted table:

DATA: ITAB LIKE SORTED TABLE OF <TYPE_LINE>

WITH NON-UNIQUE KEY MATNR WITH HEADER LINE.

LOOP AT RESULT.

LOOP AT ITAB WHERE MATNR = RESULT-MATNR

Now the reading of itab is faster, it''ll only be slower the uploading of data in ITAB, because while uploading it have to sort them.

Max

Read only

0 Likes
1,286

Hi Kaki,

I believe you should use "Read" while fetching from second internal table. See the below code:

LOOP AT RESULT.

<b>Read Table ITAB With key MATNR = RESULT-MATNR.</b>

IF SY-SUBRC = 0.

TAMT = RESULT-LBKUM * RESULT-VERPR.

9MTH = RESULT-QTY1 * RESULT-VERPR.

10MTH = RESULT-QTY2 * RESULT-VERPR.

13MTH = RESULT-QTY3 * RESULT-VERPR.

24MTH = RESULT-FBALQTY * RESULT-VERPR.

MOVE-CORRESPONDING: RESULT TO FINRESULT.

MOVE: TAMT TO FINRESULT-FTAMT,

9MTH TO FINRESULT-F9MTH,

10MTH TO FINRESULT-F10MTH,

13MTH TO FINRESULT-F13MTH,

24MTH TO FINRESULT-F24MTH.

APPEND FINRESULT.

  • CLEAR FINRESULT.

  • COLLECT FINRESULT.

ENDIF.

ENDLOOP.

I think by this you are removing one whole iteration.

I hope it helps. Reward if it is useful.

Regards,

Jignesh.

Read only

Former Member
0 Likes
1,286

I wrote a <a href="/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops on this a couple of weeks ago. Check it out.

Rob

Read only

0 Likes
1,286

On second thought, why do you loop at ITAB at all? You don't use any of its data.

Rob