GET HANDLE?

Getting started ... Alles für einen gelungenen Start.
3 Beiträge • Seite 1 von 1
3 Beiträge Seite 1 von 1

GET HANDLE?

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
hallo miteinander

habe eine frage zu der Klasse CL_DRAGDROP und darin die Methode GET_HANDLE.
Es macht GET_HANDLE Methode, habe nur gesehen, es vergibt nur Zahlen.

Im Programm
BCALV_DND_02 sieht man diese Klasseaufruf. Es vergibt die Zahlen 1 und 2, bei alv und tree

Gruss kostonstyle

gesponsert
Stellenangebote auf ABAPforum.com schalten
kostenfrei für Ausbildungsberufe und Werksstudenten


Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
wie bringe ich es fertig, dass es in alv dropt?
hier ist der code

Code: Alles auswählen.

*&---------------------------------------------------------------------*
*&  Include           ZTMP_KUNDEN_BESTELLLCL
*&---------------------------------------------------------------------*

class lcl_eventhandler definition.
  public section.
    methods:
      handle_tree_drag
        for event on_drag
        of cl_gui_simple_tree
        importing node_key drag_drop_object,
      handle_alv_drop
        for event ondrop
        of cl_gui_alv_grid
        importing e_row e_column e_dragdropobj.
  private section.
    data: gf_matnr type matnr.
endclass.                    "lcl_eventhandler DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_eventhandler implementation.
  method handle_tree_drag.
    data: lf_node_key type tv_nodekey,
          lf_node_text type text.
    data: ls_treenode type mtreesnode.

    move node_key to lf_node_key.
    read table gt_treenode into ls_treenode with key node_key = lf_node_key.
    move ls_treenode-text to lf_node_text.
    move lf_node_text to gf_matnr.
  endmethod.                    "handle_tree_drag
  method handle_alv_drop.
    data: ls_vbap type zbma_vbap.
    data: lc_gui_alv type ref to cl_gui_alv_grid.
    catch system-exceptions move_cast_error = 1.

      gf_vbeln_count = gf_vbeln_count + 1.
      gf_posnr = gf_posnr + 10.
      write gf_vbeln_count to gf_vbeln.
      select single brgew ntgew ean11
              from mara into corresponding fields of ls_vbap
              where matnr eq gf_matnr.
      move gf_vbeln to ls_vbap-vbeln.
      move gf_posnr to ls_vbap-posnr.
      append ls_vbap to gt_vbap.
      call method lc_gui_alv->refresh_table_display.
    endcatch.
    if sy-subrc <> 0.
      call method e_dragdropobj->abort.
    endif.
  endmethod.                    "handle_alv_drop
endclass.                    "lcl_eventhandler IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS lcl_buy DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_buy definition.
  public section.
    methods: create_alv.
  private section.
endclass.                    "lcl_buy DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_buy IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_buy implementation.
  method create_alv.
    data: lc_container type ref to cl_gui_custom_container,
          lc_gui_alv type ref to cl_gui_alv_grid,
          lc_eventhandler type ref to lcl_eventhandler.

    if lc_gui_alv is initial.
      create object lc_container
        exporting
          container_name              = 'C_CONTAINER_ALV'
        exceptions
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.

      create object lc_gui_alv
        exporting
          i_parent          = lc_container
        exceptions
          error_cntl_create = 1
          error_cntl_init   = 2
          error_cntl_link   = 3.

      gc_layout-cwidth_opt = 'X'.
      call method lc_gui_alv->set_table_for_first_display
        exporting
          i_structure_name = 'ZMM_ART_MEINH'
          is_layout        = gc_layout
        changing
          it_outtab        = gt_vbap.

      create object lc_eventhandler.
      set handler: lc_eventhandler->handle_alv_drop for lc_gui_alv.
    else.
      call method lc_gui_alv->refresh_table_display.
    endif.
  endmethod.                    "create_alv
