SlideShare a Scribd company logo
1 of 7
Auto inspection lot creation and
Auto Usage decision for required
parts
Reusable Artifact Descriptions
Artifact Type Enhancement - BADI
Functional Area MM
Functional Sub-Area IM, QM
SAP System ECC
Objective:
This document is for creation of automatic usage decision upon specific business scenario.
In any business process regarding vendortransactions there will be trusted material in each transaction.There is a
common scenario that need of QA inspection for this material from that particular vendor (or trusted vendor)is null.
This scenario is not available or executed in standard SAP installation. The proposed approach as described below
will allow businesses to go for automatic inventory update under specific conditions.
Target Audience:
Both functional (MM & QM) and technical (ABAP developer) can use this document.
Requirement & Overview:
Normallyvendor sends their finished goods as partofbusiness process (like vendor consignmentprocess).Later on,
inspection will be done on the goods either manuallyor automaticallyby a third-party system.After the inspection is
completed,they postthe Goods receipt(GR) using the MIGO transaction.For trusted vendor and trusted material,
inspection will be done automaticallyand MIGO is posted.(But, UD update mustbe done automatically)
Needs to be created or Pre requisites:
 Custom table ZAUTO_UD needs to be created. (To store trusted material and vendor details along with mapping
them).
 Custom Function module ‘ZUPDATE_UD’ needs to be created. (To update Usage decision for inspection lot)
Technical design or steps to achieve a functionality:
In a standard SAP process,Inspection lot number (I-L no) and Material document number (M-doc-no) will be
generated once MIGO is done.During Quality inspection,I.L no will be accepted in IL02 transaction.
In our customer business process as perbusiness requirement, Quality inspection will be automated once M-doc-no
is generated. To achieve this, we need to enhance the BADI "MB_DOCUMENT_BADI" in the interface
“IF_EX_MB_DOCUMENT_BADI”.
BADI details:
BADI Description
BAdI Definition MB_DOCUMENT_BADI
Description BAdIs During Creation of a Material Document
Interface IF_EX_MB_DOCUMENT_BADI
Implementation Name ZMB_DOCUMENT_BADI
Description MB_DOCUMENT_BADI - QM Enhancement for auto UD for trusted Parts
Method:
Method Name Description
MB_DOCUMENT_BEFORE_UPDATE Exit After Writing a Material Document. Not in 'update task'
Functionality:
Implementbelow logic into method MB_DOCUMENT_BEFORE_UPDATE.
Get inspection lot number, material number and vendor number from the importing parameter of (XMSEG
–QPLOS, XMSEG-MATNR, and XMSEG-LIFNR).
Call custom update Function module ‘ZUPDATE_UD’ using below parameters via Update task.(CALL
FUNCTION 'ZUPDATE_UD' IN UPDATE TASK)
Below function module needs to be created:
Function module: ZUPDATE_UD
Description: UD update for inspection lot in MIGO
Importing parameters:
Parameter Name Reference Description and Mandatory
I_NUMBER BAPI2045UD-INSPLOT Inspection Lot
I_MATNR QALS-MATNR Material Number
I_LIFNR QALS-LIFNR Vendor Number
Function module: ZUPDATE_UD
Check if material and vendor exist in custom table ZAUTO_UD. If material and vendor combination has found
in the table then it’s a trusted transaction else normal transaction.
Note: Custom table ZAUTO_UD will hold the trusted material and vendor combination details.
If it’s a trusted transaction then call BAPI ‘BAPI_INSPLOT_SETUSAGEDECISION’ to updated Usage Decision
as A (A = Accept) else don’t update.
Process Flowchart:
Additional information:
 We can use email functionality to trigger email to manager after User decision update.
 We can trigger workflow for approvals.
