Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set function code to cl_salv_table(Control alv table using main toolbar) ?

Former Member
0 Likes
5,931

I use cl_salv_table inside the docking container in my program. And I want to move ALV toolbar(inside the ALV container) to the main toolbar(PF-STATUS). I know that we can do this on 'cl_gui_alv_grid' by handling the main toolbar's ok_code and trigger the change to the grid via 'set_function_code'. But it seem that there is no this function in the class 'cl_salv_table'.

Do you have any idea how to set a function code to cl_alv_table ? or how to control cl_salv_table from the main toolbar ?

5 REPLIES 5
Read only

Clemenss
Active Contributor
0 Likes
2,257

Hi Winter Pinn,

not sure if it helps (and I'm not on the system): There is a class CL_SALV_CONTROLLER_METADATA with an interface IF_SALV_C_SLIS_FCODE. As there is a method cl_salv_controller_metadata=>get_slis_fieldcatalog to extract the fieldcatalog from the grid object, there may be something to access the grid object directly. Some of the methods may be protected, so  you may inherit your own class to make use of them.

Just an idea!

Merry Christmas and Happy New Year

Clemens

Read only

sandroramos
Active Participant
0 Likes
2,257

Hi,

You can use SET_SCREEN_STATUS method of class cl_salv_table, after that set an handler for ON_USER_COMMAND event.

Example:

  gr_table->set_screen_status(

     pfstatus         'SALV_STANDARD'

     report            wv_repid

     set_functions = gr_table->c_functions_all ).


SET HANDLER: gr_events->on_user_command FOR lr_events.

gr_events is a reference of a local class. If you need more details let me know.

Regards,

Sandro Ramos

Read only

0 Likes
2,257

Hi,

At first, I want to thank you for helping. It seem that the solution above is to handle the event from the cl_alv_table itself. But my requirement is that, I want to pass the event from the program toolbar to the cl_alv_table that is located inside the docking container.

For example, when the user click sort button located in the main program toolbar, the alv table inside the container get sorted.

Please let me know if I misunderstand something.

Thank you,

Finn

Read only

Former Member
0 Likes
2,257

Hello,

Check this. Go to screen 100 and activate the GUI.

data:   lo_events      TYPE REF TO   cl_salv_events_table.
data:  lo_alv         TYPE REF TO   cl_salv_table.


TRY" ALV
         CALL METHOD cl_salv_table=>factory
           IMPORTING
             r_salv_table = lo_alv
           CHANGING
             t_table      = gt_zaps12.
       CATCH cx_salv_msg .                               "#EC NO_HANDLER
     ENDTRY.

*&   PF - Status
     SET HANDLER on_user_command FOR lo_events.
     lo_alv->set_screen_status(
     pfstatus      = 'STATUS_0100'
     report        = sy-repid
     set_functions = 2 ).
*


Let me know if you need some more help.


Regards,

Guru.

Read only

0 Likes
2,257

Hi,

At first, I want to thank you for helping. It seem that the solution above is to handle the event from the cl_alv_table itself. But my requirement is that, I want to pass the event from the program toolbar to the cl_alv_table that is located inside the docking container.

For example, when the user click sort button located in the main program toolbar, the alv table inside the container get sorted.

Please let me know if I misunderstand something.

Thank you,

Finn