SAP ABAP se16n 双击跳转实现

参考老白 SAP小技巧 改造SE16N(九 双击跳转及字段描述优化) (qq.com)

se16n 双击跳转实现 我的实现

se38 lse16nlcl 287行

  call method cl_gui_control=>set_focus
                                      exporting control = alv_grid.
*.....at the moment do detail view on double click
      CALL METHOD cl_gui_cfw=>flush.
      check: es_row_no-row_id > 0.
      CALL METHOD alv_grid->GET_CURRENT_CELL
           IMPORTING
             E_ROW     = ld_row
             E_col     = ld_col
             Es_row_no = es_row_no
             E_value   = ld_value.

*.....check which action the user wants to do with double click
*{   INSERT         DEVK907773                                        3
      DATA:LV_FNAME TYPE FIELDNAME.
      data:lv_tabname TYPE tabname.
      DATA:  LV_ID      TYPE ZTEXIT-ID,          "增强序列号
    LV_STATUS  TYPE CHAR1.
    LV_ID = 'ZFI103'.
    CALL FUNCTION 'ZABAP_CHECK_EXIT'
    EXPORTING
      ID       = LV_ID
    IMPORTING
      E_STATUS = LV_STATUS.
    if LV_STATUS = 'S'.
       FIELD-SYMBOLS <LT_ALV> TYPE STANDARD TABLE.
       FIELD-SYMBOLS <FS_TABNAM> TYPE ANY.
       IF <ALL_TABLE_CELL> IS ASSIGNED.
         IF LINES( <ALL_TABLE_CELL> ) = 0.
           ASSIGN GD_DREF->* TO <LT_ALV>.
           READ TABLE <LT_ALV> ASSIGNING FIELD-SYMBOL(<LS_ALV>) INDEX ES_ROW_NO-ROW_ID.
         ELSE.
           READ TABLE <ALL_TABLE_CELL> ASSIGNING <LS_ALV> INDEX ES_ROW_NO-ROW_ID.
         ENDIF.
       ELSE.
         ASSIGN GD_DREF->* TO <LT_ALV>.
         READ TABLE <LT_ALV> ASSIGNING <LS_ALV> INDEX ES_ROW_NO-ROW_ID.
       ENDIF.
       IF SY-SUBRC = 0.
         LV_FNAME = E_COLUMN.
         ASSIGN ('(SAPLSE16N)GD-TAB') TO <FS_TABNAM>.

         DATA:LV_LINKED(1).
         CALL FUNCTION 'Z_BC_REP_CALL_TRANSACTION'
         EXPORTING
           iv_TABNAME  = <FS_TABNAM>
           IV_FILEDNAME = LV_FNAME
           LS_DATA = <LS_ALV>
         IMPORTING
            EV_LINKED = LV_LINKED.
         IF LV_LINKED = 'X'.
           RETURN.
         ENDIF.
       ENDIF.
      endif.
*}   INSERT

se37

