Skip to Content
avatar image
Former Member

Pass URL parameters from WD to BSP via Post

Is there a way to Post URL parameters in WD so that a BSP can retrieve them using get_form_field?

I am currently passing the required parameters from an event handler within my WD application to the BSP as part of the URL string, similar to below:

/companysys/fw_main/main_mvc.do?PARAM_1=XXXXX&PARAM_2=YYYYY&sap-client=270

The above works fine. But how to Post the params so they can still be retieved in the BSP...?

Thanks in advance!

fyi... I added a PARAMS table to the outbound plug and fired it as below, but the paramscould not be read in the BSP:

wd_this->fire_to_exit_plg( url = l_url close_window = close_window PARAMS = LT_PARAMS ).

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 09, 2010 at 01:15 PM

    Hi Frederic,

    you can POST parameters to the URL of your BSP using the following code:

    
    DATA: lo_client TYPE REF TO if_http_client,
          lv_url TYPE string VALUE 'http://mysapserver.net:8021/sap/bsp/mybsp'.
    
    CALL METHOD cl_http_client=>create_internal
      IMPORTING
        client = lo_client.
    
    cl_http_utility=>set_request_uri( request  = lo_client->request
                                      uri      = lv_url ).
    lo_client->request->set_header_field( name  = '~request_method'
                                          value = 'POST' ).
    lo_client->request->set_form_field( EXPORTING name  = 'myfield'
                                                  value = 'myvalue' ).
    lo_client->send( ).
    
    

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 09, 2010 at 12:03 AM

    Hi Fredrick,

    Am I understanding correctly, that a URL of the format:

    > /companysys/fw_main/main_mvc.do?PARAM_1=XXXXX&PARAM_2=YYYYY&sap-client=270

    works correctly?

    if so then just build the parameters into the URL string that you give to the exit plug - would that not work?

    Cheers,

    Chris

    Add comment
    10|10000 characters needed characters exceeded

    • passing them via the URL is the GET method of passing parameters.

      using the post method from wd to bsp is not possible I'm afraid.

      You could however try to work with server side cookies, for which I refer to my colleagues blog

      /people/koen.labie2/blog/2006/11/29/eating-cookies-with-webdynpro-and-bsp

  • avatar image
    Former Member
    Apr 14, 2010 at 12:10 PM

    Thank you Frank! This accomplished exactly what I asked. Points awarded!

    However...

    What is bugging me now is the fact that the BSP app is processed on the lo_client->send( ) and my POSTed parameters are visible, but the BSP is not displayed. Then, when I actually Fire my WD outbound plug to display the BSP, the BSP is processed and displayed, but the POSTed parameters have been lost...

    Your thoughts?

    Add comment
    10|10000 characters needed characters exceeded

    • As Thomas suggests, you are not able to display your BSP using this method. Do you really need to POST data to the BSP, can you not just share data via a SAP table? Alternatively, if you absolutely want to POST, you could perhaps create an IFrame in your WDA and load a web page inside the IFrame which does a POST to the BSP. The BSP would then display inside the IFrame in your WDA. This is not a great solution though, since he iFrame UI element is deprecated.