cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping multi-segment IDOC to multiple JDBC INSERT statements

Former Member
0 Kudos

Hi Everyone,

This is probably going to be easy for the experienced PI developers out there but I'm just starting out in this technology. We are running PI 1.11 and the scenario is as follows. We have a bespoke IDOC message type ZSTOCK which can contain 1-many segments with the following field content:

WERKS

MATNR

VBELN

ACT_LABST

AVL_LABST

For each segment in the source IDOC, I want to generate an INSERT statement to insert a row in an SQL table via the JDBC adapter with the following columns:

Plant

Material

SalesOrd

ActStock

AvlStock

Basically, each field on the source IDOC segment maps directly onto the target column of the SQL table. The problem is, on a multi-segment IDOC only the first segment is generating a row in the SQL table. I've seen a number of threads on this forum that seem to tackle the same issue but the solution is either missing or unclear. I think the solution lies somwhere in the occurrences of the STATEMENT node in my target message type and perhaps specific definitions in the message mapping. Can anyone help solve this mystery?

Thanks,

Gary

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You might want to see this [link|;

Use stored procedure and call multiple times for each row.

Former Member
0 Kudos

I would like to stick with the INSERT statement rather the using stored procedures if possible.

What I am trying to do is possible; I'm just missing some important mapping definition, I'm sure.

Former Member
0 Kudos

Hi Gary

If you created a data type, try to change occurrence of STATEMENT node to 0..unbounded or 1..unbounded.

In the message mapping, map the target STATEMENT node with the source 1-many segment.

You can find [here|http://help.sap.com/saphelp_nw70/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/content.htm] more informations about the JDBC structure

Regards,

Giuseppe

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Try and change the occurence 1 to many in jdbc structure and see how that helps.

Answers (0)