FUNCTION Z_BC_REP_CALL_TRANSACTION.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(IV_FILEDNAME) TYPE  FIELDNAME
*"     VALUE(LS_DATA)
*"     VALUE(IV_TABNAME) TYPE  TABNAME
*"  EXPORTING
*"     VALUE(EV_LINKED) TYPE  C
*"----------------------------------------------------------------------
  FIELD-SYMBOLS <FS> TYPE ANY.
  IF IV_TABNAME EQ 'VBFA'.
    FIELD-SYMBOLS <FSTYPE> TYPE ANY.
    ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
    CASE IV_FILEDNAME.
      WHEN 'VBELV'.
        ASSIGN COMPONENT 'VBTYP_V' OF STRUCTURE LS_DATA TO <FSTYPE>.
      WHEN 'VBELN'.
        ASSIGN COMPONENT 'VBTYP_N' OF STRUCTURE LS_DATA TO <FSTYPE>.
    ENDCASE.
    CASE <FSTYPE>.
      WHEN 'J'.
        SET PARAMETER ID 'VL' FIELD <FS>.
        CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'C'.
        SET PARAMETER ID 'AUN' FIELD <FS>.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'R' OR 'i' OR 'h'.
        FIELD-SYMBOLS <FSMJR> TYPE ANY.
        ASSIGN COMPONENT 'ERDAT' OF STRUCTURE LS_DATA TO <FSMJR>.
        CALL FUNCTION 'MIGO_DIALOG'
          EXPORTING
            I_ACTION            = 'A04'
            I_REFDOC            = 'R02'
            I_MBLNR             = <FS>
            I_MJAHR             = <FSMJR>+4
          EXCEPTIONS
            ILLEGAL_COMBINATION = 1
            OTHERS              = 2.
        EV_LINKED = 'X'.
      WHEN 'N' OR 'M'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        SET PARAMETER ID 'VF' FIELD <FS>.
        CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
    ENDCASE.
  ELSE.
    CASE IV_FILEDNAME.
      WHEN 'MATNR' OR 'IDNRK'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        SET PARAMETER ID 'MAT' FIELD <FS>.
        CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'VBELN'.
        IF IV_TABNAME = 'VBAK' OR IV_TABNAME = 'VBAP'.
          ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
          SET PARAMETER ID 'AUN' FIELD <FS>.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
          EV_LINKED = 'X'.
        ELSEIF IV_TABNAME = 'LIKP' OR IV_TABNAME = 'LIPS'.
          ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
          SET PARAMETER ID 'VL' FIELD <FS>.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
          EV_LINKED = 'X'.
        ELSEIF IV_TABNAME = 'VBKR' OR IV_TABNAME = 'VBRP'.
          ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
          SET PARAMETER ID 'VF' FIELD <FS>.
          CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
          EV_LINKED = 'X'.
        ENDIF.
      WHEN 'EBELN'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        SET PARAMETER ID 'BES' FIELD <FS>.
        CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'BELNR'.
        IF IV_TABNAME = 'BKPF' OR IV_TABNAME = 'BSEG' OR IV_TABNAME = 'ACDOCA'.
          FIELD-SYMBOLS <FSBUK> TYPE ANY.
          FIELD-SYMBOLS <FSGAJ> TYPE ANY.
          ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
          IF IV_TABNAME = 'ACDOCA'.
            ASSIGN COMPONENT 'RBUKRS' OF STRUCTURE LS_DATA TO <FSBUK>.
            ASSIGN COMPONENT 'GJAHR' OF STRUCTURE LS_DATA TO <FSGAJ>.
          ELSE.
            ASSIGN COMPONENT 'BUKRS' OF STRUCTURE LS_DATA TO <FSBUK>.
            ASSIGN COMPONENT 'GJAHR' OF STRUCTURE LS_DATA TO <FSGAJ>.
          ENDIF.
          SET PARAMETER ID 'GJR' FIELD <FSGAJ>.
          SET PARAMETER ID 'BUK' FIELD <FSBUK>.
          SET PARAMETER ID 'BLN' FIELD <FS>.
          CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
          EV_LINKED = 'X'.
        ELSEIF IV_TABNAME = 'RBKP' OR IV_TABNAME  = 'RSEG'.
          ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
          ASSIGN COMPONENT 'GJAHR' OF STRUCTURE LS_DATA TO <FSGAJ>.
          SET PARAMETER ID 'GJR' FIELD <FSGAJ>.
          SET PARAMETER ID 'RBN' FIELD <FS>.
          CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
          EV_LINKED = 'X'.
        ENDIF.
      WHEN 'AUFNR'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        SET PARAMETER ID 'ANR' FIELD <FS>.
        CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'KUNNR' OR 'LIFNR' OR 'PARTNER'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        DATA(REQUEST) = NEW CL_BUPA_NAVIGATION_REQUEST( ).
        REQUEST->SET_PARTNER_NUMBER( <FS> ).
        DATA(OPTIONS) = NEW CL_BUPA_DIALOG_JOEL_OPTIONS( ).
        OPTIONS->SET_NAVIGATION_DISABLED( ABAP_TRUE ).
        CL_BUPA_DIALOG_JOEL=>START_WITH_NAVIGATION( IV_REQUEST = REQUEST IV_OPTIONS = OPTIONS ).
        EV_LINKED = 'X'.
      WHEN 'MBLNR'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        ASSIGN COMPONENT 'MJAHR' OF STRUCTURE LS_DATA TO <FSMJR>.
        CALL FUNCTION 'MIGO_DIALOG'
          EXPORTING
            I_ACTION            = 'A04'
            I_REFDOC            = 'R02'
            I_MBLNR             = <FS>
            I_MJAHR             = <FSMJR>
          EXCEPTIONS
            ILLEGAL_COMBINATION = 1
            OTHERS              = 2.
        EV_LINKED = 'X'.
      WHEN 'HKONT'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        ASSIGN COMPONENT 'BUKRS' OF STRUCTURE LS_DATA TO <FSBUK>.
        IF IV_TABNAME = 'ACDOCA'.
          ASSIGN COMPONENT 'RBUKRS' OF STRUCTURE LS_DATA TO <FSBUK>.
        ENDIF.
        SET PARAMETER ID 'SAK' FIELD <FS>.
        SET PARAMETER ID 'BUK' FIELD <FSBUK>.
        CALL TRANSACTION 'FS00' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
      WHEN 'KOSTL'.
        ASSIGN COMPONENT IV_FILEDNAME OF STRUCTURE LS_DATA TO <FS>.
        SET PARAMETER ID 'KOS' FIELD <FS>.
        SET PARAMETER ID 'CAC' FIELD '1000'.
        CALL TRANSACTION 'KS03' AND SKIP FIRST SCREEN.
        EV_LINKED = 'X'.
    ENDCASE.
  ENDIF.
ENDFUNCTION.
相关推荐
momo_aa4 小时前
mac找到主目录下的文件夹
经验分享
天行健PLUS10 小时前
【经验分享】六西格玛管理培训适合哪些人参加?
经验分享
清涔秋风10 小时前
自动驾驶革命:从特斯拉到百度,谁将主宰未来交通?
其他
小奥超人11 小时前
PPT文件设置了修改权限,如何取消权?
windows·经验分享·microsoft·ppt·办公技巧
清涔秋风12 小时前
智能家居的未来:AI让生活更智能还是更复杂?
其他
Jack黄从零学c++14 小时前
C++ 的异常处理详解
c++·经验分享
做网站建设制作设计小程序推广1 天前
如何建购物网站提升用户体验
经验分享
程思扬1 天前
为什么Uptime+Kuma本地部署与远程使用是网站监控新选择?
linux·服务器·网络·经验分享·后端·网络协议·1024程序员节
白狐欧莱雅1 天前
使用python中的pygame简单实现飞机大战游戏
经验分享·python·游戏·pygame
棱角~~1 天前
盘点和嗨格式一样好用的10款数据恢复!!
数据库·经验分享·安全·电脑·学习方法