cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC to JDBC mapping problem with parent/child

katie_doody2
Participant
0 Kudos

Hi, I am working on an interface from idoc (ORDERS.ORDERS05) to jdbc . I am then inserting the data into three tables:

header table

line item table

service item table

My data looks like this:

header

line item 1

     service 1 for line item 1

     service 2 for line item 1

     service 3 for line item 1

line item 2

     service 1 for line item 2

     service 2 for line item 2

I mapped the idoc to a structure like this:

header

item

     service item

This structure matches the idoc by putting the services item as a children to the item.

When I did this, I was only getting the two line items and the first set of children:

line item 1

line item 2

service 1 for line item 1

service 2 for line item 1
service 3 for line item 1

I then changed my message structure to this:

header

item

service

This structure (although it seems wrong to me since service is a child to item) gave me everything:

line item 1

line item 1

service 1 for line item 1

service 2 for line item 1

service 3 for line item 1

service 1 for line item 2

service 2 for line item 2

The only problem I had with this is that I was referencing the line item number in the service item structure and it was always giving me 00010. I have resolved this by adding the line item to the service item structure in an extension (since I was already using it). I had also tried to use CopyValue and it did not work. I am trying to understand why this was happening?

Thanks,

Katie

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

There is fixed document format ( target stricture) that you need follow for JDBC receiver scenarios.

Please refer to the below documentation.

Defining XML Documents for Message Protocol XML SQL Format - Configuring the JDBC Adapter in the Int...

As they are three different tables, you need to duplicate the Statement tag for each table.

We can't have the structures of our choice for JDBC scenarios.

>> i have resolved this by adding the line item to the service item structure in an extension (since I was already using it).

Yes. If you need "line item number" in both the tables then this field has to be added under the respective statement tags.

katie_doody2
Participant
0 Kudos

Thanks for your answer, yes I have three different insert statements and I had a line item number at both the item and service item level where I needed them on the jdbc side. The problem that was when I mapped them from the item level from the idoc (e1edp01), they did not put the correct line number in at the service item level.

former_member184720
Active Contributor
0 Kudos

Can you share the "Display Queue" Screenshots for the field that you are referring to along with mapping logic?

Also do let us know how that sequence has to be generated with the sample xml that you are testing with.

katie_doody2
Participant
0 Kudos

Thanks. I am creating the three inserts as:

header (E1EDK01)

line item (E1EDP01)

service items (E1EDC01)

In my insert for the service item table, I am using the line item as part of the index so I am trying to add that. This is what my insert statements looked like before I added an enhancement at the service item (E1EDC01) to poplulate a custom field "line_number" with the posex from E1EDP01. As I said, I have everything working now but don't understand why I could not reference the parent field (E1EDP01 - posex) at the child level.

Thanks.

katie_doody2
Participant
0 Kudos

Here is the queue for the line item I would have liked to have used (parent to the service).

Since I have changed it by adding a custom enhancement at the service item level by adding the line item number, this is how the mapping looks now.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Katie,

What are you mapping to this segment highlighted in yellow - based on the IDoc structure that would be the key place to ensure you can access the parent context for the service item details:

Regards,

Ryan Crosby

katie_doody2
Participant
0 Kudos

Thanks Ryan, this is where I was trying to reference the parent line item in the first screen shot. In order to get it to work I added the line item to my enhacements at the service item level since I could not seem to get it properly from the item item level.

It was:

line item

          line item no

   service

          service line no

          reference to line item no

I have since changed it to add the line item at the service item level in backend code.

So it is:

line item

    line item no

service

      service line no

      line item no

My question is why it did not work to reference it through the mapping at the item level?

Thanks.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Katie,

I would have to actually see the logic for that access segment as well as the LINE_NBR elements to understand why it was not working.  Context can be very tricky in IDoc mapping with many levels and one minor miss can cause it to not work as you are expecting.

Regards,

Ryan Crosby

katie_doody2
Participant
0 Kudos

Thanks Ryan, I am now doing the same thing for the outline agreement and having the same issue. I have not extra logic in the exit. I am attaching my mapping and the display queue for the field I am trying to map to, at the line item level.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Katie,

Can you give me the example XML for only two lines of the E1EDP01 nodes and the target XML you are expecting to get?  It's very hard to read the map information from the screenshots of the text but if I know the source and target that is easier to work with.

Regards,

Ryan Crosby

katie_doody2
Participant
0 Kudos

Here is what my xml should look like. In order to get it to display a did a copy value but as you can see it always gives the first line item.

Below is the idoc:

Ryan-Crosby
Active Contributor
0 Kudos

Hi Katie,

I don't see anything that would distinguish service 1 from service 2 - what piece(s) of data here are used to differentiate one service from another?  Maybe you can attach the two source and target xml files to make it easier to understand the structure and arrangement of the data?

Regards,

Ryan Crosby

Ryan-Crosby
Active Contributor
0 Kudos

Hi Katie,

Nevermind, I'm assuming that was the failed output.  This appears to be a job for UseOneAsMany - see my screenshot below of the field mapping for LINE_NBR:

The top POSEX is from the E1EDP01 context, the middle POSEX is from the E1EDC01 with the context set to E1EDP01 and the last is the POSEX from the E1EDC01 context.  That will allow the system to replicate the line numbers in the way you are expecting for your target XML.

Regards,

Ryan Crosby

katie_doody2
Participant
0 Kudos

Yes!! Thank you.

Answers (0)