‎2008 Jul 01 1:13 PM
Hello Experts,
Please help me this below query. If I ran the program, it will take so much time to execute the below query and its goes to time out.
Please help me.
SELECT mvgr1 "Line of Business
werks "Plant
lgort "Storage Location
charg "Batch
matnr "Material Number
kwmeng "Ordered quantity
posnr "Item
vbeln "Sales Order Number
FROM vbap
INTO TABLE gt_salesdatatemp
FOR ALL ENTRIES IN gt_matmerge
WHERE matnr EQ gt_matmerge-matnr
AND werks EQ gt_matmerge-werks
AND mvgr1 EQ gt_matmerge-mvgr1
AND lgort EQ gt_matmerge-lgort
AND charg EQ gt_matmerge-charg
AND abgru EQ space.
Thanks in advance.
‎2008 Jul 01 1:16 PM
one solution can be creation of secondary index on the table VBAP for the selection fields
‎2008 Jul 01 1:18 PM
Hi Srivalli,
1. If the select query is giving time out error , then Run the report in background or.
2.Increase the Default Timeout level.(Contact BASIS)
Regards,
Sachin M M
‎2008 Jul 01 1:28 PM
make use of index table VAPMA, which is essentially a reduced version of VBAP sorted by MATNR. You can obtain all desired fields via a JOIN of VBAP and VAPMA.
Thomas
‎2008 Jul 01 2:10 PM
Have you checked gt_matmerge isn't empty?
Make sure you haven't got any duplicates in gt_matmerge by fields used for selection
sort gt_matmerge by fields used for selection
Is there no staus field you can use on VBAP/ have you got anything to go to VBAK with first?
Consider splitting into groups i.e. select for each 50000 entries and append lines
‎2008 Jul 02 5:36 AM
Hi,
have u done this check?
if not gt_salesdatatemp[] is initial.
select ....
endif.
if it is empty, it will fetch all the data from vbap.
regards,
madhu
‎2008 Jul 02 5:50 AM
Hi,
If the number of records to be fetched is very very high then you can use the cursor concept.
Please see the below code.
=====
OPEN CURSOR dbcur FOR SELECT .... FROM ....... WHERE ...... .
DO.
FETCH NEXT CURSOR dbcur INTO TABLE itab PACKAGE SIZE 10000.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDDO.
CLOSE CURSOR dbcur.
=====
Using this concept you can fetch the data in packets.
Additionally, you can take care of the following points to have better performance.
a. Check that your query is using the index.
b. Check that the internal table is not initial. If it is initial then the select will happen for all records in the DB.
Regards,
Saurabh
‎2008 Jul 02 8:17 AM
hi dear
u r using VBAP sales document item data table..which is large one. so check ur when clause correctly..
check whether u used correct primary keys and those keys must b in correct sequence as well.. remove unneccesary when clause. and use table VBRK for header info corresponding to VBRP.
regds
jigar
‎2008 Jul 22 10:32 AM
Hi Srivalli,
I have same issue with the same query, Please let me know your solution on this if your problem has solved. I request you to please give me a reply on it, Please dont ignore.
Regards,
Krishna Reddy
‎2008 Jul 29 10:45 AM
Hi ,
first sort that internal table by ur where condition key fields and check whether gt_matmerge has some records or not and also you can use field symbol for referencing the for all entries .
fareed