Code snippet:
BADI Implementation : ZMB_DOCUMENT_BADI
************************************************************************************************************
* Title : QM Enhancementfor auto UD for Req.Parts *
* BADI Definition Name : MB_DOCUMENT_BADI *
* Implementation ShortText : MB_DOCUMENT_BADI - QM Enhancementfor auto UD for Req.Parts *
* BADI Implementation Name :ZMB_DOCUMENT_BADI *
* Method : MB_DOCUMENT_BEFORE_UPDATE
(IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE) *
*----------------------------------------------------------------------------------------------------------*
*......next change..... *
************************************************************************************************************
METHOD if_ex_mb_document_badi~mb_document_before_update.
*Local Structures
DATA : ls_xvm07m LIKE LINE OF xvm07m, " Fields:Update Control of Module Pool SAPMM07M
ls_xmseg LIKE LINE OF xmseg, " Segmentof Material Document
*Clear Variables
CLEAR: ls_xvm07m,ls_xmseg.
*Read Inspection lotnumber
READ TABLE xvm07m INTO ls_xvm07m INDEX 1.
*Read material and vendor number
READ TABLE xmseg INTO ls_xmseg INDEX 1.
*Update Usage Decision as 'A - Accept'
CALL FUNCTION 'ZUPDATE_UD' IN UPDATE TASK
EXPORTING
i_number = ls_xvm07m-qplos
i_matnr = ls_xmseg-matnr
i_lifnr = ls_xmseg-lifnr.
IF sy-subrc <> 0.
MESSAGE 'Error while calling update function module'TYPE 'E'.
ENDIF.
ENDIF.
ENDMETHOD.
*******************************************************************************************
Function module: ZUPDATE_UD
FUNCTION zupdate_ud.
*"----------------------------------------------------------------------
*"*"Update Function Module:
*"
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_NUMBER) TYPE BAPI2045UD-INSPLOT
*" VALUE(I_MATNR) TYPE QALS-MATNR
*" VALUE(I_LIFNR) TYPE QALS-LIFNR
*" EXCEPTIONS
*" E_ERROR
*" E_SUCESS
*"----------------------------------------------------------------------
************************************************************************
* Title : QM Enhancementfor auto UD for Req.Parts *
* Author : Akshath L.T *
* Creation Date : 24/11/2014 *
* Description : UD update for insp.lotfrom MIGO *
************************************************************************
* Local Structures
DATA: ls_ud_data TYPE bapi2045ud, " Data for making the usage decision
ls_ud_return_data TYPE bapi2045ud_return,"Return structure after the usage decision is made
ls_stock_data TYPE bapi2045d_il2, " Stock Data for Inspection Lot
ls_return TYPE bapireturn1, " Return Parameter
* Local Internal Tables
lt_system_status TYPE STANDARD TABLE OF bapi2045ss,"Inspection lotsystem status
lt_user_status TYPE STANDARD TABLE OF bapi2045us,"Inspection lotuser status
l_insp_num TYPE bapi2045ud-insplot, " Inspection LotNumber
l_lifnr TYPE lifnr, " Vendor
l_matnr TYPE matnr. " Material
* Constants
CONSTANTS : lc_ud_selected_setTYPE bapi2045ud-ud_selected_setVALUE '01', " Selected Set of the Usage
Decision
lc_ud_code_group TYPE bapi2045ud-ud_code_group VALUE '01', " Code Group of the Usage Decision
lc_ud_code TYPE bapi2045ud-ud_code VALUE 'A', " Accept Usage Decision
lc_language TYPE bapi2045la VALUE 'E', " Language
lc_msgtyp_e TYPE c VALUE 'E', " Error
lc_werks TYPE werks VALUE '9999'.
* Clear variables
CLEAR:l_matnr,
l_lifnr,
l_insp_num,
ls_ud_data.
IF i_matnr IS NOT INITIAL AND
i_lifnr IS NOT INITIAL.
* Fetch Material and Vendor data from the table ZAUTOUD
SELECT SINGLE matnr
lifnr
FROM zauto_ud
INTO (l_matnr,l_lifnr)
WHERE matnr = i_matnr
AND lifnr = i_lifnr.
if sy-subrc = 0.
* Remove leading-zero of Vendor number
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = i_lifnr
IMPORTING
output= l_lifnr.
* Populate data for BAPI updation
ls_ud_data-insplot = i_number.
ls_ud_data-ud_selected_set = lc_ud_selected_set.
ls_ud_data-ud_plant = lc_werks.
ls_ud_data-ud_code_group = lc_ud_code_group .
ls_ud_data-ud_code = lc_ud_code .
ls_ud_data-ud_stock_posting = abap_true.
l_insp_num = i_number.
* Update usage decision as Accept in inspection lot
CALL FUNCTION 'BAPI_INSPLOT_SETUSAGEDECISION'
EXPORTING
number = l_insp_num
ud_data = ls_ud_data
language = lc_language
IMPORTING
ud_return_data = ls_ud_return_data
stock_data = ls_stock_data
return = ls_return
TABLES
system_status = lt_system_status
user_status = lt_user_status.
IF ls_return-type = lc_msgtyp_e.
MESSAGE 'Error while updating Usage Decision'TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFUNCTION.

