on 02-08-2009 12:03 AM
Before post, i have carefully read SAP docs, including the course JA310, but still don't find the solution.
My problem is that when i called a RFC, and execute output.invalidate(), the output field becomes gray.
(There won't be any authorization issues, i use the rfc_user for sap backend system, it has sap_new and sap_all authorization).
I will make the case most simple.
BAPI backed:
- IMPORT: orgin type num2, EXPORT result type num2.
- the function of BAPI is simple : result = orgin + 1.
In the NWDS.
- I have already tested the input bind, it works fine. (with an other FM has IMPORT data only)
- but when I try to bind the output data, the display field is gray and empty. (I have check the binding between model and controller, controller and view, all is fine)
Here is the 'logic flow'
Part I: wdDoInit()
public void wdDoInit()
{
//@@begin wdDoInit()
...
// out put field is now gray
Ztestbapi_Output outbapi = new Ztestbapi_Output();
outbapi.setResult("05");
wdContext.nodeZtestbapi_Output().bind(outbapi);
// output field is now availble
}
Pari II: Button Action
public void Execute1( )
{
//@@begin Execute1()
...
try {
// wdContext.nodeZtestbapi_Output().invalidate();
// out putfield is now gray again
wdContext.currentZtestbapi_InputElement().modelObject().execute();
// out putfield is now gray again
wdContext.nodeZtestbapi_Output().invalidate();
Ztestbapi_Output outbapi = new Ztestbapi_Output();
outbapi.setResult("07");
wdContext.nodeZtestbapi_Output().bind(outbapi);
// output field is now availble
wdContext.nodeZtestbapi_Output().invalidate();
// out putfield is now gray again
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Thank u very much in advance!
My recent research is :
when i change my execute() function like:
Ztestbapi_Input inbapi = new Ztestbapi_Input();
inbapi.setOrgin("02");
wdContext.nodeZtestbapi_Input().bind(inbapi);
try {
// here is the key change
wdContext.nodeZtestbapi_Output().bind(inbapi.getOutput());
// End of key change.
wdContext.currentZtestbapi_InputElement().modelObject().execute();
wdContext.nodeZtestbapi_Output().bind(inbapi.getOutput());
wdContext.nodeZtestbapi_Output().invalidate();
if (wdContext.nodeZtestbapi_Output().isEmpty()){
inbapi.setOrgin("07");
wdContext.nodeZtestbapi_Input().bind(inbapi);
}
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The output and the input should be binded automatically, shouldn't them?
Always confused.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi chat,
Well you could stop invalidating all your data. Your output fields should become gray after invalidate, as you are invalidating them......
Best to leave invalidate alone aslong as you don't want to remove the data from a node or you are not using supply functions.
So to simplify your code:
Ztestbapi_Input inbapi = new Ztestbapi_Input();
//bind your Ztestbapi to the context so all data of input and output will go in there automatically
//because we are using a new Ztestbapi we don't need to invalidate anything.
wdContext.nodeZtestbapi_Input().bind(inbapi);
inbapi.setOrgin("02");
try {
inbapi.execute();
if (wdContext.nodeZtestbapi_Output().isEmpty()){
inbapi.setOrgin("07");
inbapi.execute();
}
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Good luck,
Jeschael
Hi Soral,
You can try giving invalidate() after the execute() inside the try block it wont get greyed out, provided u binded the output node context variable from model to component and from component to outputfield of the output view. ( Hope you got me !!!!)
Its because you are trying to set output after bind() in the previous code , its not getting greyed out there.
I have worked on many such RFCs like this n it worked very fine,
ZTestInp in = new ZTestInp();
wdContext.nodeZTestInp_inputElement().bind(in);
in.setOrigin(5); // if i case its an integer (I in ABAP dictionary)
try
{
in.execute();
}
catch(Exception e)
{
e.printStackTrace();
}
You will get 6 printed in the output field. All mappings must be done properly.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.