Service call in WebDynpro application

...Previous

Step 10

Method ‘SUBSCRIBE_TO_BUTTON_EVENT ‘creates a popup with yes or no buttons. If yes button is pressed the data base is updated successfully and if pressed NO, no action should happen. For this we need to create an action YES and NO in the actions tab.

In the methods tab two method handlers will be created where we can write required logic.

Step 11

Copy the following code in the ONACTIONYES method implementation.

data: l_current_controller type ref to if_wd_controller,
l_message_manager type ref to if_wd_message_manager.

l_current_controller ?= wd_This->Wd_Get_Api( ).

CALL METHOD l_current_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = l_message_manager
.
data:
Node_Itab type ref to If_Wd_Context_Node,
Elem_Itab type ref to If_Wd_Context_Element,
Stru_Itab type If_Secondview=>Element_Itab .
data : ls_itab type zstudent.
* navigate from <CONTEXT> to <ITAB> via lead selection
Node_Itab = wd_Context->get_Child_Node( Name = `ITAB` ).

* get element via lead selection
Elem_Itab = Node_Itab->get_Element( ).

* get all declared attributes
Elem_Itab->get_Static_Attributes(
importing
Static_Attributes = Stru_Itab ).
ls_itab-empno = Stru_Itab-empno.
ls_itab-ename = Stru_Itab-ename.
ls_itab-esal = Stru_Itab-esal.
modify zstudent from ls_itab.
if sy-subrc eq 0.
* report message
CALL METHOD l_message_manager->REPORT_SUCCESS
EXPORTING
MESSAGE_TEXT = ' Updated successfully'.
endif.

Step 12

Create an application for the component and test it. Click on get data to get the data from data base

Click on next to go to next screen where it displays the user selected line

Change the data if needed and click on update.

On the popup screen, click on Yes to update the data base or click on No to do nothing. After updating a confirmation message will be displayed.

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image