02-26-2015 6:09 AM
Hi all,
My requirement is when input posting date range have to get material document numbers(Good Issue document numbers of movement type '201') in that date range..
For that i use MKPF table.. In production fetching data get lot of time because it is a huge table..
Are there any suggestion to increase the performance??
Thanks,
Pavithra.
02-26-2015 6:16 AM
You can use the PACKAGE SIZE statement to address the performance issue
Sample code
SELECT *
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE IT_SPFLI
PACKAGE SIZE 500.
LOOP AT IT_SPFLI INTO wa.
* Do processing
ENDLOOP.
ENDSELECT.
Regards
Sandy
02-26-2015 6:44 AM
02-26-2015 7:01 AM
02-26-2015 8:25 AM
Hi Atul,
Yes BUD active..
this is my query
SELECT mblnr mjahr blart budat
FROM mkpf
INTO TABLE it_mkpf
WHERE budat IN s_datum.
02-26-2015 9:20 AM
You can check with the BASIS team to find if the issues is from oracle database side.
02-26-2015 9:47 AM
Also check if these notes can be implemented at your server:
If yes or if they are implemented then you can use directly MSEG for your select statement. Also use hashed tables to store selected data.
02-26-2015 10:09 AM
If you want to get bwart i.e. movement type from Mseg by using mblnr-mkpf better way you should use joins in this case .
coz data is too much and to run the query faster we should use uniq key in where condition , check if join works or not if this doesnt u r left with the another option i.e. secondary index .
Thanks & Regards ,
Sabir Shah.
02-26-2015 12:49 PM
Hi -
If the BUD index is active, then accessing through the index you have the input 'BUDAT' already in your where clause. In this only try to use parallel processing though task on smaller date range of S_DATUM to improve the performance . You can try that.
02-27-2015 6:43 AM
And what does s_datum contain?
When you use select options in a select, the performance can vary greatly according to what the select option actually contains. If s_datum is empty, then you will be selecting everything, for example.
02-27-2015 9:15 AM
Hi,
s_datum is mandatory field which contains date range. that range is the posting date range.
02-27-2015 11:29 AM
Yes. But what does it actually contain? You know it's an internal table, right? Of structure sign option low high?
When you get bad performance
a) Is it empty?
b) Does it contain a single value?
c) Does it contain I BT lowdate highdate?
d) Does it contain something more complex?
The performance can vary dramatically according to each case. The SQL executed on the database server can be radically different according to what s_datum contains. Therefore no sensible answer can be given without this fairly basic piece of information.
Do you understand now?
03-02-2015 11:05 AM
Hi,
SELECT-OPTIONS :s_datum FOR sy-datum OBLIGATORY.
this is how i used s_datum in my program
03-02-2015 11:46 AM
What happens when you enter a single date in S_DATUM and run it, does it finish any faster?
Now try a monthly then a yearly range and compare.
Thomas
03-02-2015 12:29 PM
Do you have an idea why I'm asking the question? You've eliminated possibility a)
There still remains:
b) Does it contain a single value?
c) Does it contain I BT lowdate highdate?
d) Does it contain something more complex?
Do you understand that what is entered by the user in your select option can make a dramatic difference to run time?
03-03-2015 3:54 AM
Hi,
It contain date range with lowdate and highdate.. Need to get Good Issue summary of a user and need to get data of several months.
03-03-2015 6:09 AM
02-26-2015 10:30 AM
If you have no other selection criteria than posting date, there is not much option, once you check index (BUD) activation.
You could
Other solutions in the field of Basis, Database management or IT architecture, not Abap...
If you also require selection on MSEG movement type (BWART) either
Regards,
Raymond
02-26-2015 10:44 AM
Hi,
You can try for open cursor technique, just remember to close cursor.
Regards,
02-26-2015 12:57 PM
Hey Pavithra Jayasinghe,
call db to get data is bound with high cost (time). it`s better to load data into Memory if it`s possible.
Use ranges in your SQL Statement will rise Performance of your SQL Statement. Work with Loop <tab> Assigning <field-symbol>.
02-27-2015 5:59 AM
HI,
I use INNER JOIN with MKPF and MSEG.. it get little bit faster than earlier...
I have to know when we use index if there are 3 fields in index, do we need to add all three fields in where condition to use index???
02-27-2015 6:49 AM
Hi Pavithra,
It is always good to have all the three fields in the where clause. Incase you do not have all three fields, make sure that the first field in the index is in your where clause. Also please take an SQL trace and make sure that the query is hitting the right index.
Thanks,
Muralikrishnan
02-27-2015 6:53 AM
Optimizer will consider using an index if the first keys of the index are provided in selection criteria, so can use a 3 keys index when 2 first keys are provided, but not if the first one is not provided. You can check this with the SQL trace (Test and Analysis Tools in ABAP, Performance Analysis, Analyzing Performance Data, Analyzing Trace Records, SQL Trace Analysis) -> ST05
Regards,
Raymond