Skip to Content
author's profile photo Former Member
Former Member

simple alv report double click event

hi experts,

plz help me i will display the simple alv report. when ever double click on that report then goto vl03 application. ok i will use standard application copy SALV

TO our program under set pf-status added our display button and activated .

excuted that menu painter added to the button but when ever program excuted it can not added to standard application and write the logic it's cannot work.

i am working with ECC 6.0

PLZ help me advance thanking u

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 03, 2007 at 06:56 AM

    Hi,

    Check the below link for sample codes

    http://www.sapdev.co.uk/reporting/alv/alvgrid.htm

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 06:59 AM

    hI

    Here is an example program which illistrates how to handle the double click event.

    TABLES: MARA.
     
    DATA: BEGIN OF I_ALV OCCURS 0,
          MATNR TYPE MARA-MATNR,
          MAKTX TYPE MAKT-MAKTX,
          END OF I_ALV.
     
    ***********************************************************************
    *       CLASS cl_event_receiver DEFINITION      Handles Double Click
    ***********************************************************************
    CLASS CL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS HANDLE_DOUBLE_CLICK
          FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
          IMPORTING E_ROW E_COLUMN.
      PRIVATE SECTION.
    ENDCLASS.
     
    ***********************************************************************
    *       CLASS CL_EVENT_RECEIVER IMPLEMENTATION    Handles Double Click
    ***********************************************************************
    CLASS CL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DOUBLE_CLICK.
        PERFORM DRILL_DOWN USING E_ROW-INDEX.
      ENDMETHOD.
    ENDCLASS.
     
     
    DATA: ALV_CONTAINER  TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: EVENT_RECEIVER TYPE REF TO CL_EVENT_RECEIVER.
    DATA: ALV_GRID       TYPE REF TO CL_GUI_ALV_GRID.
    DATA: FIELDCAT  TYPE LVC_T_FCAT.
     
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
     
    START-OF-SELECTION.
     
      PERFORM GET_DATA.
      CALL SCREEN 100.
     
    ************************************************************************
    *      Module  status_0100  OUTPUT
    ************************************************************************
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
     
     
    * Create Controls
      CREATE OBJECT ALV_CONTAINER
             EXPORTING
                   CONTAINER_NAME    = 'ALV_CONTAINER'.
     
      CREATE OBJECT ALV_GRID
             EXPORTING
                   I_PARENT          =  ALV_CONTAINER.
     
    *  Create Event Receiver
      CREATE OBJECT EVENT_RECEIVER.
     
    *  ALV Specific. Data selection.
    *  Populate Field Catalog
      PERFORM GET_FIELDCATALOG.
     
     
      CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
          CHANGING
               IT_OUTTAB       = I_ALV[]
               IT_FIELDCATALOG = FIELDCAT[].
     
    *   handler for ALV grid
      SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR ALV_GRID.
     
    ENDMODULE.
     
    ************************************************************************
    *      Module  USER_COMMAND_0100  INPUT
    ************************************************************************
    MODULE USER_COMMAND_0100 INPUT.
     
      CASE SY-UCOMM.
        WHEN 'BACK' OR 'CANC'.
          IF NOT ALV_CONTAINER IS INITIAL.
            CALL METHOD ALV_CONTAINER->FREE.
            CLEAR: ALV_CONTAINER.
            FREE : ALV_CONTAINER.
          ENDIF.
          IF SY-SUBRC = 0.
            SET SCREEN 0.
            LEAVE SCREEN.
          ELSE.
            LEAVE PROGRAM.
          ENDIF.
        WHEN 'EXIT'.
          IF NOT ALV_CONTAINER IS INITIAL.
            CALL METHOD ALV_CONTAINER->FREE.
            CLEAR: ALV_CONTAINER.
            FREE : ALV_CONTAINER.
          ENDIF.
          LEAVE PROGRAM.
      ENDCASE.
     
    ENDMODULE.
     
    ************************************************************************
    * FORM GET_DATA
    ************************************************************************
    FORM GET_DATA.
     
      SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ALV
            FROM MARA
              INNER JOIN MAKT
                ON MARA~MATNR = MAKT~MATNR
                   WHERE MARA~MATNR IN S_MATNR
                     AND MAKT~SPRAS = SY-LANGU.
     
      SORT I_ALV ASCENDING BY MATNR.
     
    ENDFORM.
     
    ************************************************************************
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    ************************************************************************
    FORM GET_FIELDCATALOG.
     
      DATA: LS_FCAT TYPE LVC_S_FCAT.
      REFRESH: FIELDCAT.
     
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Material Number'.
      LS_FCAT-COLTEXT    = 'Material Number'.
      LS_FCAT-FIELDNAME  = 'MATNR'.
      LS_FCAT-REF_TABLE  = 'I_ALV'.
      LS_FCAT-OUTPUTLEN  = '18'.
      LS_FCAT-COL_POS    = 1.
      APPEND LS_FCAT TO FIELDCAT.
     
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Material Description'.
      LS_FCAT-COLTEXT    = 'Material Description'.
      LS_FCAT-FIELDNAME  = 'MAKTX'.
      LS_FCAT-REF_TABLE  = 'I_ALV'.
      LS_FCAT-OUTPUTLEN  = '40'.
      LS_FCAT-COL_POS    = 2.
      APPEND LS_FCAT TO FIELDCAT.
     
    ENDFORM.
     
    ************************************************************************
    * DRILL_DOWN
    ************************************************************************
    FORM DRILL_DOWN USING INDEX.
     
      READ TABLE I_ALV INDEX INDEX.
      IF SY-SUBRC = 0.
     
    * Do whatever you need to do, in this case, I'm driling into tcode MM03
        SET PARAMETER ID 'MAT' FIELD I_ALV-MATNR.
        CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
     
     
      ENDIF.
     
    ENDFORM.
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.