销售订单BOM组件分配(CP_BD_DIRECT_INPUT_PLAN_EXT)

Posted rainysblog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了销售订单BOM组件分配(CP_BD_DIRECT_INPUT_PLAN_EXT)相关的知识,希望对你有一定的参考价值。

转自:http://www.baidusap.com/abap/function/520

1, 销售订单BOM组件分配前台操作

Tcode:CA02,输入物料,工厂,销售订单以及行项目,回车进入下一屏幕

技术图片

点击组件分配按钮

技术图片

选中要分配的行,点击 new assignment按钮,输入operation

技术图片

保存。

技术图片

2, CP_BD_DIRECT_INPUT_PLAN_EXT参数介绍

可以通过调用函数CP_BD_DIRECT_INPUT_PLAN_EXT实现销售订单BOM的组件分配,函数参数如下:

1, 输入参数

技术图片

RC271_EX_IMP:

技术图片

下图 routing head details中可以找到group和group counter

技术图片

RC27M_EX:

技术图片

SAVE_DI_IMP:

技术图片

2, 组件分配相关tables参数

PLMZ_DI_EX_TAB:技术图片

技术图片          注意:BOMAT字段-->当bom header material(截图中编号18处)是phantom件(截图中编号19处勾上),需要向父层上找,一直找到不是phantom件的父层物料为止,

技术图片

3, 例子程序

给销售订单BOM 940602-01的10行组件57432049分配0030的operation

技术图片

程序如下:

REPORT ztest_component_allocate.
 
DATA:l_rc271_ex_imp     TYPE rc271_ex,
     l_rc27m_ex_imp     TYPE rc27m_ex,
     l_save_di_imp      TYPE save_di,
     lit_err            TYPE STANDARD TABLE OF cmfmsg,
     lwa_err            TYPE cmfmsg,
     lit_err_di         TYPE STANDARD TABLE OF error_di,
     lwa_err_di         TYPE error_di,
     lit_plmz           TYPE STANDARD TABLE OF plmz_di_ex,
     lwa_plmz           TYPE plmz_di_ex,
     lit_rcuob2         TYPE STANDARD TABLE OF rcuob2,
     lit_rcuob1_ex      TYPE STANDARD TABLE OF rcuob1_ex,
     lit_plko           TYPE STANDARD TABLE OF plko_di_ex,
     lit_mapl           TYPE STANDARD TABLE OF mapl_di_ex,
     lit_plpo           TYPE STANDARD TABLE OF plpo_di_ex,
     lit_plfl           TYPE STANDARD TABLE OF plfl_di_ex,
     lit_plfh           TYPE STANDARD TABLE OF plfh_di_ex,
     lit_text           TYPE STANDARD TABLE OF txt_obj_ex,
     lit_text_di_tab    TYPE STANDARD TABLE OF tline,
     lit_obj_null_field TYPE STANDARD TABLE OF obj_nfield.
 
*   相关notes:Notes 1944995
l_rc271_ex_imp-tcode = CA02.
CALL FUNCTION CONVERT_DATE_TO_EXTERNAL
  EXPORTING
    date_internal            = sy-datum
  IMPORTING
    date_external            = l_rc271_ex_imp-sttag
  EXCEPTIONS
    date_internal_is_invalid = 1
    OTHERS                   = 2.
 
l_rc271_ex_imp-werks = 8800.
l_rc271_ex_imp-plnnr = 50001594.
l_rc271_ex_imp-plnal = 01.
l_rc271_ex_imp-vbeln = 0690000006.
l_rc271_ex_imp-posnr = 000100.
 
l_rc27m_ex_imp-werks = 8800.
CALL FUNCTION CONVERSION_EXIT_MATN1_INPUT
  EXPORTING
    input        = 940602-01
  IMPORTING
    output       = l_rc27m_ex_imp-matnr
  EXCEPTIONS
    length_error = 1
    OTHERS       = 2.
 
