服务确定撤销/删除/关闭 (ml81n)
Posted 学习笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了服务确定撤销/删除/关闭 (ml81n)相关的知识,希望对你有一定的参考价值。
FUNCTION zrfc_mm006. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" VALUE(CALLNO) TYPE ZCALLNO *" VALUE(SHEET_NO) LIKE ESSR-LBLNI OPTIONAL *" VALUE(BLDAT) LIKE ESSR-BLDAT DEFAULT SY-DATUM *" VALUE(BUDAT) LIKE ESSR-BUDAT DEFAULT SY-DATUM *" VALUE(OPERATE) TYPE CHAR1 *" VALUE(EBELN) LIKE BAPIESSRC-PO_NUMBER OPTIONAL *" VALUE(EBELP) LIKE BAPIESSRC-PO_ITEM OPTIONAL *" EXPORTING *" VALUE(E_SHEET_NO) LIKE ESSR-LBLNI *" VALUE(FLAG) LIKE BAPIRET2-TYPE *" VALUE(MESSAGE) LIKE BAPIRET2-MESSAGE *"---------------------------------------------------------------------- *备注:删除服务确定表单,必须先撤销 . DATA: lv_row LIKE essr-lblni, lv_message LIKE bapiret2-message. DATA lv_datano TYPE zdatano. DATA lv_mode TYPE char1 VALUE ‘N‘. DATA ls_sheetheader TYPE bapiessrc. *******数据检查 IF operate = ‘R‘ OR operate = ‘D‘. IF sheet_no IS INITIAL. flag = ‘E‘. message = ‘请输入确定表单号‘. RETURN. ENDIF. ELSEIF operate = ‘F‘. IF ebeln IS INITIAL OR ebelp IS INITIAL . flag = ‘E‘. message = ‘请输入采购订单和项目‘. RETURN. ENDIF. ENDIF. ******撤销服务确定表单 IF operate = ‘R‘. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0400‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=SELP‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘RM11P-NEW_ROW‘. PERFORM bdc_field USING ‘RM11P-NEW_ROW‘ lv_row. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0340‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘RM11R-LBLNI‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=ENTE‘. PERFORM bdc_field USING ‘RM11R-LBLNI‘ sheet_no. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0400‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=AKCH‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘RM11P-NEW_ROW‘. PERFORM bdc_field USING ‘RM11P-NEW_ROW‘ lv_row. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0400‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=ACCR‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘RM11P-NEW_ROW‘. PERFORM bdc_field USING ‘RM11P-NEW_ROW‘ lv_row. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0400‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=SAVE‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘RM11P-NEW_ROW‘. PERFORM bdc_field USING ‘RM11P-NEW_ROW‘ lv_row. PERFORM bdc_dynpro USING ‘SAPLSPO1‘ ‘0300‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=YES‘. PERFORM bdc_dynpro USING ‘SAPLMLSR‘ ‘0110‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘IMKPF-BUDAT‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=ENTE‘. PERFORM bdc_field USING ‘IMKPF-BLDAT‘ bldat. PERFORM bdc_field USING ‘IMKPF-BUDAT‘ budat. REFRESH messtab. CALL TRANSACTION ‘ML81N‘ USING bdcdata MODE lv_mode UPDATE ‘L‘ MESSAGES INTO messtab. CLEAR gt_return. CALL FUNCTION ‘CONVERT_BDCMSGCOLL_TO_BAPIRET2‘ TABLES imt_bdcmsgcoll = messtab ext_return = gt_return. ******删除已撤销的服务确定表单 ELSEIF operate = ‘D‘. CLEAR: gt_return. CALL FUNCTION ‘BAPI_ENTRYSHEET_DELETE‘ EXPORTING entrysheet = sheet_no TABLES return = gt_return. ******关闭服务采购订单 ELSEIF operate = ‘F‘. ls_sheetheader-po_number = ebeln. "采购订单 ls_sheetheader-po_item = ebelp. "采购订单行项目 ls_sheetheader-doc_date = bldat. "凭证日期 ls_sheetheader-post_date = budat. "过账日期 ls_sheetheader-fin_entry = ‘F‘. "标识:关闭 CLEAR gt_return. CALL FUNCTION ‘BAPI_ENTRYSHEET_CREATE‘ EXPORTING entrysheetheader = ls_sheetheader IMPORTING entrysheet = e_sheet_no TABLES return = gt_return. ENDIF. ******返回消息处理 CLEAR:gs_return, message, lv_message. READ TABLE gt_return INTO gs_return WITH KEY type = ‘E‘. IF sy-subrc NE 0. flag = ‘S‘. IF operate = ‘R‘. CONCATENATE ‘服务确认表单:‘ sheet_no ‘ 撤销成功‘ INTO message. ELSEIF operate = ‘D‘. CONCATENATE ‘表单确认表单:‘ sheet_no ‘ 删除成功‘ INTO message. ENDIF. ELSE. LOOP AT gt_return INTO gs_return WHERE type CA ‘AEX‘. MESSAGE ID gs_return-id TYPE gs_return-type NUMBER gs_return-number WITH gs_return-message_v1 gs_return-message_v2 gs_return-message_v3 gs_return-message_v4 INTO lv_message. CONCATENATE message lv_message INTO message SEPARATED BY ‘|‘. ENDLOOP. SHIFT message LEFT DELETING LEADING ‘|‘. flag = ‘E‘. ENDIF. CLEAR:gt_log,gs_log. lv_datano = lv_datano + 1. gs_log-datano = lv_datano. gs_log-name = ‘ZRFC_MM006‘. gs_log-cdate = sy-datum. GET TIME. gs_log-ctime = sy-uzeit. gs_log-callno = callno. gs_log-flag = flag. gs_log-log = message. CONCATENATE sheet_no bldat budat operate ebeln ebelp e_sheet_no INTO gs_log-content. CONDENSE gs_log-content NO-GAPS. gs_log-length = STRLEN( gs_log-content ). APPEND gs_log TO gt_log. IF gt_log IS NOT INITIAL. INSERT zrfc_mm01in_log FROM TABLE gt_log. IF sy-subrc = 0. COMMIT WORK. ENDIF. ENDIF. ENDFUNCTION.
以上是关于服务确定撤销/删除/关闭 (ml81n)的主要内容,如果未能解决你的问题,请参考以下文章
git push完毕,发现错了,怎么撤销,回退?新建了分支怎么删除?