Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

error executing custom function module

Hi all,

am trying to read a function module form my java code as below.

There is no problem with the function module.

I think there is some problem with the java code that is written. I am sure the problem lies with the TABLES IT_PRODUCT_DATA STRUCTURE ZOG_ITEM_SCREENSTR.

Function module parameters and signature.

FUNCTION ZGET_CUST_ORDERGUIDE_ITEMDATA.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(IV_ORDER_GUID) TYPE CRMT_OBJECT_GUID OPTIONAL

*" VALUE(IV_CUSTOMER) TYPE BU_PARTNER

*" TABLES

*" IT_PRODUCT_DATA STRUCTURE ZOG_ITEM_SCREENSTR

*"----


Java Code that is Implemented is attached above.

public ArrayList fetchOrderGuide(String customerNumber) {

ArrayList itemList = new ArrayList();

ItemSalesDoc itemSalesDoc = new ItemSalesDoc();

if (log.isDebugEnabled()) {

log.debug("inside ZAdminLogin");

}

try

{

JCoConnection aJCoCon = (JCoConnection) getConnectionFactory().getConnection(com.sap.isa.core.eai.init.InitEaiISA.FACTORY_NAME_JCO,

com.sap.isa.core.eai.init.InitEaiISA.CON_NAME_ISA_STATEFUL);

try

{

try

{

JCO.Function zFetchSalesOrderFunctionModule = aJCoCon.getJCoFunction("ZGET_CUST_ORDERGUIDE_ITEMDATA");

// set the import values

Table zItemsTable = new Table("ITEMS");

//zPackagesTable.addColumn(Table.TYPE_STRING,"HUI");

zItemsTable.addColumn(Table.TYPE_STRING,"JOGITEM");

zItemsTable.addColumn(Table.TYPE_INT,"JPRUOM");

zItemsTable.addColumn(Table.TYPE_STRING,"JPRSEQ");

zItemsTable.addColumn(Table.TYPE_STRING,"JOGDESC");

zItemsTable.addColumn(Table.TYPE_STRING,"JLINE");

zItemsTable.addColumn(Table.TYPE_STRING,"JOGNR");

zItemsTable.addColumn(Table.TYPE_STRING,"JPACK");

zItemsTable.addColumn(Table.TYPE_STRING,"JSIZE");

zItemsTable.addColumn(Table.TYPE_STRING,"JBRAND");

zItemsTable.addColumn(Table.TYPE_STRING,"JWEEKAVG");

zItemsTable.addColumn(Table.TYPE_STRING,"JDELFLAG");

JCO.ParameterList importParams = zFetchSalesOrderFunctionModule.getImportParameterList();

importParams.setValue("BP-104", "IV_CUSTOMER");

aJCoCon.execute(zFetchSalesOrderFunctionModule);

JCO.Table zRtItems = zFetchSalesOrderFunctionModule.getTableParameterList().getTable("IT_PRODUCT_DATA");

int numberOfPackages = zRtItems.getNumRows();

if (log.isDebugEnabled()) {

log.debug("number of packages " + numberOfPackages);

}

if (numberOfPackages > 0)

{

for (int j=0; j<numberOfPackages; j++)

{

TableRow itemRow = zItemsTable.insertRow();

//itemRow.setRowKey(new TechKey(zRtItems.getString("EXIDV")));

//packageRow.getField("HUI").setValue(zGoods.getString("EXIDV"));

itemRow.getField("JOGITEM").setValue(zRtItems.getString("OGITEM"));

itemRow.getField("JPRSEQ").setValue(zRtItems.getString("PRSEQ"));

itemRow.getField("JOGDESC").setValue(zRtItems.getString("OGDESC"));

itemRow.getField("JLINE").setValue(zRtItems.getString("LINE"));

itemRow.getField("JOGNR").setValue(zRtItems.getString("OGNR"));

itemRow.getField("JPACK").setValue(zRtItems.getString("PACK"));

itemRow.getField("JSIZE").setValue(zRtItems.getString("SIZE"));

itemRow.getField("JBRAND").setValue(zRtItems.getString("BRAND"));

itemRow.getField("JWEEKAVG").setValue(zRtItems.getString("WEEKAVG"));

itemRow.getField("JDELFLAG").setValue(zRtItems.getString("DELFLAG"));

zRtItems.nextRow();

}

}

}

catch(JCO.AbapException abapException)

{

//Exception thrown, user is not valid

if(log.isDebugEnabled())

{

log.debug( abapException.getKey());

}

}

}

catch (Exception ex)

{

if (log.isDebugEnabled()) {

log.debug(ex);

}

}

finally

{

aJCoCon.close();

}

}

catch(BackendException beeEx)

{

if(log.isDebugEnabled())

{

}

}

return itemList;

}

LOGDETAILS

ZGET_CUST_ORDERGUIDE_ITEMDATA:: - IN: INPUT * IV_CUSTOMER='BP-104' IV_ORDER_GUID='00000000000000000000000000000000'

Oct 9, 2008 6:48:41 AM,507 SAPEngine_Application_Thread[impl:3]_7 Error com.sap.isa.core.eai.sp.jco.JCoConnectionStateful Error occcurred in EAI layer "com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet".

[EXCEPTION]

com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet

at com.sap.mw.jco.JCO$Record.checkRowCapacity(JCO.java:12354)

at com.sap.mw.jco.JCO$Record.getString(JCO.java:12827)

at com.sap.mw.jco.JCO$Field.getString(JCO.java:11055)

at com.sap.isa.core.eai.sp.jco.JCoUtil.paramIterator(JCoUtil.java:412)

at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:382)

at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:236)

at

All helpful answers will be rewarded heavily

Tags:
Not what you were looking for? View more on this topic or Ask a question