cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a dropdown box in an ALV toolbar??

Former Member
0 Kudos

hi,

i have a requirement where i need to add a dropdown box in my ALV Toolbar. To be precise next to the export button in my ALV.

Plz help me on this, thanks.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

thanks a lot. yes, the problem is solved

Former Member
0 Kudos

Hi Frank,

Sorry for late reply.

Yes, Sascha is right. You need to declare it as attribute. Hope your problem is solved by this time. All the best!

Cheers,

Darshna.

Message was edited by:

Darshna Thole

Former Member
0 Kudos

hi darshna,

thanks for your code, i tried it but it comes up with the following error message:

Method WDDOINIT

Field "R_TABLE" is unknown. It is neither in one of the specified

tables nor defined by a "DATA" statement. "DATA" statement. "DATA" statement.

could u please tell me how to proceed further.

thnx.

Former Member
0 Kudos

Hi Frank.

This is because the r_table reference is missing in your attributes of the view.

But you do not need it. e_table seems to be the model of the ALV which can be retrieved from the interface controller of the ALV component. Just declare the controller usage in the properties tab of your view.

The you can use the wizard to create the method call which would look like this:


lr_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    IF lr_ref_cmp_usage->has_active_component( ) IS INITIAL.
      lr_ref_cmp_usage->create_component( ).
    ENDIF.

    lr_ref_if_contrl =   wd_this->wd_cpifc_alv( ).

Then you can use the lr_ref_if_contrl like the r_table reference:

lr_functions ?= lr_ref_if_contrl->get_model( ).

Hope this helps.

Cheers,

Sascha

Former Member
0 Kudos

Hi Frank,

Refer the WD Component SALV_WD_TEST_TABLE_TOOLBR which will explain more clearly the Toolbar concepts and easily can do without anyone help.

The R_TABLE attrubute you may be created in Component controller thats why it is asking you that it is unknown. So you can access this variable in View using default attrubutes wd_comp_controller or you please do the ALV related coding in the respective view also instead of doing code in component controller.

Warm Regards,

Vijay

Former Member
0 Kudos

Hi Frank,

I am providing the some peice of code which will be helpful to you.

Adding the DropDown list to the ALV toolbar:

lr_functions ?= wd_this->r_table.

lr_function = lr_functions->create_function( 'MYDROPDOWNBYINDEX' ).

create object lr_dropdown_by_idx

exporting

texts_elementname = 'DROPDOWNBYINDEX.VALUE'.

lr_dropdown_by_idx->set_label_text( 'MYDROPDOWNBYINDEX' ).

lr_function->set_editor( lr_dropdown_by_idx ).

Providing the values to that DropDown:

Here in my example DROPDOWNBYINDEX.VALUE is the context attrubute. And i write the Supply function for that node as follows:

data:

lt_dropdownbyindex type if_componentcontroller=>elements_dropdownbyindex,

ls_dropdownbyindex type if_componentcontroller=>element_dropdownbyindex.

ls_dropdownbyindex-value = 'Nothing'. "#EC NOTEXT

append ls_dropdownbyindex to lt_dropdownbyindex.

ls_dropdownbyindex-value = 'ActionDropdownByIndex'. "#EC NOTEXT

append ls_dropdownbyindex to lt_dropdownbyindex.

node->bind_table( lt_dropdownbyindex ).

For reference you can refer the WD component SALV_WD_TEST_TABLE_TOOLBR which holds the same code

Hope this will help you. Reward points if it helps.

Cheers,

Darshna.