More Related Content

What's hot

SAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantSAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantAnkit Sharma
 
S4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaS4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaGanesh Tarlana
 
SAP SD interview questions
SAP SD interview questions SAP SD interview questions
SAP SD interview questions IT LearnMore
 
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshots
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshotsSAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshots
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshotsSubhrajyoti (Subhra) Bhattacharjee
 
Sap S/4 HANA New Implementation
Sap S/4 HANA New ImplementationSap S/4 HANA New Implementation
Sap S/4 HANA New ImplementationSoumya De
 
Business partner-2
Business  partner-2Business  partner-2
Business partner-2abc
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdfVaishali Ketkar
 
Material master views
Material master viewsMaterial master views
Material master viewsLokesh Modem
 
Step by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwStep by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwsristick
 
SAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration documentSAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration documentSubhrajyoti (Subhra) Bhattacharjee
 
Sales Order Specific Planned Independent Reqt Consumption
Sales Order Specific Planned Independent Reqt ConsumptionSales Order Specific Planned Independent Reqt Consumption
Sales Order Specific Planned Independent Reqt ConsumptionVijay Pisipaty
 
LOGBOOk ENTRIES IN SAP PM
LOGBOOk ENTRIES IN SAP PMLOGBOOk ENTRIES IN SAP PM
LOGBOOk ENTRIES IN SAP PMPiyush Bose
 
Business Partner S4HANA.pdf
Business Partner S4HANA.pdfBusiness Partner S4HANA.pdf
Business Partner S4HANA.pdferikotsuji
 
SAP ERP Solutions - How It Evolved Over Time
SAP ERP Solutions - How It Evolved Over TimeSAP ERP Solutions - How It Evolved Over Time
SAP ERP Solutions - How It Evolved Over TimeAPPSeCONNECT
 
Sap sd notes
Sap sd notesSap sd notes
Sap sd notesMohit2385
 
Mass User Password Reset Using Lsmw
Mass User Password Reset Using LsmwMass User Password Reset Using Lsmw
Mass User Password Reset Using LsmwDitto S Perumalsami
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAPsapdocs. info
 

What's hot (20)

SAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantSAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional Consultant
 
S4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaS4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh Tarlana
 
SAP SD interview questions
SAP SD interview questions SAP SD interview questions
SAP SD interview questions
 
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshots
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshotsSAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshots
SAP PM - WCM: Enhanced Model - Entire process flow with SAP screenshots
 
Sap S/4 HANA New Implementation
Sap S/4 HANA New ImplementationSap S/4 HANA New Implementation
Sap S/4 HANA New Implementation
 
Business partner-2
Business  partner-2Business  partner-2
Business partner-2
 
Sap qm ppt
Sap qm  pptSap qm  ppt
Sap qm ppt
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf
 
Material master views
Material master viewsMaterial master views
Material master views
 
Step by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwStep by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmw
 
SAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration documentSAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration document
 
Sales Order Specific Planned Independent Reqt Consumption
Sales Order Specific Planned Independent Reqt ConsumptionSales Order Specific Planned Independent Reqt Consumption
Sales Order Specific Planned Independent Reqt Consumption
 
