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

Issue

Former Member
0 Likes
2,787

I have issue and need to solve urgenlty.

The program is dumping here. How can I solve this issue.

Could you please help me.

SELECT BUKRS BELNR GJAHR BUZEI LIFNR SGTXT MWSKZ HKONT MENGE WRBTR

EBELN EBELP PRCTR WERKS SHKZG ZEKKN NPLNR KOSTL PROJK MATNR

AUFPL APLZL MEINS

FROM BSEG

INTO TABLE INTBSEG

WHERE BUKRS = TBKPF-BUKRS

AND BELNR = TBKPF-BELNR

AND GJAHR = TBKPF-GJAHR

AND MWART NE 'V'

AND TXJCD IN TXJCODE.

27 REPLIES 27
Read only

Former Member
0 Likes
2,741

Hi,

Check the sequence of the fields declared in the internal table and given in the select statement..

If you were not able to find out..Use INTO CORRESPONDING FIELDS OF TABLE instead of INTO TABLE..If the field names are same..

ALso Give us the description of the SHORT DUMP..

Thanks,

Naren

Read only

Former Member
0 Likes
2,741

The SELECT looks OK. Are you sure that all of the fields you are selecting are in your internal table? In the same order?

Rob

Read only

Former Member
0 Likes
2,741

What happened?

The program "ZKRAR232" has exceeded the maximum permitted runtime without

interruption, and has therefore been terminated.

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 900 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 900 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:

Read only

0 Likes
2,741

Are you doing this SELECT inside a LOOP? If so, would you post that code as well, please.

Rob

Read only

Former Member
0 Likes
2,741

Itis using the fields as same order as interenal table

Read only

Former Member
0 Likes
2,741

It is using fields in the same order as Internal table.But not in the same order of Bseg table

Read only

Former Member
0 Likes
2,741

Hi,

Looks like the program is taking long time and it has exceeded the limit of 900 seconds..

If you SELECT is with in a LOOP AT ...ENDLOOP..Move it outside the loop..

I think TBKPF is an internal table..Use the FOR ALL ENTRIES ..

<b>IF NOT TBKPF IS INITIAL.</b>

SELECT BUKRS BELNR GJAHR BUZEI LIFNR SGTXT MWSKZ HKONT MENGE WRBTR

EBELN EBELP PRCTR WERKS SHKZG ZEKKN NPLNR KOSTL PROJK MATNR

AUFPL APLZL MEINS

FROM BSEG

INTO TABLE INTBSEG

<b>FOR ALL ENTRIES IN TBKPF</b>

WHERE BUKRS = TBKPF-BUKRS

AND BELNR = TBKPF-BELNR

AND GJAHR = TBKPF-GJAHR

AND MWART NE 'V'

AND TXJCD IN TXJCODE.

<b>ENDIF.</b>

Thanks

Naren

Read only

Former Member
0 Likes
2,741

No this SELECT is not in the loop.

Read only

0 Likes
2,741

OK - would you post the section of the dump that gives the source code extract? I don't see a problem with the select.

Rob

Read only

0 Likes
2,741

OK maybe there is a problem with the select. Using NE may prevent the use of an index. Try:


SELECT  bukrs belnr gjahr buzei lifnr sgtxt mwskz hkont menge wrbtr
        ebeln ebelp prctr werks shkzg zekkn nplnr kostl projk matnr
        aufpl aplzl meins mwart
  FROM bseg
  INTO TABLE intbseg
  WHERE bukrs = tbkpf-bukrs
    AND belnr = tbkpf-belnr
    AND gjahr = tbkpf-gjahr
    AND txjcd IN txjcode.

DELETE intbseg WHERE mwart = 'V'.

You have to add MWART to the end of your internal table.

Rob

Read only

0 Likes
2,741

Well I don't know which release you are on and whether BSEG is still in the cluster or not.

I would try a completely different approach:

Find an Index (BSIS, BSAS, BKPF etc... ) to narrow down your extract from BSEG and give you the primary key for the BSEG records.

