Skip to Content

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.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Sivaraj Bellie
    Hi,
      Good blog.. helped me a lot in my project..
    You have explained how to send data from BSP to Webdynpro ABAP and I tried it it works fine.

    In the same way is it possible to send data from Webdynpro back to BSP.. ? I tried the same method using the same application name , session id .. with different cookie name .. but it doesnt work .. ?

    Any idea how to pass data from Webdynpro ABAP to BSP ?

    Thanks

    Siva

    (0) 

Leave a Reply