Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

collect issue

Former Member
0 Likes
780

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

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
750

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

Read only

0 Likes
750

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

 

Read only

0 Likes
750

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

Read only

Former Member
0 Likes
750

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:

  • The current control key of the work area remain unchanged.

  • All components with a character-like flat data type to the right of the current control key are set to character "*" in every position.

  • All the other components to the right of the current control key are set to their initial value.

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