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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

gavin_gxh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值