PS 项目报工与取消

1、项目报工

1.1、CN25

 

1.2、BAPI:BAPI_NETWORK_CONF_ADD

"-----------------------------@斌将军-----------------------------
DATA:lv_number             TYPE bapi_network_list-network,
     lv_post_wrong_entries TYPE bapi_coru_param-ins_err,
     lv_testrun            TYPE bapi_coru_param-testrun,
     ls_return             TYPE bapiret2,
     lt_confirmations      TYPE TABLE OF bapi_network_conf_add,
     ls_confirmations      TYPE bapi_network_conf_add,
     lt_message_table      TYPE TABLE OF bapi_conf_return,
     ls_message_table      TYPE bapi_conf_return.

DATA:lv_message TYPE char200,
     lv_check   TYPE char1.

lv_number = '50000077'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = lv_number
  IMPORTING
    output = lv_number.

ls_confirmations-activity = '0010'."作业
ls_confirmations-plant = '1011'."工厂
ls_confirmations-work_cntr = 'ZPS00003'."工作中心
ls_confirmations-fin_conf = ''."最终确认
ls_confirmations-act_work = '7'."实际工时
ls_confirmations-un_act_work = 'H'."单位
ls_confirmations-act_type = 'A001'."作业类型
ls_confirmations-postg_date = '20221025'."过账日期
APPEND ls_confirmations TO lt_confirmations.
*5.    最终确认AUERU=FIN_CONF(X或空)
*6.    实际工时ISMNW=ACT_WORK
*7.    单位ISMNE=UN_ACT_WORK
*8.    作业类型LEARR=ACT_TYPE
*9.    过账日期BUDAT=POSTG_DATE


CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

CALL FUNCTION 'BAPI_NETWORK_CONF_ADD'
  EXPORTING
    number          = lv_number
*   POST_WRONG_ENTRIES       = 0
*   TESTRUN         =
  IMPORTING
    return          = ls_return
  TABLES
    i_confirmations = lt_confirmations
    e_message_table = lt_message_table.

CLEAR:lv_check,lv_message.
LOOP AT lt_message_table into ls_message_table WHERE type CA 'AEX'.
  lv_message = lv_message && ls_message_table-message.
  lv_check = 'E'.
ENDLOOP.
IF lv_check = 'E'.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
ENDIF.
"-----------------------------@斌将军-----------------------------

2、项目取消报工

2.1、CN29

2.2、BAPI:BAPI_NETWORK_CONF_CANCEL

"-----------------------------@斌将军-----------------------------
DATA:lv_number           TYPE bapi_network_list-network,
     ls_conf_cancel      TYPE bapi_network_conf_key2,
     ls_additional_infos TYPE bapi_network_conf_cancel,
     ls_return           TYPE bapiret2.

DATA:lv_message TYPE char200,
     lv_check   TYPE char1.

lv_number = '50000077'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = lv_number
  IMPORTING
    output = lv_number.

ls_conf_cancel-activity = '0010'."作业
ls_conf_cancel-conf_cnt = '3'."确认计数器

ls_additional_infos-postg_date = '20220826'."过账日期
ls_additional_infos-conf_cancel_text = '111'."取消原因

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

CALL FUNCTION 'BAPI_NETWORK_CONF_CANCEL'
  EXPORTING
    number           = lv_number
    conf_cancel      = ls_conf_cancel
    additional_infos = ls_additional_infos
  IMPORTING
    return           = ls_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.
"-----------------------------@斌将军-----------------------------

 

定期更文,欢迎关注

 
 
posted @ 2022-10-27 14:58  斌将军  阅读(133)  评论(0编辑  收藏  举报