on 2005 Jul 07 7:04 AM
Hi Gang,
Can you see why this code is not working. To me it should work fine. I have seen a couple of posts regarding this topic but none give a definite yes or no as whether this method works.
I have two RFC's. Each one uses a table of Personnel numbers.
RFC1 fills the table with pernr's and this works fine - I see it on my screen.
RFC2 accepts a table (same structure) of personnel numbers and outputs the names of the people.
So I thought I could simply copy the elements from node Pernr_Tab (output from RFC1) to Pernr_Tab_name(Input for RFC2). But only a blank table is being passed to RFC2
Controller Context
O Context
|-PernrList (Bound to RFC1)
|.|-PernrOutput
|...|-Pernr_Tab (Output from RFC1)
|.....=Pernr
|
- Names (Bound to RFC2) .. | - Output_name .. | . | -Name_Tab (This is blank after RFC2 is called) .. | ...=Pernr .. | ...=Name .. |
..|-Pernr_Tab_name (Source For RFC2)
....=Pernr
public void RFCNameFill( )
{
//@@begin RFCNameFill()
Z_Wd_Name_Input nameInput = new Z_Wd_Name_Input();
wdContext.nodeNames().bind(nameInput);
// Copy all the elements from node Pernr_Tab to node Pernr_Tab_name
WDCopyService.copyElements(wdContext.nodePernr_Tab(), wdContext.nodePernr_Tab_name());
try {
wdContext.currentNamesElement().modelObject().execute();
}
catch (Exception ex){
ex.printStackTrace();
}
wdContext.nodeOutput_name().invalidate();
//@@end
}
Yip TWM, that works. I would also like to clear this up. I get very confused as to when I have to use a .set(model node) and yet this solution doesn't use it at all - we are using .add(model node).
So my new working code based on the TWM solution is as follows:
Z_Wd_Name_Input nameInput = new Z_Wd_Name_Input();
wdContext.nodeNames().bind(nameInput);
// Copy all the elements from node Pernr_Tab to node Pernr_Tab_name
//WDCopyService.copyElements(wdContext.nodePernr_Tab(), wdContext.nodePernr_Tab_name());
for (int i=0; i < wdContext.nodePernr_Tab().size(); i++) {
wdContext.nodePernr_Tab().setLeadSelection(i);
Zwd_Pernr currentPernr = new Zwd_Pernr();
WDCopyService.copyCorresponding(wdContext.currentPernr_TabElement(), currentPernr);
nameInput.addPernr_Tab(currentPernr);
}
try {
wdContext.currentNamesElement().modelObject().execute();
}
catch (Exception ex){
ex.printStackTrace();
}
wdContext.nodeOutput_name().invalidate();
My WebDynpro book says "Supply data to the correct instance of the class _Input. This can be done either by:
1) manipulating the context model node to which the object is bound
OR
2) directly manipulating the model object. Direct access to the model object makes the coding easier to read."
I would like to see an example of each. I am not even sure which one of the 2 solutions I am using now ? I think it is number 2 as the code does not reference Context Node "Names" after the second line. I only seem to have to bind the model to the Context Node so that I can see the output in the view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, that will be usefull.
However I don't think I will be getting an error from the call to RFC2, it is working correctly - only it is getting no input data to work with. The table contains no values after the WDCopyService ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I had the same problem: when doing so, content of node is not copied to the other node...
All I could do to force data to go is the following:
for (int i = 0; i < wdContext.nodeReceipts().size(); i++) {
wdContext.nodeReceipts().setLeadSelection(i);
Ptrv_Receipts receipt = new Ptrv_Receipts();
WDCopyService.copyCorresponding(wdContext.currentReceiptsElement().modelObject(), receipt);
tripChangeInput.addReceipts(receipt);
}
If someone knows a better way of doing, I'm also interested in...
Anyway Richard, this is a workaround, but it works...
Hi,
Instead of writing
ex.printStackTrace();
in catch expression try using
wdComponentAPI.getMessageManager().reportException(ex.getMessage(),false);
add one message area control to view.
You may get the exact error message which can help you in solving the issue.
NEx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
9 | |
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.