SAP PM: Inspection Rounds & Operation Account Assignment
SAP PM: Inspection Rounds & Operation Account AssignmentSAP PM: Inspection Rounds & Operation Account Assignment
SAP PM: Inspection Rounds & Operation Account Assignment
 
LOGBOOk ENTRIES IN SAP PM
LOGBOOk ENTRIES IN SAP PMLOGBOOk ENTRIES IN SAP PM
LOGBOOk ENTRIES IN SAP PM
 
Business Partner S4HANA.pdf
Business Partner S4HANA.pdfBusiness Partner S4HANA.pdf
Business Partner S4HANA.pdf
 
SAP ERP Solutions - How It Evolved Over Time
SAP ERP Solutions - How It Evolved Over TimeSAP ERP Solutions - How It Evolved Over Time
SAP ERP Solutions - How It Evolved Over Time
 
Sap sd notes
Sap sd notesSap sd notes
Sap sd notes
 
Mass User Password Reset Using Lsmw
Mass User Password Reset Using LsmwMass User Password Reset Using Lsmw
Mass User Password Reset Using Lsmw
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAP
 
Using idoc method in lsmw
Using idoc method in lsmwUsing idoc method in lsmw
Using idoc method in lsmw
 

Similar to Auto inspection lot creation and Auto Usage decision for required parts

Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Ashwin Kumar
 
1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docxnavinsurya3
 
Warranty processing recall bbp
Warranty processing recall bbpWarranty processing recall bbp
Warranty processing recall bbpvinayk_35919
 
Omnichannel Convergent Billing.pdf
Omnichannel Convergent Billing.pdfOmnichannel Convergent Billing.pdf
Omnichannel Convergent Billing.pdfAmitKumarbishoyi2
 
2F9_S4HANA2020_BPD_EN_US.docx
2F9_S4HANA2020_BPD_EN_US.docx2F9_S4HANA2020_BPD_EN_US.docx
2F9_S4HANA2020_BPD_EN_US.docxArun Obilisetty
 
Warranty processing recall bbp
Warranty processing recall bbpWarranty processing recall bbp
Warranty processing recall bbpvinayk_35919
 
Porfolio of Setfocus work
Porfolio of Setfocus workPorfolio of Setfocus work
Porfolio of Setfocus workKevinPSF
 
Coml Psg Automation Approach
Coml Psg Automation ApproachComl Psg Automation Approach
Coml Psg Automation Approachroopavani
 
Mas 500 Enhancement Digest
Mas 500 Enhancement DigestMas 500 Enhancement Digest
Mas 500 Enhancement DigestJulieS770
 
Business Intelligence QA Automation Solution
Business Intelligence QA Automation SolutionBusiness Intelligence QA Automation Solution
Business Intelligence QA Automation SolutionKaushik Dass
 
Material Quotation System Functional Requirements Document V6
Material Quotation System  Functional Requirements Document V6Material Quotation System  Functional Requirements Document V6
Material Quotation System Functional Requirements Document V6Semon Wu
 
Oracle Ebiz R12.2 Features -- Ravi Sagaram
Oracle Ebiz R12.2 Features -- Ravi SagaramOracle Ebiz R12.2 Features -- Ravi Sagaram
Oracle Ebiz R12.2 Features -- Ravi Sagaramravisagaram
 
Gunavathi_Resume
Gunavathi_ResumeGunavathi_Resume
Gunavathi_Resumeguna vathi
 
IRJET- Performance Analysis of Store Inventory Management (SIM) an Enterp...
IRJET-  	  Performance Analysis of Store Inventory Management (SIM) an Enterp...IRJET-  	  Performance Analysis of Store Inventory Management (SIM) an Enterp...
IRJET- Performance Analysis of Store Inventory Management (SIM) an Enterp...IRJET Journal
 
Inventory management system
Inventory management systemInventory management system
Inventory management systemAshrafee rakhi
 
