Iam working on an ALV Report which has the fields Material Number(BSEG_MATNR), Company Code(BSIS-BUKRS) and G/L account (BSIS-HKONT) on the selection screen.
Here Company code and G/L account are the mandatory fields.
When the user enters Copany code and G/L account, the program goes and fetches data from BSIS by passing BUKRS and HKONTS.(In My case , it returns around 100,000 records). And when the program goes to BSEG (with providing all the key fields it got from BSIS) for MATNR, its taking almost 5 minuts to fetch the data.
The program fetches data from BSEG using select single in a loop.(I even tried doing for all entries but it takes almost same time).
So what are my alternatinve options here to get the MATNR quickly from BSEG. Now its taking too long time even after passing the key fields. And moreover, even if user passes the MATNR on the selection screen, there is no use. It still need to fetch 100,000 records from BSIS and look for MATNR in BSEG for all those records.
whats the best way to fetch MATNR if you have records from BSIS?
We have other Combinitions of Company Code and G/L account which may have over 200K records...
Imagin , user enters a single material on the selection screen, the program still gets 200k records from BSIS and scan through BSEG for that single material for all those records.
I wonder why SAP didnt have both doc number and material in the same table.
Is your requirement retreiving from day 1? Your selection is a bit unrestricted, try adding more parameters like fical year (GJAHR), Business Area (GSBER) to filter it more. Or try extracting header first (BKPF) using date parameters like document date or posting date, then use these entries to search BSEG.
Hope this helps.