on 04-24-2007 12:22 PM
Hi all,
I am passing values in table in RFC. There are no import/export parameters in RFC. We are passing only tables.
There are two tables in the RFC I_Dept and I_Subdept. Initially RFC is executed for getting the Dept which works fine as for this there is no need to set in input table value. But to get sub department I need to set the dept in I_Dept and after executing RFC I should get values in table I_Subdept. The code is as below:
wdContext.nodeOutput_I_Dept().invalidate();
wdContext.nodeOutput_I_Subdept().invalidate();
Z_Bapi_Dept_Values_Input d_Input = new Z_Bapi_Dept_Values_Input();
wdContext.nodeZ_Bapi_Dept_Values_Input().bind(d_Input);
Zdept dept = new Zdept();
dept.setZname("Sales");
d_Input.addI_Dept(dept);
try
{
wdContext.nodeZ_Bapi_Dept_Values_Input().currentZ_Bapi_Dept_Values_InputElement().modelObject().execute();
wdContext.nodeZ_Bapi_Dept_Values_Input().nodeOutput().invalidate();
}
catch (WDDynamicRFCExecuteException e)
{
msgManager.reportException(e.toString(), true);
}
Is anything wrong in this code because even after executing the RFC the size of node I_Subdept() is zero. But the RFC works fine in the backend.
Regards,
Jaydeep
Hi Abhijit / Sidharth,
Thanks for your replies. I have tried your suggestions but still it doesn't work. Any more inputs. Does the "optional" option for the RFC import and table parameters has sth to do with this. In my case no table is set as optional.
Thanks and regards,
Jaydeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jaydeep,
not had that parameter been mandatory then it would have thrown exception,
in your problem we even dont know if data is being passed to backend or not, i would suggest you to go through following few steps for check:
1) Through external debugging check out if proper values are being sent to backend or not(for external debugging goto transaction code se37, open your bapi->goto Utilities->Setting->Debugging->Here check if "Act" check box is activated or not), then put a break point in code and run application from WD.
2) or check if any exception is thrown while executing model object.
hope it helps
let me know if you face any problem
regards.
Hi Abhijit,
The code is as below:
Z_Bapi_Dept_Values_Input d_Input = new Z_Bapi_Dept_Values_Input();
wdContext.nodeZ_Bapi_Dept_Values_Input().bind(d_Input);
Zdept dept = new Zdept();
Zdept.Zdept_List deptList = new Zdept.Zdept_List();
dept.setZname("Sales");
deptList.add(dept);
d_Input.setI_Dept(deptList);
try
{
wdContext.nodeZ_Bapi_Dept_Values_Input().currentZ_Bapi_Dept_Values_InputElement().modelObject().execute();
wdContext.nodeZ_Bapi_Dept_Values_Input().nodeOutput().invalidate();
}
catch (WDDynamicRFCExecuteException e)
{
msgManager.reportException(e.toString(), true);
}
After execution of RFC it should return the sub department in Sales.
Regards,
Jaydeep
Hi,
your node Sales where return values are coming , i hope is under nodeOutput(), otherwise it need to be invalidated().
if that care is taken then the problem may be binding between UI elments and context nodes, i will suggest try debugging the application.
Also check if the datatype mismatch is there between r3 and wd.
regards
A typical misunderstanding when populating structured input data
via code is the following:
- You have bound a WD context node hierarchy to the model say
N1 > M1
->N2 > ->M2
where N1, N2 are WD Context nodes (N2 is child of N1) and M1, M2 are
model classes bound to the context nodes. Important: M1 has a relation
to M2 on the model side, means there is some method M1.setMyM2(M2)
(assuming the target role of the relation is called "MyM2").
- You create context elements for N1 and N2 which are bound to a model
class instances of M1 and M2 respectively.
Assuming that M1 is the "executable" model class (*_Input) and M2
represents an input structure needed, the M2-input will - using the
above approach - not be available on execution. Why? The relation on the
model side (MyM2) is not available if just maintaining it via the
context, i.e. context and model are not "in sync". As RFC execution is
done via the model the M2 input will not be available.
You best create complex/nested input structures on the model
side and then bind the top-level model object to the resp context node.
In the above sample this would be:
M1 m1ModelObject = new M1();
M2 m2ModelObject = new M2();
m1ModelObject.setMyM2(m2ModelObject);
Hope it helps!
Regards,
Sangeeta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is because , passing table to BAPI is different than just binding structure to the model node.
For structure we would have simply bound them as
<model class name>.set<Structure name>(structure element);
but, for passing table we need to create the abstract list for the table node, like as,
you may need to do like:
Zdept dept = new Zdept();
Zdept.Zdept_List deptList = new Zdept.Zdept_List();
dept.setZname("Sales");
deptList.add(dept);
d_Input.set<table name>(deptList);
let me know if you face any problem
you may refer this thread:
hope it helps
regards
Message was edited by:
Abhijeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.