2011年3月30日 星期三

[Code] Double Click

雙擊在一行中的任一欄位上:

FORM user_command USING i_ucomm     TYPE syucomm
                         is_selfield TYPE slis_selfield.    "#EC CALLED
  DATA: lv_datum LIKE sy-datum.

  CASE i_ucomm.
    WHEN '&IC1'.             " double click
      READ TABLE gt_itab INDEX is_selfield-tabindex.
      SET PARAMETER ID 'VF'   FIELD gt_itab-vbeln.
      CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
  ENDCASE.

ENDFORM.                               " USER_COMMAND

判斷雙擊在哪一個欄位上:

CASE I_UCOMM.
  WHEN '&IC1'.             " double click
    CASE IS_SELFIELD-SEL_TAB_FIELD.
      WHEN 'GT_ITAB-VGBEL'.
        IF IS_SELFIELD-VALUE IS INITIAL.
        ELSE.
          SET PARAMETER ID 'AUN' FIELD IS_SELFIELD-VALUE.
          CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
        ENDIF.
    ENDCASE.
ENDCASE.

Non-ALV Use Event - AT LINE-SELECTION

DATA: gv_field(20),
      gv_value(18).

* -----------------
* AT LINE-SELECTION
* -----------------
AT LINE-SELECTION.
  GET CURSOR FIELD gv_field VALUE gv_value.
  CASE gv_field.
    WHEN 'GT_ITAB-VBELN'.
      SET PARAMETER ID 'VF' FIELD gv_value.
      CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
    WHEN 'GT_ITAB-VGBEL'.
      SET PARAMETER ID 'VL' FIELD gv_value.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
  ENDCASE.

------------------------------------------------------
※ Reference HIDE:

Basic form

  HIDE f.

Effect

  The contents of f related to the current output line are stored. If this line is selected,
  f is filled automatically with the stored value.

常用 Transation

VA02:
SET PARAMETER ID 'AUN' FIELD IS_SELFIELD-VALUE.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
VA43:
SET PARAMETER ID 'KTN' FIELD IS_SELFIELD-VALUE.
CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
VL03N:
SET PARAMETER ID 'VL'   FIELD IS_SELFIELD-VALUE.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
VF03:
SET PARAMETER ID 'VF'   FIELD gt_itab-vbeln.
CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
VB23:
SET PARAMETER ID 'VK1' FIELD gv_knuma_ag.
CALL TRANSACTION 'VB23' AND SKIP FIRST SCREEN.
FB03:
SET PARAMETER ID 'BLN'  FIELD GV_BELNR.
SET PARAMETER ID 'BUK'  FIELD '1000'.
SET PARAMETER ID 'GJR'  FIELD P_MJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
FK02:
SET PARAMETER ID 'LIF' FIELD V_LIFNR.
SET PARAMETER ID 'BUK' FIELD P_BUKRS.
CALL TRANSACTION 'FK02'.
FK03:
SET PARAMETER ID 'LIF' FIELD V_LIFNR.
SET PARAMETER ID 'BUK' FIELD P_BUKRS.
CALL TRANSACTION 'FK03'.
FK05:
SET PARAMETER ID 'LIF' FIELD V_LIFNR.
SET PARAMETER ID 'BUK' FIELD P_BUKRS.
CALL TRANSACTION 'FK05' AND SKIP FIRST SCREEN.
FK01:
SET PARAMETER ID 'LIF' FIELD V_LIFNR.
SET PARAMETER ID 'BUK' FIELD P_BUKRS.
SET PARAMETER ID 'KGK' FIELD V_KOTKK.
CALL TRANSACTION 'FK01' AND SKIP FIRST SCREEN.
MB03:
SET PARAMETER ID 'MBN'  FIELD is_selfield-value.
SET PARAMETER ID 'MJA'  FIELD gt_itab-budat(4).
CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.
ME03:
SET PARAMETER ID 'MAT' FIELD MATNR.
SET PARAMETER ID 'WRK' FIELD WERKS.
CALL TRANSACTION 'ME03' AND SKIP FIRST SCREEN.
ME13:
SET PARAMETER ID 'INF' FIELD XEINE-INFNR.
SET PARAMETER ID 'MAT' FIELD XEINE-MATNR.
SET PARAMETER ID 'LIF' FIELD XEINE-LIFNR.
SET PARAMETER ID 'ESO' FIELD XEINE-ESOKZ.
SET PARAMETER ID 'EKO' FIELD XEINE-EKORG.
SET PARAMETER ID 'WRK' FIELD XEINE-WERKS.
SET PARAMETER ID 'EIB' FIELD SPACE.
CALL TRANSACTION 'ME13' AND SKIP FIRST SCREEN.
ME15:
SET PARAMETER ID 'INF' FIELD XEINE-INFNR.
SET PARAMETER ID 'MAT' FIELD XEINE-MATNR.
SET PARAMETER ID 'LIF' FIELD XEINE-LIFNR.
SET PARAMETER ID 'ESO' FIELD XEINE-ESOKZ.
SET PARAMETER ID 'EKO' FIELD XEINE-EKORG.
SET PARAMETER ID 'WRK' FIELD XEINE-WERKS.
SET PARAMETER ID 'EIB' FIELD 'L'.
CALL TRANSACTION 'ME15' AND SKIP FIRST SCREEN.
ME23:
SET PARAMETER ID 'BES' FIELD EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ME23N:
READ TABLE gt_itab INDEX is_selfield-tabindex.
SET PARAMETER ID 'BES'   FIELD is_selfield-value.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
  EXPORTING
    i_ebeln gt_itab-ebeln
    i_ebelp gt_itab-ebelp
    i_enjoy 'X'
  EXCEPTIONS
    OTHERS  1.   
