HI All,
For the benefit of others. From the analysis done so far, I was able to create new records via JCO code using the BAPI function 'BAPI_CUSTOMER_CREATEFROMDATA1' . Below is the sample code which worked for me. I was able to create new records using the BAPI function BAPI_CUSTOMER_CREATEFROMDATA1 via JCO.
public static void insertCustomerData() throws JCoException
{
JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
JCoRepository repository = destination.getRepository();
JCoContext.begin(destination);
JCoFunction function = repository.getFunction("BAPI_CUSTOMER_CREATEFROMDATA1");
if(function == null)
throw new RuntimeException("BAPI_CUSTOMER_CREATEFROMDATA1" + " not found in SAP.");
System.out.println("BAPI_CUSTOMER_CREATEFROMDATA1 Name from function object: " + function.getName());
JCoStructure codes = function.getImportParameterList().getStructure("PI_PERSONALDATA");
codes.setValue("LASTNAME", "John Ray");
codes.setValue("FIRSTNAME", "John Ray");
codes.setValue("CITY", "Texsas Vd");
codes.setValue("LANGU_P", "EN");
codes.setValue("LANGUP_ISO", "EN");
codes.setValue("COUNTRY", "US");
codes.setValue("CURRENCY", "DOLLARS");
codes.setValue("POSTL_COD1", "103258");
codes = function.getImportParameterList().getStructure("PI_COPYREFERENCE");
codes.setValue("REF_CUSTMR", "000014523");
codes.setValue("SALESORG", "1250");
codes.setValue("DISTR_CHAN", "20");
codes.setValue("DIVISION", "20");
function.execute(destination);
String cusnumber = function.getExportParameterList().getString("CUSTOMERNO") ;
System.out.println("The generated customer number is" + cusnumber);
}