Wednesday, 15 May 2013

Paramaterising a Web Dynpro


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!








4 comments:

  1. I am a SAP ABAP/ITS Consultant. I am working for one of the largest MNC in India as a SAP ABAP/ ITS developer from past one year. During this period I have been working on ABAP and Internet Transaction Server(ITS). My major work has been on ITS(Both of my Projects). So I would like to know whether I should continue working on ABAP/ITS or I should pursue a career in SAP WebDynpro and later go SAP EP Cretfication. Which would add much better value to my Career? Working on ABAP or a career in SAP WebDynpro?
    Well got across this online course for SAP as well. http://www.wiziq.com/course/8153-sap-web-dynpro-pro-abap-training
    Wonder it works for me.

    ReplyDelete
  2. WebDynpro will inevitably involve a fair bit of ABAP anyway, so given the choice, go with that. If there's no WD4A work available, it's better to be on a job with ABAP than doing nothing. You definitely learn more on the job than you do in a classroom.

    Good luck with certification!

    ReplyDelete
  3. Hai, if u want to learn any sap modules..
    RS Trainings is the best WebDynpro online training provider from Hyderabad, India. Our WebDynpro Online Training faculty is very much experianced and dedicated. Our WebDynpro online training faculty is realtime and faculty is working for MNC's. Our WebDynpro Online Training Course content designed as job oriented and as per the IT industry requirement.
    Skypeid: rsonlinehyd
    Please contact us India:+91 9052699906,USA :+1 909-666-5386
    Email:contact@rstrainings.com
    Good luck

    ReplyDelete

  4. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write
    Packers and Movers Thane
    Packers and Movers Navi Mumbai
    Packers and Movers Ghaziabad
    Packers and Movers Faridabad

    ReplyDelete