*"---------------------------------------------------------------------- *"*"本地接口: *" IMPORTING *" REFERENCE(IN_EBELN) TYPE BAPIMMPARA-PO_NUMBER *" REFERENCE(IN_FLAG) TYPE CHAR01 *" REFERENCE(IN_FRGCO) TYPE BAPIMMPARA-PO_REL_COD *" EXPORTING *" REFERENCE(OUT_MSG) TYPE STRING *"---------------------------------------------------------------------- CLEAR:OUT_MSG. IF IN_FLAG = 'Y'. CALL FUNCTION 'BAPI_PO_RELEASE' EXPORTING PURCHASEORDER = IN_EBELN PO_REL_CODE = IN_FRGCO EXCEPTIONS AUTHORITY_CHECK_FAIL = 1 DOCUMENT_NOT_FOUND = 2 ENQUEUE_FAIL = 3 PREREQUISITE_FAIL = 4 RELEASE_ALREADY_POSTED = 5 RESPONSIBILITY_FAIL = 6 OTHERS = 7. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. OUT_MSG = 'S'. ENDIF. ELSEIF IN_FLAG = 'N'. CALL FUNCTION 'BAPI_PO_RESET_RELEASE' EXPORTING PURCHASEORDER = IN_EBELN PO_REL_CODE = IN_FRGCO EXCEPTIONS AUTHORITY_CHECK_FAIL = 1 DOCUMENT_NOT_FOUND = 2 ENQUEUE_FAIL = 3 PREREQUISITE_FAIL = 4 RELEASE_ALREADY_POSTED = 5 RESPONSIBILITY_FAIL = 6 NO_RELEASE_ALREADY = 7 NO_NEW_RELEASE_INDICATOR = 8 OTHERS = 9. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. OUT_MSG = 'S'. ENDIF. ENDIF.
相关表:
透明表 T16FS 批准策略
T16FE 批准标识的描述:采购凭证
使用ME25K 审批按钮跟踪:
标准事物: ME29N 采购订单审批
ME35K 采购合同审批
都会走程序 SAPLMEREP
包含文件 LMEREPI20
调用函数 BAPI_PO_RELEASE
标准代码
METHOD rel_resetrel. DATA: ls_outtab TYPE merep_outtab_purchdoc_rel, l_model TYPE REF TO lcl_reporting_model, l_datablade TYPE REF TO lcl_datablade_general, l_frgab TYPE rm06b-frgab, l_frgzu TYPE ekko-frgzu, l_frgke TYPE ekko-frgke, l_ebeln TYPE ekko-ebeln. FIELD-SYMBOLS: <line> LIKE LINE OF gt_outtab_purchdoc_rel. l_model = my_view->get_model( ). l_datablade ?= l_model->get_current_datablade( ). l_frgab = l_datablade->get_option( 'FRGAB' ). CHECK NOT l_frgab IS INITIAL. MOVE-CORRESPONDING im_wa TO ls_outtab. CASE ls_outtab-icon_release. WHEN lcl_datablade_purchdoc_rel=>my_icon_allowed. * release CALL FUNCTION 'BAPI_PO_RELEASE' EXPORTING purchaseorder = ls_outtab-ebeln po_rel_code = l_frgab use_exceptions = 'X' IMPORTING rel_status_new = l_frgzu rel_indicator_new = l_frgke EXCEPTIONS error_message = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. * update output table LOOP AT gt_outtab_purchdoc_rel ASSIGNING <line> WHERE ebeln = ls_outtab-ebeln. IF l_ebeln NE ls_outtab-ebeln. <line>-icon_release = lcl_datablade_purchdoc_rel=>my_icon_done. l_ebeln = ls_outtab-ebeln. ELSE. CLEAR <line>-icon_release. ENDIF. <line>-frgzu = l_frgzu. <line>-frgke = l_frgke. SELECT SINGLE frget FROM t16fe INTO <line>-frget WHERE spras EQ sy-langu AND frgke EQ l_frgke. ENDLOOP. ENDIF. WHEN lcl_datablade_purchdoc_rel=>my_icon_done. * reset release CALL FUNCTION 'BAPI_PO_RESET_RELEASE' EXPORTING purchaseorder = ls_outtab-ebeln po_rel_code = l_frgab use_exceptions = 'X' IMPORTING rel_status_new = l_frgzu rel_indicator_new = l_frgke EXCEPTIONS error_message = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. LOOP AT gt_outtab_purchdoc_rel ASSIGNING <line> WHERE ebeln = ls_outtab-ebeln. IF l_ebeln NE ls_outtab-ebeln. <line>-icon_release = lcl_datablade_purchdoc_rel=>my_icon_allowed. l_ebeln = ls_outtab-ebeln. ELSE. CLEAR <line>-icon_release. ENDIF. <line>-frgzu = l_frgzu. <line>-frgke = l_frgke. SELECT SINGLE frget FROM t16fe INTO <line>-frget WHERE spras EQ sy-langu AND frgke EQ l_frgke. ENDLOOP. ENDIF. ENDCASE. ENDMETHOD. "rel_resetrel