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

ALVGRID event of user one click on cell Как сделать?



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List
View previous topic :: View next topic  
Author Message
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Thu Nov 24, 2011 12:57 pm    Post subject: ALVGRID event of user one click on cell Как сделать? Reply with quote

Добрый день !

Подскажите плиз как словить event, когда пользователь кликает только одни раз по строке грида, double click не подходит! использую REUSE_ALV_GRID_DISPLAY_LVC.

Задача стоит так: есть колонка в виде сheck-box и колонка traffic-light, вот если пользователь изменил сheck-box - поставил галочку или убрал, соответственно traffic-light тоже изменяется.

Заранее спасибо! Smile
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Thu Nov 24, 2011 2:55 pm    Post subject: Reply with quote

В этой теме REUSE & F4 разбиралась регистрация события по F4. Я думаю, что если заменить на событие DATA_CHANGED, то можно попробовать в нем одиночный клик эммулировать.

Code:
TYPE-POOLS: slis.

CLASS lcl_events DEFINITION DEFERRED.
*----------------------------------------------------------------------*
*       CLASS lcl_events DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    METHODS:
    data_changed   FOR EVENT data_changed OF cl_gui_alv_grid
                   IMPORTING er_data_changed
                             e_onf4
                             e_onf4_before
                             e_onf4_after
                             e_ucomm.

ENDCLASS.                    "lcl_events DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_events IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_events IMPLEMENTATION.
  METHOD data_changed.
    BREAK-POINT.
  ENDMETHOD.                    "data_changed
ENDCLASS.                    "lcl_events IMPLEMENTATION

DATA: itab TYPE TABLE OF spfli,
      events TYPE slis_t_event,
      event TYPE slis_alv_event,
      gr_events TYPE REF TO lcl_events.
DATA: fcat TYPE lvc_t_fcat,
      hcat TYPE lvc_s_fcat,
      glay TYPE lvc_s_glay.

START-OF-SELECTION.
  SELECT * FROM spfli INTO TABLE itab.

END-OF-SELECTION.
  event-name = 'CALLER_EXIT'.
  event-form = 'CALLER_EXIT'.
  APPEND event TO events.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = 'SPFLI'
    CHANGING
      ct_fieldcat      = fcat.
  LOOP AT fcat INTO hcat
    WHERE fieldname = 'FLTYPE'.
    hcat-edit = 'X'.
    hcat-checkbox = 'X'.
    MODIFY fcat FROM hcat.
  ENDLOOP.

  glay-edt_cll_cb = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program      = sy-cprog
      it_fieldcat_lvc         = fcat
      it_events               = events
      i_grid_settings         = glay
    TABLES
      t_outtab                = itab.

*&---------------------------------------------------------------------*
*&      Form  caller_exit
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM caller_exit USING data.

  DATA: grid TYPE REF TO cl_gui_alv_grid,
        tab_f4 TYPE lvc_t_f4,
        wa_f4 TYPE lvc_s_f4.

  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = grid.

  CREATE OBJECT gr_events.
  SET HANDLER gr_events->data_changed
              FOR grid.

ENDFORM.                    "caller_exit

_________________
FunCoding.ru
KicksCollector.ru
Back to top
View user's profile Send private message Blog
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Thu Nov 24, 2011 3:14 pm    Post subject: Reply with quote

Как оказалось можно еще проще.
Code:
TYPE-POOLS: slis.

DATA: itab TYPE TABLE OF spfli,
      events TYPE slis_t_event,
      event TYPE slis_alv_event.
DATA: fcat TYPE lvc_t_fcat,
      hcat TYPE lvc_s_fcat,
      glay TYPE lvc_s_glay.

START-OF-SELECTION.
  SELECT * FROM spfli INTO TABLE itab.

END-OF-SELECTION.
  event-name = 'DATA_CHANGED'.
  event-form = 'DATA_CHANGED'.
  APPEND event TO events.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = 'SPFLI'
    CHANGING
      ct_fieldcat      = fcat.
  LOOP AT fcat INTO hcat
    WHERE fieldname = 'FLTYPE'.
    hcat-edit = 'X'.
    hcat-checkbox = 'X'.
    MODIFY fcat FROM hcat.
  ENDLOOP.

  glay-edt_cll_cb = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program = sy-cprog
      it_fieldcat_lvc    = fcat
      it_events          = events
      i_grid_settings    = glay
    TABLES
      t_outtab           = itab.

*&---------------------------------------------------------------------*
*&      Form  data_changed
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM data_changed USING changed.
  BREAK-POINT.
ENDFORM.                    "data_changed

_________________
FunCoding.ru
KicksCollector.ru
Back to top
View user's profile Send private message Blog
firacat
Специалист
Специалист



Joined: 20 Apr 2011
Posts: 80
Location: Ukraine

PostPosted: Thu Nov 24, 2011 5:01 pm    Post subject: Reply with quote

Спасибо John Doe все получилось!!! Wink Very Happy
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 -> ALV Grid / ALV Tree / ALV List 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.