Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Introduction




Due to the fact that WebDynpro for ABAP is on the rise, communication between the existing BSP's and the new WebDynpro's can be a solution, so that the BSP's need no rewriting. The communication can be handled eg with Server Side Cookies.

I "stole" the idea from BSP: Stateless Modelbinding - Proof Of Concept and implemented the parameter-url call towards the WebDynpro.element_model,

    node_table                          TYPE REF TO if_wd_context_node.

  • navigate from <CONTEXT> to <IMPORT> via lead selection

  node_import = wd_context->get_child_node( name = if_zklab_xml_call=>wdctx_import ).

  • get element via lead selection

  elem_import = node_import->get_element(  ).

  • get single attribute

  elem_import->set_attribute(

    EXPORTING

      name =  `USERNAME`

      value = username ).

  DATA: istream TYPE string,

        xslt_err TYPE REF TO cx_xslt_exception.

*Get cookie

  CALL METHOD cl_bsp_server_side_cookie=>get_server_cookie

    EXPORTING

      name                  = 'modeldata2'

      application_name      = application_name

      application_namespace = application_namespace

      username              = username

      session_id            = session_id

      data_name             = 'modeldata2'

    CHANGING

      data_value            = istream.

*Do deserialization:

  IF istream IS NOT INITIAL.

    TRY.

        CALL TRANSFORMATION id

        SOURCE XML istream

        RESULT model = r_model.

      CATCH cx_xslt_exception INTO xslt_err.

    ENDTRY.

    CALL METHOD cl_bsp_server_side_cookie=>delete_server_cookie

      EXPORTING

        name                  = 'modeldata2'

        application_name      = application_name

        application_namespace = application_namespace

        username              = username

        session_id            = session_id.

  ENDIF.

  node_table = wd_context->get_child_node( name = if_zklab_xml_call=>wdctx_table ).

  node_table->bind_elements( r_model->lt_companies ).

  • navigate from <CONTEXT> to <MODEL> via lead selection

  node_model = wd_context->get_child_node( name = if_zklab_xml_call=>wdctx_model ).

  • get element via lead selection

  elem_model = node_model->get_element(  ).

  • get single attribute

  elem_model->set_attribute(

    EXPORTING

      name =  `MODEL`

      value = r_model ).

ENDMETHOD.



After consuming the data in the cookie, it will be deleted so the server doesn't get loaded with it. This way you can get your model data to the context.

2 Comments