cancel
Showing results for 
Search instead for 
Did you mean: 

how to read the text of ALV tool bar button

Former Member
0 Kudos

Hi,

Can anybody guide me how to read text of a ALV tool bar button when it pressed..

If anybody can provide code also will be great.

Thanks

Edited by: subba rao on Jun 29, 2011 2:05 AM

Accepted Solutions (1)

Accepted Solutions (1)

former_member199125
Active Contributor
0 Kudos

Small modification in kris code.... like class name and method name..

data:

lr_button type ref to CL_SALV_WD_FE_A_BUTTON,

lr_function type ref to cl_salv_wd_function,

bname type string.

lr_function = l_alv_model->if_salv_wd_function_settings~get_function( ID = <your ID> ).

lr_button ?= lr_function->get_editor( ).

bname = lr_button->get_text( ).

Thanks and Regards

Srinivas

Former Member
0 Kudos

Hi ,

Your coding is working fine but my actual requirement is i have designed 4 buttons on ALV like example

APPEND-A, APPEND-B , APPEND-C, APPEND-D.

These buttons have standard alv APPEND ROW funtionality.

when i click on those buttons it is appending new rows, that's what i also need.

but I need to write separate validation for each button when it is appending row.

When i am cliking on those buttons ON_DATA_CHECK event is trigging. But i am unable to catch which button id is triggering.

Each button have differend id's.

I know i can catch this button id's by ON_FUNCTION event, but this event is not triggering if i am using standard APPEND ROW

functionality..

Can you help me how to read button id's or button name when we click on APPEND-A or APPEND -B

in ON_DATA_CHECK event .

Thanks.

Edited by: subba rao on Jul 1, 2011 8:01 PM

former_member199125
Active Contributor
0 Kudos

Hi Subba rao,

In data check event we can get the details of all modified cells but not button actions details.

I think you need to get those names ( i mean button id's ) in on click event.

Check that once .

Regards

Srinivas

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Subba rao,

Please check this...

On your alv model, first call if_salv_wd_function_settings~get_function( ID = <your ID> ). This will return you a reference of cl_salv_wd_function. If your function uses a button editor, do the following:

data:
lr_button type ref to CL_SALV_WD_FE_BUTTON,
lr_function type ref to cl_salv_wd_function.

lr_function = l_alv_model->if_salv_wd_function_settings~get_function( ID = <your ID> ).
lr_button ?= lr_function->get_editor( ).
lr_button->set_text( ).// this is to set your own text 

you can check this also..

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2...

Cheers,

Kris.