cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO - Map/collate multiple records in a file to single IDoc

jamespallett
Explorer
0 Kudos

Hi SAP community

I am looking for some help with message mapping in SAP PO.

We have an interface that takes a text file from one system, and creates IDocs using message type CONF_ACT10, and Idoc type CONF_ACT1001. It currently creates 1 IDoc for each record in the file.

The source data file contains 6 fields, and the current mapping is as follows:

  • EmployeeID - This goes in E1BP_CORU_ACTIV-PERS_NO;
  • WorkStartDate - Moved to E1BP_CORU_ACTIV-EX_CREATED_DATE, but we reformat the date to yyyyMMdd;
  • ActivityNumber - Put in EDI_DC40-MESCOD;
  • NetworkNumber - We put part of the value in E1BP_CORU_ACTIV-ORDERID, and another part in E1BP_CORU_ACTIV-OPERATION;
  • ActualWork - Goes in the field E1BP_CORU_ACTIV-LABOR_VAL; and
  • Source - Put in E1BP_CORU_ACTIV-CONF_TEXT.

So if the source file contained the following data, it would post 3 IDocs:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:Messages xmlns:ns1="http://sap.com/xi/XI/SplitAndMerge">
   <ns1:Message1>
      <ns0:MT_JP_FlatFile_Source xmlns:ns0="http://PALLETT.com/Test/FlatFileToIDoc">
         <RecordSet>
            <Record>
               <EmployeeID>0902160</EmployeeID>
               <WorkStartDate>29/07/2020</WorkStartDate>
               <ActivityNumber>PM</ActivityNumber>
               <NetworkNumber>PM0000090790450150</NetworkNumber>
               <ActualWork>92</ActualWork>
               <Source>SAP-MES</Source>
            </Record>
            <Record>
               <EmployeeID>0902162</EmployeeID>
               <WorkStartDate>30/07/2020</WorkStartDate>
               <ActivityNumber>PM</ActivityNumber>
               <NetworkNumber>PM0000090790450152</NetworkNumber>
               <ActualWork>92</ActualWork>
               <Source>SAP-MES</Source>
            </Record>
            <Record>
               <EmployeeID>0902160</EmployeeID>
               <WorkStartDate>29/07/2020</WorkStartDate>
               <ActivityNumber>PP</ActivityNumber>
               <NetworkNumber>PM0000090790450150</NetworkNumber>
               <ActualWork>92</ActualWork>
               <Source>SAP-MES</Source>
            </Record>
         </RecordSet>
      </ns0:MT_JP_FlatFile_Source>
   </ns1:Message1>
</ns1:Messages>

I am now looking at changing the mapping so that instead of posting each record as a separate IDoc, it posts one IDoc per employee. The segment E1BP_CORU_ACTIV should then be populated n number of times depending on the number of records for each employee. As an example, if we received the sample message above:

  • IDoc 1 - This would have the data for employee 0902160 but the segment E1BP_CORU_ACTIV is populated twice; and
  • IDoc 2 - This would have the data for employee 0902162, and the segment E1BP_CORU_ACTIV only appears once.

I have tried following a similar scenario I found in another question (example), but I can't quite get it to work. I have tried a few different things, but I either get 1 IDoc and E1BP_CORU_ACTIV is populated 3 times, or I get 2 IDocs, but all of the E1BP_CORU_ACTIV data is only populated in IDoc 1, and IDoc 2 is effectively empty.

Instead of each record being mapped to the IDoc, I have changed it to this:

I'm guessing it's not quite right, but I've never used the node functions before, so not entirely sure how they work! If anyone can help, it would be much appreciated. Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

jamespallett
Explorer
0 Kudos

Hi Khusal

Thanks for the message, I've already updated the IDoc from 1 to unbounded.

I made some changes last week and have now managed to get it working, but only if the source data is sorted by EmployeeID. If the source data isn't in order, some of the data gets added to the wrong IDoc...

This is the mapping at the CONF_ACT1001 IDOC header level, it now creates 1 IDoc per EmployeeID:

And this is the mapping at the segment we want to populate each time there is a record for an employee:

I will try and get it working today, I think I just need some extra sorts, but couldn't work it out last week! Thanks.

khusal810
Active Participant
0 Kudos

This is probably because of the idoc occurrence in the structure is one.

I suggest try to change the xsd of the idoc from 1 to unbounded or use multi-mapping.