on 02-20-2008 12:15 PM
Dear all,
I am trying to execute BAPI_SALESORDER_CREATEFROMDAT1 from Java.
I am passing all mandatory parameters.
I am setting the DOC_TYPE as "OR".
However in the Return structure I get the message
Sales document type OR is not defined.
This works fine from the ECC system.
The DOC_TYPE field has 4 characters.
So I have tried passing "OR ". (OR followed by 2 spaces.)
But the string passed is getting trimmed and te reult is the same return message.
Can anyone please help me in this matter.
Thanks and regards,
Mayuresh.
Dear All,
This is my code.
import com.sap.mw.jco.*;
import java.io.StringWriter;
public class Test {
public static void main(String[] args) {
String result = "";
try {
JCO.Client mConnection;
JCO.Repository mRepository;
JCO.Function mFunction;
JCO.Table mTable;
mConnection =
JCO.createClient( "100" , "user" , "password" , "en" , "host-ip" , "10" );
mConnection.connect();
mRepository = new JCO.Repository("myRep", mConnection);
mFunction = mRepository.getFunctionTemplate( "BAPI_SALESORDER_CREATEFROMDAT1").getFunction();
JCO.Structure mStructure = mFunction.getImportParameterList().getStructure("ORDER_HEADER_IN");
String doc = "OR ";
System.out.println(doc);
System.out.println(doc.length());
mStructure.setValue(doc,"DOC_TYPE");
System.out.println(doc);
System.out.println(doc.length());
mStructure.setValue("1000","SALES_ORG");
mStructure.setValue("10","DISTR_CHAN");
mStructure.setValue("01","DIVISION");
mTable = mFunction.getTableParameterList().getTable("ORDER_PARTNERS");
mTable.appendRow();
mTable.setValue("SP","PARTN_ROLE");
mTable.setValue("AMIT","PARTN_NUMB");
mTable = mFunction.getTableParameterList().getTable("ORDER_ITEMS_IN");
mTable.appendRow();
mTable.setValue("58","MATERIAL");
mTable.setValue("6","REQ_QTY");
mConnection.execute(mFunction);
//mFunction = mRepository.getFunctionTemplate("BAPI_TRANSACTION_COMMIT").getFunction();
//mConnection.execute(mFunction);
mStructure = mFunction.getExportParameterList().getStructure( "RETURN" );
StringWriter writer = new StringWriter();
mStructure.writeXML(writer);
result = writer.getBuffer().toString();
mConnection.disconnect();
}
catch (Exception ex) {
ex.printStackTrace();
result = ex.getMessage();
}
System.out.println(result);
}
}
I hope now someone will be able to help.
Thanks and regards,
Mayuresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.