SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Двойной щелчек в ячейке экранной таблицы



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Sep 17, 2007 4:29 pm    Post subject: Двойной щелчек в ячейке экранной таблицы Reply with quote

В 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.

*&---------------------------------------------------------------------*
END-OF-SELECTION.
  CALL SCREEN 100.


*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

  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.

 MODULE USER_COMMAND_0100.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.