Skip to Content
avatar image
Former Member

Passing Object ref to Webdynpro Application while calling from BSP screen

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 22, 2009 at 10:10 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

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

  • avatar image
    Former Member
    Jun 22, 2009 at 09:21 AM

    Hi,

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

    Regards

    Vikranth

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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