首页 > 其他分享 >ABAP:ME21N状态栏添加自定义按钮

ABAP:ME21N状态栏添加自定义按钮

时间:2024-02-18 16:33:53浏览次数:26  
标签:wa 状态栏 自定义 ME21N lv ls bukrs ekko ebeln

SE38:LMEGUICJL---->代码增强点

ENHANCEMENT 1  Z_SEND_PO_TO_OA.    "active version
IF im_fcode = 'OA'.

  DATA: ls_return TYPE zscomm03,
        lv_bsart  TYPE ekko-bsart.
  DATA: lv_status TYPE zshr0004,
        ls_ekko TYPE ekko.

  CLEAR im_fcode.

  DATA: wa_ebeln TYPE ebeln.
  DATA: wa_bukrs TYPE bukrs.
  DATA: lv_flag.

  IF sy-tcode = 'ME21N'.
    GET PARAMETER ID 'BES' FIELD wa_ebeln.
    SELECT SINGLE bukrs INTO wa_bukrs FROM ekko WHERE ebeln = wa_ebeln.
  ELSE.
    DATA: field(50).
    FIELD-SYMBOLS: <dbcnt> TYPE any.
    field = '(SAPLMEGUI)MEPO_TOPLINE-EBELN'.
    ASSIGN (field) TO <dbcnt>.
    wa_ebeln = <dbcnt>.

    SELECT SINGLE bukrs INTO wa_bukrs FROM ekko WHERE ebeln = wa_ebeln.

  ENDIF.

  IF wa_ebeln IS INITIAL.
    IF sy-langu = 'E'.
      MESSAGE w001(00) WITH 'Po not found, please check the data!'DISPLAY LIKE 'W'.
    ELSE.
      MESSAGE w001(00) WITH '未找到PO,请检查数据!'DISPLAY LIKE 'W'.
    ENDIF.
  ENDIF.

  CHECK wa_ebeln IS NOT INITIAL.

  IF sy-mandt = '320' OR sy-mandt = '620' OR sy-mandt = '820'.

    SELECT SINGLE bsart
      FROM ekko
      INTO lv_bsart
     WHERE ebeln = wa_ebeln.

    IF lv_bsart = 'NB' OR lv_bsart = 'FNB' OR lv_bsart = 'ZNBS' OR lv_bsart = 'GDZC' OR lv_bsart = 'GXWX' OR lv_bsart = 'LXCG'.
      SELECT SINGLE * INTO ls_ekko FROM ekko WHERE ebeln = wa_ebeln.
      IF ls_ekko-frgzu IS NOT INITIAL AND ls_ekko-frggr = 'P1' AND ls_ekko-frgsx = 'P1'.
        MESSAGE  '采购订单已审批,请勿发送OA' TYPE 'E'.
      ENDIF.
      CALL FUNCTION 'ZFMMM_PO_SEND'
        EXPORTING
          iv_ifid   = '003'
          iv_ebeln  = wa_ebeln
        IMPORTING
          es_return = ls_return.
      IF ls_return-type <> 'W'.
        lv_status-code    = ls_return-type.
        lv_status-message = ls_return-message.
      ENDIF.
    ENDIF.

  ELSE.

    DATA: lr_bukrs TYPE RANGE OF bukrs,
          ls_bukrs LIKE LINE OF lr_bukrs,
          lr_ebeln TYPE RANGE OF ebeln,
          ls_ebeln LIKE LINE OF lr_ebeln.

    CLEAR:lr_bukrs[],lr_bukrs,ls_bukrs,lr_ebeln[],lr_ebeln,ls_ebeln.

    ls_bukrs-sign = 'I'.
    ls_bukrs-option = 'EQ'.
    ls_bukrs-low = wa_bukrs.
    APPEND ls_bukrs TO lr_bukrs.

    ls_ebeln-sign = 'I'.
    ls_ebeln-option = 'EQ'.
    ls_ebeln-low = wa_ebeln.
    APPEND ls_ebeln TO lr_ebeln.

    EXPORT oa_flag = 'X' TO MEMORY ID zpo_send_oa_memory_id=>oa_flag.

    SUBMIT zmmi0004
      WITH s_bukrs IN lr_bukrs
      WITH s_ebeln IN lr_ebeln
      AND RETURN.


    IMPORT oa_return TO lv_status FROM MEMORY ID zpo_send_oa_memory_id=>oa_stauts.

    FREE MEMORY ID zpo_send_oa_memory_id=>oa_stauts.

  ENDIF.

  IF lv_status-code = 'E'.
    MESSAGE s001(00) WITH lv_status-message DISPLAY LIKE 'W'.
  ELSEIF lv_status-code = 'S'.
    IF sy-langu = 'E'.
      MESSAGE s001(00) WITH 'Po sent OA successfully!'DISPLAY LIKE 'S'.
    ELSE.
      MESSAGE s001(00) WITH 'PO 发送 OA 成功!'DISPLAY LIKE 'S'.
    ENDIF.
  ELSE.
    DATA l_ekko LIKE ekko.

    CLEAR l_ekko.

    SELECT SINGLE * INTO l_ekko FROM ekko WHERE ebeln = wa_ebeln.
    IF l_ekko-frgzu IS NOT INITIAL AND l_ekko-frggr = 'P1' AND l_ekko-frgsx = 'P1'.
      IF sy-langu = 'E'.
        MESSAGE s001(00) WITH 'Po has been sent to OA, no need to re execute!'DISPLAY LIKE 'S'.
      ELSE.
        MESSAGE s001(00) WITH 'PO已经发送 OA,不需要重新执行!'DISPLAY LIKE 'S'.
      ENDIF.
    ELSEIF l_ekko-frgzu IS INITIAL.
      IF sy-langu = 'E'.
        MESSAGE s001(00) WITH 'Po does not need to be sent to OA for approval!'DISPLAY LIKE 'S'.
      ELSE.
        MESSAGE s001(00) WITH 'PO不需要发送OA审批!'DISPLAY LIKE 'S'.
      ENDIF.
    ELSE.
      IF sy-langu = 'E'.
        MESSAGE s001(00) WITH 'The Po has been approved and does not need to be sent to OA for approval!'DISPLAY LIKE 'S'.
      ELSE.
        MESSAGE s001(00) WITH 'PO已经审批通过,不需要发送OA审批!'DISPLAY LIKE 'S'.
      ENDIF.
    ENDIF.
  ENDIF.

