SAP 创建及修改独立需求计划

6 篇文章 0 订阅
该代码示例展示了如何使用SAP的BAPI函数调用BAPI_REQUIREMENTS_CREATE和BAPI_REQUIREMENTS_CHANGE来创建和修改独立需求计划。参数包括工厂、MRP区域、需求号、版本、物料、日期和数量等关键信息。首先创建新的需求计划,然后更新需求计划的内容。
摘要由CSDN通过智能技术生成

创建独立需求计划:BAPI_REQUIREMENTS_CREATE

修改独立需求计划:BAPI_REQUIREMENTS_CHANGE

  DATA: lv_reqmtsplannumber  TYPE pbdnr.
  DATA: ls_requirements_item TYPE bapisitemr.
  DATA: lt_return            TYPE STANDARD TABLE OF bapireturn1.
  DATA: ls_return            TYPE bapireturn1.
  DATA: ls_requirement_param TYPE cm60r.
  DATA: lt_requirements_schedule_in TYPE STANDARD TABLE OF  bapisshdin.
  DATA: lt_requirements_schedule_del TYPE STANDARD TABLE OF  bapisshdin.
  DATA: ls_requirements_schedule_in TYPE bapisshdin.

    CLEAR ls_requirements_item.
    CLEAR ls_requirement_param.
    CLEAR ls_requirements_schedule_in.
    CLEAR ls_pbid.
    CLEAR lv_reqmtsplannumber.

    lv_werks = gs_data-pbdnr+0(4).
    lv_berid = gs_data-pbdnr.


    "工厂
    ls_requirements_item-plant      = lv_werks.
    "MRP AREA
    ls_requirements_item-mrp_area   = lv_berid.
    "
    ls_requirements_item-req_number   = gs_data-pbdnr.
    "激活
    ls_requirements_item-vers_activ = 'X'.
    "版本
    ls_requirements_item-version    = gs_data-versb.
    "Material
    ls_requirements_item-material    = gs_data-matnr.

    "日期
    ls_requirements_schedule_in-req_date = lv_budat.
    "计划周期
    ls_requirements_schedule_in-date_type = '1'.
    "数量
    ls_requirements_schedule_in-req_qty = lv_menge.
    APPEND ls_requirements_schedule_in TO lt_requirements_schedule_in.

      CALL FUNCTION 'BAPI_REQUIREMENTS_CREATE'
        EXPORTING
          requirements_item        = ls_requirements_item
          requirement_param        = ls_requirement_param
*         DO_COMMIT                = 'X'
*         UPDATE_MODE              = 'X'
*         REFER_TYPE               = ' '
*         PROFILID                 = ' '
        IMPORTING
*         MATERIAL                 =
*         PLANT                    =
*         REQUIREMENTSTYPE         =
*         VERSION                  =
          reqmtsplannumber         = lv_reqmtsplannumber
*         MRP_AREA                 =
*         MATERIAL_EVG             =
*         REQ_PLAN_ID_EXT          =
*         REQ_SEGMENT              =
        TABLES
          requirements_schedule_in = lt_requirements_schedule_in
*         REQUIREMENTS_CHAR_IN     =
          return                   = lt_return.

        CALL FUNCTION 'BAPI_REQUIREMENTS_CHANGE'
          EXPORTING
            material                 = lv_matnr
            plant                    = lv_werks
            requirementstype         = 'LSF'
            version                  = gs_data-versb
            reqmtsplannumber         = gs_data-pbdnr
            vers_activ               = 'X'
*           REQUIREMENT_PARAM        =
            mrp_area                 = lv_berid
            do_commit                = 'X'
            update_mode              = 'X'
            delete_old               = 'X'
*           NO_WITHDR                = ' '
*           MATERIAL_EVG             =
*           REQ_PLAN_ID_EXT          =
*           REQ_SEGMENT              =
*           MATERIAL_LONG            =
*           REQ_SEG_LONG             =
* IMPORTING
*           REQUIREMENT_ITEM_OUT     =
          TABLES
            requirements_schedule_in = lt_requirements_schedule_in
*           REQUIREMENTS_CHAR_IN     =
            return                   = lt_return.

BAPI_REQUIREMENTS_CHANGE 首先会将原有的删除。然后去新建新的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值