cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Object ref to Webdynpro Application while calling from BSP screen

Former Member
0 Kudos

Hi,

Is it possible to pass Object(ClassObject) reference to webdynpro application ?

I am calling WebDynpro Application from BSP screen. When I try to pass Object reference through WD Application parameteres. It is not accepting the 'Type Ref to' to declare a parameter.

Can any one give me the solution for this.

Thanks & regards

Warun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Warun,

Where you are creating object to your model class and did you take global variable or local variable for creating object.What ever it is do in this way.

Create one static attribute say go_model type ref to your model class in your class.Create object in BSP like create object zcl_model=>go_model..Since this is a class variable you can use any where else.you no need to export.

Use same varible in your web dynpro application to call any like below.

zcl_model=>gp_model->get_flights( ).

Edited by: suman kumar chinnam on Jun 22, 2009 12:10 PM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The static attribute approach can't be relyed upon in real production systems. Static attributes can't cross application servers. In production systems you often have multiple application servers and can't control how you might be load ballanced between different app servers when switching from BSP to WDA.

You should consider instead making your model object serializable (if_serializable_object). You can then use a CALL TRANSFORMATION on the object to serialize it to XML. Just be careful because only public attributes can be serialized. You can then write this XML XSTRING into a temporary database table (perhaps as a Server Cookie) and read it reliably from the WDA application.

Saving the model:

data: ostream type string,
           xslt_err type ref to cx_xslt_exception.
***** serialize model class
  try.
      call transformation id
      source model = system_state
      result xml ostream.

****Write cookie it into the Server Cookie
      cl_bsp_server_side_cookie=>set_server_cookie( name = data_name
        application_name = ''
        application_namespace = ''
        username = 'F1HELP'
*        session_id = mc_runtime->session_id
        data_name = data_name
        data_value = ostream
        expiry_time_rel = '1200' ).
    catch cx_xslt_exception into xslt_err.
  endtry.

Restoring the model:

data: istream type string,
          xslt_err type ref to cx_xslt_exception.

**** Read Server cookie
  call method cl_bsp_server_side_cookie=>get_server_cookie
    exporting
      name                  = data_name
      application_name      = ''
      application_namespace = ''
      username              = 'F1HELP'
*      session_id            = session_id
      data_name             = data_name
    changing
      data_value            = istream.

**** deserialize the Class
  if istream is not initial.
    try.
        call transformation id
        source xml istream
        result model = r_model.
      catch cx_xslt_exception into xslt_err.
    endtry.
  endif.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Can you brief out your error exactly, Are u getting the error in the bsp side, or the WDA side ?

Regards

Vikranth

Former Member
0 Kudos

Hi,

Thanks for the reply.

Actually, I am not getting error.But while declaring parameters for WD Application. It is not allowing to declare a variable with 'type ref to'.

Requirement is as below..

First screen will be the BSP screen. User fills the data on BSP and clicks on one button. then a Web Dynpro Application will be called. Now when calling WD Application I need to pass the Object reference of the Model class of the same BSP to the Web Dynpro Application.

Basically I need to access some data from Web Dynpro, which is generated in BSP using the model class of the BSP. So, If I am able to pass the instance of the Object reference, I can access the data of the model class..

Or provide me any other solution to access the data from WD Application.

Thanks & regards

Warun