ENDIF.
ENDENHANCEMENT.

 

标签:wa,状态栏,自定义,ME21N,lv,ls,bukrs,ekko,ebeln
From: https://www.cnblogs.com/ap-ad-java-abap/p/18019513

相关文章

  • Go模仿gin自定义中间件
    packagemainimport( "fmt" "net/http")//中间件函数类型typeMiddlewareFuncfunc(http.HandlerFunc)http.HandlerFunc//自定义中间件1funcLoggerMiddleware(nexthttp.HandlerFunc)http.HandlerFunc{ returnfunc(whttp.ResponseWriter,req*ht......
  • java自定义中文排序比较器
    1、先看看排序结果 2、自定义中文比较器//Comparator<String[]>中String[]表示的是每一行数据classStringArrayComparatorimplementsComparator<String[]>{privatefinalList<SortDTO>sortDTOList;//排序信息集合privatefinalCollatorcollator=Coll......
  • Windows Server 2022 新的服务管理 API 提供了更多的选项和功能,可以更灵活地进行服务
    sc 命令是Windows操作系统自带的一种命令行实用程序,用于创建、删除、启动、停止以及配置Windows服务。通过 sc 命令,您可以直接将可执行文件注册为服务,而不需要第三方工具的帮助。sc 命令提供了丰富的选项,如启动类型、依赖关系、服务描述等。instsrv 和 srvany 是两个......
  • c# aveva marine hull design Design Explorer 的自定义
    首先显示界面如下左边为改造后的,右边为默认的界面1#将内部名称显示改为装配名显示2#直接显示了零件是否已经拉装配这部分代码也很简单其次改造下元素的右键菜单封装的方法,没写注释,看不明白可以联系我交流publicclassMyDesignExplorerRightClicKAtt:Attribute{......
  • 如何使用TailwindCSS和JavaScript构建自定义的HTML5视频播放器
    HTML5自带了一个原生视频播放器。它在浏览器中配备了简单的用户界面、功能和一些基本的控件。尽管通过浏览器的默认视频播放器的功能完美运行,但用户界面并不那么美观和时尚,总体上并不令人满意。因此,大多数现代Web应用程序和平台,如Udemy、Netflix、YouTube和AmazonPrime,不会将默......
  • C++ map自定义比较函数遵守严格弱序
    C++map自定义比较函数遵守严格弱序问题背景及定位背景:这个问题是在将tablesaw(一个Java的数据处理项目)迁移到C++时出现的。问题位置:SplitOn()函数,在数据流水线中的aggregate阶段。问题描述:使用google/benchmark进行了批量化的性能测试,在测试中出现偶发性段错误,几率大约在万分......
  • jvm shutdownHook + spring 自定义事件实现业务处理
    jvm的shutdownHook可以实现对于jvm退出的一些处理,比如资源清理,异常事件通知,spring自定义事件(或者使用内部的)可以实现bean的一些事件驱动处理,两个结合起来可以方便我们进行一些业务处理一些业务场景资源清理服务停止业务状态一致性补偿服务注册场景中的取消注册服务停......
  • springboot自定义starter 版本大于2.7
    相关jar包<!--提示配置--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><version>3.2.1</versi......
  • qt自定义标题栏,纯代码实现,拿来即用,初始化列表时传入父窗口的this指针
    //头文件#ifndefTITLEBAR_H#defineTITLEBAR_H#include<QWidget>#include<QPoint>//坐标点#include<QMouseEvent>//鼠标事件classTitleBar:publicQWidget{Q_OBJECTpublic:explicitTitleBar(QWidget*parent=nullptr);//移动窗口......
  • elsa-core自定义Activity创建Bookmark人工任务完成
    //实现一个自定的activity用于人工处理的节点publicclassMyRunTask:Activity<object>{[Input(Description="Thenameofthetaskbeingrequested.")]publicInput<string>TaskName{get;set;}=default!;///<inheritdo......