Skip to Content
Former Member
Dec 05, 2013 at 04:24 AM

Order Aging Report (AUFK-AUFNR , USER1)


Hello Experts,

I'm working on Order Aging Report: A Report of Orders that have been inactive for greater than 90 days.

I need to check the Posting Date of the Order is greater than the Start Date.

How can I do this?

If I read BSEG / BKPF Tables, it is taking a lot of time. Performance is getting affected.

Here's my code:

* Validation for Posting Date

* Display the orders that do not have had any activity during the past 90 days from wdate

LOOP AT aaufk.

SELECT SINGLE * FROM aufk WHERE aufnr = aaufk-aufnr.

IF sy-subrc EQ 0.

SELECT SINGLE belnr FROM bseg INTO w_belnr

WHERE bukrs EQ aufk-bukrs

AND gjahr EQ p_gjahr

AND aufnr EQ aaufk-aufnr

AND prctr EQ aufk-prctr.

IF sy-subrc EQ 0.

SELECT SINGLE budat INTO w_budat

FROM bkpf

WHERE bukrs EQ aufk-bukrs

AND belnr EQ w_belnr

AND gjahr EQ p_gjahr.

IF sy-subrc EQ 0.

IF w_budat GT strt-date.

* If Posting Date is GT Start Date, then delete the entry

* as the order had an activity in the last 90 days

DELETE aaufk WHERE user1 EQ aufk-user1

AND aufnr EQ aufk-aufnr.






Since this is inside the LOOP, performance is really bad.

I need to delete the entries from an Internal Table where the Posting Date > Start Date (if it is within 90 days).

Which Table can I use to get the Posting Date of a Particular Order (AUFK-AUFNR)?

Please advise.

Thanks & Regards,