on 10-29-2010 10:58 AM
Hello Everyone,
I have a difficulty to pass a table data to a RFC. here is my main code lines:
Zrfc_Input rfcInput = new Zrfc_Input();
wdContext.nodeZrfc_Input().bind(rfcInput);
// some code lines to fill table data in model node and display model node data successfully
.....................
wdContext.currentZrfc_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
I use above to retrieve the table data without problem, but have trouble to pass tabel data to RFC (then save data). Do I miss some code statements? Any advices / suggestions?
Thanks, Jin
Hi,
Traverse the contents of the value node and pass the values to the the table to the function module
Regards
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Follow these steps to send the table data to RFC:
1. Get the value from the Model Node.
2. Copy the values toValue Node
3. Set the values to the Model Node using the values of Value Node:
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();
Hope this helps you
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Poojith,
Thank you very much for your help with detail steps / sample code. I have a trouble to use below statement: wdContext.currentZrfc_InputElement().set<structurename>(<structireme>);
I don't have set method for the structure, did I do something wrong?
I have this one: wdContext.currentZrfc_InputElement().modelObject.set<structurenameli>(<AbstractList st>);
but I don't know it's same or not and how to set AbstractList.
Any advice / suggestions?
Thanks, Jin
Hi Saravanan,
Sorry for my delay reply and thanks for you help. Here is my code lines:
****************************************************
Zrfc_Input objInput = new Zrfc_Input();
wdContext.nodeZrfc_Input ().bind(objInput );
Zbp_Wf_Determ tab1 = new Zbp_Wf_Determ();
// set 1 row test data in the table
tab1.setDivision("55");
tab1.setPhone("2100");
objInput.addT_Zbp_Wf_Determ(tab1);
// I can't find wdContext.currentZrfc_InputElement().set<structurename>(<structireme>),
wdContext.currentZrfc_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
**************************************************
T_Zbp_Wf_Determ Like ZBP_WF_DETERM is the Table parameter setting in RFM.
I can not find wdContext.currentZrfc_InputElement().set<structurename>(<structireme>),
I can find this one: wdContext.currentZrfc_InputElement().modelObject().setT_Zbp_Wf_Determ(abstractlist);
Any advices / suggestions?
Thanks, Jin
T_Zbp_Wf_Determ Like ZBP_WF_DETERM is the Table parameter setting in RFM
Thanks Saravanan and Arun for your help.
I followed Arun's link and added 2 more lines as below before .execute():
Zbp_Tool_Get_Determ_Output objOutput = new Zbp_Tool_Get_Determ_Output();
objOutput.addT_Zbp_Wf_Determ(tab1);
I still have the same problem: the table data not pass to RFM.
Any advices / suggestions?
Thanks, Jin
Hi Arun,
Thanks for your help, here is the coding (T_Zbp_Wf_Determ Like ZBP_WF_DETERM is the Table parameter setting in RFM, ZBP_WF_DETERM is not a Structure is a Table, can it be a problem?)
****************************************************
Zrfc_Input objInput = new Zrfc_Input();
wdContext.nodeZrfc_Input ().bind(objInput );
Zbp_Wf_Determ tab1 = new Zbp_Wf_Determ();
// set 1 row test data in the table
tab1.setDivision("55");
tab1.setPhone("2100");
objInput.addT_Zbp_Wf_Determ(tab1);
// I try to display the value, but don't know how to, any code sample is appreciated.
for (int i = 0; i < objInput.getT_Zbp_Wf_Determ().size(); i++) {
wdComponentAPI.getMessageManager().reportWarning("Row" + i + objInput.getT_Zbp_Wf_Determ().get(i).toString());
}
// I can't find wdContext.currentZrfc_InputElement().set<structurename>(<structireme>),
wdContext.currentZrfc_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
**************************************************
Any advices / help?
Thanks, Jin.
Hi Raju,
Thanks for your help. The problem is that I don't have set<structurename>(<structireme>) method in wdContext.currentZrfc_InputElement() class object. I have this one: wdContext.currentZrfc_InputElement().modelObject().setT_Zbp_Wf_Determ(AbstractList); Also I checked the mapping and can't find any problem (simply drag).
Maybe in RFM I use a table type to define the Table parameter not a structure is the probjem?
Any advices?
Thanks, Jin
Hi Jin,
Your code looks good. you can also try with last statement and use it in try, catch and finally block.
//Executing Model
objInput.execute();
wdContext.nodeOutput().invalidate();
Also use the [Logging and Tracing in Web Dynpro |http://wiki.sdn.sap.com/wiki/display/WDJava/LoggingandTracinginWeb+Dynpro] AND /people/jacek.wozniczak/blog/2010/02/05/logging-in-web-dynpro-java--a-guide-and-tutorial-for-beginners-part-1
Refer to [Linking Remote Function Call to Web Dynpro|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/761eba66-0401-0010-b982-d5f5bd9e8f90]
Hope it will helps to resolved your issue.
Regards
Arun Jaiswal
Thanks Arun and Nizamudeen both very much for your help, the links are very helpful.
I checked again, the mapping looks good and the node cardinality is 0... n.
by the way, no problem to pass input parameters and retrieve the table data from RFC, the problem is send table data back to RFM.
Any advices?
Thanks, Jin
Hi,
First check with the ABAP team as to which is the Input structure which needs to be sent to the RFM. Once you know the name of the structure, u can create an instance of the input structure and set the values and add it to the list and send it back to RFM.
If possible, kindly send the hierarchy of the RFM imported in WDJ model which you are trying to send a table.
Regards,
Poojith MV
Hi Poojith, thank you for your help.
Here is RFM setting forTable: T_Zbp_Wf_Determ Like ZBP_WF_DETERM (ZBP_WF_DETERM is not a Structure is a Table).
Here is the Model hierarchy looks like:
Zrfc_Input
Output (Zrfc_Output)
Zrfc_Output
T_Zbp_Wf_Determ (ZBP_WF_DETERM)
Zbp_Wf_Determ
T_Zbp_Wf_Determ (ZBP_WF_DETERM)
Zbp_Wf_Determ
I use table T_Zbp_Wf_Determ for import and export both directions. My guess it maybe the problem. I will create another RFM or add another table in same RFM to see if the table data can be passed back to RFM.
Any advices?
Thanks, Jin
Hi,
Tables are bi-directional parameters which can be used for both importing and exporting data. so that should not be the problem. try this piece of code to send the values:
//get the size of the value node
int size = wdContext().node<valuenodename>().size();
//loop to get everyrecord
for(int i = 0; i < size; i++
{
I<valuenodename>Element objValueNode = wdContext().node<valuenodename>().get<valuenodename>ElementAt(i);
Zbp_Wf_Determ objZbp_Wf_Determ = new Zbp_Wf_Determ();
objZbp_Wf_Determ.set<attributename>(objValueNode.get<attaribute>());
wdContext().currentZrfc_Input().nodeT_Zbp_Wf_Determ().add(objZbp_Wf_Determ);
}
//execute the RFM
Hope this helps you
Regards,
Poojith MV
Hi Poojith,
Very sorry for my late reply and thanks again for your help and code sample. You're very right bi-directional table can be used for both importing and exporting data and my dummy test (add another table) got the same result.
One thing I am sure is that the data is in model node T_Zbp_Wf_Determ, but the problem is the data is not passed to RFM's table.
Let me create new thread, so that I can give more points (I feel bad about you all give me so much help but I can't give back anything).
Thank you all very much for all your time and help, I learnt so much from all of you.
Thanks again, Jin
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.