Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
ambrish_mishra
Active Contributor

Business Case:

In some cases, there may be a requirement to split the source message with multiple records into multiple messages (files) at the receiver (multiple files) where file name and directory name are to be determined at run time. It becomes even more peculiar when the decision to determine the file/name and directory resides in PI. 

Technical challenges:

  • Message splitting has to be take place so multi-mapping is the only solution.
  • Dynamic configuration does not work in case of multi-mapping.
  • Variable substitution is an alternate way to assign file/directory name dynamically.
  • Value assignment happens in the payload (in this example CSV format), at mapping run time and populated through the adapter at runtime.
  • Technical glitch is the values will be written to the target file and how to overcome that.
  • Extra line generated in the file with file name\directory hampers processing at the target system and target system reluctant to ignore the extra line during processing.

Technical solution:

Here is the example of the source message with multiple records and the data identifier on basis of which records will be segregated into multiple files say File1, File2 and File3.

Now it is required to generate 3 files, based on values of Field3 in the source message.

Splitting of message and Grouping of data:

Splitting the source message and into 3 messages and grouping the data can be achieved easily by graphical mapping through multi-mapping.

Value mapping to store file name/directory:

File name and directory corresponding to different can be stored in Value mapping to provide flexibility to add or delete more values and the entire solution would work seamlessly without changes in mapping.

Snapshot of Value mapping

Definition of structure for file name/directory:

To facilitate variable substitution, the target structure is created as below:

At runtime, the values will be retrieved from Value mapping table and the fields for each target message will be populated as below:

Configuration of the adapter and variable substitution:

Normally the file created by normal FCC for this scenario will have the last line having FileName, DIR as stated above since they are part of the message.

Following are the screenshots with normal settings of an adapter in case of variable substitution:

Target Tab

Advanced Tab

Adapter is configured with the details that the target structure has structure Record and File and the File has fields FileName and Directory. It might be the case that the third party does not want the file name and directory name in the file so the final task remains on how to trick the adapter into believing that these fields

have length 0.

Content Conversion Tab


This way in the final output the file name and directory name are not written.

Hope it was informative!

Labels in this area