Retrieve all the information on the BSEG records (and I mean the full BSEG record because if the table is still clustered it will be faster) into an internal table.

Delete the records you don't need from the internal table...

Process.

Enjoy

Read only

Former Member
0 Likes
2,741

Source code extract

004660 PERFORM TOTAL-BSET-DATA.

004670

004680 PERFORM FILL-TABLES.

004690

004700 ENDLOOP.

004710

004720 END-OF-SELECTION.

004730

004740 PERFORM MODIFY_DETAIL.

004750

004760 PERFORM PRINT-COVER-PAGE.

004770

004780 PERFORM PRINT-DETAIL-REPORT.

004790

004800 INCLUDE ZZEZ410C. "Variant capture

004810

004820 ************************************************************************

004830 * BEGIN OF FORM SUBROUTINES *

004840 ************************************************************************

004850

004860 * *

004870 * Form GET_BSEG *

004880 * *

004890 FORM GET_BSEG.

004900 * Read all record that belong to the document number

004910

004920 REFRESH: VBSEG, BSEG_NT, INTBSEG.

004930 CLEAR: VBSEG, BSEG_NT.

004940 CLEAR : QTY_TOTAL, INTBSEG_TABIX.

004950

> SELECT BUKRS BELNR GJAHR BUZEI LIFNR SGTXT MWSKZ HKONT MENGE WRBTR

004970 EBELN EBELP PRCTR WERKS SHKZG ZEKKN NPLNR KOSTL PROJK MATNR

004980 AUFPL APLZL MEINS

004990 FROM BSEG

005000 INTO TABLE INTBSEG

005010 WHERE BUKRS = TBKPF-BUKRS

005020 AND BELNR = TBKPF-BELNR

005030 AND GJAHR = TBKPF-GJAHR

005040 AND MWART NE 'V'

005050 AND TXJCD IN TXJCODE.

005060

005070 DESCRIBE TABLE INTBSEG LINES NO_OF_INTBSEG_LINES. " # 1 : Jaideep

005080

005090 LOOP AT INTBSEG.

005100 INTBSEG_TABIX = SY-TABIX. " # 2 : Jaideep Fadia 12/05/97

005110

005120 * CMS 17969 If quantity is 0, default it to 1.

005130 IF INTBSEG-MENGE = 0. "17969

005140 INTBSEG-MENGE = 1. "17969

005150 MODIFY INTBSEG INDEX SY-TABIX. "17969

Read only

Former Member
0 Likes
2,741

I want change in program and see whether I can do some thing to improve perfromance of my program.

Basically some body wrote this program and initially it is SELECTING from bkpf table into internal table and then looping through that internal table and each time it is selecting from BSEG . and then from BSET.

How can I compare my performance of my program WITH and WITH OUT my changes...

my program i

Read only

0 Likes
2,741

Well, I asked earlier if this select was in a loop and you said no. Since this SELECT doesn't look so bad, how do you know it's not in a different SELECT. Particularly the one on BKPF. could you post that portion of the code please?

You can use the performance trace (ST05) to look at the results with and without your changes.

Rob

Read only

Former Member
0 Likes
2,741

SELECT BUKRS BELNR GJAHR BLART BLDAT BUDAT XBLNR HWAER

FROM BKPF INTO TABLE <b>TBKPF</b>

WHERE BUKRS IN COMPCODE

AND BSTAT NE 'M'

AND BSTAT NE 'D'

AND BUDAT IN POSTDATE "shifted position

AND BLART IN R_BLART "5205

  • AND ( BLART EQ 'KG' OR "17969

  • BLART EQ 'KR' OR "17969

  • BLART EQ 'RE' ) "17969

%_HINTS ORACLE 'INDEX (BKPF BKPF______Z1)'. "17969

  • order by primary key.

LOOP AT <b>TBKPF</b>.

PERFORM GET_BSEG.

PERFORM GET_BSET.

DESCRIBE TABLE VBSEG LINES TAB_LINES.

