2010 May 07 6:48 PM
Dear Experts:
The below SQL has very bad performance. It's never get the result.
Please advise how to improve the run time and complete the SQL statement?
SELECT zbukr "Paying company code
vblnr "Payment Document
bukrs "Company Code
belnr "Accounting Document Number
gjahr "Fiscal Year
FROM regup "Processed items from payment program
INTO CORRESPONDING FIELDS OF TABLE gt_regup
FOR ALL ENTRIES IN lt_bseg
WHERE lifnr = lt_bseg-lifnr AND
bukrs = lt_bseg-bukrs AND
belnr = lt_bseg-belnr AND
gjahr = lt_bseg-gjahr .
Thank you very much!
Helen
2010 May 07 7:32 PM
I'm not sure there's much you can do with this query.
You might consider changing your approach. You know lbukrs, belnr gjahr and lifnr. So why not go to BSAK (vendor cleared items) first? That will give you the clearing date. You can check to see if this is the same as REGUP-LAUFD. If so, that should help a whole lot.
Rob
2010 May 07 7:32 PM
I'm not sure there's much you can do with this query.
You might consider changing your approach. You know lbukrs, belnr gjahr and lifnr. So why not go to BSAK (vendor cleared items) first? That will give you the clearing date. You can check to see if this is the same as REGUP-LAUFD. If so, that should help a whole lot.
Rob
2010 May 07 7:38 PM
Thank you for your response.
Do you mean the BSAK-AUGDT = REGUP-LAUFD ?
Thanks,
Helen
2010 May 07 7:42 PM
2010 May 07 7:55 PM
Bob,
Thank you for your confirmation.
I would like to ask you another general ABAP data base access question:
1. Should I extract (SELECT) the records from the table into internal table,
then READ later to extract the data from the internal table.
2. Should I just do the SQL call for particular record to get the data for that record --- no internal table.
I currently use the method 1. Is SAP recommended method 1?
Should I use the method 2 in this REGUP case?
Thank you very much!
Helen
2010 May 07 8:03 PM
Well first of all, you are really only supposed to ask one question per thread. That makes it easier for people who are searching the forum to find an answer. So If your first question is answered, please close the thread.
But in general, I don't think there are any specific recommendations on this. But I would go whichever way was most readable and therefore maintainable so long as it doesn't introduce serious performance problems. And I don't think that would be a problem in either case here.
Rob
2010 May 07 8:06 PM