10-23-2014 9:20 AM
Dear All,
In debugg Mode when i run the GT_VBRP-fkimg1 have value when go to statement at new maktl the value was zero . why ??
LOOP AT GT_VBRP.
AT NEW MATKL.
AT NEW MATNR.
GT_VBRP-fkimg12 = GT_VBRP-fkimg12 + GT_VBRP-fkimg1.
GT_VBRP-WAVWR1 = GT_VBRP-WAVWR1 + GT_VBRP-WAVWR.
GT_VBRP-NETWR1 = GT_VBRP-NETWR1 + GT_VBRP-NETWR.
COLLECT GT_VBRP INTO GT_VBRP2.
ENDAT.
ENDAT.
ENDLOOP.
thanks,
Eman
10-23-2014 9:53 AM
Just read doculmentation of AT - itab
(look for work area between AT/ENDAT for field to the right of the key)
NB: Usually AT NEW/AT END OF are used to prepare and append to final table, when ADD statements olr MIN/MAX check are executed out of such block /OR/ COLLECT statement is used to bypass those constraints, but both statements together may be surprising...
Regards,
Raymond
10-26-2014 7:54 AM
dear Raymond ,
when i debug first statement my itab has data but when move to next statement AT New MATKL the value was zero and stars why please help me
10-27-2014 3:51 PM
Read actually and carefully the online document AT - itab, what happen at fields right of break field is clearly described (* for character fields, all other types are cleared to initial value)
Regards,
Raymond
10-28-2014 11:53 AM
Hi Eman Elgammal,
The problem you are facing is not at all odd. In fact it is quite obvious in nature.
ABAP engine resets work area to ensure that control level processing in case of AT-ENDAT is carried out properly.
The following 3 rules must be observed:
In your case, 3rd rule is applied as field you are referring to is of type quantity. Hence it will be reset to its initial value as 0. A simple work around would be to copy the content of the work area just before it's values are reset.
Also, like Raymond Giuseppi mentioned, go through online documention for AT - itab. It will clear your doubt.
Thanks,
Nik