cancel
Showing results for 
Search instead for 
Did you mean: 

giving input to database and getting output

Former Member
0 Kudos

hai all ,

iam using adaptive rfc model.I need to give one input to database and get a list a values as output.

Since i dont have idea of how to give input to database pz help me doing that.

Thanks n Regards

Sharanya.R

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hai shyam,

my mapping holds good.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi Sharanya,

u r setting input to model node attributes. Try to set input to ur model objet. In ur case it is

objData.setsetIv_Voltage(wdContext.currentContextElement().getInput_node());

I think it may work ..

-

Shyam.

Former Member
0 Kudos

Hi Sharanya,

in Custom Controller,

1. Zmmin_Display_Busconfig_Input input = null; // as a global variable.

2. in wdDoInit

try {

input = new Zmmin_Display_Busconfig_Input();

} catch(Exception e) {

}

3. create a method executing() in that

set input parameters like

input.set....

after that bind ur input..

this.wdContext.Zmmin_Display_Busconfig_Input().bind(input);

execute..

this.wdThis.wdGetContext().currentthis.wdThis.wdGetContext().currentZmmin_Display_Busconfig_InputElement().modelObject().execute();

..........

In CustomController i think u cant display any out put messages.

--

Shyam.

Former Member
0 Kudos

hai shyam ,

we can display output msg from custom ctrller thats not an issue. but i need to know wat all can be the reason if the data output retrived in backend not availble in front end.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

just make sure that the ouput model node you are refering is the correct one..

you shud use the output node which resides inside the main input node of the model( while mapping model node with a component)

Former Member
0 Kudos

hai shyam ,

my mappings are correct.

Thanks n Regards

Sharanya.R

former_member214651
Active Contributor
0 Kudos

Hi Sharanya,

After you finish importing the RFC into ur webdynpro project, add the model under the UsedModels section in ur component.

make the binding with the controller and the corresponding views.

declare a method in ur component controller and the write the following code:

<ModelNodeName> objData = null;

try

{

objData = new <ModelNodeName>();

wdContext.node<ModelNodeName>.bind(objData);

wdContext.current<ModelNodeName>.modelObject.set<import parameter name>(<value>);

wdContext.current<ModelNodeName>.modelObject.execute();

}

catch(Exception e)

{

//code for printing the error message

}

call this method in ur default view wdDoInit()

Hope this helps you.

Regards,

Poojith MV

Former Member
0 Kudos

hai poojitha,

thanks a lot.can you help me in that context binding.

I have imported the model.i have dragged and dropped the rfc and now my custom controller contains

the following structure.

ZMM_DISPLAY_BUS_INPUT

| |_Output

| |_ET_BUS(node--internal table)

| |_bus_config(this is the output)(attribute)

|

|_Et_voltage(this is the input to be passed)

ALSO TELL ME HOW AND WHERE TO GET THE OUTPUT.

Thanks n Regards

Sharanya.R

Edited by: Sharanya R on Feb 28, 2008 6:51 AM

Edited by: Sharanya R on Feb 28, 2008 7:07 AM

Former Member
0 Kudos

Hey,,

There are two procedure u can follow to do this.

once ur model is imported into WD side.

goto ur component there is an entity called usedModels.

Right click on that and add ur model to comp.

then goto ur custom/compont controller context tab.

1)Rightclick on the Root context create model node give some name of what ever ur FNM name.

2) right click on the model nodeeditmodelbindingselect the FNM_inputthen nodes will displayselect ur input nodes or variables. and output purpose select only the nodes under output node ur o/p node select.nextfinish.

3)

goto ur comp/custom init method add the code previous mail what he has given code.

4) do the context mapping for ur o/p screen. design the screen based on o/p node to table.

5) deploy and execute.

Another process automatic process

go thru this link.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202f1dfb-74db-2910-e48e-a7430c31...

If u are not clear, Let me know.

Thanks,

Lohi.

Former Member
0 Kudos

hai lohitha,

your link was of great help to me.Thanks a lot.I have a input attribute in my view.I have created a attribute in my custome ctrller and i have mapped the attribute with views attribute.now iam setting the value of the context attribute in init and i have set the attribute in custom ctrller to the input value to be passed.just tell if iam doing the right thing.the problem is no output is obtained.there is no prob with rfc as its working fine in back end.

public void executing( )

