So I wanted to Paramaterise my Web Dynpro. At the moment,
we give out users a front screen that allows them to enter the Document #, and
then view the Document.
What you’re looking at here is part of my WebDynpro
application, the top view that you see when you first call the application…The requirement was that another Web Frontend Application
(a really sexy BSP written by a company that does Websites) could call the
WebDynpro by way of a paramaterised URL.
Chances are you see Paramaterised URLs all the time :Stuff like
https://www.google.co.uk/search?q=dynamo
Shows that you’re searching for dynamo on google. I started by adding I_QMNUM to the Paramaters list of the
Application.
You don’t really need to Type this, because it’ll just behave like
a string regardless, and lots of browsers will do a bit of escape-charactering to
it anyway.
I
then put the following code into the HandleDefault Method of the main WINDOW
(not view!) of the Application.
method HANDLEDEFAULT .
DATA : it_parameter TYPE tihttpnvp,
wa_parameter TYPE ihttpnvp.
DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
* DATA ls_url_param TYPE wd_this->element_url_param.
" Get all URL parameters
CALL METHOD wdevent->get_data
EXPORTING
name = if_wd_application=>all_url_parameters
IMPORTING
value = it_parameter.
* " Get parameter values
* CLEAR wa_parameter.
READ TABLE it_parameter WITH KEY name = 'I_QMNUM' INTO wa_parameter.
IF sy-subrc EQ 0.
l_qmnum = wa_parameter-value.
ENDIF.
Endmethod.
I then gave it a
quick test.
I dropped an external breakpoint at the top of my code in
the HANDLEDEFAULT method.
I went to my application in Internet Explorer, and opened
my application as usual.
The Code was hit, but the it_paramater field wasn’t
populated.
Now my usual url is
http://<servername>/sap/bc/webdynpro/sap/zhpewd_zecn_dash_chrome?sap-client=101&sap-language=EN
If I tag the I_QMNUM data on the end of it. (My QMNUM of
choice is GB0002280), and plug in
http:// <servername /sap/bc/webdynpro/sap/zhpewd_zecn_dash_chrome?sap-client=101&sap-language=EN&I_QMNUM=GB0002280
to my browser bar…
when I hit the breakpoint, I’ve got it_parameter
populated with the I_QMNUM!
Now all I’ve got to do is copy the code from the button
press on the front screen which calls the document. But that’s the bit I
already know how to do, so I’m not going to document that unless it throws up
something interesting!