cancel
Showing results for 
Search instead for 
Did you mean: 

Change text of buttons of ALV of WEB DYNPRO ABAP

former_member497277
Participant
0 Kudos

Hello to all:

How I can to change the texts of the buttons what appear by defect in the ALV element of Web dynpro Abap, like 'Delete line' or 'Exporting to excel'. etc.???

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Chandresh
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ana,

Here is coding please implement in your coding it will change the text of standard ALV Button.

**-- 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

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

lr_function->text = 'Put the text you want'.

This code has been tested and working really fine. Please let me know if you have any questions on that.

Give me your feed back on that,

Chandresh

former_member497277
Participant
0 Kudos

Hello Chandresh. Thanks for your response.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Miguel,

The class is CL_SALV_WD_FUNCTION.

Regards,

Supriya

Answers (3)

Answers (3)

Former Member
0 Kudos

Here is the new solution.

DATA: lo_function_dpwty       TYPE REF TO cl_prs_std_alv_funct,
        lr_functions           
TYPE REF TO if_salv_wd_function_settings,
        lr_function_std        
TYPE REF TO cl_salv_wd_a_function_std.



 
CREATE OBJECT lo_function_dpwty
   
EXPORTING
     
id = 'X'.

  lr_functions = l_ref_interfacecontroller->get_model( ).

 
" append row rename
  lr_function_std = lr_functions->get_function_std( if_salv_wd_c_std_functions=>edit_append_row ).
  lv_button_text =
'Add Item'.
  lo_function_dpwty->change_text(
EXPORTING text        = lv_button_text
                                                      
CHANGING  std_function  = lr_function_std ).


 
"Delete row item rename
  lr_function_std = lr_functions->get_function_std( if_salv_wd_c_std_functions=>edit_delete_row ).
  lv_button_text =
'Delete Item'.
  lo_function_dpwty->change_text(
EXPORTING text        = lv_button_text
                                                      
CHANGING  std_function  = lr_function_std ).

Former Member
0 Kudos

Made my day.

Thx!!!!!

Former Member
0 Kudos

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

Chandresh
Product and Topic Expert
Product and Topic Expert
0 Kudos

In Order to change the Text of Button, you need to use the class CL_SALV_WD_UIE_BUTTON with proper method of reading text and than change the text of this Button. with the help this class you can change design of the button.