on 06-18-2009 4:42 PM
Hi all,
I trying to write a simple webdynpro based app that makes use of BAPI_GOODSMVT_CREATE. The Input parameter will be entered on the screen and these will populate the IMPORT and Table parameters of the BAPI call.
All data binding between the UI and view context as well as the context mapping between the view controller and the component have been done.
//inside mycomponent
//@@begin wdDoInit()
//Create Bapi_Goodsmvt_Create_Input object and bind it to context node
bapiGoodsMvt = new Bapi_Goodsmvt_Create_Input();
wdContext.nodeBapi_Goodsmvt_Create_Input().bind(bapiGoodsMvt);
//Get a reference to the Message Manager
msgMgr = wdThis.wdGetAPI().getMessageManager();
//Create new elements for IMPORTING/TABLES parameters nodes
bapiGoodsMvt.setGoodsmvt_Code(new Bapi2017_Gm_Code());
bapiGoodsMvt.setGoodsmvt_Header(new Bapi2017_Gm_Head_01());
bapiGoodsMvt.setGoodsmvt_Item(new Bapi2017_Gm_Item_Create()); //this does not compile
//@@end
The error that i get is: The method setGoodsmvt_Item(AbstractList) in the type Bapi_Goodsmvt_Create_Input is not applicable for the arguments (Bapi2017_Gm_Item_Create).
The definition of the setGoodmvt_item method takes an AbstractList and i'm not sure how i can give it one since it's 'abstract' and thus cannot be instantiated.
public void setGoodsmvt_Item(com.sap.aii.proxy.framework.core.AbstractList list) {
setRelatedModelObjects("Goodsmvt_Item", list);
}
Any help is appreciated. An example of a bapi call that requires table parameters would be welcomed as well.
Edited by: MonkD on Jun 18, 2009 5:42 PM
Edited by: MonkD on Jun 18, 2009 5:52 PM
Hi,
This is because the Goodsmvt_Item is not an attribute but a node (which represents the table in the BAPI parameters the others are structure hence can have only one set of values while table can have multiple).
In such a scenario you can add elements Goodsmvt_Item to the bapiGoodsMvt or use the abstractlist interface. Add the following code for the goods item:
//Instantiate the AbstractList
AbstractList GoodsItemList = Bapi2017_Gm_Item_Create.Bapi2017_Gm_Item_CreateList();
//Find which model object Goodsmvt_Item is mapped to the list method will be present for that model object. I used Bapi2017_Gm_Item_Create as it was there in your code.
//Create an element
Bapi2017_Gm_Item_Create GoodsItem = new Bapi2017_Gm_Item_Create();
GoodsItem.set<Attr1>(<value>);
GoodsItem.set<Attr2>(<value>);
//Add the element to the list
GoodsItemList.add(GoodsItem);
//Set the list in mode node object
bapiGoodsMvt.setGoodsmvt_Item(GoodsItemList);
Regards,
Kartikaye
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
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.