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

Не срабатывает событие handle_on_drag



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Katya
Участник
Участник


Age: 37
Joined: 20 Oct 2011
Posts: 13

PostPosted: Tue Dec 20, 2011 10:04 am    Post subject: Не срабатывает событие handle_on_drag Reply with quote

Здравствуйте!

Я делаю перетаскивание drag and drop с ALV Tree на ALV grid.
Элемент дерева уже перетаскивается на грид, но почему то событие HANDLE_ON_DRAG не срабатвает

Code:
CLASS CL_TREE_EVENT_RECEIVER DEFINITION.

  PUBLIC SECTION.
*   double click item
    METHODS HANDLE_DOUBLE_CLICK
      FOR EVENT NODE_DOUBLE_CLICK OF cl_gui_alv_tree
      IMPORTING node_key sender.
    METHODS HANDLE_ON_DRAG
      FOR EVENT ON_DRAG OF CL_GUI_ALV_TREE
      IMPORTING DRAG_DROP_OBJECT
                FIELDNAME
                NODE_KEY.
  PRIVATE SECTION.
ENDCLASS.

CLASS CL_TREE_EVENT_RECEIVER IMPLEMENTATION.
* handle double_click
  METHOD HANDLE_DOUBLE_CLICK.
    perform select_flats using node_key.
  ENDMETHOD.
* Drag & Drop
  METHOD HANDLE_ON_DRAG.
    CHECK NOT NODE_KEY IS INITIAL.
    perform AddFlat using node_key.
    CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE EXPORTING NEW_CODE =
    FCODE_ENTR.
  ENDMETHOD.
ENDCLASS.

В PBO пытаюсь поймать событие

if TREE_EVENT_RECEIVER is initial.
      CREATE OBJECT TREE_EVENT_RECEIVER.

        DATA: LT_EVENTS TYPE CNTL_SIMPLE_EVENTS,
          L_EVENT TYPE CNTL_SIMPLE_EVENT.
*   define the events which will be passed to the backend
    CLEAR L_EVENT.
    L_EVENT-EVENTID = CL_GUI_COLUMN_TREE=>EVENTID_NODE_DOUBLE_CLICK.
    APPEND L_EVENT TO LT_EVENTS.
    CLEAR L_EVENT.
    L_EVENT-EVENTID = CL_GUI_COLUMN_TREE=>EVENTID_EXPAND_NO_CHILDREN.
    APPEND L_EVENT TO LT_EVENTS.
    CLEAR L_EVENT.
    L_EVENT-EVENTID = CL_GUI_COLUMN_TREE=>EVENTID_HEADER_CLICK.
    APPEND L_EVENT TO LT_EVENTS.
    CLEAR L_EVENT.
*   register events
    CALL METHOD TREE1->SET_REGISTERED_EVENTS
      EXPORTING
        EVENTS = LT_EVENTS
      EXCEPTIONS
        CNTL_ERROR                = 1
        CNTL_SYSTEM_ERROR         = 2
        ILLEGAL_EVENT_COMBINATION = 3.
    IF SY-SUBRC <> 0.
      MESSAGE X534(0K).
    ENDIF.
    SET HANDLER TREE_EVENT_RECEIVER->HANDLE_ON_DRAG FOR TREE1.
    SET HANDLER TREE_EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR TREE1.

     CALL METHOD TREE1->FRONTEND_UPDATE.
endif.


perform AddFlat using node_key не выполняется.

подскажите, пожалуйста, в чем может быть дело? Почему не работает?
Back to top
View user's profile Send private message
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Thu Dec 22, 2011 9:56 am    Post subject: Reply with quote

См. программу BCALV_GRID_DND_TREE_SIMPLE
_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
Katya
Участник
Участник


Age: 37
Joined: 20 Oct 2011
Posts: 13

PostPosted: Thu Dec 22, 2011 9:57 am    Post subject: Reply with quote

Спасибо, я ее и использовала как образец. Уже нашла почему не срабатывало событие.
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 -> ABAP 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.