This website is not affiliated with, sponsored by, or approved by SAP AG.

Change function text on cl_salv_table

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Change function text on cl_salv_table

Postby q4u » Wed Jul 23, 2014 10:01 am

Hi,
I'm adding a function to my SALV grid using the following common coding, and it appears as expected:

Code: Select all
o_functions = go_grid->get_functions( ).
    TRY.
        o_functions->add_function( name = 'RUN'
                                    icon = '@01@'
                                    text = v_text
                                    tooltip = v_text
      position = if_salv_c_function_position=>right_of_salv_functions ).
      CATCH cx_salv_wrong_call cx_salv_existing.
    ENDTRY.

I would like to change the text when the button is clicked - is that possible? I don't see a "Change_function" method.

Thanks
Q4U
Last edited by Gothmog on Wed Jul 23, 2014 10:14 am, edited 1 time in total.
Reason: code tags
q4u
 
Posts: 439
Joined: Wed Mar 08, 2006 7:02 am

Re: Change function text on cl_salv_table

Postby Gothmog » Wed Jul 23, 2014 10:20 am

Can't you use o_functions->get_functions( ) to get the tables of functions, read the right line to get the reference of the function you want (type CL_SALV_FUNCTION), then use its methods SET_TEXT and/or SET_TOOLTIP to change the texts?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Change function text on cl_salv_table

Postby q4u » Wed Jul 23, 2014 10:51 am

Gothmog wrote:Can't you use o_functions->get_functions( ) to get the tables of functions, read the right line to get the reference of the function you want (type CL_SALV_FUNCTION), then use its methods SET_TEXT and/or SET_TOOLTIP to change the texts?

Yes I could, and yes I did. Thank-you!
q4u
 
Posts: 439
Joined: Wed Mar 08, 2006 7:02 am

Re: Change function text on cl_salv_table

Postby Gothmog » Wed Jul 23, 2014 11:06 am

Great! :)

This class is structured in such a way that you often have to use a method to get a "collection" (of functions, or columns, for example) object, then a method of this "collection" object to get to the specific object you want to modify, and then use methods of this object to get/set its properties.

So, get use to double-click a lot on method parameter types to find what you're looking for. ;)
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home


Return to ABAP

Who is online

Users browsing this forum: No registered users and 8 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.