(轉)ABAP--處理'REUSE_ALV_GRID_DISPLAY'的雙擊事件

mmccking發表於2007-08-12

ABAP--處理'REUSE_ALV_GRID_DISPLAY'的雙擊事件 。

[@more@]

1 定義命令處理Form
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

DATA: VBELN1 LIKE L_SPETAB-VBELN, VBTYP1 LIKE L_SPETAB-VBTYP.
RS_SELFIELD-REFRESH = 'X'. "控制grid產生新螢幕
CASE R_UCOMM.
WHEN 'BEAN' OR '&IC1'. "雙擊事件
LOOP AT L_SPETAB WHERE SELK = 'X' .
VBELN1 = L_SPETAB-VBELN.
VBTYP1 = L_SPETAB-VBTYP.
CALL FUNCTION 'RV_CALL_CHANGE_TRANSACTION'
EXPORTING
VBELN = VBELN1
VBTYP = VBTYP1.

COL = COL_BEARBEITEN.
FARB-FARB2 = COL.
L_SPETAB-COL = FARB.
LF_LAYOUT-INFO_FIELDNAME = 'L_SPETAB-COL'.
MODIFY L_SPETAB.
CLEAR: VBELN1, VBTYP1.
ENDLOOP.
IF SY-SUBRC NE 0.
READ TABLE L_SPETAB INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
REPLACE '1-' WITH ' ' INTO RS_SELFIELD-SEL_TAB_FIELD.
CONDENSE RS_SELFIELD-SEL_TAB_FIELD NO-GAPS.
FELD = RS_SELFIELD-SEL_TAB_FIELD.
PERFORM SELECT USING RS_SELFIELD-TABINDEX.
CLEAR FELD.
ENDIF.
ENDIF.
RS_SELFIELD-COL_STABLE = 'X'.
RS_SELFIELD-ROW_STABLE = 'X'.
ENDCASE.

ENDFORM. "USER_COMMAND

2 定義一個常量包含"USER_COMMAND"
DATA: L_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

3 呼叫REUSE_ALV_GRID_DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_BUFFER_ACTIVE = 'X'
* I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PROGRAM = L_REPID
* I_CALLBACK_PF_STATUS_SET = L_STATUS
I_CALLBACK_USER_COMMAND = L_USER_COMMAND
* I_STRUCTURE_NAME = 'VBUK'
* IS_LAYOUT = LF_LAYOUT
IT_FIELDCAT = LF_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS = LF_SP_GROUP
* I_DEFAULT = 'X'
* I_SAVE = L_SAVE
* IS_VARIANT = L_VARIANT
* IT_EVENTS = LF_EVENTS[]
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = L_SPETAB .

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8356764/viewspace-950218/,如需轉載,請註明出處,否則將追究法律責任。

相關文章