‎2006 Nov 10 10:00 PM
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.
‎2006 Nov 10 10:02 PM
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
‎2006 Nov 10 10:05 PM
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
‎2006 Nov 10 10:08 PM
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:
‎2006 Nov 10 10:14 PM
Are you doing this SELECT inside a LOOP? If so, would you post that code as well, please.
Rob
‎2006 Nov 10 10:12 PM
Itis using the fields as same order as interenal table
‎2006 Nov 10 10:13 PM
It is using fields in the same order as Internal table.But not in the same order of Bseg table
‎2006 Nov 10 10:13 PM
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
‎2006 Nov 10 10:16 PM
‎2006 Nov 10 10:21 PM
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
‎2006 Nov 10 10:27 PM
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
‎2006 Nov 12 2:03 PM
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
‎2006 Nov 10 10:23 PM
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
‎2006 Nov 13 6:49 PM
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
‎2006 Nov 13 7:08 PM
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
‎2006 Nov 13 8:20 PM
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
‎2006 Nov 13 8:34 PM
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
‎2006 Nov 15 4:59 PM
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
‎2006 Nov 13 8:46 PM
‎2006 Nov 13 9:00 PM
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
‎2006 Nov 13 9:20 PM
in st05, shall I run performance race.
Thanks.
i will take .
‎2006 Nov 13 9:44 PM
Sorry .
I was confused . Could you please tell me how to run SQL trace
and what to consider/observe?
THANK YOU,
‎2006 Nov 13 9:51 PM
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
‎2006 Nov 13 10:00 PM
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
‎2006 Nov 13 10:09 PM
‎2006 Nov 13 10:16 PM
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'
‎2006 Nov 13 10:30 PM
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
‎2006 Nov 14 11:35 AM
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.