博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
服务确定撤销/删除/关闭 (ml81n)
阅读量:6582 次
发布时间:2019-06-24

本文共 5675 字,大约阅读时间需要 18 分钟。

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.

 

转载于:https://www.cnblogs.com/caizjian/p/6074218.html

你可能感兴趣的文章
[Usaco2005 Open]Disease Manangement 疾病管理 BZOJ1688
查看>>
【Android视图效果】分组列表实现吸顶效果
查看>>
多文件上传示例源码(默认支持各种类型,包括图片)
查看>>
Tomcat 关于表单提交数据量过大导致数据丢失的问题
查看>>
金融数据库
查看>>
mysql优化:连接数
查看>>
PHP 时间操作 / 跳转问题
查看>>
使用流的方式往页面前台输出图片
查看>>
java核心技术反射
查看>>
LAMP,安装脚本
查看>>
电脑上怎样压缩图片大小
查看>>
lnmp安装
查看>>
【在线研讨-现场文字】《敏捷开发用户故事分类与组织结构(二期-3)》2012-07-03...
查看>>
易语言 --什么情况下 用许可证
查看>>
建属于自己的网站
查看>>
boost库之智能指针
查看>>
我的友情链接
查看>>
自定义View Client 登录方式(一)
查看>>
我的友情链接
查看>>
我来自CSDN
查看>>