Skip to Content
0
Former Member
Aug 13, 2013 at 06:11 AM

Which EXITS and BAdIs should i use for Blocking PO cancellation based on condition?

1022 Views

Hi,

I need to know which all EXIT(S) and BAdI(s) i need if i need the system to block PO and items

cancellation (deletion) if advance payment has been made for that PO.

Following points would really help:

1. EXIT/BAdI which is triggered at PBO and has i_ekko as input parameter.

2. EXIT/BAdI which would help me to cancel that PO.

I tried using

EXIT MM06E005 -> EXIT_SAPMM06E_013 & EXIT_SAPMM06E_012(Function Module)->

INCLUDE ZXM06U44

For exporting PO Number to ABAP memory, but none of them triggers at PBO or while cancelling the PO.

In ZXM06U44 , wrote the following code, for exporting PO Number to ABAP memory:

EXPORT zebeln FROM i_ekko-ebeln TO MEMORY ID 'ZABC'.

Then in BAdI 'ME_ACTV_CANCEL_PO' -> CHECK_ACTIVITY, wrote this:

IF sy-tcode = 'ME22' OR sy-tcode = 'ME22N' OR sy-tcode = 'ME23' OR sy-tcode = 'ME23N' OR sy-tcode = 'ME29' OR sy-tcode = 'ME29N'.

TYPES: BEGIN OF IT_BSEG,

EBELN TYPE BSEG-EBELN,

BELNR TYPE BSEG-BELNR,

GJAHR TYPE BSEG-GJAHR,

END OF IT_BSEG,

BEGIN OF IT_BKPF,

BELNR TYPE BKPF-BELNR,

GJAHR TYPE BKPF-GJAHR,

BLART TYPE BKPF-BLART,

END OF IT_BKPF.

DATA: GT_BSEG TYPE TABLE OF IT_BSEG,

GS_BSEG TYPE IT_BSEG,

GT_BKPF TYPE TABLE OF IT_BKPF,

GS_BKPF TYPE IT_BKPF,

VAR(1).

SELECT EBELN BELNR GJAHR FROM BSEG

INTO TABLE GT_BSEG

WHERE EBELN = yebeln.

SELECT BELNR GJAHR BLART from bkpf

INTO TABLE GT_BKPF

FOR ALL ENTRIES IN GT_BSEG

WHERE BELNR = GT_BSEG-BELNR AND GJAHR = GT_BSEG-GJAHR.

LOOP AT GT_Bkpf INTO GS_Bkpf.

IF GS_bkpf-BLART = 'DP'.

VAR = 'X'.

ENDIF.

ENDLOOP.

IF VAR = 'X'.

IS_ACTIVE = 1. " IS_ACTIVE is standard export parameter.

ENDIF.

ENDIF.

-> I chose this BAdI because the name kind of says that it is for cancelling PO "ME_ACTV_CANCEL_PO".

But when i put debugger on them, none of them are triggered.

Can someone tell me the exact BAdI(s) and EXITS i should be using here?

Thanks & Regards,

KS