This document will help you to understand the concept of calling the Tcode from Web Dynpro ABAP and passing values to it.
In this example I will call sales order Edit Tcode VA02 by passing sales order number from web Dynpro application and will go to direct Edit page by skipping initial page of that Tcode.
- Create a Web Dynpro Component
- In the Main view Create an input filed to get sales order number and create a Push button to call the Tcode.
- Create an event in the push button to call the transaction & pass the sales order value.
![Untitled.png]()
- Code to call sales order Transaction and passing the SO Number in push button :
METHOD onactionon_edit .
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_vbeln LIKE ls_context-vbeln.
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 lv_url TYPE string.
DATA lv_host TYPE string.
DATA lv_port TYPE string.
lo_el_context = wd_context->get_element( ).
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_el_context->get_attribute(
EXPORTING
name = `VBELN`
IMPORTING
value = lv_vbeln ).
* Call below method to get host and port
CLEAR : lv_host , lv_port.
cl_http_server=>if_http_server~get_location(
IMPORTING
host = lv_host
port = lv_port ).
* Creating URL
CONCATENATE 'http'
'://'
lv_host
':'
lv_port
'/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=*VA02%20VBAK-VBELN='
lv_vbeln
';DYNP_OKCODE=/00'
INTO lv_url.
* calling the url which we created above as a popup
lo_window_manager->create_external_window(
EXPORTING
url = lv_url
RECEIVING
window = lo_window ).
lo_window->open( ).
ENDMETHOD.
- Create the Web Dynpro Application , activate the whole component and call the Application URL , once you enter the SO number & hit Edit button it will open SO Edit screen in your browser with the given SO number and Initial page of VA02 will be skipped.
- Gowtham