endclass.                    "lcl_buy IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS lcl_make_tree DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_make_tree definition.
  public section.
    methods: create,
             fill.
  private section.
    "Typesdefinition für Nodetree
    types: begin of lty_tree,
                    mtart type mtart,
                    matnr type matnr,
           end of lty_tree.
    "Datendefinition
    data: lct_tree type table of lty_tree.
    "Containerdefinition
    data: lcc_guitree type ref to cl_gui_simple_tree.
    methods: selectdb.

endclass.                    "make_tree DEFINITION

*----------------------------------------------------------------------*
*       CLASS make_tree IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_make_tree implementation.
  method selectdb.
    constants: lf_roh(3) type c value 'ROH',
               lf_halb(4) type c value 'HALB',
               lf_zfe2(4) type c value 'ZFE2'.
    select matnr mtart from mara into corresponding fields of table lct_tree
                                 where mtart in (lf_roh, lf_halb, lf_zfe2).
  endmethod.                    "selectdb
  method create.
    data: lc_container type ref to cl_gui_custom_container,
          lc_eventhandler type ref to lcl_eventhandler,
          lc_buy type ref to lcl_buy.
    data: lt_regi_event type cntl_simple_events.

    me->selectdb( ).
    "Container erzeugen
    create object lc_container
      exporting
        container_name              = 'C_CONTAINER_TREE'
      exceptions
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.
    "Anwendungscontainer
    create object lcc_guitree
      exporting
        parent              = lc_container
        node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single.

    me->fill( ).
    create object lc_eventhandler.
    set handler: lc_eventhandler->handle_tree_drag for lcc_guitree.
    "Aufrufen der ALV Grid
    create object lc_buy.
    call method lc_buy->create_alv.

  endmethod.                    "create_doking
  method fill.
    field-symbols: <ls_tree> type lty_tree.
    data: ls_treenode type mtreesnode,
          lf_counter(6) type n,
          lf_treehandler type i,
          lf_alvhandler type i,
          lf_effect type i.

    "Kommunikation herstellen zwischen zwei Drag&Drop Objekte
    create object: gc_alv,
                   gc_tree.

    call method gc_tree->add
      exporting
        flavor     = 'matsh'
        dragsrc    = 'X'
        droptarget = ' '
        effect     = lf_effect.
    call method gc_tree->get_handle
      importing
        handle = lf_treehandler.

    call method gc_alv->add
      exporting
        flavor     = 'matsh'
        dragsrc    = ' '
        droptarget = 'X'
        effect     = lf_effect.
    call method gc_alv->get_handle
      importing
        handle = lf_alvhandler.
    gc_layout-s_dragdrop-grid_ddid = lf_alvhandler.

    loop at lct_tree assigning <ls_tree>.
      at new mtart.
        ls_treenode-node_key = <ls_tree>-mtart.
        "Löschen, damit Werte von Unterknote nicht übernimmt.
        clear: ls_treenode-relatkey,
               ls_treenode-relatship,
               ls_treenode-n_image,
               ls_treenode-exp_image,
               lf_counter,
               ls_treenode-dragdropid.
        ls_treenode-isfolder = 'X'.
        ls_treenode-text = <ls_tree>-mtart.
        append ls_treenode to gt_treenode.
      endat.
      at new matnr.
        clear: ls_treenode-isfolder.
        lf_counter = lf_counter + 1.
        concatenate <ls_tree>-mtart lf_counter into ls_treenode-node_key.
        ls_treenode-relatship = cl_gui_simple_tree=>relat_last_child.
        ls_treenode-relatkey = <ls_tree>-mtart.
        ls_treenode-text = <ls_tree>-matnr.
        ls_treenode-dragdropid = lf_treehandler.
        call function 'ICON_CREATE'
          exporting
            name   = 'ICON_SET_B'
            info   = text-mat
          importing
            result = ls_treenode-n_image
          exceptions
            others = 4.
        ls_treenode-exp_image = ls_treenode-n_image.
      endat.
      append ls_treenode to gt_treenode.
    endloop.
    call method lcc_guitree->add_nodes
      exporting
        table_structure_name = 'MTREESNODE'
        node_table           = gt_treenode.
  endmethod.                    "fill
