Archive

Posts Tagged ‘OBJET’

ALV – Ajout d’un bouton spécifique

June 30th, 2009 No comments

** En OBJET**

Pour l’ajout d’un bouton spécifique dans la barre d’outils et pour sa gestion, il faut implémenter deux methodes.

toolbar

 

 

 

  1.   METHODS  handler_tool FOR EVENT toolbar OF cl_gui_alv_grid
                                                      IMPORTING e_object.
  2.   METHODS handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
                                                                            IMPORTING e_ucomm.

Handler_tool : Création du bouton

Handler_user_command : Gestion du bouton

 

Exemple de code :

   METHOD handler_tool.
    CLEAR ws_toolbar. ” => On affiche la ligne de séparation
    MOVE 3 TO ws_toolbar-butn_type.
    MOVE space TO ws_toolbar-disabled.
    APPEND ws_toolbar TO e_object->mt_toolbar.

    CLEAR ws_toolbar. “=> On affiche le bouton
    MOVE 0 TO ws_toolbar-butn_type.
    MOVE ‘SAVE’ TO ws_toolbar-function.
    MOVE icon_system_save TO ws_toolbar-icon.
    MOVE text-001 TO ws_toolbar-quickinfo.
    MOVE space TO ws_toolbar-disabled.
     APPEND ws_toolbar TO e_object->mt_toolbar.

    ENDMETHOD.   

  METHOD handle_user_command.
    CASE e_ucomm.
      WHEN ‘SAVE’. ” Traitement bouton 1
      WHEN ‘XXX’.” Traitement bouton X
    ENDCASE.
  ENDMETHOD.      

Il faut bien penser à initer les évenements dans le constructeur par exemple.

   METHOD constructor.
    SET HANDLER handler_tool FOR i_alv.
    SET HANDLER handle_user_command FOR i_alv. 

  ENDMETHOD.

Categories: SAP Tags: , ,

Tutorial SAP – ABAP Objet et ALV – 3/3

April 15th, 2009 No comments

Gestion de l’ecran ’100′

abap_objet_alv_6

Description du module init_0100

On crée dans l’ordre le container puis l’ALV et enfin l’objet wo_app pour pouvoir nous servir des méthodes

abap_objet_alv_7



Categories: SAP, Tutorial Tags: , ,

Tutorial SAP – ABAP Objet et ALV – 2/3

April 15th, 2009 No comments

allons utiliser des methodes avec des paramètres differents( importing, changing, returning) et des évenements de l’ALV comme le “double_click” tout ça pour tester les différentes solutions.

Definition :

abap_objet_alv_21

Implementation :

abap_objet_alv_5


Categories: SAP, Tutorial Tags: , ,