cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in calling BAPI_SALESORDER_CREATEFROMDAT2 Using JCO

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)

Former Member
0 Kudos

In the documentation for the BAPI I noticed this:

If no ship-to party is entered, use the following: Ship-to party = sold-to party.

Try adding the ship-to-party - partner role 'WE' - using the same partner number as the sold-to-party.

Another tip: Setting the CONVERT parameter to 'X' causes the R/3 system to perform the partnerrole conversion for you. This should allow you to leave out the conversion exit calls.

Message was edited by: Pascal Willemsen