ME33:
SET PARAMETER ID 'VRT' FIELD EBELN.
CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
ME43:
SET PARAMETER ID 'ANF' FIELD HIDK-EBELN.
CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
MIR4:
SET PARAMETER ID 'RBN'  FIELD is_selfield-value.
SET PARAMETER ID 'GJR'  FIELD gt_itab-wadat_ist(4).
CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
MM03:
SET PARAMETER ID 'MXX' FIELD 'KD'. " Table T132: Status definition
SET PARAMETER ID 'WRK' FIELD p_werks.
SET PARAMETER ID 'MAT' FIELD KABT-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
MMBE:
SET PARAMETER ID 'MAT' FIELD LIST-MATNR.
SET PARAMETER ID 'WRK' FIELD LIST-WERKS.
SET PARAMETER ID 'LAG' FIELD ''.
CALL TRANSACTION 'MMBE' AND SKIP FIRST SCREEN.
KOB1:
SET PARAMETER ID 'ANR' FIELD V_AUFNR.
SET PARAMETER ID 'KAG' FIELD V_KAGRU.
CALL TRANSACTION 'KOB1'. "AND SKIP FIRST SCREEN.
KO88:
SET PARAMETER ID 'ANR' FIELD V_AUFNR.
CALL TRANSACTION 'KO88'.
CO02:
SET PARAMETER ID 'ANR' FIELD V_AUFNR.
CALL TRANSACTION 'CO02' AND SKIP FIRST SCREEN.
CS03:
SET PARAMETER ID 'MAT' FIELD gt_itab-idnrk.
SET PARAMETER ID 'WRK' FIELD p_werks.
SET PARAMETER ID 'CSV' FIELD gt_itab-stlan.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.

1 則留言:

  1. MIGO的物料文件檢視可以用
    CALL FUNCTION 'MIGO_DIALOG'
    EXPORTING
    I_MBLNR = EKBE-BELNR "=物料文件號
    I_MJAHR = EKBE-GJAHR. "=會計年度

    有機會的話交個朋友吧~

    回覆刪除