• How to expand the BOM using ABAP?


            在某项目中,根据业务部门提出的需求,需要把BOM展开。通过调用系统提供的FM 来实现BOM 展开的函数。以下是实现代码的函数。

    FUNCTION Z_BOM_EXPAND.

    *"---------------------------------------------------------

    *"*"Local Interface:

    *" IMPORTING

    *" VALUE(MATNR) LIKE MARA-MATNR

    *" VALUE(WERKS) LIKE MARC-WERKS OPTIONAL

    *" VALUE(CAPID) LIKE TC04-CAPID DEFAULT 'PP01'

    *" TABLES

    *" STB STRUCTURE STPOX

    *" RETURN STRUCTURE BAPIRET2

    *"---------------------------------------------------------

    IF WERKS IS INITIAL."Added in case external call does not know

       WERKS = '3001'.

    ENDIF.

    IF CAPID IS INITIAL.

       CAPID = 'PP01'.

    ENDIF.

    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

      EXPORTING

        CAPID = CAPID

        DATUV = SY-DATUM

        MEHRS = 'X'

        MTNRV = MATNR

        WERKS = WERKS

      TABLES

        STB = STB

      EXCEPTIONS

        NO_BOM_FOUND = 1.

    IF sy-subrc <> 0.

       msg_typ = 'E'.

       msg_id = 'Z_EF'.

       msg_no = '002'.

       msg_v1 = MATNR.

       if not msg_typ is initial.

    *     append error to table RETURN

          call function 'BALW_BAPIRETURN_GET2'

            exporting

              type = msg_typ

              cl = msg_id

              number = msg_no

              par1 = msg_v1

              par2 = msg_v2

              par3 = msg_v3

              par4 = msg_v4

              parameter = space

              row = space

              field = space

            importing

              return = wa_return_tmp.

          append wa_return_tmp to return.

       endif.

    ENDIF.

    ENDFUNCTION.

  • 相关阅读:
    python 协程
    python 打印乘法表
    python 线程池
    python 队列
    开发react 应用最好用的脚手架 create-react-app
    React面试题
    修改了背景透明度
    低门槛彻底理解JavaScript中的深拷贝和浅拷贝
    Web Worker 使用教程
    Vue2 实现时空穿梭框功能模块
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/2992085.html
Copyright © 2020-2023  润新知