cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass context data from one WD Application to other WD Application ?

Former Member
0 Kudos

Hi,

I have a situation where I need to work with 2 different WD applications.

WDA1 will have buttons and on click a pdf form opens using WDA2 in new window.

I know we can pass parameters from one application to other but how do we pass Context itself?

I am using following code for passing parameters .This is inside of BUTTON1 onaction.

DATA lo_el_contextl TYPE REF TO if_wd_context_element.
  DATA ls_contextl TYPE wd_this->element_context.
  DATA lv_visibl LIKE ls_contextl-visibl.
* get element via lead selection
  lo_el_contextl = wd_context->get_element(  ).

* get single attribute
  lo_el_contextl->set_attribute(
    EXPORTING
      name =  `VISIBL`
      value = '02').



  lo_el_contextl->get_attribute(
      EXPORTING
         name =  `VISIBL`
      IMPORTING
         value = lv_visibl ).

  DATA:
    w_url   TYPE string,
    w_value TYPE string.


*   * Get the URL of the called application
  CALL METHOD cl_wd_utilities=>construct_wd_url
    EXPORTING
      application_name = 'WDAPPLICATION2'
    IMPORTING
      out_absolute_url = w_url.

*   * make the Value type compatible that has to be passed with the URL
  w_value = lv_visibl.

* Attach the parameters and its value with the URL that
* have to be passed to the 2nd application
  CALL METHOD cl_http_server=>append_field_url
    EXPORTING
      name  = 'VISIBL'
      value = w_value
    CHANGING
      url   = w_url.
  
* generate a popup window for the 2nd application with the above URL
  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.

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).

  lo_window         = lo_window_manager->create_external_window(

                   url = w_url ).

  lo_window->open( ).

Rgds

Vara

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Context data is generally much too larger to be passed as a URL parameter. Normally you would extract the data of the context itself and store it somehow. I might suggest conversion to XML so it is a single XSTRING. You can then store it in the database (perhaps as a server cookee). Generate a unique key (like a GUID) for the entery and only pass the unique as a URL parameter. Then on the receiving side; you can read the data, deserialize it and populate it back into your context.

Answers (0)