Application Development 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: 

ZXMBCU02 userexit to be restricted to goods receipt and purchase order

pashasapcha
Participant
0 Kudos
545

There is customer exit ZXMBCU02 which is currently in use in MIGO transaction. However , I want it to be triggered only when

I select GOODS RECEIPT AND PURCHASE ORDER in the MIGO transaction. In other cases it should not go through ZXMBCU02.

Or is there any way out (like sy-tcode = 'MIGO' ) where I can make piece of code executable inside the ZXMBCU02 ,possible only when

GR and PO are selected in the MIGO as shown in pic below.

In other words how can I make system understand that it should work (ZXMBCU02 to be executed ) only when GR and PO is selected.

I have placed validation inside ZXMBCU02 .

Now I want the validation to be executed only when GOODS RECEIPT AND PURCHASE ORDER is selected but not in any other combinations.

Thanks in advance.

1 ACCEPTED SOLUTION

DominikTylczyn
Active Contributor
502

Hello

ZXMBCU02 is not a user-exit, but an include with which EXIT_SAPMM07M_001 is implemented:

FUNCTION EXIT_SAPMM07M_001.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_MSEG) LIKE  MSEG STRUCTURE  MSEG
*"             VALUE(I_VM07M) LIKE  VM07M STRUCTURE  VM07M
*"             VALUE(I_DM07M) LIKE  DM07M STRUCTURE  DM07M
*"             VALUE(I_MKPF) LIKE  MKPF STRUCTURE  MKPF
*"       EXPORTING
*"             VALUE(E_SGTXT) LIKE  MSEG-SGTXT
*"----------------------------------------------------------------------

  INCLUDE ZXMBCU02.


ENDFUNCTION.<br>

In case of GR posting against a purchase order you should get I_MSEG-BWART = 101 and I_MSEG-KZBEW = B

BWART contains material movement type. The 101 movement type is a standard one to post GR for purchase or production orders.

KZBEW contains the movement indicator, e.g.

  • B - movement for purchase order
  • F - movement for production order

Best regards

Dominik Tylczynski

1 REPLY 1

DominikTylczyn
Active Contributor
503

Hello

ZXMBCU02 is not a user-exit, but an include with which EXIT_SAPMM07M_001 is implemented:

FUNCTION EXIT_SAPMM07M_001.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_MSEG) LIKE  MSEG STRUCTURE  MSEG
*"             VALUE(I_VM07M) LIKE  VM07M STRUCTURE  VM07M
*"             VALUE(I_DM07M) LIKE  DM07M STRUCTURE  DM07M
*"             VALUE(I_MKPF) LIKE  MKPF STRUCTURE  MKPF
*"       EXPORTING
*"             VALUE(E_SGTXT) LIKE  MSEG-SGTXT
*"----------------------------------------------------------------------

  INCLUDE ZXMBCU02.


ENDFUNCTION.<br>

In case of GR posting against a purchase order you should get I_MSEG-BWART = 101 and I_MSEG-KZBEW = B

BWART contains material movement type. The 101 movement type is a standard one to post GR for purchase or production orders.

KZBEW contains the movement indicator, e.g.

  • B - movement for purchase order
  • F - movement for production order

Best regards

Dominik Tylczynski