cancel
Showing results for 
Search instead for 
Did you mean: 

Advice on mapping

Former Member
0 Kudos
45

Hi Experts,

Im a learner and new to PI . I have a file to Idoc scenario, where the source file comes with multiple records with multiple Header and Item details. Example file structure is as below

H,T1,xx,yy,...

I,T1,aa,bb,..

H,T2,gg,hh...

I,T2,cc,dd,...

.

.

.

Where T1 & T2 are key field values, which identifies the related header and Item records.

Need to generate 1 idoc for each related header & Item data.

So, please guide me how the source data type to be created and how to implement mapping logic.

Thanks,

Aish

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi Aish,

Experiment based on the following mapping pattern:

field2 (context set to root) -> splitByValue(Value Change) -> collapseContexts -> IDoc

You might also find it useful to read about the basic concepts of graphical mapping in one of my old blogs here:

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

Thank you for your quick reply.

I created source structure as below, not sure whether its correct to implement mapping logic as said by you

DT_FTOIDOC

Record 1.1

  Header 0..99999

    Field1

    Field2 (key)

    Field3

  ITEM 0..99999

    Field1

    Field2 (key)

    Field3

Please help me to define source structure too.

Thanks,

Aish

former_member184720
Active Contributor
0 Kudos

Hi Aish - You won't be able to build a nested strcture using FCC so the above strcture is fine.

But when you map to target, do you have any correlation b/w your header and item to split them into separate IDOCs?

Former Member
0 Kudos

Hi Hareesh,

Header and item records with same Field2 to be written to 1 idoc.

Field 2 is unique which would identify related header & Item records.

Thanks,

Aish

former_member184720
Active Contributor
0 Kudos

Hi Aish -  May be you can change the structure to below and try.. i think it should work

record 1..unbounded

header 1.1

     field 1

item 0..unbounded

     field2

So that one record ->one idoc

Give the Recordset Structure : header,1,item,*


With this whenever there is a new header, i assume a separate recordset will be created..

Message was edited by: Hareesh Gampa

Former Member
0 Kudos

Hi Hareesh,

Please find the data from the sample test file given to have clear idea of the scenario.

Header and item records with same Field2 to be written to 1 idoc.All the records H & I for one unique ID need to be placed on the same idoc

H,001,20140211,A,CA1,20140211,USD,100.00,CASALES

I,001,20140211,01,WINTERSALE,CR,XXXXXX

H,002,20140211,A,CA2,20140211,USD,200.00,CASALES

I,002,20140211,01,WINTERSALE,CR,XXXXXX

H,003,20140211,A,CA3,20140211,USD,125.00,CASALES

I,003,20140211,01,WINTERSALE,CR,XXXXXX

H,004,20140211,A,CA4,20140211,USD,239.00,CASALES

I,004,20140211,01,WINTERSALE,CR,XXXXXX

Where H - header data and I- Item data sent in file.

So, for the above sample data, 4 idocs to be created for unique field2 (001,002,003 & 004).

Please advice based on above data, how the source structure to be and mapping logic.

Thanks,

Aish

former_member184720
Active Contributor
0 Kudos

I got that and I hope your file will be in the same order..

Create the structure as i mentioned in the above reply.

In the file content conversion of your sender channel,

configure the recrodset as header,1,item,* (don't give header,*)

this way a separate record will be created for each header&item set like below.

record

header1

    field 1

item1

    field1

record

header2

    field2

item2

    field2

.....

...

....

mapping logic is something depends on your target IDOC structure. Once you have the xml in the above formate it would be easy for you to map.

I believe you can even set the recordset per message to 1 so that you'll have separate messages in PI for each header&respective items.

0 Kudos

Hi Aish,

Please advice based on above data, how the source structure to be and mapping logic.

Based on your test data, create source structure as

Record 1..unbounded

  Header 1..1

       ...Fields

  Item 1..1

       ...Fields

In mapping, map the Record Node to Idoc node, and rest mapping as per your rek.

and in FCC, set the value of parameters along with other

Recordset structure as header,1,item,1

Recordset Name as Record

Key Field Name as <Field 2 from your data structure>

Key field value H (for Header)

Key field value I (for Item)

this will help in creating separate record with respective Header & item.

Regards,

Pranaya

Answers (0)