cancel
Showing results for 
Search instead for 
Did you mean: 

WEB DYNPRO ABAP - query

Former Member
0 Kudos

Hi ,

I added a button SAVE in my alv table. It gets dis played on my alv table also. But I dont know where to write the code for the button to make it work. Please some on help me regarding this issue.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the View, METHODS tab, first you need to create a method for save and under EVENT controller you need to select the ALV event on ON FUNCTION for that alv. there is a help when you click on EVENTS, select this event.

Methodname           Methodtype                 event*
*USER_FUNCTION   EVENTHANDLER         ONFUNCTION

Go to the method, there is a parameter R_PARAM type IF_SALV_WD_TABLE_FUNCTION which returns the function that is called.

You need to write a case statment for each function and write the respective coding

Ex:

case r_param~name = 'SAVE'.

// coding..You can call SAVE method in this and handle your code.

endcase.

Regards,

Lekha.

Edited by: Lekha on Apr 13, 2011 2:16 PM

Former Member
0 Kudos

Hi Leka,

Thank you so much for your reply. have a doubt.

DATA LR_BUTTONUI TYPE REF TO CL_SALV_WD_FE_BUTTON.

DATA BUTTON1 TYPE REF TO CL_SALV_WD_FUNCTION.

CREATE OBJECT LR_BUTTONUI.

LR_BUTTONUI->SET_TEXT( 'Update' ).

BUTTON1 = L_VALUE->IF_SALV_WD_FUNCTION_SETTINGS~CREATE_FUNCTION( ID = 'SAVE_UP' ).

BUTTON1->SET_EDITOR( LR_BUTTONUI ).

Below is my code, should i create a method with the name 'SAVE_UP' and i dont understand about the event contoller u said. i found a tab called event under method tab when i click on that it shows "Event and controller can only be maintained for event handlers". Is that wat u are meaning.

Former Member
0 Kudos

Hi,

Create a entry - METHODS TAB

USERFUNCTION(Method Name), Method type as EVENT HANDLER, EVENT as ON_FUNCTION.

Create one more method as SAVE, Method type (METHOD), code it here.

METHOD USERFUNCTION.

CASE R_PARAM~NAME = 'SAVE_UP' "Button Id
call method  wd_this->SAVE.
ENDCASE.

ENDMETHOD.

Regards,

Lekha.

Former Member
0 Kudos

Thank you so much Leka. I understood clearly will get back to you in case of any queries.

Former Member
0 Kudos

Small correction,

CASE R_PARAM~ID = 'SAVE_UP'

Former Member
0 Kudos

hi leka thank you so much my query is working fine now. thanks a lot once again.

Former Member
0 Kudos

hi,

would you please share the solution with me, i have the same issue, and i need to know how did you solve your problem

thank you

Former Member
0 Kudos

Hi Scafandri,

It is very simple. Follow the stepa i have given below your code will work fine.

To create a Button in the Alv table:

data lr_buttonui type ref to cl_salv_wd_fe_button.

data button1 type ref to cl_salv_wd_function.

create object lr_buttonui.

lr_buttonui->set_text( 'Update' ).

button1 = l_value->if_salv_wd_function_settings~create_function( id = 'SAVE_UP' ).

button1->set_editor( lr_buttonui ).

Then create a method name USER_FUNCTION, method Type - Event Handler, Event - ONFUNCTION. And write the below code in that method.

method user_function .

case r_param->id.

when 'SAVE_UP'.

call method wd_this->save.

endcase.

endmethod.

Then create a method SAVE and write your logic as per your requirement. The code will work fine. Get back to me in case of any queries.

Answers (0)