User exit for Delivery Challan (Duplicate Entry) in MIGO Transaction.
.
By Sagar dev
PURPOSE:
In case we enter the duplicate delivery Challan No from the same vendor in the same physical/financial year, should get error/warning message. In MIGO delivery note not accepted repeated Delivery Challan numbers.
Step by step Solution:
Go to transaction “CMOD”.
Click On Create Button.
Define Short Text and Package.
Enter Name of an SAP enhancement – MBCF0002.
Click on Components –
Double Click On – EXIT_SAPMM07M_001.
Double Click On include zxmbcu02.
We have to implement the code and it will looks like this.
**&———————————————————————*
**& Include ZXMBCU02
**&———————————————————————*
data: yy(4) type c,
xblnr1 type mkpf-xblnr,
bwart1 type mseg-bwart ,
text1 type string ,
ref_goitem type goitem ,
bwart2 type goitem-bwart,
* GOHEAD-LFSNR(15),
ebeln type mseg-ebeln.
“pt_goitem TYPE goitem.
if sy-tcode = ‘MIGO’.
yy = i_mkpf-budat(4).
select single mkpf~xblnr mseg~bwart into (xblnr1 ,bwart1 ) from mkpf inner join mseg on mkpf~mblnr = mseg~mblnr and mkpf~mjahr = mseg~mjahr
where mkpf~mjahr = yy
and mseg~lifnr = i_mseg-lifnr
and mkpf~xblnr = i_mkpf-xblnr
and mseg~bwart = ‘101’.
if sy-subrc = 0.
if i_mseg-bwart = ‘101’ .
MESSAGE ‘Deliver No is already exist’ type ‘E’ .
endif.
endif.
if e_sgtxt is INITIAL.
e_sgtxt = i_mseg-sgtxt.
endif.
*ref_goitem = pt_goitem.
endif.
Activate the code and exit.
Good one with less explanation 🙂