Sunteți pe pagina 1din 12

JDBC Stored Procedure

One of my customers showcased me existing business process and he want to replace the same
business process with SAP PI,the requirement is very simple like integrating SAP ECC and
ORACLE data base system.

After analyzing the business process I came to know that to achieve my client requirement using
SAP PI, I need to come up with innovative design standard because requirement demanded
processing of 1.5 million JDBC messages per day and the operation on data base is JDBC insert.

Second challenge here is business process logic (mapping logic) and number of data base
operations for every IDoc Eg: one contract IDoc needs to insert in 4 tables (Header, Line item,
partner and DTN) but at minimum one contract IDocs is having nearly 54 messages (1 header, 6
line items, 42 partner records and 5 DTN records) and maximum 1400 messages.

Implementing mapping logic can be achieved using GUI functions, user defined functions and
JAVA mapping. My Earlier projects involved very complex mapping logics so designed couple of
standards to achieve current business process and it worked but only worry is will PI JDBC
Adapters support processing of 1.5 million messages per day?

Do I need to recommend my customer to upgrade hard ware to support high volume?

Finally designed interface using multiple ways and compared the results but most of the design
didn’t gave expected results eventually using one design we are able to process 1.5 +million
messages without increasing hardware.
As part of this blog series I will cover JDBC receiver scenarios and will discuss different design
approaches Pros and Cons.

This blog series covers below points,

1) 1) Comparing different JDBC receiver designs standard with Pros and Cons.

2) 2 )Processing high volume messages (Eg: 1.5 million message per day) using unique
design.

3) 3) Implementing IDoc packaging in JDBC receiver scenarios and processing collected


IDocs in one JDBC call.

4) 4) Maximum concurrency /Pool waiting time in JDBC receiver.


5) 5) Error handling in stored procedure design.

Design 1: INSERT operation

Lest start with standard INSERT statement design, every one familiar with insert
operation and it works really good way for medium and low high volume load.

There were many documents available on the same concept hence not going to give
detailed description.

The first and foremost thing while working with the JDBC scenario is creating a JDBC
receiver data type structure, SAP defined a standard format to use while working
JDBC receiver scenario.

Refer below SAP help to understand the XML document structures for different
operations.

http://help.sap.com/saphelp_nw73/helpdata/en/2e/96fd3f2d14e869e10000000a155
106/content.htm
Below screenshots is an example for inserting data in to single data base table using
INSERT operation.

Design2:Inserting data into multiple tables without multi mapping

This case creates a data type with multiple statement objects like below and map
accordingly.
The advantage with using multiple statement objects in one JDBC receiver Data type
is within one process call we can PI executes a scenario, utilization of PI recourse
less compare to multi mapping design.

Below is an example shows inserting MEDIA Products IDoc data in two data base
tables MATERIAL ACCOUNT TABLE and Material Basic data table.

Use this design when you want to process medium volume records to data base (Eg :
20k), INSERT operation takes high resources and once INSERT operation succesfuly
perfrormed then only it releases JDBC connection.

Advantages:

1) 1) Error handling is very easy because if insert operation fails due data issue or field
length exceeds issue or unsupported data issue or network connectivity issues then
we can track it in CC monitoring.
2) 2) ALERT framework covers JDBC adapter issues so that Support team can easily
identify the root case.

3) 3)Easy to develop and dependency on data base team always minimal.

Disadvantages:

1) 1)Processing high messages not recommended with this design and i had a serious
problems with INSERT statment design while dealing with hig volume.

2)JDBC adapter got locked many cases and all connections showed in utilisation
mode ,eventually JDBC adapter locked after Java stack restart problem was solved.

Using this design we can perform multiple data base operations on data base using one
interface, like inserting data in to multiple tables.

Refer below blog to know more about multi mapping without BPM concept.

http://scn.sap.com/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it-
s-possible
Pros:

Easy to develop and dependency on data base team always minimal.

We can perform multiple data base operations on different data bases/same data
base using one interface.

This design is idle for sending data to multiple different systems and data base
system using one interface.
Cons:

Multiple messages IDs will get generate depending on number of receivers and
number of tables.

Multiple data types/message types/service interfaces required to perform


multiple data base operations.

PI use multiple process calls to process message to multiple receives.

Processing high messages not recommended with this design.

A stored procedure is a named group of SQL statements that have been previously
created and stored in the database. Stored procedures accept input parameters so that a
single procedure can be used over the network by several clients using different input
data. Stored procedures reduce network traffic and improve performance. Additionally,
stored procedures can be used to help ensure the integrity of the database.

PI interface development point of view the difference between Standard INSERT


statement design and stored procedure design is JDBC receiver structure,

JDBC Receiver Stored procedure structure:


Refer below SAP documentation to understand about JDBC receiver structure formats

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/44/7b72b2fde93673e10000000a114a
6b/content.htm

Below screenshot shows the mapping between IDoc to JDBC stored procedure.
Map action attribute to constant (EXECUTE) and TABLE to stored procedure name like
below screen shot and make sure that stored procedure name is correct.

PS: Stored procedure will not support batch mode processing hence make sure that batch
mode not selected in JDBC receiver channel.
How stored procedure design works:

PI JDBC adapter not going to perform any operation on Data base only it calls JDBC
stored procedure with input parameters,Make sure that PI input put parameter hierarchy
should match with stored procedure input parameters.

Once stored procedure receives a request from PI then it performs operation on table
(INSERT/UPDATE/DELETE).

Advantages:

1)Performance point of view Stored procedure is always right a design to implement


because PI is not going to perform any operation on data base it only calls stored
procedure to pass input hence JDBC connection gets released short time compare to
compare to earlier designs.

2) Optimal solution to Handling high volume loads.

Disadvantages:

1) 1)As per my observation bit difficult to handle data issues, like MATERIAL number
length defined in data base is 18 characters but PI sending more than 18 characters in
this case PI calls stored procedure successfully but record might fail at stored procedure
level, but in case of insert statement design message fails at JDBC adapter level.

2) 2) Dependency on data base, DB team has to develop stored procedures hence it


required development efforts.

S-ar putea să vă placă și