Skip to Content
0
Aug 13, 2015 at 06:03 AM

Delivery note duplication performance issue.

68 Views

Dear Experts,

We have used user exit ZXMBCU02 to avoid delivery note duplication while doing MIGO transaction.

We have made changes in user exit in such way that the delivery note no. for a vendor will not be repeated in same financial year & allowed entries for previous year delivery note number.

For example :

Case -1: ABC vendor has used delivery note no. 123 in FY 2014 then it can be used in FY 2015 for vendor ABC.

Case- 2: ABC vendor has used delivery note no. 456 in FY 2015 then it cannot be used again in FY 2015.

At our client the goods receipt is done with movement type 103 & 105.

This is working fine for regular goods receipts using movement type 103 & 105.

Actual Issue ::

Now when we are doing goods receipt for return PO with movement type 101 the system is taking more than 30 mins to get it checked & posted in production system.

This scenario is working correctly in DEV & QAS system this might be because of less data in tables.

User Exit :

We have used below mentioned code

IF sy-tcode = 'MB31' and i_mseg-bwart = '101' and i_mseg-aufnr is not initial.

tables: AFVV, AFKO, AFPO, AFRU.

TYPES: BEGIN OF ty_afru,

RUECK TYPE CO_RUECK,

RMZHL TYPE CO_RMZHL,

AUFNR TYPE AUFNR,

GMNGA TYPE RU_GMNGA,

END OF ty_afru.

DATA: it_afvv like AFVV occurs 0 with header line.

DATA: it_afru TYPE STANDARD TABLE OF ty_afru,

wa_afru TYPE ty_afru.

DATA: tot_gr like mseg-menge,

confirm_qty like mseg-menge.

select single * from AFKO where aufnr = i_mseg-aufnr.

select RUECK RMZHL AUFNR GMNGA from AFRU into table it_afru where aufnr = i_mseg-aufnr AND MEILR = 'X'.

LOOP AT it_afru INTO wa_afru.

confirm_qty = confirm_qty + wa_afru-GMNGA.

ENDLOOP.

select single * from AFPO where aufnr = i_mseg-aufnr.

tot_gr = afpo-wemng + i_mseg-menge.

if tot_gr > confirm_qty.

MESSAGE 'Total GR Quantity Exceeds than Confirmed Quantity.' TYPE 'E'.

Endif.

ENDIF.

IF sy-tcode = 'MIGO' AND i_mseg-bwart = '105' AND E_SGTXT IS INITIAL.

E_SGTXT = i_MSEG-sgtxt.

ENDIF.

*

***&---------------------------------------------------------------------*/*MODIFIED ON 13.09.2013

*

***& Include ZXMBCU02

*

***&---------------------------------------------------------------------*

*

DATA: YY(4) TYPE C,

XBLNR1 TYPE MKPF-XBLNR,

BWART1 TYPE MSEG-BWART ,

LIFNR1 TYPE MSEG-LIFNR,

TEXT1 TYPE STRING ,

REF_GOITEM TYPE GOITEM ,

BWART2 TYPE GOITEM-BWART,

* GOHEAD-LFSNR(15),

GJAHR TYPE MSEG-GJAHR,

EBELN TYPE MSEG-EBELN.

"PT_GOITEM TYPE GOITEM.

IF SY-TCODE = 'MIGO'.

YY = I_MKPF-BUDAT(4).

IF SY-SUBRC = 0.

SELECT SINGLE MKPF~XBLNR MSEG~BWART MSEG~LIFNR INTO (XBLNR1 ,BWART1 ,LIFNR1)

FROM MKPF INNER JOIN MSEG ON MKPF~MBLNR = MSEG~MBLNR AND MKPF~MJAHR = MSEG~GJAHR

WHERE MKPF~MJAHR = YY

AND MSEG~LIFNR = I_MSEG-LIFNR

AND MKPF~XBLNR = I_MKPF-XBLNR

AND MSEG~BWART = '103'. "AND MSEG~BWART <> '101' .

ENDIF.

*

IF SY-SUBRC = 0.

IF I_MSEG-BWART = '103'.

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.





Please suggest modification/code to improve performance of the output.






Thanks & Regards,

Arpit R.