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 vendor transactions 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:

  

Normally vendor sends their finished goods as part of business process (like vendor consignment process). Later on, inspection will be done on the goods either manually or automatically by a third-party system. After the inspection is completed, they post the Goods receipt (GR) using the MIGO transaction. For trusted vendor and trusted material, inspection will be done automatically and MIGO is posted. (But, UD update must be 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 per business 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:     Implement below 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_UDDescription: UD update for inspection lot in MIGOImporting 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 Enhancement for auto UD for Req.Parts                                     *

* BADI Definition Name      : MB_DOCUMENT_BADI                                                             *

* Implementation Short Text : MB_DOCUMENT_BADI - QM Enhancement for 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,               " Segment of Material Document

 

 

*Clear Variables

  CLEAR: ls_xvm07m, ls_xmseg.

 

 

*Read Inspection lot number

  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 Enhancement for auto UD for Req.Parts          *

* Author           : Akshath L.T                                       *

* Creation Date    : 24/11/2014                                        *

* Description      : UD update for insp.lot from 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 lot system status

        lt_user_status     TYPE STANDARD TABLE OF bapi2045us, " Inspection lot user status

        l_insp_num         TYPE bapi2045ud-insplot,           " Inspection Lot Number

        l_lifnr            TYPE lifnr,                        " Vendor

        l_matnr            TYPE matnr.                        " Material

 

 

*  Constants

  CONSTANTS : lc_ud_selected_set TYPE bapi2045ud-ud_selected_set VALUE '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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"使用颜色梯度和布尔规则进行芯片焊点检测和分类的方法"是一种用于芯片焊接点的检测和分类的方法。该方法利用颜色梯度和布尔规则来分析焊接点图像,以确定其质量等级。 该方法的基本步骤如下: 1. 图像获取:通过光学设备或相机获取芯片焊接点的图像。 2. 颜色梯度计算:使用图像处理技术计算焊接点图像中的颜色梯度。颜色梯度表示颜色变化的程度,可以提供焊接点区域的细节和特征。 3. 特征提取:基于颜色梯度,提取与焊接点质量相关的特征。可能的特征包括焊接点的形状、大小、颜色等。 4. 布尔规则分类:定义一组基于布尔规则的分类条件。这些规则可以基于特征值范围、阈值或其他逻辑条件来确定焊接点的质量等级。例如,如果焊接点的形状满足特定条件,并且颜色梯度在某个范围内,则将其分类为良好的焊接点。 5. 检测和分类:根据之前定义的布尔规则,对焊接点图像进行检测和分类。将焊接点分为不同的质量等级,如良好、一般、不良等。 该方法的优点是利用了颜色梯度和布尔规则的组合来对焊接点进行快速而准确的检测和分类。通过提取特征和定义布尔规则,可以根据特定的质量标准对焊接点进行分类,从而提高生产质量和效率。 需要注意的是,以上是对该方法的一般概述,具体的细节和步骤可能因实际应用或研究论文而有所不同。如果您对该方法有更具体的问题或需要更详细的解读,请提供更多详细信息,我将尽力为您提供帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值