cancel
Showing results for 
Search instead for 
Did you mean: 

How can i change the text of an standard button in ALV?

Former Member
0 Kudos

hi everybody,,,i use this code ,,but when i check ,,there is an error , it says the <b> lr_function</b> is unknown ,,my question is , what class i have to use to make lr_function ref to?...thanks

**-- First check ALV component usage

DATA: lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.

lr_salv_wd_table_usage = wd_this->wd_cpuse_alv_viewer( ).

IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.

lr_salv_wd_table_usage->create_component( ).

ENDIF.

**-- Get data cinfiguration data for ALV Table

data: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.

lr_salv_wd_table = wd_this->wd_cpifc_alv_viewer( ).

**-- (1) get ConfigurationModel from ALV Component

data : lr_functions type ref to if_salv_wd_function_settings,

lr_functions= lr_salv_wd_table->get_model( ).

**-- Standard Function ID you will get from lr_functions

<b>lr_function</b> = lr_functions->get_function_std(Function ID of Standard Button ).

<b>lr_function->text = 'Put the text you want'.</b>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

lr_function should refer to the class cl_salv_wd_function.

-nithya

Former Member
0 Kudos

thanks nithya, , but i use the class and still doesn't work, so i use the class cl_salv_wd_function_std and finally it works.

0 Kudos

Hi All,

I tried to use this solution, but the class CL_SALV_WD_FUNCTION_STD attribute TEXT is read-only and method SET_TEXT is protected, so it doesn't work...

Any idea?

Former Member
0 Kudos

Lazlo,

TEXT attribute in CL_SALV_WD_FUNCTION_STD is NOT read only and is public. That mean u can directly change it using <b>lr_function->text</b>.

If u wanna use the SET_TEXT method heres how -

Yes thats a protected method, means only Subclass can access it.

Heres a round about way....

CL_SALV_WD_A_FUNCTION_STD is the Superclass for CL_SALV_WD_FUNCTION_STD .

Create a Subclass ZCL_SALV_WD_A_FUNCTION_STD that inherits from CL_SALV_WD_A_FUNCTION_STD. In this class define a method CHANGE_TEXT that has a CHANGING parameter TYPE REF TO CL_SALV_WD_A_FUNCTION_STD

So:

data <b>m_a_func_std</b> type ref to CL_SALV_WD_A_FUNCTION_STD.

m_a_func_std ?= m_alv_model->IF_SALV_WD_FUNCTION_SETTINGS~ GET_FUNCTION_STD ( 'button function' )

data <b>m_sub_a_func_std</b> type ref to ZCL_SALV_WD_A_FUNCTION_STD .

m_sub_a_func_std->CHANGE_TEXT( m_a_func_std ).

CHANGE_TEXT method...

m_a_std_func->SET_TEXT ( 'your text' ).

Thanks

Anand

0 Kudos

Great!

It is working well now.

Thanks.

Answers (0)