Hi,
I am trying to upload some data into the SAP tables using JCO and Java. The data is getting uploaded successfully into a SAP structure from which it is supposed to be moved into a SAP master table (I am assuming this as successful as after updating the data into the structure I am able to read them back in my java code). However, the data does not seem to move from the structure to the master table. My SAP colleague says me that the data moves into master table appropriately when she tries to move the data from the struture into the master table using SAP screens. Can you please suggest what could be the possible reason for this.
The java code that I have written for this is as below
JCO.addClientPool(?SAPConPool?, <SAPPoolSize>, <SAPClient>, <SAPUserName>, <SAPPassword>, ?EN?, <SAPHostString>, ?00?);
com.sap.mw.jco.JCO.Client aSAPConnection = JCO.getClient(?SAPConPool?);
com.sap.mw.jco.IRepository aSAPRepository = new JCO.Repository(?REPOS_NAME?, aSAPConnection);
com.sap.mw.jco.IFunctionTemplate ftemplate = aSAPRepository.getFunctionTemplate(?<RFC PROGRAM NAME>?);
com.sap.mw.jco.JCO.Function jcoFunction = new com.sap.mw.jco.JCO.Function(ftemplate);
com.sap.mw.jco.JCO.Table aTable = jcoFunction.getTableParameterList().getTable(?<SAP TABLE NAME>?);
aTable.appendRow();aTable.setValue(?<field1Value>?, ?<field1Name>?);aTable.setValue(?<field2Value>?, ?<field2Name>?);
JCO.getClient(aSAPConnection);
Thanks and Regards,
Lala
Software/Hardware used:
ASKED:
August 21, 2006 4:22 PM
UPDATED:
August 23, 2006 6:22 AM
first u have to execute your function:
aSAPConnection.execute(jcoFunction);
and then, if the function is BAPI u have to execute another SAP function module “BAPI_TRANSACTION_COMMIT” to commit db updates.