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

Reuse_alv_grid_display

Hi All,

Iam writing a report program using oops and I am displaying the data using reuse_alv_grid_display.But the client wants a UPLOAD button on application toolbar. Please provide a sample code that how to put a button on application toolbar.

Note:I am not using any performs and forms in my program.The entire report is done using oops so, it contains only methods.

Thanks in advance.

Regards,

Chakradhar.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 20, 2014 at 07:53 AM

    Hi Charki,

    As you mentioned that you are using OOPs to build ALV, you have to call method SET_TABLE_FOR_FIRST_DISPLAY.

    And to add a button on Tool bar we have an Event called TOOLBAR in the same class. Please refere the following sample code to add a button on standard toolbar.

    -----------------------------------------------------------------------------------------------------------------

    CLASS LCL_EVENT HANDLER DEFINITION.

    PUBLIC SECTION.

    METHODS: Handle_Toolbar FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID

    IMPORTING e_object

    e_interactive,

    ENDCLASS.

    CLASS LCL_EVENT HANDLER IMPLEMENTATION.

    METHOD HANDLE_TOOLBAR.

    DATA LS_TOOLBAR TYPE STB_BUTTON. " Push button properties

    * Push Button

    CLEAR LS_TOOLBAR.

    MOVE G_FC TO LS_TOOLBAR-FUNCTION. " Function code of button

    MOVE '<text that appear on button>'(100) TO LS_TOOLBAR-TEXT.

    MOVE '<wrte text here>'(100) TO LS_TOOLBAR-QUICKINFO.

    MOVE SPACE TO lv_toolbar-disabled.

    APPEND LS_TOOLBAR TO e_object->mt_toolbar.

    ENDMETHOD.

    ENDCLASS.

    " At where ALV is displaying

    DATA : GR_EHANDLER TYPE REF TO LCL_EVENT HANDLER,

    GR_TABLE TYPE REF TO CL_GUI_ALV_GRID,

    CREATE OBJECT GR_EHANDLER.

    * Event Handler, before displaying ALV

    SET HANDLER GR_EHANDLER->HANDLE_TOOLBAR FOR GR_TABLE.

    " Call method SET_TABLE_FOR_FIRST_DIPLAY

    -----------------------------------------------------------------------------------------------------------------

    Regards,

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 19, 2014 at 03:24 PM

    Hi Chakri,

    If you are displaying the report using OOABAP, then you can display the same using SET_TABLE_FOR_FIRST_DISPLAY method. I hope that in that case, we can use method... endmethod.

    For this case, we are using REUSE_ALV_GRID_DISPLAY, then we have to use the FORM....ENDFORM for USER_COMMAND(handling the actions) and PF-STATUS. Correct me if I am wrong.

    Go to SE80 and open the program SLVC_FULLSCREEN here you will find the GUI Status node. drill the node and rightclick -> copy the GUI Status STANDARD_FULLSCREEN. give the target program name (your alv grid program) and zguistatus name.

    Add the 'UPLOAD' button in the Zguistatus.

    For handling the button event the code snippet is below,

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    IT_FIELDCAT = d_fieldcat

    I_GRID_TITLE = 'Communications Infotype'

    IT_EVENTS = it_event

    TABLES

    t_outtab = it_final.

    FORM user_command USING l_comm TYPE syucomm

    rs_selfield TYPE slis_selfield.

    CASE l_comm.

    WHEN '&UPLOAD'.

    "Write the Upload statement here

    ENDCASE.

    ENDFORM.

    FORM set_pf_status USING rt_extab TYPE slis_t_extab .

    SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.

    ENDFORM.

    Regards

    Rajkumar Narasimman

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Chakri,

      Even I tried the same long back before you did. I didn't make it. So I purely converted the program to OOABAP.

      I understood that using REUSE_ALV_GRID_DISPLAY, we can't call the Method...Endmethod.

      If you are trying in OOABAP, please use OOABAP concepts to show the ALV Grid. We know using REUSE_ALV_GRID_DISPLAY is little bit easy to show the ALV Output. But when we come to OOABAP, it is better to adopt object oriented functionality.

      Regards

      Rajkumar Narasimman

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.