cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in calling BAPI

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Hello Bhavin,

you have marked your question an self solved. Would be fine if you post your solution.

Regards

Gregor