‎2009 Feb 12 6:33 AM
Moderator message: Please use a more informative subject in future. It's kind of obvious that since we're in the ABAP Performance and Tuning forum that the post will be a performance problem. Try to put a little more information into the subject.
Hi
Below is the code which is giving time-out problem. 1st fetching data from VBAk table by giving creation date( ERDAT) and transaction type(VBTYP). Then taking the sales document number and fetching material number, plant, strorage location etc from VBAP table. Then by giving sales document no in table ser02 table, fetching the object no. then by giving object no in table OBJK table fetching the serial no. In selection screen we have only date,material no, transaction type nd plant. and we need a output of Serial number, Material number, Plant, Date, order quantity and transaction type.
Pls suggest.
Extraction of sales document
SELECT VBTYP VBELN ERDAT VKORG
FROM VBAK
INTO TABLE LT_VBAK
WHERE ERDAT IN S_DATE
AND ( VBTYP = GC_R1
OR VBTYP = GC_R2
OR VBTYP = GC_S ).
IF SY-SUBRC = 0.
SORT LT_VBAK BY VBELN.
ENDIF.
Extraction of Material info
SELECT MATNR WERKS VBELN ERDAT KWMENG LGORT
FROM VBAP
INTO TABLE LT_VBAP
FOR ALL ENTRIES IN LT_VBAK
WHERE VBELN = LT_VBAK-VBELN
AND ERDAT = LT_VBAK-ERDAT
AND MATNR IN S_MATNR
AND WERKS IN S_PLANT.
IF SY-SUBRC = 0.
SORT LT_VBAP BY VBELN MATNR .
ENDIF.
Extraction of object number
SELECT SDAUFNR OBKNR
FROM SER02
INTO TABLE LT_SER02
FOR ALL ENTRIES IN LT_VBAP1
WHERE SDAUFNR = LT_VBAP1-VBELN.
IF SY-SUBRC = 0.
SORT LT_SER02 BY OBKNR.
ENDIF.
Extraction of serial number
SELECT OBKNR MATNR SERNR
FROM OBJK
INTO TABLE LT_OBJK
FOR ALL ENTRIES IN LT_SER02
WHERE OBKNR = LT_SER02-OBKNR.
IF SY-SUBRC = 0.
SORT LT_OBJK BY OBKNR.
ENDIF.Edited by: Matt on Feb 12, 2009 9:39 AM - oh yes, and please put around your ABAP code.
‎2009 Feb 12 7:23 AM
Hi,
1.Just Create a Secondary Index on VBAK table related on what conditions u r fetching the data.
I think tht can mostly help for ur Problem.
2 . Try to Avoid the For all entries Statments. Just try some function modules to get the Material details by passing ur Sales order Number . That also improve the performance.
If it Helps u just reply..
With Regards,
Sumodh.P
Edited by: Sumodh P on Feb 12, 2009 8:24 AM
‎2009 Feb 12 8:41 AM
Please use a more informative subject in future. It's kind of obvious that since we're in the ABAP Performance and Tuning forum that the post will be a performance problem. Try to put a little more information into the subject.
‎2009 Feb 12 8:44 AM
VBAK has an index on ERDAT. How is S_DATE filled, a narrow range should be OK, if empty -> long runtime.
VBAP looks OK, a JOIN with VBAK could be better.
SER02, you are using LT_VBAP1 as driver table, where is it filled? If empty, you are selecting all SER02 records!
OBJK looks OK.
In general try using joins instead of FAE if possible, at least check that driver table is not empty when doing FAE.
Run an SQL trace ST05 to find out more.
Thomas