cancel
Showing results for 
Search instead for 
Did you mean: 

How to Execute a Model

Former Member
0 Kudos

I created an abap routine call Get_BPList. It does a very simple select and brings back 3 fields. I tested the function module and it works ok.

I just want to execute it in dynpro and fill a dropdown list

I created a model and pointed it to the RFC ok and it generated a model. My problem is that my RFC is very simple on the ABAP side. It has no inputs or outputs, just one table (BPList). The model it generated has three nodes ZBP_Getlist_Input, ZBP_Getlist_Output, and ZBP_List.

Which one do I use in the context mapping and how do I execute the RFC?

Appreciate the help and will award points...

Regards,

Tom

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Thomas

Create a custom controller , right click it and apply service controller pattern , choose the ZBP_Getlist_Input for binding . This will generate the necessary code for you which includes an execute method. Attach this execute method to an action in the view.

check doco

<a href="

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/stu/tutorial...;

Regards

Pran

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Thomas,

You can make use of Templates in WebDynpro which will generate the code for exeuting the RFC !!!

1. Right click on the componentController ->Appply->Templates->Service Controller.

Select the ModelNode and click next and check the checkbox "generatemethod"

2. This will create a method in componentController.

You can call this method from the view.

Regards, Anilkumar

Former Member
0 Kudos

Hi Thomas,

Please check out the following link it will answer all your queries regarding RFC's and how to work with them.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/li... rfc to web dynpro.pdf

Regards,

Vijith

Former Member
0 Kudos

Hi Thomas,

Follow the steps:

1. Create Model for RFC.

2. Add this model in Used Models.

3. Open Data modeler by double clicking on yoor Component.

4. Create link between your component and model.

5. Drag ZBP_Getlist_Input from model to component controller.

6. Check all nodes under it.

7. Make one method in Component controller named ExicuteBapi.

8. Write following code in it.

try{

ipublic<componetn name>.iZBP_Getlist_Input ele = wdcontext.createZBP_Getlist_Inputelement(new ZBP_Getlist_Input());

wdcontext.nodeZBP_Getlist_Input ().bind(ele);

wdcontext.currentZBP_Getlist_InputElement().modelobject().execute();

wdcontext.nodeOutput().invalidate();

}

catch(Exception e)

{

}

9. Now call this method from your view whenevder required.

Regards,

Bhavik

Former Member
0 Kudos

hi,

1.Add your model to the used models.

2.Go to data modeler and map the model to the controller.

3.In the controller init

ZBP_Getlist_Input inp = new ZBP_Getlist_Input();

wdContext.nodeZBP_Getlist_Input().bind(inp);

//within try catch

wdContext.currentZBP_Getlist_InputElement().modelObject().execute();

And go through the sample applications available in SDN,

Regards

Bharathwaj