CHECK TAB_LINES > 0.

PERFORM TOTAL-BSEG-DATA.

PERFORM TOTAL-BSET-DATA.

PERFORM FILL-TABLES.

ENDLOOP.

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

FORM GET_BSEG.

  • Read all record that belong to the document number

REFRESH: VBSEG, BSEG_NT, INTBSEG.

CLEAR: VBSEG, BSEG_NT.

CLEAR : QTY_TOTAL, INTBSEG_TABIX. " # 1 : Jaideep Fadia 11/26/97

SELECT BUKRS BELNR GJAHR BUZEI LIFNR SGTXT MWSKZ HKONT MENGE WRBTR

EBELN EBELP PRCTR WERKS SHKZG ZEKKN NPLNR KOSTL PROJK MATNR

AUFPL APLZL MEINS

FROM BSEG

INTO TABLE INTBSEG

WHERE BUKRS = TBKPF-BUKRS

AND BELNR = TBKPF-BELNR

AND GJAHR = TBKPF-GJAHR

AND MWART NE 'V'

AND TXJCD IN TXJCODE.

DESCRIBE TABLE INTBSEG LINES NO_OF_INTBSEG_LINES.

LOOP AT INTBSEG.

INTBSEG_TABIX = SY-TABIX.

  • CMS 17969 If quantity is 0, default it to 1.

IF INTBSEG-MENGE = 0.

INTBSEG-MENGE = 1.

MODIFY INTBSEG INDEX SY-TABIX.

ENDIF.

IF NOT INTBSEG-LIFNR IS INITIAL.

MOVE: INTBSEG-LIFNR TO TBKPF-LIFNR,

INTBSEG-SGTXT TO TBKPF-TEXT.

MODIFY TBKPF.

ELSEIF INTBSEG-MWSKZ = SPACE AND BSEG-HKONT = '0074400010'.

MOVE-CORRESPONDING INTBSEG TO BSEG_NT.

APPEND BSEG_NT.

ELSE.

  • RE & 0021300011

IF TBKPF-BLART = TEXT-TYP AND INTBSEG-HKONT = TEXT-GL1.

QTY_TOTAL = QTY_TOTAL + INTBSEG-MENGE.

ENDIF.

CHECK INTBSEG-MWSKZ IN TAXCODE AND INTBSEG-WRBTR NE 0."11/26

*avoid duplicate DB access AH 8/97.

IF NOT INTBSEG-EBELN IS INITIAL AND

NOT INTBSEG-EBELP IS INITIAL.

IF INTBSEG-EBELN NE EKPOTMP-EBELN AND " next record

INTBSEG-EBELP NE EKPOTMP-EBELP.

READ TABLE EKPOTMP WITH KEY EBELN = INTBSEG-EBELN

EBELP = INTBSEG-EBELP

BINARY SEARCH.

IF SY-SUBRC NE 0. " record found

EKPOTMP-EBELN = INTBSEG-EBELN.

EKPOTMP-EBELP = INTBSEG-EBELP.

CLEAR EKPO.

SELECT SINGLE WERKS INTO EKPOTMP-WERKS

FROM EKPO WHERE EBELN = INTBSEG-EBELN AND

EBELP = INTBSEG-EBELP.

IF SY-SUBRC NE 0.

CLEAR EKPOTMP-WERKS.

ENDIF.

INSERT EKPOTMP INDEX SY-TABIX.

ENDIF. " record found

ENDIF. " next record

ENDIF.

IF NOT INTBSEG-PRCTR IS INITIAL.

CHECK INTBSEG-PRCTR IN PRCENTER.

ELSEIF NOT INTBSEG-WERKS IS INITIAL.

IF INTBSEG-WERKS CO '0123456789'.

UNPACK INTBSEG-WERKS TO INTBSEG-PRCTR.

ELSE.

MOVE INTBSEG-WERKS TO INTBSEG-PRCTR.

ENDIF.

CHECK INTBSEG-PRCTR IN PRCENTER.

