You are on page 1of 3

4/5/2019 SAP PI Proxy to JDBC to get millions of records – Jaehoo Weblog

Jaehoo Weblog

Blog personal de jaehoo

SAP PI Proxy to JDBC to get millions of records

julio 16, 2018julio 23, 2018

Recently I’ve had to develop a scenario with Proxy to JDBC communication to extract a lot of records
(millions of records), the strategy to achieve this is get a bunches of records in packages until transfer all
records from database to SAP.

I’ve developed a Service Interface with tree operations:

Count: to get the number of records to extract


Transfer: to get records in packages
Delete: clear the table if the prrocess completes successfully

The execution logic is simple, first, SAP counts all record in DB to know how many of them will be
extract, next an ABAP program calculate the size of packages and start to extract the records in
packages, and count the transfered data per package, at last, if the transferred data is equal to initial
count the source table is deleted.

The interesting point is on Message mapping, let’s review them:

Count operation

I’ve used the data tyoestructure to set my own query, thats the reason because I only need two fields
(action property and access field), notice the sender Message Type has different name to receiver
Message Type and the field ‘check’ is not mapped to receiver message:

https://jaehoo.wordpress.com/2018/07/16/sap-pi-proxy-to-jdbc-to-get-millions-of-records/ 1/3
4/5/2019 SAP PI Proxy to JDBC to get millions of records – Jaehoo Weblog

In “action” property set constant value as: SQL_QUERY, and in “access” I’ve set the custom count SQL
query, something like : SELECT field FRROM table WHERE… some conditions.

If the SQL statement represents a query to the database (SELECT), choose Action=SQL_QUERY.

If it represents a call from the SQL Data Manipulation Language (UPDATE, INSERT, DELETE), choose
Action=SQL_DML.

If you wna o know more abot this options you can check this blog
(h p://shz2008bj.iteye.com/blog/1308722)

Now in the response message:

The root fields must be the same as the reques, but in addition the name has “_response” suffix, and I
return the number of records.

Transfer operation

The transefer operation is the main key in all of this, in the action property set: SQL_QUERY, in access
I’ve wrote my custom query something like this:

1 SELECT fields FROM custom_table WHERE OFFSET '$offset$' ROWS FETCH NEXT '$next$

I’ve used named parameters, that parametes must to have the same name as the key fields in the receiver
message, the named fields will be replaced into query.

https://jaehoo.wordpress.com/2018/07/16/sap-pi-proxy-to-jdbc-to-get-millions-of-records/ 2/3
4/5/2019 SAP PI Proxy to JDBC to get millions of records – Jaehoo Weblog

I’m working with oracle, the previous query does a single select but is delimited by rowset (to skip
records) and offset (to pick some records). When SAP PI build the SQL query it will going to replace the
parameters.

In the response only have to map the fields.

The delete operation it’s very similar to count.

And thats it, the main logic is controlled in SAP to request data in pakages.

References

Document Formats for the Receiver JDBC Adapter (h p://shz2008bj.iteye.com/blog/1308722)


Count Records from JDBC Sender (h ps://archive.sap.com/discussions/thread/154924)
JDBC receiver adapter (h ps://archive.sap.com/discussions/message/9452360#9452360)
High volumes on receiver JDBC adapter
(h ps://archive.sap.com/discussions/message/8049780#8049780)

Best

Publicado en: Development, General, SAP, SAP PI | Etiquetado: Development, SAP PI


This site uses Akismet to reduce spam. Learn how your comment data is processed.

BLOG DE WORDPRESS.COM.

https://jaehoo.wordpress.com/2018/07/16/sap-pi-proxy-to-jdbc-to-get-millions-of-records/ 3/3

You might also like