Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Reading application parameter from portal

In this blog we will learn how to read the application parameter from the portal. Let us see how to read a parameter from the URL in an already created component.

Let’s see how to read the user who is logging into the portal and triggering the link for our application.

Pre-requisites: The portal must be configured in a way to pass the parameter.

Step 1:
Go to the window of the component and select the method handle default. This is the first method which is triggered when a component load, even before the DOINIT method.

clip_image001

Step 2:
In Handle default method create a importing parameter to get the value from the portal the importing parameter must be created in a same name that the portal passes the parameter.

clip_image002

Step 3:
Go to the application. In parameters tab add the variable declared in Handle default method using F4 help.

clip_image003

Step 4:
Whatever the value that comes in the portal will be captured by the parameter we declared. It can be used only within the windows, to use that variable in our view we have to move it to the controller.
To move it to the controller, create a variable in the component controller as shown below.

clip_image004

Step 5:
Now move the application parameter to the variable declared in the component controller.
Wd_component_controller is the object referring to the component controller.
Using that object access the attribute of the component controller and assign the importing parameter of the handle default method to it. Now value is passed from window to the controller.

clip_image005

Step 6:
Now we have to set the value in some variable so that the value can be used across any no’s of views.
Create a node in the component controller with an attribute to hold the value.

clip_image006

Step 7:
Handle default method is executed after the method wddoinit. Hence we can make use of method wddomodifyview to set the value to the context node.

clip_image007

Code:

method wddomodifyview .

 
data : lv_user type uname.
 
data lo_nd_uname type ref to if_wd_context_node.
 
data lo_el_uname type ref to if_wd_context_element.
 
data ls_uname type wd_this->element_uname.

* Move the value from component controller attribute to the variable.
  lv_user
= wd_comp_controller->lv_user.
 
* set the value to the context node.
* navigate from to via lead selection
  lo_nd_uname
= wd_context->get_child_node( name = wd_this->wdctx_uname ).
* get element via lead selection
  lo_el_uname
= lo_nd_uname->get_element( ).
* set single attribute
  lo_el_uname
->set_attribute(
  name
= `LV_USER`
 
value = lv_user ).

endmethod.                    "WDDOMODIFYVIEW

Now Parameter has been set in the context node and can be accessed in any number of views.

About Arun

16 Comments:

  1. We can also read the application parameter using the class

    wdr_task=>client_window->get_parameter( 'i_parameter' ).

    ReplyDelete
    Replies
    1. Please, explain how to read application parameters from WDDOINIT method of component controller.

      in 1st step, you told that handledefault method triggers first but in 7th step you told differently.

      please clarify brother!.

      Delete
    2. i learnt webdynpro from your website........thank you very much brother!

      Delete
  2. They ought to be simple in correspondence and you can contact by messages, live visits, moment errand people and by global calling framework. Outsourcing organizations give every one of these offices to their designers.
    convert website to app

    ReplyDelete
  3. Nice to read your article! I am looking forward to sharing your adventures and experiences. desawar satta

    ReplyDelete
  4. Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work.. buy weed online usa

    ReplyDelete
  5. This article is an appealing wealth of informative data that is interesting and well-written. I commend your hard work on this and thank you for this information. You’ve got what it takes to get attention. nationwide thc vape shipping

    ReplyDelete
  6. When you use a genuine service, you will be able to provide instructions, share materials and choose the formatting style. thc oil cartridges shipped anywhere

    ReplyDelete
  7. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. birrificio artigianale

    ReplyDelete
  8. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. https://www.sergiofabbri.com/scarpe-converse-originali

    ReplyDelete
  9. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! situs slot online

    ReplyDelete
  10. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. شحن من كندا الى مصر

    ReplyDelete
  11. Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene. bahis siteleri listesi

    ReplyDelete
  12. If you set out to make me think today; mission accomplished! I really like your writing style and how you express your ideas. Thank you. bahis siteleri listesi

    ReplyDelete

Powered by Blogger.