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: 
govardanam
Explorer
This blog describes the use of CamelFileName header while zipping the files using Zip function  in SAP Cloud Integration ,Build number 6.27.9 !

When using zip function in sap cloud integration make sure to set the header CamelFileName  before the Zip function.Also  CamelFileName header should not be set explicitly in FileName parameter in SFTP Receiver Adapter. [ If set Dynamic Value of ${header.CamelFileName}is lost and rather file name is just " ${header.CamelFileName}"] 

1.What if CamelFileName header is not set before the Zip function function.

1.a)  Set Header FileName = Test_${date-with-timezone:now:CET:dd-MM-yyyy}.csv

Using FileName as ${header.FileName} without using .zip extension in the sftp adapter.


IFlow without CamelFileName  header set before ZIP function


Let  us try to understand the first case. I have used a sample flow where a Xml  file is converted to csv and we zip the csv file and put it into the SFTP folder.

Using the Content Modifier : Setting the FileName we have created a header FileName


FileName Header in Content Modifier


We set the FileName  in sftp receiver channel as ${header.FileName} [ Note we have not used the .zip extension]


FileName in SFTP Receiver Channel


When we try to hit the IFlow with XML, we have the following csv file in the sftp target folder.


ZIP Compressed CSV File in SFTP Folder


We can see that the .zip type is missing in the file as well as when i tried to open the file it was corrupt. Actual Size of the Proper CSV file was about 237 Kb .. which we will see later .

 

1.b)  Set Header FileName = Test_${date-with-timezone:now:CET:dd-MM-yyyy}.csv

Using FileName as ${header.FileName}.zip  in the sftp adapter

 


FileName in SFTP Receiver Channel


 

In this case you will have a zip file in the SFTP Folder, but  compressed file would have automatically assigned name with type as "File".

 


ZIP Compressed CSV File with type as File


When the target system unzips, looks up for a specific naming format , this could lead to problems as now  the actual intended filename pattern would become a folder under which the compressed file would be saved as type "File" with a automatically assigned file name.

 

2.What if CamelFileName header is set  before the Zip function


IFlow with CamelFileName header set before ZIP function


 

Now, i have changed the IFlow to set the header ' CamelFileName' before the ZIP function .


CamelFileName set in Content Modifier before ZIP Function


We should not set the  FileName in sftp receiver channel.The SFTP Adapter takes CamelFileName header set in Iflow  as FileName.[ On setting the ${header.CamelFileName}  explicitly in sftp adatper, no dynamic value is carried over and rather filename in SFTP become "${header.CamelFileName}"]



No FileName in SFTP Receiver Channel


 

When we try to hit the IFlow with XML, we have following zip file in the sftp target folder. Also the unzip file contains the same file name pattern as intended.

 


 


The explanation for above behavior could be due to the fact that  CamelFileName header is generated after zip compression and assigned a random value if not assigned before. I leave it upto the readers to build a basic flow and use simulation to understand the same.

One more behaviour is that CamelFileName header is lost when used in SFTP Adapter. I don't have a concrete answer for that atleast now.

Update 1: CamelFileName header when set in Iflow is chosen as filename for SFTP receiver adapter when filename parameter is  blank .When CamelFileName header is explicitly set as filename in SFTP Adapter, dynamic value of CamelFileName header  is lost!
5 Comments
Labels in this area