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

abstract list error in nwds 7.2

Hi all,

I am working with nwds 7.2. When I am trying to set values to a structure in a bapi using list it gives code error, so I used abstract list. Please find below the structure and code:

structure:

Model UploadProdOrderModel

bapi Zbapi_Por_5003_Upload_So_Input

I->File_Table of structure type Zbapi_Por_5003_Table

collection cardinality as 0...n and selection cardinality as 0..1

I->Bapi_Input of structure type Zbapi_Por_5003_Input

collection cardinality as 0..1 and selection cardinality as 0..1

The code is as follows :

try

{

com.sap.crmb2b.uploadproductorder.model.UploadProdOrderModel modalVar = new com.sap.crmb2b.uploadproductorder.model.UploadProdOrderModel();

com.sap.crmb2b.uploadproductorder.model.Zbapi_Por_5003_Upload_So_Input requestVar = new com.sap.crmb2b.uploadproductorder.model.Zbapi_Por_5003_Upload_So_Input(modalVar);

Zbapi_Por_5003_Input in = new Zbapi_Por_5003_Input(modalVar);

Zbapi_Por_5003_Table tab= new Zbapi_Por_5003_Table(modalVar);

in.setSales_Org("1010");

in.setDist_Channel("00");

in.setDivision("00");

wdComponentAPI.getMessageManager().reportSuccess("1");

requestVar.setBapi_Input(in);

wdComponentAPI.getMessageManager().reportSuccess("2");

AbstractList<Zbapi_Por_5003_Table> listin = null;

wdComponentAPI.getMessageManager().reportSuccess("3");

tab.setMatnr("0101");

wdComponentAPI.getMessageManager().reportSuccess("4");

tab.setShipto("23324");

wdComponentAPI.getMessageManager().reportSuccess("5");

tab.setKwmeng("1");

wdComponentAPI.getMessageManager().reportSuccess("6");

tab.setSoldto("2345");

wdComponentAPI.getMessageManager().reportSuccess("7");

listin.add(tab);

wdComponentAPI.getMessageManager().reportSuccess("8");

requestVar.setFile_Table(listin);

wdComponentAPI.getMessageManager().reportSuccess("9");

requestVar.execute();

Error on execution:

while trying to invoke the method java.util.AbstractList.add(java.lang.Object) of an object loaded from local variable 'listin'

Thank you

Regards,

Preet Kaur

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 10, 2011 at 06:26 AM

    Dear Preet,

    Please refer to the thread for the abstract list initilization:

    initializing AbstractList Model in Custom Controller

    Best Regards

    Arun Jaiswal

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2011 at 05:11 AM

    Hi,

    Can you check the JCO Connections for the RFC is working fine or not?

    Test the JCO from below link:

    http:<hostname>:<port no>/index.html ->WD tools ->Content administrator->Manage JCOs.

    Best Regards

    Vijay K

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2011 at 07:31 AM

    Hi,

    You set

    AbstractList<Zbapi_Por_5003_Table> listin = null;

    but you never initialized it. Adding to 'null' will give you this exception.

    If your Bapi method returns an AbstractList, you need to have something like

    AbstractList listin = new <YourBapi>.<YourBapi>_List();

    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.