Saturday 16 April 2011

Call ABAP Webdynpro Application from a R/3 Transaction

Please find the Code Snippets to Call a Webdynpro ABAP Application from a R/3 Transaction
Create a ABAP Program from SE38 and associate a transaction to it and Call the same.

REPORT  ZWD1.

***data declarations
DATA:gv_url_string TYPE string,
     gv_url_c(250) TYPE c.

CONSTANTS:gc_login_auth TYPE string VALUE '?sap-system-login-basic_auth=X',
          gc_client     TYPE string VALUE '&sap-client=',
          gc_lang       TYPE string VALUE '&sap-language='.

***Get the Url of Webdynpro Applicaion with HTTPS Protocol
CALL METHOD cl_wd_utilities=>construct_wd_url
  EXPORTING
    application_name = 'WDR_TEST_NAVIGATION'
    in_protocol      = 'HTTPS'
  IMPORTING
    out_absolute_url = gv_url_string.

***If the server and port have not got added, try without HTTPS Protocol
IF gv_url_string CS '//:/'.
  CALL METHOD cl_wd_utilities=>construct_wd_url
    EXPORTING
      application_name = 'WDR_TEST_NAVIGATION'
    IMPORTING
      out_absolute_url = gv_url_string.

***If server and port have still not got added
  IF gv_url_string CS '//:/'.
**Raise a Error Message
  ENDIF.
ENDIF.

***Build the URL
CONCATENATE gv_url_string
            gc_login_auth
            gc_client sy-mandt
            gc_lang   sy-langu
  INTO gv_url_c.

***Call the Browser
CALL FUNCTION 'CALL_BROWSER'
  EXPORTING
    url                    = gv_url_c
  EXCEPTIONS
    frontend_not_supported = 1
    frontend_error         = 2
    prog_not_found         = 3
    no_batch               = 4
    unspecified_error      = 5
    OTHERS                 = 6.

4 comments :

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. hi,
    How to differentiate in WDA whether it has been called from R3 or ESS? Sy-Tcode did not work

    ReplyDelete
  4. Titanium Shift knob - Tioga Center of Design
    In all, the design is pretty unique, keith titanium which means that you can titanium undertaker use ford titanium ecosport the device with ion titanium hair color different functions. I love the fact that harbor freight titanium welder the

    ReplyDelete