Skip to Content
author's profile photo Former Member
Former Member

Passing Variables from one View to another

First of all Hi this is my first post on the sap forums.

Aplogies if I have come to the wrong place or if this question is very easy, but I am new to abap and web dynpro and have found myself struggling a little bit. So I stumbled across this site and thought I would ask for help.

My problem is this, I have 2 variables on my MAIN view, one called MONTH and the other called YEAR. What I want to do is on a button click on the MAIN view pass the values of these variables to another view called SUMMARY_RPT and then use these variables in an SQL query I have on this view.

Anybody out there that can help ?

Many Thanks,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Mar 18, 2009 at 09:09 AM

    Hi George,

    Welcome to webdynpro abap community. To pass data from one view to another, you can should create two attributes (type string) in the attribute tab of of the component controller. Now these will act as global variable for you. Now you can access these attribute in your view in this way:

    wd_comp_controller->gv_val "gv_val is the name of the attribute

    Populate the value in it and use it anywhere you want.

    There is one more way to do the same.

    Create a node under context in component controller and create 2 attributes(type string) after that. Map this node to both the views. Now get the value of month , year and set these attribute with the same values with the help of code wizard in view 1. Now in the view2 simply read those attribute and you'll get the value of month and year which was entered in the first view. Read the attribute with the help of code wizard. Now you can use them accordingly.

    I would suggest you to use 1st method as it is better performance wise.

    I hope it helps.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 18, 2009 at 09:12 AM


    You must be navigating from one view to other view.

    You might have created Outbound plug in View1 , Inbound Plug in View2.

    go tothe Outbound Plug tab in View1, and at the down add parameter Month type your time

    Year type your type

    pass these two parameters where you are firing the outbound plug.

    go to the Second View choose inbound plug tab and go to your inbuond plug event handler method.

    Manually add two parameters Month of your type, Year of your type.

    and simply inside the method access Month and Year.


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Arjun Singh Thakur


      Sorry I worded my last post wrong. I have created 2 new attributes in the 'attributes' tab of the context controller named MONTH and YEAR. I can now use the variabled in my second view with the following statement:

      wd_comp_controller->MONTH & wd_comp_controller->YEAR

      I dont get a error message when I activate so I think all is working ok... fingers crossed!

      Many Thanks for you help guys.



  • author's profile photo Former Member
    Former Member
    Posted on Mar 18, 2009 at 09:57 AM

    Apologies I forgot to ask one last question...

    Any ideas how I assign my attribute in my context controller to my 2 textboxes because at the moment my variable contains null ?

    Many Thanks,


    Edited by: George Georgiou on Mar 18, 2009 10:57 AM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.