2007 Apr 11 1:30 AM
Dear all,previously this program is working fine,and it is use every month.But somehow this program was giving error when i trying to run for march data.below is the portion of code where makes the program terminated....guess the join table is tooo big untill it takes too long time and excess the normal runtime.Any suggestio how should i change it? please advice.Thank you.
LOOP AT ITAB1.
insert the last good received vendor
SELECT MSEGMATNR MSEGLIFNR MKPF~BUDAT UP TO 1 ROWS
INTO (ITABVENDOR-MATNUM, ITABVENDOR-VENDOR, ZBUDAT)
FROM MKPF INNER JOIN MSEG ON MKPFMBLNR = MSEGMBLNR
AND MKPFMJAHR = MSEGMJAHR
WHERE MSEG~BWART IN ('101', '901', '411', '412')
AND MSEG~MATNR = ITAB1-MATNUM
AND MSEG~LIFNR IN PVENDOR
AND MKPF~BUDAT BETWEEN FIRSTDAY AND LASTDAY
AND MSEG~LIFNR <> ' '
ORDER BY MKPF~BUDAT DESCENDING.
ENDSELECT.
ENDLOOP.
Dear all,previously this program is working fine,and it is use every month.But somehow this program was giving error when i trying to run for march data.below is the portion of code where makes the program terminated....guess the join table is tooo big untill it takes too long time and excess the normal runtime.Any suggestio how should i change it? please advice.Thank you.
LOOP AT ITAB1.
insert the last good received vendor
SELECT MSEGMATNR MSEGLIFNR MKPF~BUDAT UP TO 1 ROWS
INTO (ITABVENDOR-MATNUM, ITABVENDOR-VENDOR, ZBUDAT)
FROM MKPF INNER JOIN MSEG ON MKPFMBLNR = MSEGMBLNR
AND MKPFMJAHR = MSEGMJAHR
WHERE MSEG~BWART IN ('101', '901', '411', '412')
AND MSEG~MATNR = ITAB1-MATNUM
AND MSEG~LIFNR IN PVENDOR
AND MKPF~BUDAT BETWEEN FIRSTDAY AND LASTDAY
AND MSEG~LIFNR <> ' '
ORDER BY MKPF~BUDAT DESCENDING.
ENDSELECT.
ENDLOOP.
2007 Apr 11 1:40 AM
Hi,
If you are saying that runtime error occured at this statement and the program used to run fine before, then the problem is definitely with the amount of data this select statement is retrieving. You must be getting a "<b>Time Out</b>" error.
Let me know exactly what error you are getting. Give the exact wording at you are seeing on short dump.
Regards,
RS
2007 Apr 11 1:43 AM
HI Joan
Try this way instead of using NESTED SELECT within a LOOP:
* insert the last good received vendor
SELECT MSEG~MATNR MSEG~LIFNR MKPF~BUDAT UP TO 1 ROWS
INTO CORRESPONDING FIELDS OF TABLET ITABVENDOR "(ITABVENDOR-MATNUM, ITABVENDOR-VENDOR, ZBUDAT)
FROM MKPF INNER JOIN MSEG ON MKPF~MBLNR = MSEG~MBLNR
AND MKPF~MJAHR = MSEG~MJAHR
FOR ALL ENTRIES IN ITAB1
WHERE MSEG~BWART IN ('101', '901', '411', '412')
AND MSEG~MATNR = ITAB1-MATNUM
AND MSEG~LIFNR IN PVENDOR
AND MKPF~BUDAT BETWEEN FIRSTDAY AND LASTDAY
AND MSEG~LIFNR <> ' '
ORDER BY MKPF~BUDAT DESCENDING.Kind Regards
Eswar
2007 Apr 11 1:50 AM
Hi Eswar,
the tablet itabvendor...need to declare it 1st or wat? thanks
2007 Apr 11 1:56 AM
Declare an internal table ITABVENDOR with the required fields. Now with the SELECT statement, you will have all the details in the internal table with one go.
Use them to manipulate accordingly.
Sorry for my typo error <b>tablet</b> itabvendor, itz just <b>table itabvendor</b>.
Kind Regards
Eswar
2007 Apr 11 1:44 AM
Hi Rs,
The error msg tat i was getting is " Program "ZFI_TCJ_PROD_CTGY " has exceeded the maximum runtime permitted without interruption, and has therefore been terminated " and the Error ID is Time_out
2007 Apr 11 2:00 AM
Hi Joan,
Using '<>' in the where conditon of a select query is performance intensive. When we use '<>' in the where condition, the select query scans the database tables for each and every record. Since you are selecting the data from MSEG and MKPF, which will contain huge number of records, it will scan each record of these database tables.
Instead you can remove the where condition <b>MSEG~LIFNR <> ' '</b> and select all the data. Once the data is selected in the internal table, you can delete the unwanted entries from this internal table.
This should reduce the performance and time-out errror.
Regards,
Sandeep