04-22-2018 11:57 AM
Hi Experts,
I need to get BELNR from bseg table, all i have is Company Code, Year, PO number.
The following is my query,
SELECT BUKRS BELNR GJAHR BUZEI EBELN XREF3 FROM BSEG INTO TABLE IT_BELNR FOR ALL ENTRIES IN IT_BSEG_TEMP WHERE BUKRS = IT_BSEG_TEMP-BUKRS AND GJAHR = IT_BSEG_TEMP-GJAHR AND EBELN = IT_BSEG_TEMP-EBELN AND XREF3 = IT_BSEG_TEMP-XREF3.
My requirement is to get Goods Receipt Accounting document number from Invoice Accounting Document details. So in IT_BSEG_TEMP I have Invoice Accounting details.
Even though I'm getting only 1 or 2 documents with the above query, it takes more than 15 seconds to fetch data.. some times it will end in runtime error.
So how can i solve this issue??
04-23-2018 11:51 AM
Hi Nidhi,
As you have PO Order, Year, Company Code, you could go to EKBE table (PO history) and then go to MKPF, RBKP and BSEG document.
Are you on ERP 6 or S/4 HANA ?
Kind Regards
04-22-2018 1:32 PM
Hi
Since BSEG seems to be still (see Matthees comment) a cluster table, no index is possible but you can use BSIK (maybe there is also some other Index table?) with a Z-index to fetch the BELNR and read BSEG with full key.
Do you check if IT_BSEG_TEMP is empty befor the SELECT? - otherwise it will try to fetch all the data, which can cause the dump!
regards
Domi
04-22-2018 1:58 PM
BSEG is a transparent table on systems using HANA. It's also been possible to convert it to a transparent table (though not recommended) for quite a while. The reason cluster tables exist at all is that some databases, at least historically, had a limitation on the number of fields a table could have.
04-22-2018 2:08 PM
Thats absolutely right, but if this would be the case, I think - at least, hope - they would have tried an Z index!
04-23-2018 8:11 AM
04-23-2018 8:12 AM
@ dominik.. thank you for replying..
I already checked IT_BSEG_TEMP is initial before fetching. I tried BSIK but most of the records I couldnt find there.
04-23-2018 8:47 AM
You have different index tables for BSEG: BSIK, BSAK, BSID, BSAD.
Based on your scenario, choose the ones fitting more your needs
04-23-2018 8:15 AM
04-23-2018 10:31 AM
Find a very old reference: 62435 - F-03: Selection by purchasing documents
04-23-2018 11:51 AM
Hi Nidhi,
As you have PO Order, Year, Company Code, you could go to EKBE table (PO history) and then go to MKPF, RBKP and BSEG document.
Are you on ERP 6 or S/4 HANA ?
Kind Regards
04-23-2018 2:27 PM
Thank you all for the response.
@Gustavo Vazquez I already did like that and it's working now.
with bseg-ebeln and ebelp of invoice accounting document, fetch from ekbe (po history table) from there we will get invoice document number (ekbe-belnr).. we concatenate ekbe-belnr+gjahr and pass to awkey field in bkpf.. there we will GR accounting Document numbers.