zoukankan      html  css  js  c++  java
  • 生产工单组件修改BAPI



    工单组件修改函数组为 CNIF_MAT

    image


    1. 获取组件信息

    BAPI_NETWORK_COMP_GETDETAIL
    BAPI_NETWORK_COMP_GETLIST

    2.修改组件信息 BAPI_NETWORK_COMP_CHANGE

    3.删除组件信息 BAPI_NETWORK_COMP_REMOVE

    4.添加组件信息 BAPI_NETWORK_COMP_ADD(不能用,参见另一篇博文)


    其中基本使用方法为:获取后进行修改,也就是1和2和组合。

    示例代码,举例如下:


    image


    image

    REPORT ytest_co02.
    "==================示例数据======================
    DATA:
    BEGIN OF it_comp ,
        matnr TYPE mara-matnr,
        posnr TYPE resb-rspos,
        idnrk TYPE mara-matnr,
        meins TYPE meins,
        menge TYPE menge_d,
        aufnr TYPE afko-aufnr,
        lgort TYPE lgort_d,
    text  TYPE char100,
    END OF it_comp.
    it_comp-matnr =  '000000541003089900'.
    it_comp-idnrk =  '000000404016392000'.
    it_comp-posnr =  '0010' .
    it_comp-menge = '720' .
    it_comp-aufnr = '000010462694'.
    it_comp-lgort = '1013'.
    "==================示例数据x结束======================
    DATA: return                      LIKE bapiret2,
          li_components_change        LIKE TABLE OF bapi_network_comp_change,
          lw_components_change        LIKE bapi_network_comp_change,
          li_components_change_update LIKE TABLE OF bapi_network_comp_cng_upd,
          lw_components_change_update LIKE  bapi_network_comp_cng_upd,
          e_message_table             LIKE TABLE OF bapi_meth_message.
    DATA:li_components_detail LIKE TABLE OF bapi_network_comp_detail .
    DATA:lw_components_detail LIKE  bapi_network_comp_detail .
    CLEAR:
    li_components_detail,li_components_detail[],
    li_components_change,li_components_change[]  ,
    li_components_change_update,li_components_change_update[],
    e_message_table,e_message_table[].
    CALL FUNCTION 'BAPI_NETWORK_COMP_GETDETAIL'
    EXPORTING
    number              = it_comp-aufnr
    TABLES
        e_components_detail = li_components_detail.
    LOOP AT li_components_detail INTO lw_components_detail WHERE item_number = it_comp-posnr AND material = it_comp-idnrk.
      lw_components_change-component = lw_components_detail-component.
      lw_components_change-entry_quantity = it_comp-menge.
      lw_components_change-stge_loc = it_comp-lgort.
    APPEND lw_components_change TO li_components_change .
      lw_components_change_update-component = lw_components_detail-component.
    IF it_comp-menge IS NOT INITIAL .
        lw_components_change_update-entry_quantity = 'X'.
    ENDIF .
    IF it_comp-meins IS NOT INITIAL .
        lw_components_change_update-base_uom = 'X'.
    ENDIF .
    IF it_comp-lgort IS NOT INITIAL .
        lw_components_change_update-stge_loc = 'X'.
    ENDIF .
    APPEND lw_components_change_update TO li_components_change_update .
    ENDLOOP.
    CALL FUNCTION 'BAPI_NETWORK_COMP_CHANGE'
    EXPORTING
    number                     = it_comp-aufnr
    IMPORTING
    return                     = return
    TABLES
        i_components_change        = li_components_change
        i_components_change_update = li_components_change_update
        e_message_table            = e_message_table.
    "todo: 处理返回消息
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    wait = 'X'.


    image

  • 相关阅读:
    MySql 获取当前节点及递归所有上级节点
    MySql创建树结构递归查询存储过程
    F2工作流引擎Web层全新扁平化UI上线
    F2工作流引擎参与者类型成员的交、并、互拆计算规则
    F2工作流引擎之组织用户模型(四)
    F2工作流引擎之 工作流运转模型(三)
    F2工作流引擎之 概述(一)
    离线安装docker,并导入docker镜像
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set 的解决办法
    yml 文件中使用环境变量
  • 原文地址:https://www.cnblogs.com/twttafku/p/14871659.html
Copyright © 2011-2022 走看看