cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI 7.4 - Flat file to IDoc - New IDoc based on Key Field

Former Member
0 Kudos

Hi Everyone,

I'm having a bit of trouble with a flat file to IDoc ORDERS05 scenario and I would appreciate any advice you could give.

I have an incoming flat file and my message type which this file translates to is in the following format

Record            1:Unbounded 

----- ID             1:1

----- Material     1:1

----- Quantity    1:1

----- UOM         1:1

----- etc.


For every change of ID I need to create a new ORDERS05 IDoc.  I'm using Split by Value to achieve this and that does seem to work fine.


ID-->removeContexts-->SplitByValue[Value Change]-->collapseContexts->IDOC (IDoc Node 0:Unbounded)


The problem I have is the subsequent mapping of the line item segment E1EDP01 in the IDoc and it's occurrence.  I'm not sure what maps this this. I'm currently mapped it to Constant 1 which isn't correct. Fields like Material will be mapped in this segment


In an example where we have different IDs the scenario appears to work. When the ID's are the same only the first Material is populated into E1EDP01 - which is course is becuase the occurence is 1. If I map Record node to E1EDP01 it create's all instances of the segment in the first IDoc.


I know I probably need some sort of context mapping here and I've tried a few things but I'm failing to see what that is. I assume I can achieve this with the Record format above ?  I'm hoping I've not overlooked something obvious but the penny isn't dropping on this.


Here is an example to illustrate what I'm looking for


Record           

----- ID             800

----- Material     1234

----- Quantity    10

----- UOM         EA

Record           

----- ID             800

----- Material     5678

----- Quantity    10

----- UOM         EA

Record           

----- ID             810

----- Material     1234

----- Quantity    10

----- UOM         EA


For the above example I want two ORDERS05 IDocs.


+ First IDoc     with two E1EDP01 segments (one each for Material 1234 and 5678 respectively)

+ Second IDoc with one E1EDP01 segment  (Material 1234)



Any help you can give is much much appreciated.


Thanks you

JE

Accepted Solutions (1)

Accepted Solutions (1)

diego_gabriel
Participant
0 Kudos

Hi Joel,

You are right when using SplitByValue on ValueChange.

Just check if you are using the right context in the below fields.

Material, quantity and UOM must use the ID context.

Let me know the results.

Regards,

Diego

Former Member
0 Kudos

Hi Diego,

Thanks for that. The context of the other fields is the same as ID which is Record. So i think there's something more I need to do.

I'll keep trying.

Thanks

JE

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Everyone,

It appears I have solved this. I needed to use formatByExample when mapping node E1EDP01

So the mapping I've used is

Input 1: Record-->removeContexts-->                                          formatByExample --> E1EDP01

Input 2: ID-->removeContexts-->SplitByValue[Value Change]

Diego's prompt is what helped me so marking as correct answer.

Thanks to you all guys.

Thanks

JE

r_s_kulkarni11
Participant
0 Kudos

Hello Joel,

Can you tell me to which target node you have mapped the material and in which way?

Former Member
0 Kudos

Hi Raul,

Thanks for the reply. It's mapped to segment E1EDP19 under E1EDP01. The field is IDTNR.  I've mapped Constant 1 to E1EDP19 which maybe be right either.  The Material is just mapped directly. I've tried various operations to no avail.

Thanks

JE