cancel
Showing results for 
Search instead for 
Did you mean: 

Calling RFC from view/component controller

Former Member
0 Kudos

I've got a model node in the component controller's context which is mapped to a node in a view controller. Now, when binding the model's input node with an array and executing the RFC from within an event handler in the view controller, everything goes just fine.

Now, I want to put this functionality in the component controller, so I created a method there, copied the code and call it from the view controller's event handler. When the RFC is called, the input table always contains just 1 element, of which the fields are all initial.

Any thoughts on what might be going on here?

Accepted Solutions (0)

Answers (3)

Answers (3)

lokesh_kamana
Active Contributor
0 Kudos

Hi friend,

I too faced the problem what you faced.

Near to it.

Ill explain you .

YOu have your model node.

1st you will map that to component controller And from there to view controller.

After that you will bind the elements in this node to some elements in your view after that .

For example

Model class name:-Lok_model.

In the DOINIT method:-

write this code.

Lok_model k = new Lok_model(); wdContext.nodeLok_model().bind(k);

Suppose you have a button in the onaction you write this code.

wdContext.nodeLok_model().currentLok_modelElement().modelObject().get_details();

Ill expalin you about this statement Lok_model() is the node in my view which is mapped from the model and by using that i am calling the method get_details() which is in my model class Lok_model.By this data will be automatically populated into the view elements which are being binded to the model attributes.

Hope this helps you,

Lokesh

Former Member
0 Kudos

Hi Lieven,

Follow the below document Accessing ABAP Functions in Web Dynpro Java which explains the required steps:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a00f7103-6790-2a10-ac9c-fcac7c5b...

Thanks n Regards,

Jhansi Miryala

Former Member
0 Kudos

Thanks for the replies, but they don't solve my problem. I know how to call RFCs from my WD application. The problem in this particular case is it works fine when doing everything in the view, but not when using the same code in the component controller.

0 Kudos

have you copied the code in doInit method too??

have you binded the context from controller to view?

Former Member
0 Kudos

have you copied the code in doInit method too??

It is empty.

have you binded the context from controller to view?

Yes.

Former Member
0 Kudos

you have to create the blank instance of the request parameters that is import parameters and bind it with the node Element in the wdDoInit method

nikhil_bose
Active Contributor
0 Kudos

instantiate structure in component controller and try setting values in this controller itself.

Debug RFC and find data is coming to R/3 or what

nikhiL

nikhil_bose
Active Contributor
0 Kudos

for input: you need to create new object for the structure and bind to the context.

for output:

after executing the modelObject().execute() function, invalidate the node which has the output values to reflect the changes

wdContext.node<Name_Exact_Out>().invalidate();

nikhiL