cancel
Showing results for 
Search instead for 
Did you mean: 

Access to R/3 Transaction from Web Dynpro Application with parameters.

SantiMoreno
Participant
0 Kudos

Hi Gurus.

I have a question from a customer in which he asks whether I can access to a SAP transaction from a Web Dynpro App I've implemented.

I followed thru a document I found about how to do it (but nothing about parameters); so, I've generated an external window (explorer) which accesses to the demanded URL (let say http://customer_server/sap/bc/gui/sap/its/webgui/?~transaction=FB03).

Is there any way to access that transaction giving information to the entry fields (BELNR, GJAHR and BUKRS)? I was going to use SET ID Params but since it's a new session, no info is passed.

Kind Regards.

Santy.

Accepted Solutions (0)

Answers (1)

Answers (1)

Gowtham
Contributor
0 Kudos

Hi Santiago,

Use the following code to call SAP Transaction from web dynpro abap and passing values to it.


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.

Kindly refer this link for more detailed information.

http://scn.sap.com/docs/DOC-63107

- Gowtham