Skip to Content

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 :

Untitled.png

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_contextvbeln.

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.

Untitled.png

Untitled.png

– Gowtham

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Kenneth Moore

    Ahh, but do you know how to get rid of that ugly button toolbar and replace it with the SAP familiar buttons (Back/Cancel/Etc.)?  Ha.ha!

    Actually, quite simple.  T-code SICF.  Navigate to the WEBGUI node: /sap/bc/gui/sap/its/webgui.  Change the WEBGUI node.

    Change GUI LINK to ‘Yes’ if not already selected.

    Click the GUI CONFIGURATION button. 

    Add parameter ~WEBGUI_ICON_TOOLBAR and set to 2.

    Save.

    (0) 
  2. Kenneth Moore

    A better way to construct the url for your transaction is by using function ‘SITSP_GET_URL’.  You can then tack on your extra parameters you want to pass with it.

    (0) 

Leave a Reply