l_save_di_imp-save_error = X.
l_save_di_imp-syn_save   = X.
 
REFRESH:lit_plmz.
CLEAR:lwa_plmz.
lwa_plmz-acttyp = H.               "create
lwa_plmz-plnal  = 01.              "Group Counter
lwa_plmz-plnfl  = 000000.          "Sequence
lwa_plmz-plnkn  = 00000000.        "Node number (batch input)
lwa_plmz-vornr  = 0030.            "Operation/Activity Number
lwa_plmz-stlty  = K.               "BOM category:order bom
lwa_plmz-stlnr  = 00001094.        "Bill of material
lwa_plmz-stlal  = 01.              "Alternative BOM
lwa_plmz-stlkn  = 00000001.        "Node number (batch input)
lwa_plmz-posnr  = 0010.            "BOM Item Number
*       "Material Number components
CALL FUNCTION CONVERSION_EXIT_MATN1_INPUT
  EXPORTING
    input        = 57432049
  IMPORTING
    output       = lwa_plmz-matnr
  EXCEPTIONS
    length_error = 1
    OTHERS       = 2.
lwa_plmz-werks  = 8800.             "plant
lwa_plmz-stlst  = 1.                "Order level
lwa_plmz-stlwg  = 1.                "Order path
CALL FUNCTION CONVERSION_EXIT_MATN1_INPUT
  EXPORTING
    input        = 940602-01
  IMPORTING
    output       = lwa_plmz-bomat
  EXCEPTIONS
    length_error = 1
    OTHERS       = 2.
* stlnr_w  stlal_w stlty_w是上层物料BOM和Alternative BOM,
* 如果上层物料是Phantom件,接着向上找,一直找到非Phantom件
lwa_plmz-stlnr_w = 00001093.        "
lwa_plmz-stlal_w = 01.              "
lwa_plmz-stlty_w = K.               "
lwa_plmz-stlan   = 1.               "BOM Usage
APPEND lwa_plmz TO lit_plmz.
REFRESH:lit_err,
        lit_obj_null_field.
CALL FUNCTION CP_BD_DIRECT_INPUT_PLAN_EXT
  EXPORTING
    rc271_ex_imp              = l_rc271_ex_imp
    rc27m_ex_imp              = l_rc27m_ex_imp
    save_di_imp               = l_save_di_imp
  TABLES "MAPL_DI_EX_TAB
    plko_di_ex_tab            = lit_plko[]
    mapl_di_ex_tab            = lit_mapl[]
    plpo_di_ex_tab            = lit_plpo[]
    plfl_di_ex_tab            = lit_plfl[]
    plfh_di_ex_tab            = lit_plfh[]
    text_obj_di_ex_tab        = lit_text[]
    text_di_tab               = lit_text_di_tab[]
    knowl_alloc_di_ex_tab     = lit_rcuob2[]
    knowl_alloc_obj_di_ex_tab = lit_rcuob1_ex[]
    plmz_di_ex_tab            = lit_plmz[]
    obj_null_field_tab        = lit_obj_null_field[]
    error_plan_di_tab         = lit_err_di[]
    error_plan_tab            = lit_err[].
 
LOOP AT lit_err INTO lwa_err.
  "error handling
ENDLOOP.

程序运行结果,30的operation分配成功

技术图片

以上。

 

以上是关于销售订单BOM组件分配(CP_BD_DIRECT_INPUT_PLAN_EXT)的主要内容,如果未能解决你的问题,请参考以下文章

关于订单BOM替换组件不成功的问题

NetSuite,如果分配了潜在客户与客户,则阻止引用销售订单(通过销售订单按钮)

BOM在生产管理中的作用

MySQL_杭州11月销售昨日未上架的SKU_20161212

SAP中怎么删除BOM组件中的其中一个组件,点删除显示已被分配给任务清单删除不了怎么办?

SD自定义销售订单审批状态