2012 May 10 2:05 PM
Hello ABAP experts;
I made a report that suppose to update a field in a customized "Z" database table. However my code should not be good enough to make it for 200K datas. (Got this error on test system and I will have 3 or 4 millions of data )
My code is like this:
data: itab type table of zpp_20 with header line,
indx type i,
alort like zpp_20-alort.
data: lv_lgort type lgort_d.
data : begin of gt_mseg occurs 0,
lgort like mseg-lgort,
mblnr like mseg-mblnr,
mjahr like mseg-mjahr,
matnr like mseg-matnr,
werks like mseg-werks,
end of gt_mseg.
select-options: s_prtnr for zpp_20-prtnr,
s_mjahr for zpp_20-mjahr.
parameters p_werks like zpp_20-werks obligatory.
start-of-selection.
select zpp_20~belnr zpp_20~mjahr zpp_20~matnr
zpp_20~werks zpp_20~prtnr
from zpp_20 inner join blpk on
zpp_20~prtnr = blpk~prtnr
into corresponding fields of table itab
where zpp_20~prtnr in s_prtnr and
zpp_20~mjahr in s_mjahr and
zpp_20~werks eq p_werks and
zpp_20~alort = '' and
blpk~vaart = 'B'.
indx = 1.
select lgort mblnr mjahr matnr werks from mseg
into corresponding fields of table gt_mseg
for all entries in itab
where mblnr = itab-belnr
and mjahr = itab-mjahr
and matnr = itab-matnr
and werks = itab-werks
and ( bwart = '131' or bwart = '132' ).
"In this select I got TSV_TNEW_BLOCKS_NO_ROLL_MEMORY error
"There was not enough memory anymore and got that dump.
" Anyone know how can i alter this select or anything else?
loop at itab.
clear gt_mseg.
read table gt_mseg with key mblnr = itab-belnr
mjahr = itab-mjahr
matnr = itab-matnr
werks = itab-werks.
itab-alort = gt_mseg-lgort.
modify itab transporting alort.
endloop.
modify zpp_20 from table itab.
commit work.
I need change this code slightly I guess in order not to get that memory error but I dont know how. Any help would be nice.
Thank you
Talha
2012 May 10 2:07 PM
Can you put a check to see if ITAB is empty or not before using FOR ALL ENTRIES?
2012 May 10 2:13 PM
Avoid using join. Use cursors with small package size and free the internal tables as soon as they are no more required.