on 02-16-2007 8:11 AM
Hi,
I have a BAPI that has 3 importparameters and 1 Input table.
When I execute it, the input parameters are filled but the table is always send initial to R3.
This is my code:
IPublicInventoryCmp.IIm_T_ItemsElement element =
wdContext.createIm_T_ItemsElement(new Zcab_L_Inv_Items());
wdContext.nodeIm_T_Items().bind(new Zcab_L_Inv_Items());
wdContext.nodeIm_T_Items().addElement(element);
element.setBatch(wdContext.currentV_Im_ItemsElement().getBatch());
element.setMaktx("");
element.setMat_Type("");
element.setMatnr(wdContext.currentV_Im_ItemsElement().getMatnr());
wdContext.currentZ_Bapi_Create_Inv_InputElement().modelObject().execute();
wdContext.nodeOutputCreate().invalidate();
Now there should be 1 row passed to R3 but if It try to run that there will be an table with nothing!
Does anyone have an idea whats wrong?
Thanks and best regards,
Dennis
When you pass table parameters you need to get parent model class reference.
Instead of calling set<parametername>() method for table parameters call add<parametername>() method on the reference.
Z_Bapi_Create_Inv_Input <ref>= new Z_Bapi_Create_Inv_Input ();
wdContext.nodeZ_Bapi_Create_Inv_Input().bind(<ref>);
<tableparameter's class> <ref_table>=new <tableparameter's class>();
<ref>.add<tableparametername>(<ref_table>);
<ref_table>.set<parameter1>("<value>"); .
.
.
<ref_table>.set<parametern>("<value>");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
Try the following coding procedure.
1) Create an instance for the model node.
Z_<> modelNode = new Z_<>;
2) Bind the instance to the node.
wdContext.nodeZ_<>().bind(modelNode);
3) Set the 3 input parameters in ur case.
modelNode.set<>();
modelNode.set<>();
modelNode.set<>();
4) Create an instance for the class that contains the table import parameters.
Z_class() importClass = new Z_class();
5) Set the table values to this instance.
importClass.set<>();
6) Add this element to the node.
wdContext.nodeZ_class().addElement(importClass);
7) Finally add the import table parameter to the model node.
modelNode.add<table parameter>(importClass);
😎 Now Execute the Bapi.
modelNode.execute();
- Nagarajan.
Oops hope u got the solution....
Message was edited by:
Nagarajan Kumarappan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satyajit and Gopi,
i tried both of your suggestions, but it was the same result
I always get the message back: "Mandatory parameter IM_T_ITEMS of method Z_BAPI_CREATE_INV missing" what means that the table will be delivered initial...
I tried the bapi in R3 and there it works fine!
The R3 system is a 4.6C.
Any other clues?
regards,
Dennis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just a modification to my earlier code:
Zcab_L_Inv_Items() items = new Zcab_L_Inv_Items());
items.setBatch(wdContext.currentV_Im_ItemsElement().getBatch());
items.setMaktx("");
items.setMat_Type("");
items.setMatnr(wdContext.currentV_Im_ItemsElement().getMatnr());
/* add this to the main BAPI input element.
You must have created an element like this
Z_Bapi_Create_Inv_Input input = new Z_Bapi_Create_Inv_Input();
So add it like
*/
input.setZcab_L_Inv_Items(items);
wdContext.currentZ_Bapi_Create_Inv_InputElement().modelObject().execute();
//...
Regards,
Satyajit.
Dennis,
It's always "safer" to modify model objects of Adaptive RFC model directly rather then via node elements creation. So:
1. Make sure your context mapping to model has all "supplyingRelationRole" properties of nodes set correctly.
2. In your code modify model objects directly:
final <BapiName>_Input query = wdContext.current<BapiName>_InputElement()
.modelObject();
query.add<TableName>( new <TableName>() );
3. Now your data will be both visible on UI (thanks to supplyingRelationRole) and will be passed correctly during call.
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try like this:
Zcab_L_Inv_Items() items = new Zcab_L_Inv_Items());
items.setBatch(wdContext.currentV_Im_ItemsElement().getBatch());
items.setMaktx("");
items.setMat_Type("");
items.setMatnr(wdContext.currentV_Im_ItemsElement().getMatnr());
wdContext.nodeIm_T_Items().bind(items);
wdContext.currentZ_Bapi_Create_Inv_InputElement().modelObject().execute();
//...
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.