Posted: Mon Sep 17, 2007 4:29 pm Post subject: Двойной щелчек в ячейке экранной таблицы
В PF-STATUS-e экрана присвойте клавише F2 (Важно! Именно этой клавише) какое-нибудь значение, например 'CEL'.
Code:
**********************************************
* Get double click on a Cell of the Table Control
**********************************************
REPORT Z_TABLE_DOUBLE_CLICK.
TABLES bkpf.
DATA: BEGIN OF it_tab OCCURS 0,
bukrs TYPE bkpf-bukrs,
gjahr TYPE bkpf-gjahr,
belnr TYPE bkpf-belnr,
budat TYPE bkpf-budat,
END OF it_tab.
DATA: FCODE LIKE SY-UCOMM,
SCODE LIKE SY-UCOMM.
*&spwizard: declaration of tablecontrol 'TABLE' itself
CONTROLS: TABLE TYPE tableview using screen 0100.
SELECT-OPTIONS: so_bukrs FOR bkpf-bukrs,
so_gjahr FOR bkpf-gjahr.
*&---------------------------------------------------------------------*
START-OF-SELECTION.
SELECT bukrs gjahr belnr budat
FROM bkpf
INTO TABLE it_tab
WHERE bukrs IN so_bukrs
AND gjahr IN so_gjahr.
DATA: FIELD_NAME LIKE D021S-FNAM,
SEL_LINE TYPE I,
DOCNO LIKE BKPF-BELNR.
DATA: wa_tab LIKE it_tab.
SCODE = FCODE.
CLEAR FCODE.
CASE SCODE.
WHEN 'CANC' or 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'CEL'.
CLEAR: FIELD_NAME, DOCNO.
* Get values of cell in selected line
GET CURSOR FIELD FIELD_NAME VALUE DOCNO.
* Get number of selected line
GET CURSOR LINE SEL_LINE.
IF SY-SUBRC = 0.
SEL_LINE = SEL_LINE + TABLE-TOP_LINE - 1.
ENDIF.
IF FIELD_NAME EQ 'IT_TAB-BELNR' AND NOT DOCNO IS INITIAL.
READ TABLE it_tab INTO wa_tab INDEX SEL_LINE.
IF sy-subrc IS INITIAL.
SET PARAMETER ID 'BUK' FIELD wa_tab-bukrs.
SET PARAMETER ID 'GJR' FIELD wa_tab-gjahr.
ENDIF.
SET PARAMETER ID 'BLN' FIELD DOCNO.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'TITLE_0100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&spwizard: output module for tc 'TABLE'. do not change this line!
*&spwizard: update lines for equivalent scrollbar
module TABLE_change_tc_attr output.
describe table IT_TAB lines TABLE-lines.
endmodule.
Логика экрана
Code:
PROCESS BEFORE OUTPUT.
*&spwizard: pbo flow logic for tablecontrol 'TABLE'
module TABLE_change_tc_attr.
*&spwizard: module TABLE_change_col_attr.
loop at IT_TAB
with control TABLE
cursor TABLE-current_line.
*&spwizard: module TABLE_change_field_attr
endloop.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
*&spwizard: pai flow logic for tablecontrol 'TABLE'
loop at IT_TAB.
chain.
field IT_TAB-BUKRS.
field IT_TAB-GJAHR.
field IT_TAB-BELNR.
field IT_TAB-BUDAT.
endchain.
endloop.
*&spwizard: module TABLE_change_tc_attr.
*&spwizard: module TABLE_change_col_attr.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.