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

Add log button in alv report-OO

Hi experts,

i have a alv report with 2 buttons: one - RElease order and the other is LOG.

the user want that after he push on release button(that operate a functions)

he want to see if it ended succesfuly - so he need log.

the problem is that i dont know how can i show the report when he click on the "log" button?

(how can i create a report that we can see after the user ran the alv report and click on "log" button?)

thanks in advanced,

Michal.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Sep 09, 2009 at 11:43 AM

    The Release button operates a function, correct? This function should return some sort logging, like Succesfully created, or error not all required fields provided.

    Catch this logging and display it after pressing the Log button.

    The other option would be this. It is possible that this function creates some sort of application log that can be viewed with transaction SGL1. This logging you can retrieve in your program and display it as a pop-up screen.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 11:48 AM

    Hi,

    I can help you on this if you are using the SALV method. Factory method.

    You need to created event handlers for this. and then need to call the second alv .

    CLASS LCL_HANDLE_EVENTS DEFINITION DEFERRED.        "events for the alv
    
    DATA: GR_EVENTS TYPE REF TO LCL_HANDLE_EVENTS.      "events object
    
    *---------------------------------------------------------------------*
    *       CLASS lcl_handle_events DEFINITION
    *---------------------------------------------------------------------*
    * To define a local class for handling events of cl_salv_table
    *---------------------------------------------------------------------*
    CLASS LCL_HANDLE_EVENTS DEFINITION.
      PUBLIC SECTION.
        METHODS:
          ON_USER_COMMAND FOR EVENT ADDED_FUNCTION OF CL_SALV_EVENTS
            IMPORTING E_SALV_FUNCTION.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    
    *---------------------------------------------------------------------*
    *       CLASS lcl_handle_events IMPLEMENTATION
    *---------------------------------------------------------------------*
    * To implement the events for handling the events of cl_salv_table
    *---------------------------------------------------------------------*
    CLASS LCL_HANDLE_EVENTS IMPLEMENTATION.
      METHOD ON_USER_COMMAND.
        PERFORM HANDLE_USER_COMMAND USING E_SALV_FUNCTION.
      ENDMETHOD.                    "on_user_command
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    
    
      DATA: LR_EVENTS TYPE REF TO CL_SALV_EVENTS_TABLE.
    
      LR_EVENTS = IR_TABLE->GET_EVENT( ).
    
      CREATE OBJECT GR_EVENTS.
    
    *... register to the event USER_COMMAND
      SET HANDLER GR_EVENTS->ON_USER_COMMAND FOR LR_EVENTS.
    
    *&---------------------------------------------------------------------*
    *&      Form  handle_user_command
    *&---------------------------------------------------------------------*
    FORM HANDLE_USER_COMMAND USING I_UCOMM TYPE SALV_DE_FUNCTION.
    
      DATA: LR_SELECTIONS TYPE REF TO CL_SALV_SELECTIONS,
            L_W_ROW_TAB   LIKE LINE OF ROW_TAB,
            L_W_INDEX     TYPE I.
    
    *...   To get the selected rows
      LR_SELECTIONS = IR_TABLE->GET_SELECTIONS( ).
      ROW_TAB  = LR_SELECTIONS->GET_SELECTED_ROWS( ).
    
      LOOP AT ROW_TAB INTO L_W_ROW_TAB.
        L_W_INDEX = L_W_ROW_TAB.
        READ   TABLE IT_OUTTAB INTO WA_OUTTAB INDEX L_W_INDEX.
        APPEND WA_OUTTAB TO IT_OUTTAB2.
        CLEAR  WA_OUTTAB.
      ENDLOOP.
    
    
    
      IF IT_OUTTAB2 IS NOT INITIAL.
        PERFORM DISPLAY_ALV_DETAILS.
      ELSE.
        EXIT.
      ENDIF.
    
    ENDFORM.                            "handle_user_command
    *&---------------------------------------------------------------------*
    *&      Form  display_alv_details
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM DISPLAY_ALV_DETAILS.
    
    *... create an ALV table
    *    just create an instance and do not set LIST_DISPLAY for
    *    displaying the data as a Fullscreen Grid
    
      TRY.
          CL_SALV_TABLE=>FACTORY(
            IMPORTING
              R_SALV_TABLE = IR_TABLE
            CHANGING
              T_TABLE      = I_RECON ).
        CATCH CX_SALV_MSG.                                  "#EC NO_HANDLER
      ENDTRY.
    
    
    IR_TABLE->SET_SCREEN_STATUS(
        PFSTATUS      =  'STANDARD_ALV'
        REPORT        =  SY-REPID
        SET_FUNCTIONS = IR_TABLE->C_FUNCTIONS_ALL ).
    
    *... To display the Table IT_OUTTAB2 with values
      IR_TABLE->DISPLAY( ).
    ENDFORM.                    " display_alv_details
    

    Regards

    Ansari

    Edited by: Muhammed Ansari Abubekkar on Sep 9, 2009 5:18 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 09, 2009 at 12:01 PM

    Hi,

    As suggested, just show the log after the function is successful. You might have used some subroutine if log button is pressed.Call the same subroutine after the function is called also.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2009 at 07:20 AM

    thank you all very much.

    the problem was solved.

    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.