Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8451

Re: Refresh button in ALV grid display

$
0
0

Hi,

 

you have to redefine the toolbar

(my example is for a tree, but it's the same)

 

 

*---------------------------------------------------------------------*
*   CLASS lcl_toolbar_event_receiver DEFINITION                       *
*---------------------------------------------------------------------*

CLASS lcl_toolbar_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS: on_function_selected
               FOR EVENT function_selected OF cl_gui_toolbar
                 IMPORTING fcode.
ENDCLASS. "lcl_toolbar_event_receiver DEFINITION

 

 

 

DATA : obj_tree_toolbar   TYPE REF TO cl_gui_toolbar .



*---------------------------------------------------------------------*
*   Form P_CHANGE_TOOLBAR.                                            *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*

FORM p_change_toolbar.

 


  CALL METHOD obj_tree->get_toolbar_object
    IMPORTING
      er_toolbar = obj_tree_toolbar.

 

 

* Test qu'il y a bien une barre d'outil.

  CHECK NOT obj_tree_toolbar IS INITIAL.

 

 

* Ajoute un separateur à la barre d'outil.

  CALL METHOD obj_tree_toolbar->add_button
    EXPORTING
      fcode     = ''
      icon      = ''
      butn_type = cntb_btype_sep
      text      = ''
      quickinfo = 'Seperator'.

 

 

* Ajoute le bouton détail simple / accés deuxieme ecran

  CALL METHOD obj_tree_toolbar->add_button
    EXPORTING
      fcode     = 'SM_TREE'
      icon      = '@CC@'
      butn_type = cntb_btype_button
      text      = ' SM '
      quickinfo = 'Sortie Marchandise'.

 

 

* Active la gestion des evenements sur la barre d'outil.

  CREATE OBJECT obj_tree_tevent.
  SET HANDLER obj_tree_tevent->on_function_selected
              FOR obj_tree_toolbar.

 

 

 

ENDFORM. " P_CHANGE_TOOLBAR

 

 

 

 

 

*---------------------------------------------------------------------*
*       CLASS lcl_toolbar_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*

CLASS lcl_toolbar_event_receiver IMPLEMENTATION.

 

 

 

 

* Methode On_Function_Selected

  METHOD on_function_selected.

 

    DATA : it_select_node TYPE lvc_t_nkey ,
           is_select_node TYPE lvc_nkey   ,
           is_data        TYPE ts_lipov .

 

 

*     Si bouton SM.

    IF fcode EQ 'SM_TREE'.

*       Recherche le numéro du noeud.

      CALL METHOD obj_tree->get_selected_nodes
        CHANGING
          ct_selected_nodes = it_select_node.
      CALL METHOD cl_gui_cfw=>flush.

*     Cole le numero dans une zone avec header-line.

      READ TABLE it_select_node INTO is_select_node INDEX 1.
      IF NOT is_select_node IS INITIAL.

*         Récupère la ligne

        CALL METHOD obj_tree->get_outtab_line
          EXPORTING
            i_node_key    = is_select_node
          IMPORTING
            e_outtab_line = is_data.

*       Vérifie que c'est une ligne : livraison

        CHECK ( NOT is_data-vbeln IS INITIAL AND
                    is_data-posnr IS INITIAL    ) OR
              ( NOT is_data-tknum IS INITIAL AND
                    is_data-vbeln IS INITIAL AND
                    is_data-posnr IS INITIAL    ).

*       Sortie Marchandise.

        PERFORM p_sm_delivery USING is_data-vbeln
                                    is_data-tknum.
      ELSE.
        MESSAGE i227(0h).
      ENDIF.

 

    ENDIF.

 


  ENDMETHOD.                    "on_function_selected

 


ENDCLASS. "lcl_toolbar_event_receiver IMPLEMENTATION

 

 

 

regards

Fred


Viewing all articles
Browse latest Browse all 8451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>