cancel
Showing results for 
Search instead for 
Did you mean: 

Append Data from Java Web Dynpro to an Internal Table in ECC

Former Member
0 Kudos

Hi,

Currently I am using AdaptiveRFCModels to creating/updating records from Java Web Dynbpro to FM in R/3. Users can add few records before they save the changes. The current design is Java Web Dynpro call RFC FM when user add/edit one record. The record will store in an global internal table in the Function Group. For example, I have added 3 records before I save the changes. It means that global internal table should have 3 records that I added before I save it. But in fact, the global internal table only store one record while I adding the third record. The global internal table not able to keep the previous records. The code below is how I code to execute the FM from Java Webdynpro. Is the code can work as I expected? Anything missing in the codes? Please advice. Thanks.

wdContext.nodeZhr_abc_Input().bind((Zhr_abc_Input) model.createModelObject(Zhr_abc_Input.class));

Zhr_abc_Input objReq = new Zhr_abc_Input();

Zhr_Pad31 insUpdVer = new Zhr_Pad31();

insUpdVer.setQ_Id(wdContext.currentContextElement().getQ_Id());

insUpdVer.setZ_ce(wdContext.currentZhr_Detail_OutputElement().getZ_ce());

objReq.addLt_Pad88(insUpdVer);

wdContext.nodeZhr_abc_Input().bind(objReq);

wdContext.currentZhr_abc_InputElement().modelObject().execute();

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

According to your code you are setting only one record.

You have to create 3 elements for each record and add all the three to the nodeZhr_abc_Input node.

If I understand correctly, node currentZhr_Detail_Output is the one which is containing all the three records. Loop through this node, pick each record and set to the input node.

 
wdContext.nodeZhr_abc_Input().bind((Zhr_abc_Input) model.createModelObject(Zhr_abc_Input.class));

for(int i=0;i<wdContext.nodeZhr_Detail_Output().size();i++)
{
Zhr_abc_Input objReq = new Zhr_abc_Input(); 
Zhr_Pad31 insUpdVer = new Zhr_Pad31();
insUpdVer.setQ_Id(wdContext.currentContextElement().getQ_Id());
insUpdVer.setZ_ce(wdContext.nodeZhr_Detail_Output().getElementAt(i).getZ_ce());
objReq.addLt_Pad88(insUpdVer);
wdContext.nodeZhr_abc_Input().addElement(objReq); // Changed from bind to addElement
}//for end
wdContext.currentZhr_abc_InputElement().modelObject().execute();

Note: I just typed the code. Syntax might be wrong here and there. Please correct it while coding.

Regards,

Jaya.