ELSEIF NOT EKPOTMP-WERKS IS INITIAL.

IF EKPOTMP-WERKS CO '0123456789'.

UNPACK EKPOTMP-WERKS TO INTBSEG-PRCTR.

ELSE.

MOVE EKPOTMP-WERKS TO INTBSEG-PRCTR.

ENDIF.

CHECK INTBSEG-PRCTR IN PRCENTER.

ENDIF.

CLEAR VBSEG.

IF INTBSEG-SHKZG = 'H'.

INTBSEG-WRBTR = INTBSEG-WRBTR * -1.

ENDIF.

IF INTBSEG-BUZEI EQ NO_OF_INTBSEG_LINES.

VBSEG-QTY_TOTAL = QTY_TOTAL.

ENDIF.

MOVE-CORRESPONDING INTBSEG TO VBSEG.

  • modify intbseg index sy-tabix.

MODIFY INTBSEG INDEX INTBSEG_TABIX." # 2

APPEND VBSEG. "apped vbseg original.

ENDIF.

ENDLOOP.

  • endselect.

ENDFORM. "GET_BSEG

Read only

0 Likes
2,741

I think your problem is here:


SELECT bukrs belnr gjahr blart bldat budat xblnr hwaer
  FROM bkpf INTO TABLE tbkpf
  WHERE bukrs IN compcode
    AND bstat NE 'M'
    AND bstat NE 'D'
    AND budat IN postdate "shifted position
    AND blart IN r_blart                                        "5205

Make sure compcode is not empty and only tests for equality.

Rather than specifying BSTAT NE ...

Specify BSTAT EQ (all the other possibilities).

Check this:

/people/rob.burbank/blog/2006/09/13/using-an-index-when-you-dont-have-all-of-the-fields

Rob

Read only

0 Likes
2,741

Sam,

If your issue is releated to fetching records from BSEG table and it is taking lot of time, then try using package size. This will surely improve the performance if it is related to memory.

Thanks,

Santosh

Read only

Former Member
0 Likes
2,741

the problem is it is timing out at BSEG select .

Read only

0 Likes
2,741

Yes, I understand that, but it may be tha the program spent so much time on the BKPF select, it ran out of time on BSEG. So long as you looked at the issues I pointed out earlier, the BSEG SELECT looks OK.

Have you run the performance trace on this code? It should tell you where the problem is.

Rob

Read only

Former Member
0 Likes
2,741

in st05, shall I run performance race.

Thanks.

i will take .

Read only

Former Member
0 Likes
2,741

Sorry .

I was confused . Could you please tell me how to run SQL trace

and what to consider/observe?

THANK YOU,

Read only

0 Likes
2,741

Bring up tw sessions - one with your program and the other for ST05. Run your program up to the point just before the BKPF SELECT. Then switch to the ST05 session and turn on the performance trace. Press execute for your program and wait for it to finish or fail. then bo back to ST05, turn off the trace and list it. You should see just how long the BKPF SELECT took along with the individual BSEG SELECTs.

Rob

Read only

Former Member
0 Likes
2,741

Rob, thank you very much.

I am doing sql trace . it is taking too long to fail/finish to give out put.

Thank you sir

Read only

0 Likes
2,741

But which SELECT is it stuck in?

Rob

Read only

Former Member
0 Likes
2,741

I just put break point before bkpf .

executed program till that point.

in another section, switched on SQL trace.

then set first screen to debugging off ( becaues it selects first selects from bkpf

and loop it to bseg.)

after bseg it almost gives output.

thats why I just did 'Debuggin off'

Read only

Former Member
0 Likes
2,741

Rob,

From the past 10 to 15 minutes, sql trace is running in production system.

What can i do ? Shall I allow it to run still, till it gives some output/completes ?

Thank you so mucn

Read only

0 Likes
2,741

FORM GET_BSEG contains ur select statement and this form is called within the loop. First remove the 'perform' from the loop and place it outside by using 'for all entries'. Also, don't use NE in the select statement. Instead manipulate using internal tables.