Software Defined WebSphere Messaging Infrastructure with Puppet
Software Defined WebSphere Messaging Infrastructure with PuppetSoftware Defined WebSphere Messaging Infrastructure with Puppet
Software Defined WebSphere Messaging Infrastructure with PuppetRahul Gupta
 
About BLE server profile
About BLE server profile About BLE server profile
About BLE server profile Lin Steven
 

Similar to Auto inspection lot creation and Auto Usage decision for required parts (20)

CATS Approval.pdf
CATS Approval.pdfCATS Approval.pdf
CATS Approval.pdf
 
Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0
 
1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx
 
Warranty processing recall bbp
Warranty processing recall bbpWarranty processing recall bbp
Warranty processing recall bbp
 
Omnichannel Convergent Billing.pdf
Omnichannel Convergent Billing.pdfOmnichannel Convergent Billing.pdf
Omnichannel Convergent Billing.pdf
 
GeoXpedite
GeoXpediteGeoXpedite
GeoXpedite
 
2F9_S4HANA2020_BPD_EN_US.docx
2F9_S4HANA2020_BPD_EN_US.docx2F9_S4HANA2020_BPD_EN_US.docx
2F9_S4HANA2020_BPD_EN_US.docx
 
Warranty processing recall bbp
Warranty processing recall bbpWarranty processing recall bbp
Warranty processing recall bbp
 
Porfolio of Setfocus work
Porfolio of Setfocus workPorfolio of Setfocus work
Porfolio of Setfocus work
 
Coml Psg Automation Approach
Coml Psg Automation ApproachComl Psg Automation Approach
Coml Psg Automation Approach
 
Mas 500 Enhancement Digest
Mas 500 Enhancement DigestMas 500 Enhancement Digest
Mas 500 Enhancement Digest
 
Business Intelligence QA Automation Solution
Business Intelligence QA Automation SolutionBusiness Intelligence QA Automation Solution
Business Intelligence QA Automation Solution
 
Material Quotation System Functional Requirements Document V6
Material Quotation System  Functional Requirements Document V6Material Quotation System  Functional Requirements Document V6
Material Quotation System Functional Requirements Document V6
 
Oracle Ebiz R12.2 Features -- Ravi Sagaram
Oracle Ebiz R12.2 Features -- Ravi SagaramOracle Ebiz R12.2 Features -- Ravi Sagaram
Oracle Ebiz R12.2 Features -- Ravi Sagaram
 
Logistics Execution.pdf
Logistics Execution.pdfLogistics Execution.pdf
Logistics Execution.pdf
 
Gunavathi_Resume
Gunavathi_ResumeGunavathi_Resume
Gunavathi_Resume
 
IRJET- Performance Analysis of Store Inventory Management (SIM) an Enterp...
IRJET-  	  Performance Analysis of Store Inventory Management (SIM) an Enterp...IRJET-  	  Performance Analysis of Store Inventory Management (SIM) an Enterp...
IRJET- Performance Analysis of Store Inventory Management (SIM) an Enterp...
 
Inventory management system
Inventory management systemInventory management system
Inventory management system
 
Software Defined WebSphere Messaging Infrastructure with Puppet
Software Defined WebSphere Messaging Infrastructure with PuppetSoftware Defined WebSphere Messaging Infrastructure with Puppet
Software Defined WebSphere Messaging Infrastructure with Puppet
 
About BLE server profile
About BLE server profile About BLE server profile
About BLE server profile
 

