cancel
Showing results for 
Search instead for 
Did you mean: 

One input node not sending data to SAP

Former Member
0 Kudos

Hello all,

First of all, let me start off by saying that I have a Java background and virtually no SAP background, so I apologize if I'm using the wrong terms here.

I'm working on a Web Dynpro for Java app that a previous employee wrote. There was an RFC Model created, and an ABAP Developer added a new table to that RFC, so we updated the Model to reflect that.

We have a context node representing that model, it's called Zwm_Get_Gen_Func_Loc_Info_Input.

Under that node, there are a number of nodes. One that was already existing is called Obj_Type. The new node we added for the new table is called Unit.

In the Web Dynpro app, there is a method that gets called in order to set some fields in Obj_Type and Unit and then execute the RFC. Here is a snippet of that method:

//setting all the data for the obj_type

wdContext.currentObj_TypeElement().setLow(obj_type_output.getObj_Types());

wdContext.currentObj_TypeElement().setOption("EQ");

wdContext.currentObj_TypeElement().setSign("I");

if (wdContext.currentUnitElement() == null) {

Zwm_Gen_Unit_Sel unit = new Zwm_Gen_Unit_Sel();

wdContext.nodeUnit().addElement(wdContext.nodeUnit().createUnitElement(unit));

}

//setting all the data for unit

wdContext.currentUnitElement().setLow(wdContext.currentZpg_Unit_OutputElement().getPlant_Unit());

wdContext.currentUnitElement().setZ_Option("EQ");

wdContext.currentUnitElement().setZ_Sign("I");

//execute.

