Skip to Content
author's profile photo Former Member
Former Member

problem with bapi's table parameter

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 04:49 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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.