endclass.                    "make_tree IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS lcl_kunden DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_kunden definition.
  public section.
    methods: selectdb importing pf_kunnr type kunnr
                      exporting pf_name1 type name1_gp
                                pf_name2 type name2_gp.
  private section.
    types: begin of lty_kun,
           kunnr type kunnr,
           name1 type name1_gp,
           name2 type name2_gp,
           end of lty_kun.
    data: lct_kunnumber type lty_kun.
endclass.                    "lcl_kunden DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_kunden IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_kunden implementation.
  method selectdb.
    select single kunnr name1 name2 from kna1 into corresponding fields of lct_kunnumber
                             where kunnr eq pf_kunnr.
    pf_name1 = lct_kunnumber-name1.
    pf_name2 = lct_kunnumber-name2.
  endmethod.                    "selectdb
endclass.                    "lcl_kunden IMPLEMENTATION
das ereignis

Code: Alles auswählen.

set handler: lc_eventhandler->handle_tree_drag for lcc_guitree.
wird nicht ausgelöst.
ich denke, hier liegt der Fehler

Code: Alles auswählen.

  create object: gc_alv,
                   gc_tree.

    call method gc_tree->add
      exporting
        flavor     = 'matsh'
        dragsrc    = 'X'
        droptarget = ' '
        effect     = lf_effect.
    call method gc_tree->get_handle
      importing
        handle = lf_treehandler.

    call method gc_alv->add
      exporting
        flavor     = 'matsh'
        dragsrc    = ' '
        droptarget = 'X'
        effect     = lf_effect.
    call method gc_alv->get_handle
      importing
        handle = lf_alvhandler.
    gc_layout-s_dragdrop-grid_ddid = lf_alvhandler.
grop ziel ist der alv.

danke kostonstyle

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
ich bitte euch dringend um hilfe....

Seite 1 von 1

Vergleichbare Themen

5
Antw.
4729
Views
Handle Double Click for ALV Grid
von PeterPaletti » 15.06.2018 08:40 • Verfasst in ABAP Objects®
1
Antw.
1973
Views
Eclipse: ungültiges Sperr-Handle
von Icke0801 » 06.04.2020 10:49 • Verfasst in ABAP® für Anfänger
1
Antw.
183
Views
How to Handle Error Messages in ABAP Forms?
von sslmith » 26.11.2024 19:39 • Verfasst in SAP Cloud Platform

Über diesen Beitrag

kostonstyle
Unterstütze die Community und teile den Beitrag für mehr Leser und Austausch

Aktuelle Forenbeiträge

ABAP - Mail so10 Text
vor 2 Stunden von PeterPaletti 2 / 48
selection-screen comment mit icon
vor 5 Stunden von DeathAndPain 9 / 1125
Chat GPT - Erfahrungen?
vor 3 Tagen von DeathAndPain 33 / 6809

Newsletter Anmeldung

Keine Beiträge verpassen! Wöchentlich versenden wir lesenwerte Beiträge aus unserer Community.
Die letzte Ausgabe findest du hier.
Details zum Versandverfahren und zu Ihren Widerrufsmöglichkeiten findest du in unserer Datenschutzerklärung.

Aktuelle Forenbeiträge

ABAP - Mail so10 Text
vor 2 Stunden von PeterPaletti 2 / 48
selection-screen comment mit icon
vor 5 Stunden von DeathAndPain 9 / 1125
Chat GPT - Erfahrungen?
vor 3 Tagen von DeathAndPain 33 / 6809

Unbeantwortete Forenbeiträge

SD_PRINT_TERMS_OF_PAYMENT
vor 4 Tagen von Manfred K. 1 / 915
BUSOBJEKT zu CMIS PHIO ermitteln
vor 3 Wochen von snooga87 1 / 2724