Skip to Content
0
Aug 06, 2020 at 10:54 AM

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

315 Views

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.

Attachments

mapping.jpg (34.3 kB)