on 02-13-2006 12:25 PM
Hi Experts
I have 2 tables on my Iview which have data as below
1) Task table containing task id & checkbox. This is a table parameter of RFC A
2) Resource table containing resourceid & checkbox. This is a table parameter of RFC B
I want to pass these 2 tables as table parameters to RFC C for updating the task allocations in the backend - for the tasks selected in task table & resources selected in resource table. The code written till now was containing for loops on both table to fill the table parameter of RFC C - this is taking lot of time.
Alternatively WDCopyservice can be used to copy the nodes. The code written till now is as below
Z_Nits_Task_Freeresources_Input objallocfin = null;
try
{
WDCopyService.copyElements(wdContext.nodeZ_Nits_Resource_Task_Prtasks_Input().nodeOutputT().nodeT_TasksOIT(),wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_TasksFI());
WDCopyService.copyElements(wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeOutputF().nodeT_ResourcesFO(),wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_ResourcesFI());
int Size = wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_ResourcesFI().size();
int Size1 = wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_TasksFI().size();
wdContext.currentContextElement().setErrtext("res table size is"+Size);
wdContext.currentContextElement().setErrtext2("task table size is"+Size1);
objallocfin = new Z_Nits_Task_Freeresources_Input();
I am getting the correct sizes in the 2 fields displayed on the iview after the copy statements.
My problem is I am not sure how to bind the copied nodes to the object and execute the RFC.
Before I used to use .add for adding the data row-by-row into the table parameter of the RFC C and then bind it to the object objallocfin.
I am not sure how to do the bindings when WDCopyservice is used.
Please suggest.
Thanks Maksim for your reply. I will certainly try that out.
But I would still like to avoid the use of for loop.
How do I link the copied nodes to the model for execution of the RFC.
Do let me know if you have any ideas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sanjay,
As far as I understood you requirements you need to pass only selected items. So, anyway you need to iterate through model nodes to filter only selected elements. With my approach you just re-assign instance of model object to another node.
BTW, WDCopyService implicitly iterates through node lements.
Best regards, Maksim Rashchynski.
Hi Maksim,
I need to pass a structure as a table parameter to the RFC.
This structure needs to hold multiple rows.
Currently I am using the below mentioned LOC.
<b>wdContext.currentZesstest1_InputElement().modelObject().addZpernr1(objESSTable);</b>
However the above code works when the structure objESSTable has single of data.
For setting multiple rows of data I tried to use the below code:
<b>wdContext.nodeZesstest1_Input().nodeZpernr1().bind(objVector);</b>
Here objVector is object of Vector class holding multiple rows of the sturcture objESSTable.
But this is not working.
Please help!!
Hi Sanjay,
Try this:
IWDNode node = wdContext.nodeZ_Nits_Resource_Task_Prtasks_Input().nodeOutputT().nodeT_TasksOIT();
int size = node.size();
int leadSelection = node.getLeadSelection();
final Collection modelObjects = new ArrayList(size);
for (int i = 0; i< size; i++)
{
final IWDNodeElement element = node.getElementAt( i );
final int idx = element.index();
if( leadSelection == idx || node.isMultiSelected( idx ) ) {
final Object model = element.model();
modelObjects.add(model);
}
}
wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_TasksFI( modelObjects );
node = wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeOutputF().nodeT_ResourcesFO();
size = node.size();
leadSelection = node.getLeadSelection();
modelObjects = new ArrayList(size);
for (int i = 0; i< size; i++)
{
final IWDNodeElement element = node.getElementAt( i );
final int idx = element.index();
if( leadSelection == idx || node.isMultiSelected( idx ) ) {
final Object model = element.model();
modelObjects.add(model);
}
}
wdContext.nodeZ_Nits_Task_Freeresources_Input().nodeT_ResourcesFI( modelObjects );
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.