cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Global attribute in component controller?

Former Member
0 Kudos

Hai all,

I am using a variable in wddoinit method to calculate the total amount. say lv_amount_payable.

I want to use this variable in a Fm in Submit method in the same webdynpro app.

How can I declare that variable globally??? Am now getting an error

lv_amount_payable is having a invalid value.

Please help me.

Thanks in advance.

Nalla.B

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

If you need a global attribute, create that attribute amount_payable in Attributes Tab of Component Controller.

And mark that attribute as public if you need to access that attribute from other controllers say view controller.

If you need only in component controller, you need not mark it as Public.

Suppose your Submit method is in a view, you can refer to Component controller using the view's attribute WD_COMP_CONTROLLER. And you can access the global variable with the following code:

WD_COMP_CONTROLLER->amount_payable

Hope this helps!

Best Regards,

Srilatha

Former Member
0 Kudos

Hai,

That is useful but i have set that lv_amount_payable variable to a value in wddoinit method.

I need to pass the same value to a FM in my submit method.

I have declared that variable as global attribute and checked public now do i have to refer to that lv_amount_payable variable by wd_comp_controller ref in wddoinit method?????

Kindly help me in understanding this.

Thanks in Advance.

Nalla.B

Former Member
0 Kudos

Hi,

I assume you had created the global attribute in component controller of your web dynpro component.

If the wdDoInit() method in which you are setting the value for the global attribute is in component controller, then you can directly refer to the attribute with its name as the attribute is declared inside component controller.

Incase you are using that global attribute somewhere other than component controller methods, then you need to refer to it as

wd_comp_controller-><attribute_name>.

Hope this is clear!

Best Regards,

Srilatha

Former Member
0 Kudos

Hi Nalla,

Yes you can refere variables in component controller.

As suggested by srilatha, just use WD_COMP_CONTROLLER->your_variable.

you can pass value to this variable and you can use this variable in any no of views by using that reference.

cheers,

Kris.

Former Member
0 Kudos

Hai kris/Srilatha,

Thanks for ur solutuions. Now am clear with the things..

But am facing type conflict errors In FM which i have created using the BDC recordings.

Is there any FM to upload the data From WDY screen to infotype since am working with HR req.

Thanks in Advance,

Nalla.B