on 07-30-2018 10:49 AM
Hi Team,
I had worked in SAP Web Dynpro Java Coding and was good at that time. I have doubts as I left it for long.
Pushing data in RFC:
Zrfc_Input rfcInput = new Zrfc_Input();
wdContext.nodeZrfc_Input().bind(rfcInput);
// Create the instance of the structure which needs to be sent to RFC
for(int i = 0; i < <valuenodesize>; i++)
{
//create an instance of the model node structure
<structurename> structname = new <structurename>();
structname.set<attribute>(<vakuenodeelement>At(i).get<attribute>);
<structireme>.add(structname);
}.
wdContext.currentZrfc_InputElement().set<structurename>(<structireme>);
wdContext.currentZrfc_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
-----------------------------------------------------------------------------------------------------------------------
For Inserting data from Model Node to Value Node
int nDetailsTableSize = wdContext.node<Model Node>().size();
IPrivateSampleView.I<Value Node>Element ele<Value Node>;
wdContext.node<Model Node>().moveFirst();
for(int i = 0; i < nDetailsTableSize; i++)
{
ele<Value Node>= wdContext.node<Value Node>().create<Value Node>Element();
wdContext.node<Value Node>().addElement(ele<Value Node>);
ele<Value Node>.set<Value Attribute>(wdContext.node<Model Node>().current<Model Node>Element().get<Model Attribute>());
ele<Value Node>.set<Value Attribute>(wdContext.node<Model Node>().current<Model Node>Element().get<Model Attribute>());
wdContext.node<Model Node>().moveNext();
}
For Inserting data from Value Node to Model Node
// Create the structured input parameters required for this RFC
Z<RFC_Structure_Name> obj<RFC_Structure_Name> eleT_Save = new Z<RFC_Structure_Name>();
IPrivateSampleView.I<Model_Structure_Name>Element ele<Model_Structure_Name> = wdContext.node<Model_Structure_Name>().create<Model_Structure_Name>Element(obj<RFC_Structure_Name>);
wdContext.nodeT_Save().addElement(eleT_Save);
wdContext.node<Table_Value_Node>().moveFirst();
for(int i = 0; i < wdContext.node<Table_Value_Node>().Size(); i++)
{
ele<Model_Structure_Name>.setPernr(wdContext.currentContextElement().getEmpID().replaceFirst("M", "0"));
wdContext.node<Table_Value_Node>().moveNext();
}
wdContext.currentZ<RFC_Model_Name>_InputElement().modelObject().addT_Save(objZ<RFC_Structure_Name>);
/**************************************************************************/
//Execute RFC
wdThis.wdGetSampleCustController().executeZvisa_Save_Input();
/**************************************************************************/
wdComponentAPI.getMessageManager().reportSuccess("Your Details has been saved successfully");
wdContext.currentZ<RFC_Model_Name>_InputElement().modelObject().removeT_Save(obj<RFC_Structure_Name>);
Are the above code snippets correct? Instead of populating the Value Node in a WDJ View; same can be achieved in WDJ Component Controller; so, it would IPublic instead of IPrivateSampleView. Also,
ele<Model_Structure_Name>.setPernr(wdContext.currentContextElement().getEmpID().replaceFirst("M", "0"));
wdContext.node<Table_Value_Node>().moveNext();
can be replaced by the below code:
ele<Model_Structure_Name>.setPernr(wdContext.getElementAt(I).getEmplID().replaceFirst("M","0"));
Let me know if my approach is correct. Also, after creating the model in WDJ DC, Adding the model as a usage in dc reference. Model binding and context mapping with Component Controller Value Node. Value Node must be created before context mapping. Parent Model Object should be created as a reference and passed in the child dcs as objects. Could let me if my approach is correct in adaptive RFC Model.
Best Regards
sap portal learner
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.