Webdynpro ABAP application to locate Employee’s location into google map.Follow the below 10 easy steps to create this application.
in last you can able to locate your employee on google map.
Step 1:
Go to Se80 create a Webdynpro comp name ZTEST_LOCATE_EMP.
Step 2:
Create a node into your main windo with name EMP. Dictionary strcuture as PA0006.Click on the button “ADD attriubute from structure” and select the perner from it.
Step 3:
Go to layout tab into MAIN view and create an input field with name EMP_ID.
Step 4:
Double click on the EMP_ID.
You can see the value property for it.Bind this to the context attribute you have created.
Step 5:
Create a Button with name LOCATE.
Step 6:
Double click on it, you can see On action propery. Just click on the create button right side of it.
Create a ACTION name LOCATE .no need to give any outbound plug name.
Step 7 :
When you create an action it automatically a Method name ONACTION<your acion name>.
Here it is ONACTIONLOCATE
Step 8.
Put the below code inside your method :
data : v_pernr type pa0006-pernr.
data : v_street type pa0006-STRAS.
data : v_city type pa0006-ORT01.
data : lr_node type ref to if_wd_context_node.
data: lo_window_manager type ref to if_wd_window_manager.
data: lo_api_component type ref to if_wd_component.
data: lo_window type ref to if_wd_window.
data: ld_url type string.
DATA : FINAL_URL TYPE STRING.
lr_node = wd_context->get_child_node( ‘EMP’ ).
lr_node->GET_ATTRIBUTE( exporting NAME = ‘PERNR’
IMPORTING VALUE = V_PERNR ).
select SINGLE STRAS ORT01 from pa0006 into (v_street,v_city) where
PERNR eq v_pernr.
IF SY-SUBRC EQ 0.
CONDENSE V_CITY.
CONDENSE V_STREET.
CONCATENATE
‘http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=’
V_CITY V_STREET INTO FINAL_URL SEPARATED BY SPACE.
ENDIF.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
*FINAL_URL = ‘www.google.com’.
ld_url = FINAL_URL.
CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
EXPORTING URL = ld_url
RECEIVING WINDOW = lo_window.
lo_window->open( ).
Step 9:
Create a Webdynpro application
Step 10:
Execute the application and give the perner which have the address data updated in PA0006. Take pernr 00000003 if you dont get any.