cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc to flat file mapping

Former Member
0 Kudos

Hello Guys,

One quick one - I am working on a idoc(Idoc with customer details) to flatfile scenario , My requirment goes like this - There is a possibility that for a particular customer there can be more than one contact details. These details will be captured in the E1KNVKM segment(Name1 and VRTNR fields), For every unique contact detail there will be a new segment created. We have to map these additional segments as seperate lines in the output file.

In the newline that will be created in the output file there should be only the Name1,VRTNR fields.

The output file looks like this :

For example if characters 'd' and 'e' are the Name1 and VRTNR fields in the idoc and these are more than one for a customer then the output should be like this :

a,b,c,d,e,f,g

,,,d1,e1,,

,,,d2,e2,,

Thanks,

Shashank.

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member184681
Active Contributor
0 Kudos

Hi Shashank,

I'm afraid duplicating target structure won't work, unless you know in advance how many contact details will come for each customer (which is not the case here, I guess). But you have another option. Build the message mapping in such a way that for your example data, you had the following target XML data:

<customer>
   <f1>a</f1>  <f2>b</f2>  <f3>c</f3>  <f4>d</f4>  <f5>e</f5>  <f6>f</f6>  <f7>g</f7>
</customer><customer>
   <f1/>  <f2/>  <f3/>  <f4>d1</f4>  <f5>e1</f5>  <f6/>  <f7/>
</customer><customer>
   <f1/>  <f2/>  <f3/>  <f4>d2</f4>  <f5>e2</f5>  <f6/>  <f7/>
</customer>

Just make sure that fields f1, f2 and so on are populated, although having no value (a blank " ", for instance). Then in the receiver communication channel use file content conversion with following parameters to achieve the expected target file:

Recordset Structure: Customer,*

Customer.fieldSeparator = ,
Customer.endSeparator = 'nl'

Refer here for further details on converting XML data to flat file with FCC: http://help.sap.com/saphelp_nwpi71/helpdata/en/44/686e687f2a6d12e10000000a1553f6/content.htm

Hope this helps,
Greg

Former Member
0 Kudos

Hi Shashank

Duplicate the target structure (Right Click on parent node of a,b,c,d,e,f,g and duplicate). Map the fields of  first one as you were doing to generate all values (a,b,c,d,e,f,g). Do some logic to populate its parent once for each customer. (Map with Customer ID)

Map the fields of second to generate D & E only.  Do some logic to populate its parent as many times as the additional contact detail (you can map with E1KNVKM but do suppress the first occurance of E1KNVKM as it will be already there.)

Regards

Raj

deepak_shah
Contributor
0 Kudos

Hi,

Map E1KNVKM node to root node of file structure. i.e. repeat root node of file as many times E1KNVKM node occurs.

As to other fields of the file, you can use copy value or useone as many function.

Regards,

Deepak

rajasekhar_reddy14
Active Contributor
0 Kudos

You have to build mapping logic in PI to genarate XML output accordingly , insted of putting efforts in FCC.