Skip to Content

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

At new command not working

Hi all,

I pasted my sample code below. In this i have used "At new event" this command is not working in my code, the values are redundant, How to rectify this problem. Pls help me.

Thanks in advance.

Tables : RBKP,

RSEG.

Data : Begin of itab,

BELNR like RBKP-BELNR, " Invoice Document Number

BUZEI like RSEG-BUZEI, " Invoice Item Number

GJAHR like RBKP-GJAHR, " Fiscal Year

EBELN like RSEG-EBELN, " Purchase Order Number

MENGE like RSEG-MENGE, " Invoice Quantity

RMWWR like RBKP-RMWWR, " Invoice Amount

WAERS like RBKP-WAERS, " Currency

MATNR like RSEG-MATNR, " Material Number

LIFNR like RBKP-LIFNR, " Vendor Code

ZTERM like RBKP-ZTERM, " Terms of payment key

End of itab.

Data itab2 like itab occurs 0 WITH HEADER LINE.

data a like rbkp-lifnr.

Selection-screen : Begin of block a with frame title text-001.

Select-options : LIF For RBKP-LIFNR.

Select-options : gjahr For RBKP-gjahr.

Selection-screen : End of block a.

Start-of-selection.

select * from rbkp where LIFNR in LIF and GJAHR in gjahr.

if sy-subrc = 0.

select * from rseg where BELNR = rbkp-BELNR and gjahr = rbkp-gjahr.

if sy-subrc = 0.

itab-BELNR = RBKP-BELNR.

itab-BUZEI = RSEG-BUZEI.

itab-GJAHR = RBKP-GJAHR.

itab-EBELN = RSEG-EBELN.

itab-MENGE = RSEG-MENGE.

itab-RMWWR = RBKP-RMWWR.

itab-WAERS = RBKP-WAERS.

itab-MATNR = RSEG-MATNR.

itab-LIFNR = RBKP-LIFNR.

append itab to itab2.

endif.

endselect.

endif.

endselect.

Sort itab2 by LIFNR.

loop at itab2.

Move itab2 to itab.

at new LIFNR.

write : / itab-lifnr.

endat.

endloop.

Regards,

Kesav.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question