CN22设置网络系统状态或用户状态 - BAPI_BUS2002_SET_STATUS
程序员文章站
2022-07-06 11:05:05
...
BAPI: BAPI_BUS2002_SET_STATUS
具体用法注意事项可以参看BAP参考文档
调用BAPI之前,首先调用BAPI_PS_INITIALIZATION
调用BAPI之后,如果调用成功,首先执行操作CALL FUNCTION 'BAPI_PS_PRECOMMIT'.
然后再 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
METHOD mt_set_network_sys_status.
*The following system statuses are supported for the network header:
*•'REL' Released (I0002) set
*•'LKD' Locked (I0043) set/revoke
*•'TECO' Technically completed (I0045) set/revoke
*•'CLSD' Closed (I0046) set/revoke
*•'AALK' Account Assignment locked (I0064) set/revoke
*•'DLFL' Deletion flag (I0076) set/revoke
DATA: lv_aufnr TYPE bapi_network_list-network,
lv_sys_status TYPE bapi_system_status-system_status,
ls_return TYPE bapireturn1,
lt_result TYPE TABLE OF bapi_status_result,
lv_message TYPE string.
CLEAR: es_return.
CHECK iv_aufnr IS NOT INITIAL AND iv_sys_status IS NOT INITIAL.
lv_aufnr = |{ iv_aufnr ALPHA = IN }|.
lv_sys_status = iv_sys_status.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
CALL FUNCTION 'BAPI_BUS2002_SET_STATUS'
EXPORTING
number = lv_aufnr
* UNDO_SYSTEM_STATUS =
* UNDO_USER_STATUS =
set_system_status = lv_sys_status
* SET_USER_STATUS =
IMPORTING
return = es_return
TABLES
* I_ACTIVITY_SYSTEM_STATUS =
* I_ACTIVITY_USER_STATUS =
e_result = lt_result.
IF es_return-type CA 'AEX'.
lv_message = es_return-message.
ENDIF.
IF lv_message IS INITIAL.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
es_return-type = 'S'.
es_return-message = '系统状态更新成功'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
IF iv_popup_flag = 'X'.
MESSAGE i001(00) WITH '网络系统状态更新失败,请到CN22中手动设置删除状态,网络号' lv_aufnr DISPLAY LIKE 'E'.
ENDIF.
ENDIF.
ENDMETHOD.
上述代码,传入参数如下
效果如下:
上一篇: 202.(1249)移除无效的括号