Skip to Content
0
Former Member
Apr 01, 2005 at 07:49 AM

Problem in calling BAPI

53 Views

Hi everyone,

We are using R3 4.6c. I am try to create a java application using SAP JCO 2.0.9 for creating SALES order using BAPI_SALESORDER_CREATEFROMDAT2

. For this BAPI it is required to call conversion exit also. I have called that conversion exit also. But still it is giving me error that please enter sold-to-party or ship-to-party. I have already defined valid Sold-to-party number . The code is given below.

try

{

function = this.createFunction("BAPI_SALESORDER_CREATEFROMDAT2");

function1 = this.createFunction("ZCONVERSION_EXIT_PARVW_INPUT");

if (function == null) {

System.out.println("BAPI_SALESORDER_CREATEFROMDAT2" +

" not found in SAP.");

System.exit(1);

}

JCO.Structure Tb = function.getImportParameterList().getStructure("ORDER_HEADER_IN");

Tb.setValue("ZSDS","DOC_TYPE");

Tb.setValue("SALT","SALES_ORG");

Tb.setValue("DP","DIVISION");

Tb.setValue("10","DISTR_CHAN");

JCO.Table Tab = function.getTableParameterList().getTable("ORDER_ITEMS_IN");

Tab.setRow(0);

Tab.setValue("000000000090502208","MATERIAL");

function1.getImportParameterList().setValue("SP","INPUT");

mConnection.execute(function1);

JCO.Table Tab2 = function.getTableParameterList().getTable("ORDER_PARTNERS");

Tab2.setRow(0);

System.out.println(function1.getExportParameterList().getString("OUTPUT") + "Hi");

//Tab2.setValue(function1.getExportParameterList().getString("OUTPUT"),"PARTN_ROLE");

Tab2.setValue("AG","PARTN_ROLE");

Tab2.setValue("00S0953U00","PARTN_NUMB");

mConnection.execute(function);

JCO.Table returnTable = function.getTableParameterList().getTable("RETURN");

if (! (returnTable.getString("TYPE").equals("") ||

returnTable.getString("TYPE").equals("S")) )

{

System.out.println(returnTable.getString("MESSAGE"));

System.exit(1);

}

System.out.println(function.getExportParameterList().getValue("SALESDOCUMENT"));

}

catch (Exception ex)

{

ex.printStackTrace();

System.exit(1);

}

Thanks in advance.