Professional Documents
Culture Documents
Jaehoo Weblog
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.
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.
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)
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.
And thats it, the main logic is controlled in SAP to request data in pakages.
References
Best
BLOG DE WORDPRESS.COM.
https://jaehoo.wordpress.com/2018/07/16/sap-pi-proxy-to-jdbc-to-get-millions-of-records/ 3/3