Hello experts,
I am having a big trouble to select invoices (FI tables J_1BNFDOC & J_1BNFLIN) related to the most recent entry of a given material number inside another invoice (J_1BNFLIN-MATNR). My report is dumping with a memory overflow when I execute it for a full month's worth of invoices.
Basically, I'm doing the following:
1. Selecting invoice items with an INNER JOIN to also get header information:
SELECT lmatnr ldocnum lmenge lnetpr lnetoth ddocdat dmodel dseries dnfnum dparid
INTO TABLE it_ult_e_aux
FROM j_1bnflin AS l
INNER JOIN j_1bnfdoc AS d
ON ldocnum = ddocnum
FOR ALL ENTRIES IN it_ult_e
WHERE l~matnr = it_ult_e-matnr
AND d~doctyp = '1'
AND d~direct = '1'
AND d~docdat > '20030101'
AND d~cancel = ' '.
In this case, IT_ULT_E and IT_ULT_E_AUX have both the same structure, and IT_ULT_E is already populated with all the MATNRs I want to search. The structure for both tables is as follows:
TYPES: BEGIN OF ty_ult_e,
matnr LIKE j_1bnflin-matnr,
docnum LIKE j_1bnflin-docnum,
menge LIKE j_1bnflin-menge,
netpr LIKE j_1bnflin-netpr,
netoth LIKE j_1bnflin-netoth,
docdat LIKE j_1bnfdoc-docdat,
model LIKE j_1bnfdoc-model,
series LIKE j_1bnfdoc-series,
nfnum LIKE j_1bnfdoc-nfnum,
parid LIKE j_1bnfdoc-parid,
END OF ty_ult_e.
2. After this, the table is sorted by DOCDAT to get the most recent entries, some move logic is applied and IT_ULT_E ends up with the information I want.
But then, the report dumps with TSV_TNEW_BLOCKS_NO_ROLL_MEMORY, right on the SELECT statement. Am I doing the best selection? Or maybe I'm missing something (maybe a standard FM...)
Any help is appreciated.
Thanks,
Leonardo