{

//@@begin executing()

wdComponentAPI.getMessageManager().reportSuccess("hi");

Zmmin_Display_Busconfig_Input objData = null;

try

{

objData = new Zmmin_Display_Busconfig_Input();

wdContext.nodeZmmin_Display_Busconfig_Input().bind(objData);

wdComponentAPI.getMessageManager().reportSuccess("1");

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().setIv_Voltage(wdContext.currentContextElement().getInput_node());

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().execute();

wdComponentAPI.getMessageManager().reportSuccess("2");

for(int i=0;i<wdThis.wdGetContext().nodeEt_Busconfig().size();i++)

{

wdComponentAPI.getMessageManager().reportSuccess("3");

wdComponentAPI.getMessageManager().reportSuccess(""+wdThis.wdGetContext().nodeEt_Busconfig().getEt_BusconfigElementAt(i).getBus_Config());

}

}

// catch(Exception e)

// {

//// code for printing the error message

// }

catch(WDDynamicRFCExecuteException ex)

{

wdComponentAPI.getMessageManager().reportWarning(""+ex);

}

plz help me..

thanks

Sharanya.R

Former Member
0 Kudos

Hey

try this code ur customconroller WDdoinit method. it should work

wdContext.nodeZmmin_Display_Busconfig_Input().bind(new Zmmin_Display_Busconfig_Input());

// pass ur input from here.

wdContext.currentZmmin_Display_Busconfig_Inputelement().setEt_voltage("hard code the value");

// call the execute method

try

{

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().execute();

wdcontext.nodeoutput().invalidate();

}

Exception e

{

e.pst();

}

Take first view and add do context mapping or ur o/p node and display with Table UI.

It should display ur o/p.

Let me know any issues.

Thanks,

Lohi.

Former Member
0 Kudos

Hai Lohitha,

my custom ctrller coding is as follows.

public void executing( )

{

wdComponentAPI.getMessageManager().reportSuccess("hi");

wdComponentAPI.getMessageManager().reportSuccess(""+wdContext.currentContextElement().getInput_node());

Zmmin_Display_Busconfig_Input objData = null;

try

{

objData = new Zmmin_Display_Busconfig_Input();

wdContext.nodeZmmin_Display_Busconfig_Input().bind(objData);

wdComponentAPI.getMessageManager().reportSuccess("1");

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().setIv_Voltage(wdContext.currentContextElement().getInput_node());

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().execute();

wdContext.nodeOutputt().invalidate();

wdComponentAPI.getMessageManager().reportSuccess("2");

for(int i=0;i<wdThis.wdGetContext().nodeEt_Busconfig().size();i++)

{

wdComponentAPI.getMessageManager().reportSuccess("3");

wdComponentAPI.getMessageManager().reportSuccess(""+wdThis.wdGetContext().nodeEt_Busconfig().getEt_BusconfigElementAt(i).getBus_Config());

}

}

// catch(Exception e)

// {

//// code for printing the error message

// }

catch(WDDynamicRFCExecuteException ex)

{

wdComponentAPI.getMessageManager().reportWarning(""+ex);

}

}

Iam calling this method in the init method of view,

1,2 is getting printed but 3 is not getting printed.

I have given my context structure also.

Iam not getting the output.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hey yar,

Try my code once ur application yar.

It shoud display ur o/p.

dont use ur code for testing use my code and test if not getting o/p I will modify ur code.

Thanks,

Lohi.

Former Member
0 Kudos

hai lohitha i tried ur code in my custom ctrller this way and tried printing the output node size it gives 0.

wdContext.nodeZmmin_Display_Busconfig_Input().bind(new Zmmin_Display_Busconfig_Input());

// pass ur input from here.

wdContext.currentZmmin_Display_Busconfig_InputElement().setIv_Voltage("220KV");

// call the execute method

try

{

wdContext.currentZmmin_Display_Busconfig_InputElement().modelObject().execute();

wdContext.nodeOutputt().invalidate();

wdComponentAPI.getMessageManager().reportSuccess(""+wdContext.nodeEt_Busconfig().size());

}

catch(Exception e)

{

e.printStackTrace();

}

wat can be the problem ?

Thanks n Regards

Sharanya.R

former_member214651
Active Contributor
0 Kudos

Hi Sharanya,

ZMM_DISPLAY_BUS_INPUT

| |_Output

| |_ET_BUS(node--internal table)

| |_bus_config(this is the output)(attribute)

|

|_Et_voltage(this is the input to be passed)

For the RCF are u passing both the parameters????

if u r just passing one and if both are mandatory then it wont execute properly

to get the output

wdContext.currentET_BUSElement().get<Attrinute Name>();

Regards

Poojith MV

Former Member
0 Kudos

hai pooojitha,

voltage is input and bus config is output and iam giving the voltage as input ...

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

hai all,

I need to know how the binding should take place while giving input to database.

Thanks n Regards

Sharanya.R