cancel
Showing results for 
Search instead for 
Did you mean: 

Pass data to global table by service call

Former Member
0 Kudos

Hi all,

I am using a web service to call a RFC function module into my web dynpro component.When I create a new service then a new custom controller will created and in this controller a method is created for FM.

Now my query is, when I run the WD application, FM will retun a table at my end and I want to use it at view level.

I declared a global table in Component controller attribute and want to fill that table when I execute service. when I use wd_this-><Table name> (at custom controller level, in method for FM) then it shows me that this table is not exist.

Please suggest how to fetch table's value.

Thanks

Sanket sethi

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can't use WD_THIS to access the Component Controller from custom controllers or views. WD_THIS refers to the local object (the custom contorller or the view). Use the WD_COMP_CONTROLLER object instead.

Former Member
0 Kudos

Hi Jung,

Yes I know that wd_this-> represents the local declarations. I also check WD_COMP_CONTROLLER

in the method in custom controller but it does not recognised by the system.

I also use if_componentcontroller but it also did not work.

Suggest how to fetch data into Global table into componentcontroller or in View level.

Thanks

Sanket sethi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Please be specific as to what you mean by "it does not recognised by the system". Is the WD_COMP_CONTROLLER object itself not recognized or the internal table that you added as an attirbute to the object? If it is the second case, make sure you have have fully activated the component controller. Only on activation does the underlying class get generated and make your added objects visible.

Former Member
0 Kudos

Yes, WD_COMP_CONTROLLER itself is not recognized in custom controller.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Go to the Properties tab of the custom controller and add an entry in the Used Controllers/Components table for your component controller. You will then have the attribute WD_COMP_CONTROLLER.

Former Member
0 Kudos

Yes now I am able to get the WD_COMP_CONTROLLER by adding it into custom controller. But now I am facing another issue, the table which I declare in component controller attribute is not recognised by system.It shows it as unknown. Here is the code which I used to get this:

loop at WD_COMP_CONTROLLER->T_HIRE.

endloop.

The message comes out Field T_HIRE is unknown. How to get this table on custom controller.

Also If I want to use it on view level then what will I use instead of WD_COMP_CONTROLLER.

Please suggest.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>The message comes out Field T_HIRE is unknown.

Sounds like you haven't activated the Component Controller yet.

>Also If I want to use it on view level then what will I use instead of WD_COMP_CONTROLLER.

You should have WD_COMP_CONTROLLER as an attribute on the View level as well.

Also depending upon how the data is used, consider putting it in the Component Controller Context and do mapping of that Context to other Views/Controllers.

Former Member
0 Kudos

I activated the component controller already but after that I am still facing this issue. This issue is my high priorty.

Also for View level, actually if I am modify the view at run time then I am using Service call method in modify view.Then how will I get the View on custom controller level.

Please suggest.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Did you mark that attribute as Public in the Component Controller?

>Also for View level, actually if I am modify the view at run time then I am using Service call method in modify view.Then how will I get the View on custom controller level.

I have no idea what you are describing. Do you want to try to access the view object from the custom controller? That is absolutely not allowed. If you need to share data between the two - it should be int the component controller and cross mapped.

Former Member
0 Kudos

Yes I have already checked the public check box on component controller attribute table but not checked ref to.

Please suggest what will I do to get this custom controller table on custom controller level.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You don't check REF TO unless you want it to be treated as a data reference. Active it and make the attributes public - that is all there should be to it. It is working in my system. Have you doubled clicked on the Associated Type of the WD_COMP_CONTROLLER in the attributes view of the Custom Controller. That should show you in a new code window what all is exposed by your Component Controller object.

Former Member
0 Kudos

Yes when I double click on componentcontroller it shows the controller in seperate window. But the table which I declared into componentcontroller attribute is not accesable in custom controller and checked it as Public.

I activated the component controller again but I don't know why I am facing this issue.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Have you activated the entire component or just the component controller? Make sure everything is activated so you know the internal classes all get generated. Otherwise I'm not sure what to suggest to you.

Former Member
0 Kudos

Hi Jung,

Thanks for your kind suggestions. I tried to activate whole component and also update navigation index but I still facing same issue. Anyways if you find some solution please suggest me.

Thanks again.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have no idea why it wouldn't be working still, but why not use the context instead to hold the data and do context mapping?

Former Member
0 Kudos

As per I think we will find a structure on context mapping but I want to pass table data (Multiple entries).

Is it possible by context mapping.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Of course. Just set the proper cardinality on your context node definition.

Former Member
0 Kudos

Will I use get_static_attributtable method to get the node table data.

If I bind the table on custom controller level and get the node data on custom controller or View level.

Then, is this method return multiple data as cardinality 0..n and selection 0..n.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes