ABAP 计划订单转生产订单

Posted 想发财的小夏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ABAP 计划订单转生产订单相关的知识,希望对你有一定的参考价值。

需求:计划订单转生产订单程序,允许修改计划订单数量/时间

    " Create BAPI_PLANNEDORDER_CHANGE
    CALL FUNCTION 'BAPI_PLANNEDORDER_CHANGE'
      EXPORTING
        plannedorder = <fs_alv>-plnum
        headerdata   = VALUE bapiplaf_i2(
        total_plord_qty  = <fs_alv>-gsmng
        version          = <fs_alv>-verid
        order_start_date = <fs_alv>-psttr
        order_fin_date   = <fs_alv>-pedtr
        firming_ind      = 'X'          " 标识必打,不然转单bapi报错
        conversion_ind   = 'X' )    " 标识必打,不然转单bapi报错
        headerdatax  = VALUE bapiplaf_i2x(
        total_plord_qty  = 'X'
        version          = 'X'
        order_start_date = 'X'
        order_fin_date   = 'X'
        firming_ind      = 'X'
        conversion_ind   = 'X' )
      IMPORTING
        return       = ls_ret.

    IF ls_ret-type CA 'AEX'.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      <fs_alv>-icon  = gc_red.
      <fs_alv>-msg   = |计划订单修改报错: ls_ret-message |.
      CONTINUE.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.

    " Create BAPI_PRODORD_CREATE 
    CLEAR:ls_return,lv_order_number.
    CALL FUNCTION 'BAPI_PRODORD_CREATE_FROM_PLORD'
      EXPORTING
        planned_order    = <fs_alv>-plnum
        order_type       = <fs_alv>-auart
      IMPORTING
        production_order = lv_order_number
        return           = ls_return.

    IF ls_return-type CA 'AEX'.

      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      <fs_alv>-icon  = gc_red.
      <fs_alv>-msg   = |创建生产订单报错: ls_return-message |.

    ELSE.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      <fs_alv>-icon  = gc_green.
      <fs_alv>-msg   = |生产订单创建成功,订单号: lv_order_number |.
      <fs_alv>-aufnr = lv_order_number.
 
    ENDIF.

 

以上是关于ABAP 计划订单转生产订单的主要内容,如果未能解决你的问题,请参考以下文章

ABAP 计划订单转生产订单

ABAP生产订单号码是哪张表

[求助]关于ABAP中找生产订单状态的问题

ABAP生产订单收货增强控制

ABAP生产订单收货增强控制

abap 获取生产订单标准工时和实际报工工时的报表