‎2009 Jun 03 10:11 AM
Hi Guru's,
Please tell how to improve performance of this query..this query makes performance issue on my program
SELECT vbelv
posnv
vbeln
posnn
rfmng
FROM vbfa
INTO TABLE i_sditem2
FOR ALL ENTRIES IN i_sales_p
WHERE vbelv EQ i_sales_p-vbeln
AND posnv EQ i_sales_p-posnr
AND vbtyp_n EQ 'J'.
otherwise how to use function module for this query..
Regards
P.Senthil Kumar.
‎2009 Jun 03 10:15 AM
Use the not initial check as given below. If this check is not used,
the select query will fetch huge no. of records, when there is no entry in
i_sales_p table
if not i_sales_p[] is initial.
SELECT vbelv
posnv
vbeln
posnn
rfmng
FROM vbfa
INTO TABLE i_sditem2
FOR ALL ENTRIES IN i_sales_p
WHERE vbelv EQ i_sales_p-vbeln
AND posnv EQ i_sales_p-posnr
AND vbtyp_n EQ 'J'.
endif.
‎2009 Jun 03 10:20 AM
Hi Rudra Prasanna,
Not initial check is already done it in my Query..
is it has any function module for accessing VBFA table based on my where condition.???
i checked some function module it has single input..
Regards
P.Senthil Kumar
‎2009 Jun 03 10:18 AM
Hi,
The number of entries in i_sales_p is not known and may be too much in numbers, so try reducing entries in i_sales_p by refining the where conditions for i_sales_p.
Hopefully, this will improve performance of your query.
Regards,
Ibrar.
‎2009 Jun 03 10:19 AM
hi,
order of fields in selection and whare condition is correct, so there is problem in query.
make sure your internal table is sorted.
or try these FM's
READ_VBFA
SD_VBFA_ARRAY_READ_VBELV
SD_VBFA_READ_WITH_VBELV
SD_VBFA_SELECT
SD_VBFA_SINGLE_READ
SD_VBFA_TRANSFER_TO_BUFFER
i hopr these may increse ur query performance
pradeep
‎2009 Jun 03 10:20 AM
Hi,
You can use following statement:-
If not i_sales_p[] is Initial.
SELECT vbelv
posnv
vbeln
posnn
rfmng
FROM vbfa
INTO TABLE i_sditem2
FOR ALL ENTRIES IN i_sales_p
WHERE vbelv EQ i_sales_p-vbeln
AND posnv EQ i_sales_p-posnr.
EndIf.
Then you can filter out entries depending upon Document category of subsequent document which is VBTYP_N.
Delete i_sditem2 where vbtyp_n NE 'J'.
Hope this works for you........
Thanks..........
‎2009 Jun 03 10:20 AM
Hi,
Try this:
1) Try to use all primary keys in WHERE clause... if not possible use only vbelv and posnv.
After selection delete the entries which are not requried as per VBTYP_N.
2) Select all primary keys when u r using for all entries....
Kiran
‎2009 Jun 03 10:28 AM
make sure that i_sales_p has no duplicate entries. If so, then sort and delete adjacent duplicates
from i_sales_p[] .
‎2009 Jun 03 10:35 AM
Hi Kumar,
Use Secondary index in Table VBFA for the Field vbtyp_n.
This will ultimately increase performance.
Procedure.
Goto-->se11
table : vbfa.
in application toolbar Press on INDEXES button,
Create new Z index by giving field as vbtyp_n.
Regards,
Rama Krishna.