Data not uploading from Java/JCO to SAP tables

pts.
Tags:
ABAP
Development
J2EE
Java
SAP
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

Well, I don’t know Java or JCO, and I can’t tell from your code what RFC you’re using, but I can say this:
1) A structure is a temporary work area (a record layout), and
2) A structure can be loaded to an “internal” table, which is also a temporary work area, and is not a database table.

It sounds like your structure is being loaded to an internal table. Loading a structure (or internal table) does not automatically load a related database table. You need a second routine (RFC or BAPI) to move the data from the structure (or internal table) to the database table. Perhaps your SAP colleague can help you identify the required routine. Good luck.
Dave

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Servee
    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.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following