Auto inspection lot creation and Auto Usage decision for required parts

  • 1. Auto inspection lot creation and Auto Usage decision for required parts Reusable Artifact Descriptions Artifact Type Enhancement - BADI Functional Area MM Functional Sub-Area IM, QM SAP System ECC Objective: This document is for creation of automatic usage decision upon specific business scenario. In any business process regarding vendortransactions there will be trusted material in each transaction.There is a common scenario that need of QA inspection for this material from that particular vendor (or trusted vendor)is null. This scenario is not available or executed in standard SAP installation. The proposed approach as described below will allow businesses to go for automatic inventory update under specific conditions. Target Audience: Both functional (MM & QM) and technical (ABAP developer) can use this document. Requirement & Overview: Normallyvendor sends their finished goods as partofbusiness process (like vendor consignmentprocess).Later on, inspection will be done on the goods either manuallyor automaticallyby a third-party system.After the inspection is completed,they postthe Goods receipt(GR) using the MIGO transaction.For trusted vendor and trusted material, inspection will be done automaticallyand MIGO is posted.(But, UD update mustbe done automatically) Needs to be created or Pre requisites:  Custom table ZAUTO_UD needs to be created. (To store trusted material and vendor details along with mapping them).  Custom Function module ‘ZUPDATE_UD’ needs to be created. (To update Usage decision for inspection lot) Technical design or steps to achieve a functionality:
  • 2. In a standard SAP process,Inspection lot number (I-L no) and Material document number (M-doc-no) will be generated once MIGO is done.During Quality inspection,I.L no will be accepted in IL02 transaction. In our customer business process as perbusiness requirement, Quality inspection will be automated once M-doc-no is generated. To achieve this, we need to enhance the BADI "MB_DOCUMENT_BADI" in the interface “IF_EX_MB_DOCUMENT_BADI”. BADI details: BADI Description BAdI Definition MB_DOCUMENT_BADI Description BAdIs During Creation of a Material Document Interface IF_EX_MB_DOCUMENT_BADI Implementation Name ZMB_DOCUMENT_BADI Description MB_DOCUMENT_BADI - QM Enhancement for auto UD for trusted Parts Method: Method Name Description MB_DOCUMENT_BEFORE_UPDATE Exit After Writing a Material Document. Not in 'update task' Functionality: Implementbelow logic into method MB_DOCUMENT_BEFORE_UPDATE. Get inspection lot number, material number and vendor number from the importing parameter of (XMSEG –QPLOS, XMSEG-MATNR, and XMSEG-LIFNR). Call custom update Function module ‘ZUPDATE_UD’ using below parameters via Update task.(CALL FUNCTION 'ZUPDATE_UD' IN UPDATE TASK) Below function module needs to be created: Function module: ZUPDATE_UD Description: UD update for inspection lot in MIGO Importing parameters: Parameter Name Reference Description and Mandatory I_NUMBER BAPI2045UD-INSPLOT Inspection Lot I_MATNR QALS-MATNR Material Number I_LIFNR QALS-LIFNR Vendor Number
  • 3. Function module: ZUPDATE_UD Check if material and vendor exist in custom table ZAUTO_UD. If material and vendor combination has found in the table then it’s a trusted transaction else normal transaction. Note: Custom table ZAUTO_UD will hold the trusted material and vendor combination details. If it’s a trusted transaction then call BAPI ‘BAPI_INSPLOT_SETUSAGEDECISION’ to updated Usage Decision as A (A = Accept) else don’t update. Process Flowchart: Additional information:  We can use email functionality to trigger email to manager after User decision update.  We can trigger workflow for approvals. Code snippet: BADI Implementation : ZMB_DOCUMENT_BADI
  • 4. ************************************************************************************************************ * Title : QM Enhancementfor auto UD for Req.Parts * * BADI Definition Name : MB_DOCUMENT_BADI * * Implementation ShortText : MB_DOCUMENT_BADI - QM Enhancementfor auto UD for Req.Parts * * BADI Implementation Name :ZMB_DOCUMENT_BADI * * Method : MB_DOCUMENT_BEFORE_UPDATE (IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE) * *----------------------------------------------------------------------------------------------------------* *......next change..... * ************************************************************************************************************ METHOD if_ex_mb_document_badi~mb_document_before_update. *Local Structures DATA : ls_xvm07m LIKE LINE OF xvm07m, " Fields:Update Control of Module Pool SAPMM07M ls_xmseg LIKE LINE OF xmseg, " Segmentof Material Document *Clear Variables CLEAR: ls_xvm07m,ls_xmseg. *Read Inspection lotnumber READ TABLE xvm07m INTO ls_xvm07m INDEX 1. *Read material and vendor number READ TABLE xmseg INTO ls_xmseg INDEX 1. *Update Usage Decision as 'A - Accept' CALL FUNCTION 'ZUPDATE_UD' IN UPDATE TASK EXPORTING i_number = ls_xvm07m-qplos i_matnr = ls_xmseg-matnr i_lifnr = ls_xmseg-lifnr. IF sy-subrc <> 0. MESSAGE 'Error while calling update function module'TYPE 'E'. ENDIF. ENDIF. ENDMETHOD. ******************************************************************************************* Function module: ZUPDATE_UD FUNCTION zupdate_ud. *"---------------------------------------------------------------------- *"*"Update Function Module: *" *"*"Local Interface:
  • 5. *" IMPORTING *" VALUE(I_NUMBER) TYPE BAPI2045UD-INSPLOT *" VALUE(I_MATNR) TYPE QALS-MATNR *" VALUE(I_LIFNR) TYPE QALS-LIFNR *" EXCEPTIONS *" E_ERROR *" E_SUCESS *"---------------------------------------------------------------------- ************************************************************************ * Title : QM Enhancementfor auto UD for Req.Parts * * Author : Akshath L.T * * Creation Date : 24/11/2014 * * Description : UD update for insp.lotfrom MIGO * ************************************************************************ * Local Structures DATA: ls_ud_data TYPE bapi2045ud, " Data for making the usage decision ls_ud_return_data TYPE bapi2045ud_return,"Return structure after the usage decision is made ls_stock_data TYPE bapi2045d_il2, " Stock Data for Inspection Lot ls_return TYPE bapireturn1, " Return Parameter * Local Internal Tables lt_system_status TYPE STANDARD TABLE OF bapi2045ss,"Inspection lotsystem status lt_user_status TYPE STANDARD TABLE OF bapi2045us,"Inspection lotuser status l_insp_num TYPE bapi2045ud-insplot, " Inspection LotNumber l_lifnr TYPE lifnr, " Vendor l_matnr TYPE matnr. " Material * Constants CONSTANTS : lc_ud_selected_setTYPE bapi2045ud-ud_selected_setVALUE '01', " Selected Set of the Usage Decision lc_ud_code_group TYPE bapi2045ud-ud_code_group VALUE '01', " Code Group of the Usage Decision lc_ud_code TYPE bapi2045ud-ud_code VALUE 'A', " Accept Usage Decision lc_language TYPE bapi2045la VALUE 'E', " Language lc_msgtyp_e TYPE c VALUE 'E', " Error lc_werks TYPE werks VALUE '9999'. * Clear variables CLEAR:l_matnr, l_lifnr, l_insp_num, ls_ud_data. IF i_matnr IS NOT INITIAL AND i_lifnr IS NOT INITIAL.
  • 6. * Fetch Material and Vendor data from the table ZAUTOUD SELECT SINGLE matnr lifnr FROM zauto_ud INTO (l_matnr,l_lifnr) WHERE matnr = i_matnr AND lifnr = i_lifnr. if sy-subrc = 0. * Remove leading-zero of Vendor number CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = i_lifnr IMPORTING output= l_lifnr. * Populate data for BAPI updation ls_ud_data-insplot = i_number. ls_ud_data-ud_selected_set = lc_ud_selected_set. ls_ud_data-ud_plant = lc_werks. ls_ud_data-ud_code_group = lc_ud_code_group . ls_ud_data-ud_code = lc_ud_code . ls_ud_data-ud_stock_posting = abap_true. l_insp_num = i_number. * Update usage decision as Accept in inspection lot CALL FUNCTION 'BAPI_INSPLOT_SETUSAGEDECISION' EXPORTING number = l_insp_num ud_data = ls_ud_data language = lc_language IMPORTING ud_return_data = ls_ud_return_data stock_data = ls_stock_data return = ls_return TABLES system_status = lt_system_status user_status = lt_user_status. IF ls_return-type = lc_msgtyp_e. MESSAGE 'Error while updating Usage Decision'TYPE 'E'. ENDIF.