cancel
Showing results for 
Search instead for 
Did you mean: 

problem with bapi's table parameter

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello,

Thanks for your answer. I don't get any errors now.

The line for the list creation should be as follow: AbstractList goodsItemList = new Bapi2017_Gm_Item_Create_List();

regards

Answers (0)