EXIT_SAPLM61R_001
*----------------------------------------------------------------------*
* INCLUDE ZXM61U03 *
*----------------------------------------------------------------------*
TABLES: VBAK.
TABLES: EBAN.
***********************************************************************
* Example 1 User-Exit 1 / Individual Lines
* Column --> Requested delivery date
IF NOT IBUTT1 IS INITIAL.
*---------------------You can see the different MRP-Elements in the
*---------------------include: 'MM61XVAL':
* ...
*--> Kennzeichen Dispositionselemente
* constants:
* wkbst(2) type c value 'WB', "Werksbestand
* lgbst(2) type c value 'LB', "Lagerortbestand
* kdbst(2) type c value 'KB', "Kundeneinzelbestand
* .....
IF IMDEZEXIT-DELKZ = 'VC'
OR IMDEZEXIT-DELKZ = 'VB'
OR IMDEZEXIT-DELKZ = 'VA'
OR IMDEZEXIT-DELKZ = 'VJ'.
SELECT SINGLE VDATU FROM VBAK INTO VBAK-VDATU
WHERE VBELN = IE3MDPSLX-DELNR.
IF SY-SUBRC = 0.
MOVE VBAK-VDATU TO EMDEZX_USEX1 . "Requested delivery date
ENDIF.
ENDIF.
ENDIF.
************************************************************************
***********************************************************************
* Example 2 User Exit 2 Individual Lines
* Release-Status of a purchase-requesition
IF NOT IBUTT2 IS INITIAL.
IF IMDEZEXIT-DELKZ = 'BA'.
SELECT SINGLE FRGKZ FROM EBAN INTO EBAN-FRGKZ
WHERE BANFN = IE3MDPSLX-DELNR
AND BNFPO = IE3MDPSLX-DELPS.
IF SY-SUBRC = 0.
MOVE EBAN-FRGKZ TO EMDEZX_USEX2.
ENDIF.
ENDIF.
ENDIF.
************************************************************************
************************************************************************
* Example 3 User Exit 3 Individual Lines
IF NOT IBUTT3 IS INITIAL.
MOVE 'Individual Text' TO EMDEZX_USEX3. "Text
ENDIF.
************************************************************************
*----------------------------------------------------------------------
* Period Totals
* -------------
* 1) The User Exit fills columns in the stock/requirements
* list an the mrp list when the corresponding button is pressed on
* the period totals screen. Three different columns are possible.
* The columns 1 and 2 can only be filled with quantities,
* column 3 can be filled with a 30-character-string.
* 2) The same user exit is used in the repetitive planning table
* There, the values of exit 1 and 2 can be displayed as rows,
* if the user selects these rows. Exit 3 is not availible.
*----------------------------------------------------------------------
*--> Data definitions
STATICS: LAST_PLAAB LIKE MDSU-PLAAB, "last planning segment
LAST_PLANR LIKE MDSU-PLANR, "number of this planning segment
FZ_PROD TYPE F, "summarized production
FZ_REQUI TYPE F. "summarized requirements
************************************************************************
*--> Example 1 User Exit 1 Period totals
*--> Example: Summarize production quantities by mrp segment
* along the time axis
*--> check that user exit 1 is active
IF NOT IBUTT1_PS IS INITIAL.
*--> New list(table) or new MRP-segment: Start summation
IF INEW_ENTRY EQ 'X'
OR IMDSUX-PLAAB NE LAST_PLAAB
OR IMDSUX-PLANR NE LAST_PLANR.
*--> No stock: start with receipt quantity
IF IMDSUX-DELKZ NE 'WB'
AND IMDSUX-DELKZ NE 'LB'
AND IMDSUX-DELKZ NE 'KB'
AND IMDSUX-DELKZ NE 'PB'
AND IMDSUX-DELKZ NE 'LK'.
MOVE IMDSUX-MNG03 TO FZ_PROD.
*--> Stock: Start with 0
ELSE.
CLEAR FZ_PROD.
ENDIF.
*--> Same material, same MRP-segment: Add production quantity
ELSE.
FZ_PROD = FZ_PROD + IMDSUX-MNG03.
ENDIF.
*--> Fill output quantity 1 for period totals
MOVE FZ_PROD TO EMDSUX_USEX1.
ENDIF.
************************************************************************
************************************************************************
*--> Example 2 User Exit 2 Period totals
*--> Example: Summarize requirements by mrp segment
* along the time axis
*--> check that user exit 2 is active
IF NOT IBUTT2_PS IS INITIAL.
*--> New list(table) or new MRP-segment: Start summarization from zero
IF INEW_ENTRY EQ 'X'
OR IMDSUX-PLAAB NE LAST_PLAAB
OR IMDSUX-PLANR NE LAST_PLANR.
FZ_REQUI = IMDSUX-MNG01 + IMDSUX-MNG02.
*--> Same material, same MRP-segment: Add requirement quantities
* (forecast + requirements)
ELSE.
FZ_REQUI = FZ_REQUI + IMDSUX-MNG01 + IMDSUX-MNG02.
ENDIF.
*--> Fill output quantity 2 for period totals
MOVE FZ_REQUI TO EMDSUX_USEX2.
ENDIF.
************************************************************************
************************************************************************
*--> Example 3 User Exit 3 - period totals
* Only in stock/requirements- and mrp-list
* Not availible in the REM planning table!
IF NOT IBUTT3_PS IS INITIAL.
MOVE 'Individual Text' TO EMDSUX_USEX3.
ENDIF.
MOVE IMDSUX-PLAAB TO LAST_PLAAB.
MOVE IMDSUX-PLANR TO LAST_PLANR.
************************************************************************
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/166523/viewspace-153318/ ,如需转载,请注明出处,否则将追究法律责任。