cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple entries in SAP system

saprookieat
Explorer
0 Kudos

Hello,

I am new developing a Java SAP JCo application and currently trying to send data over a tRFC interface to the customer.

Basically what it does:

We have a JCoServer that receives iDocs and saves them to a database table e.g. SAP_INBOUND. After processing the data, we store it in another table e.g. SAP_OUTBOUND. The SAP JCoClient will then pick up records from this table and sent them to the SAP gateway. Both use the IDOC_INBOUND_ASYNCHRONOUS JCoFunction.

Client specifics

In the client I just get the JCoDestination, try to get the JCOFunction for the IDOC_INBOUND_ASYNCHRONOUS.

After that I get the JCoTable with

JCoTable idocControlTable = getIDocInboundAsynchronousFunction().getTableParameterList().getTable("IDOC_CONTROL_REC_40");

Then I append one row:

idocControlTable.appendRow();

and iterate all values of a Java Map to set the JCoTable values:

idocControlTable.setValue("KEY", "VALUE");

After that I do the same with the IDOC_DATA_REC_40 table with the only difference, that there are of course more entries to iterate.

The last step is:;

getIDocInboundAsynchronousFunction().execute(jcoDestination);

The problem

The customer claims that there are more iDocs arriving, than they expect. We previously used a .NET SAP interface and the customer received the same amount of iDocs we wrote in the IDOC_CONTROL_REC_40 table. The issue occurred since we used the Java SAP JCo solution.

The program logs (iteration of rows from the database as well as iteration of the IDOC_CONTROL_REC_40 itself) as well as the SAP traces show for instance 10 iDocs have been sent, but the customer has received 30.

Expectation

I know, that without the source code it is more difficult to analyze. The main goal was to ask, if there is another way to add rows to a table or trigger the transmission to the SAP Gateway in SAP JCo?

Maybe other people have experienced the same kind of thing and it is a configuration side effect?

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions.

As you're looking to get most out of your community membership, please consider include a profile picture to increase user engagement & additional resources to your reference that can really benefit you:

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,

Alex

View Entire Topic
MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Thomas

I strongly recommend to not build the IDoc by directly manipulating the RFC function module used for transferring it to an ABAP system via RFC, but to use the Java IDoc Library instead. It is an add-on library for JCo and will take care of a correct structure for the IDoc and will populate the metadata of the RFC table correctly. On IDoc level, you simply need to set the content.

Best regards,
Markus

saprookieat
Explorer
0 Kudos

Thank you I appreciate your answer!

As I am currently replacing a .NET solution the first approach was to call the RFC function module directly, as it is very similar to the old solution, that can not be maintained anymore.

I would like to do as you suggested, unfortunately I have two obstacles:

  • I do not have a SAP test system at hand and only very limited time frames I can use at the customers test environment
  • From the documentation I only got the examples idocclientexample.java and idocserverexample.java at hand, but I am lacking of information about the structure of the XML that will be constructed will the Java class libraries.

Do you have a source example for a more substantial documentation of the SAP IDoc Library?