cancel
Showing results for 
Search instead for 
Did you mean: 

Passing values to RFC holding structure.

sureshmandalapu6
Active Contributor
0 Kudos
181

Hi Experts,

I have DC which needs to update backend table through RFC. In this RFC i have a structure in import tab which holds 2 fields.

From webDynpro Java code , i have to pass the those 2 fields as input before when i execute the model.

How can i write code for inputing the values for this structure fields ?

thanks in advance.

Regards,

suresh

Accepted Solutions (0)

Answers (4)

Answers (4)

gill367
Active Contributor
0 Kudos

Hello Suresh,

For passing the values to the import structure of an RFC,

You have to first import the RFC as a model to the web dynpro side and then it will create model nodes in the context.

Suppose your Model name is TestRFC having one import structure TESTSTR which has 2 fields Ta and Tb.

Then it will create a model node with the following structure.

-


Context

-


TestRFC_input (node)

-


TESTSTR (node)

-


Ta (attr)

-


Tb (attr)

-


then if you want to set the value of Ta and Tb write the following code before executing.


 TSTR  teststr = new TSTR();   //where TSTR is the reference type of structure TESTSTR
teststr.setTa("a");
teststr.setTb("b");
wdcontext.nodeTESTSTR.bind(teststr);

thanks ,

Sarbjeet Singh

Former Member
0 Kudos

Hi Suresh,

Steps to execute you Adaptive RFC Model:

1. Create an instance of the BAPI's input structure-

<Your BAPI Name>_Input input = new <Your BAPI Name>_Input();

2. Set the two input parameters to this input structure with desired parameter values-

input.set<Your Para 1>(<Desired Parameter Value>);

input.set<Your Para 2>(<Desired Parameter Value>);

3. Create and Bind a model node in context to the input structural node of Your BAPI using model binding. Now using code bind the instance of the input structute to the model nodel in conext as stated below-

wdConext.node<Your Custom created Model Node in Context>().bind(input);

4. Execute the model and invalidate the output node-

try{

wdContext.current<Your Model Node in Conext>().modelObject().execute();

wdConext.node<Output Node in the conext>().invalidate();

}catch(Exception){

}

5. Pick all the output parameters from the Output Node in the context.

Hope it helps!!

Regards,

Tushar S

Former Member
0 Kudos

hi,

please refer the below pdf,

[http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/wdjava%20archive/creating%20a%20web%20dynpro%20application%20accessing%20abap%20functions.pdf]

Regards,

ramesh

Edited by: Ramesh Babu V on Mar 29, 2010 11:05 AM

p330068
Active Contributor
0 Kudos

Hi Suresh

Create the structure obect and set input parameter and add to the model object before excuting your model.

it might you need to create abstruct object for your structure

Hope it helps

Regards

Arun