11-07-2014 12:58 AM
hello Guys!
how can i make faster the process in selection of data..please check this code..
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln
WHERE gjahr = lt_vbeln-fkdat+0(4)
AND monat = lt_vbeln-fkdat+4(2)
AND blart = 'RV'
and awkey = lt_vbeln-vbeln
and budat = lt_vbeln-fkdat.
when executing this code process is very slow..what is the best thing to run this faster..
thank you.
11-07-2014 6:35 AM
hello guys this my code...
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln
WHERE gjahr = lt_vbeln-fkdat+0(4)
AND monat = lt_vbeln-fkdat+4(2)
AND blart = 'RV'
and awkey = lt_vbeln-vbeln
and budat = lt_vbeln-fkdat.
CHECK lt_belnr IS NOT INITIAL.
SORT lt_belnr BY belnr .
DELETE ADJACENT DUPLICATES FROM lt_belnr COMPARING belnr.
thank you.
11-07-2014 2:15 AM
Hi John,
Please try using this 'Index':
So your sql statement like this:
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln
WHERE bukrs = lt_vbeln-bukrs
AND bstat in s_bstat
AND budat = lt_vbeln-fkdat,
and awkey = lt_vbeln-vbeln.
sort it_vbeln by gjahr monat blart.
Loop it_belnr.
lv_index = sy-tabix.
read it_vbeln with key gjahr = wa_belnr-gjahr monat = wa_belnr-monat blart = wa_belnr-blart binary search.
if sy-subrc ne 0.
delete it_belnr index lv_index.
endif.
endloop.
Alternativly, to create a new 'index' or try other 'index'.
regards,
Archer
11-07-2014 3:43 AM
Hi,
You can go to SE11 and check Indexes button...
There are several indexes..You can use indexes ( check they are active ). After select data using index field you can check other conditions and delete data.
OR else you can create new index if it frequently using you.. But make sure to use exist index..
Cheers,
Pavithra
11-07-2014 4:21 AM
Hi
Whenever for alla entries used, try to pass to BKPF all the primary keys, then it wil reduse some time.
thanks.
laxman
11-07-2014 4:21 AM
Hi,
check for lt_vbeln table . if it is not initial put the select query.
select fields in the same sequence as given in database.
after where use primary fields and then the other fields and all these should be in sequence as given in database table bkpf.
after select query sort the internal table lt_belnr by primary key.
Regards,
Akansha
11-11-2014 7:09 AM
Hello.
How can i do that..im new here in ABAP programming..im only know basic..
Thank you..
11-07-2014 6:35 AM
hello guys this my code...
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln
WHERE gjahr = lt_vbeln-fkdat+0(4)
AND monat = lt_vbeln-fkdat+4(2)
AND blart = 'RV'
and awkey = lt_vbeln-vbeln
and budat = lt_vbeln-fkdat.
CHECK lt_belnr IS NOT INITIAL.
SORT lt_belnr BY belnr .
DELETE ADJACENT DUPLICATES FROM lt_belnr COMPARING belnr.
thank you.
11-07-2014 7:21 AM
Hi
Try to create Secondary indexes for all the fields which you have used instead GJAHR and also write the select Query based on the order of fields which are present in BKPF table so that the Performance will be faster.
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln
WHERE gjahr = lt_vbeln-fkdat+0(4)
AND blart = 'RV'
and budat = lt_vbeln-fkdat
AND monat = lt_vbeln-fkdat+4(2)
and awkey = lt_vbeln-vbeln.
CHECK lt_belnr IS NOT INITIAL.
SORT lt_belnr BY belnr .
DELETE ADJACENT DUPLICATES FROM lt_belnr COMPARING belnr.
11-07-2014 7:36 AM
Hi John,
Transfer the records of it_vbeln in a temporary table and delete duplicates.
Hope it'll work.
IF it_vbeln[] is not initial.
it_vbeln_tmp[] = it_vbeln[].
SORT it_vbeln_tmp by fkdat vbeln.
DELETE ADJACENT RECORDS FROM it_vbeln_tmp comparing fkdat vbeln.
SELECT belnr gjahr
FROM bkpf
INTO TABLE lt_belnr
FOR ALL ENTRIES IN lt_vbeln_tmp
GJAHR = lt_vbeln_tmp-fkdat+0(4)
BLART = 'RV'
BUDAT = lt_vbeln_tmp-fkdat.
MONAT = lt_vbeln_tmp-fkdat+4(2)
AWKEY = lt_vbeln_tmp-vbeln
Endif.
11-07-2014 9:36 AM
Michael,
Don't know what data you have available before your selection, but keep in mind the secondary indexes:
BSAD | Accounting: Secondary Index for Customers (Cleared Items) |
BSAK | Accounting: Secondary Index for Vendors (Cleared Items) |
BSAS | Accounting: Secondary Index for G/L Accounts (Cleared Items) |
BSID | Accounting: Secondary Index for Customers |
BSIK | Accounting: Secondary Index for Vendors |
BSIS | Accounting: Secondary Index for G/L Accounts |
For performance reasons, it is advisable to access BKPF, BSEG through one of these.
Each has its own indexes that may help.