try {

wdContext.currentZwm_Get_Gen_Func_Loc_Info_InputElement().modelObject().execute();

//etc, etc, etc.

Anyway, so... the weird thing is, everything is working FINE for the Obj_Type node - I can debug the RFC in SAP and see that all the data is getting to that table. But NOTHING is getting sent to the Unit table.

Any ideas?

Thanks,

Jennifer

Edited by: Jennifer A. Jacobs on Jun 10, 2009 8:54 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Jennifer,

It should work. Anyways some times there are some problems with model nodes, I am not sure why the same code does not work some other time.

Just try with these changes:

//setting all the data for the obj_type 
wdContext.currentObj_TypeElement().setLow(obj_type_output.getObj_Types());
wdContext.currentObj_TypeElement().setOption("EQ");
wdContext.currentObj_TypeElement().setSign("I");

try {
     wdContext.currentZwm_Get_Gen_Func_Loc_Info_InputElement().modelObject().getUnit()clear();
}
catch (Exception e)
{
}

Zwm_Gen_Unit_Sel unit = new Zwm_Gen_Unit_Sel();
//setting all the data for unit
unit .setLow(wdContext.currentZpg_Unit_OutputElement().getPlant_Unit());
unit .setZ_Option("EQ");
unit .setZ_Sign("I");
wdContext.currentZwm_Get_Gen_Func_Loc_Info_InputElement().modelObject().addUnit(unit);

//execute. 
try {
wdContext.currentZwm_Get_Gen_Func_Loc_Info_InputElement().modelObject().execute();
//etc, etc, etc.

Most probably this code will work. If you still face any problems, the problem most not probably is not in this part of the program atleast.

Regards,

Siva

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Jennifer,

You can try the code suggested by Sri. That is to create a instances of the parent model node and setting the attributes or child nodes to it. Then binding the model node and executing the it.

I would also suggest you create a temporary web dynpro application. Import the BAPI and use the Template->Service Controller on the Component Controller (this will create ) and the Template on view for the node to be displayed.

Add the code to the execute method to create the model child node and hard code the input values.

Call the execute method from the view. Build and deploy the application to see if the output is being retrieved.

Regards,

Kartikaye

Former Member
0 Kudos

you guys, I can't thank you enough! It's working!

Charan - with your solution, I was finally about to see the Unit data in the RFC! However, all those other nodes that I was ignoring in my post? Well, that data's actually being filled out in other parts of the app, so when I bound the new input object, I lost all that data, so ultimately, that solution didn't work...

Siva - your solution gave me the Unit data without over-writing all the other data that had been sent. I'm still a little baffled as to why I had to do something special for the Unit and not the Obj_Type, but at this point, I really don't care. It's working!

Thanks again!

-Jennifer

Former Member
0 Kudos

Siva - I have tried that with no success

Jaya - I'm not sure what that would prove? The problem isn't that it's not returning data, the problem is that it's not getting the data. That being said, I did try it, and it does work.

Charan - That node does indeed exist (as an input node), and is mapped properly, too. You can see a screenshot of the Context [here|http://farm3.static.flickr.com/2450/3615996295_c5994af96c_o.jpg].

Former Member
0 Kudos

Hi,

I am not able to see the context structure as it is not opening here.

I think you did not get my point.

For example your context is like below:

ModelNode_Input

-


> Unit_Input

-


> ModelNode_Output

-


> Unit_output

-


>Response

Here while executing you have to set the input in Unit_Input node. Not in Unit_output node.

Regards,

Charan

Former Member
0 Kudos

That's weird. The link works for me. Oh well.

I understood what you meant, I was just being lazy Tt was just easier to do it as a screenshot than to type it all out - plus you can see it better, since, quite honestly, the formatting in this forum sucks!

It looks like this (I'm not "expanding" the nodes that aren't being used in this call):

Zwm_Get_Gen_Func_Loc_Info_Input

--Func_loc

--Func_Loc_Info_Input

--Maintplant

--Mfg

--Model

--Obj_Type

-


High

-


Low

-


Option

-


Sign

--Output_func_loc

--Return_input

--Serialnumber

--Sup_Func_loc

--Unit

-


High

-


Low

-


Z_Option

-


Z_Sign

Everything is a node, with the exception of the High/Lower/Option/Sign fields under Obj_Type and Unit, which are obviously attributes. Zwm_Get_Gen_Func_Loc_Input is a model node directly off of Context.

Former Member
0 Kudos

Hi,

You are setting the input into correct node only.

I am not sure what is the exact problem. Will get back to you if i found anything.

Regards,

Charan

Former Member
0 Kudos

Hi,

Try this: generally we write the RFC exeucte code as below:

Zwm_Get_Gen_Func_Loc_Info_Input objZwm_Get_Gen_Func_Loc_Info_Input=
new Zwm_Get_Gen_Func_Loc_Info_Input()

Zwm_Gen_Unit_Sel unit = new Zwm_Gen_Unit_Sel();
unit .setLow(wdContext.currentZpg_Unit_OutputElement().getPlant_Unit()); 
unit .setZ_Option("EQ");
unit .setZ_Sign("I"); 

objZwm_Get_Gen_Func_Loc_Info_Input.addZwm_Gen_Unit_Sel unit(unit);

wdContext.nodeZwm_Get_Gen_Func_Loc_Info_Input.bind(objZwm_Get_Gen_Func_Loc_Info_Input);
wdContext.currentnodeZwm_Get_Gen_Func_Loc_Info_InputElement().modelobject().execute().

wdContext.nodeOutput_func_loc().invalidate();

Note: Similarly set the other input objects like Obj_Type also as above. And print all the input values before sending to backend for debug purpose.

Regards,

Charan

Former Member
0 Kudos

hi

Set the value 'unit' in your object created for bapi..

Say

<Bapi Name> Obj = new <Bapi Name >

Obj.setZwm_Gen_Unit_Sel(unit);

then execute the bapi..

Best Wishes

Idhaya R

Former Member
0 Kudos

Hi,

Check nodeUnit() is there in the input of the context structure. Sometimes the same node exists in the Output also. If you are setting some values in output node then it will not be sent as part of input. If possible post your RFC context structure in WebDynpro.

Regards,

Charan

Former Member
0 Kudos

Hi Jennifer,

Did you execute the RFC seperatley by passing the same input which you are passing through your webdynpro application? Is it returning the new table?

If every thing fine there, then there could be a caching issue. Try restarting your portal server and see.

Regards,

Jaya.

former_member197348
Active Contributor
0 Kudos

Hi Jennifer,

The problem may be here:


if (wdContext.currentUnitElement() == null) {
Zwm_Gen_Unit_Sel unit = new Zwm_Gen_Unit_Sel();
wdContext.nodeUnit().addElement(wdContext.nodeUnit().createUnitElement(unit));
}

//setting all the data for unit
wdContext.currentUnitElement().setLow(wdContext.currentZpg_Unit_OutputElement().getPlant_Unit());
wdContext.currentUnitElement().setZ_Option("EQ");
wdContext.currentUnitElement().setZ_Sign("I");
 

Try these changes:

if (wdContext.currentUnitElement() == null) {
Zwm_Gen_Unit_Sel unit = new Zwm_Gen_Unit_Sel();

//setting all the data for unit
unit .setLow(wdContext.currentZpg_Unit_OutputElement().getPlant_Unit());
unit .setZ_Option("EQ");
unit .setZ_Sign("I");
wdContext.nodeUnit().addElement(wdContext.nodeUnit().createUnitElement(unit));

} 

Let me know if there is still problem.

Regards,

Siva