Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

at end of

hi experts

i have a problem with my code:

SORT i_data by lifnr grund.

  • loop for summing quantity for each vendor and reason

  • for movment:

LOOP at i_data INTO wa_data.

if i_data-shkzg = 'H'.

i_data-erfmg = i_data-erfmg * -1.

modify i_data.


at END OF grund.


flag = 1.

outtab-erfmg = wa_data-erfmg.


if flag = 1.

outtab-lifnr = wa_data-lifnr.

outtab-name1 = wa_data-name1.

outtab-kvgr1 = wa_data-kvgr1.

outtab-bezei = wa_data-bezei.

outtab-stras = wa_data-stras.

outtab-ort01 = wa_data-ort01.

outtab-telef1 = wa_data-telf1.

outtab-kunnr = wa_data-kunnr.

outtab-grund = wa_data-grund.

outtab-preis = wa_data-preis.

outtab-bwaer = wa_data-bwaer.

outtab-peinh = wa_data-peinh.

outtab-bprme = wa_data-bprme.

APPEND outtab.

flag = 0.



the statement at end of grund works only in the first time i.e.,

when i have for example three first rows with the same grund it takes the third row but in

the next three rows with the same grund it takes the first instead of third

what's the problem?



Former Member

probably they have a different value in LIFNR

when you do "AT END OF grund." the statement considers all fields up to the field "grund"

so if you want to break on this field only, you have to put it in front !

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question