SFTP File Level Checks in SAP BTP Cloud Integration

Estimated read time 7 min read

Hi Folks,

In the realm of SAP BTP Cloud Integration, we’ve observed a growing client demand for transferring data via file exchanges between SFTP servers. This is a common scenario that any integration developer is likely to encounter and design.

However, if an external party is responsible for triggering the I-flow, we should consider using an I-flow with an SFTP Poll-Enrich approach rather than relying on the Sender SFTP adapter with its built-in scheduler.

The primary setback for this scenario is that SFTP with Poll-Enrich can only poll one file per iflow trigger. To address this, we need a Main I-flow that utilizes a Looping Process Call to repeatedly invoke a Local Integration Process (LIP). This LIP will have SFTP with Poll-Enrich configured in it.

Here is the I-flow Design:

Main I-flow:

Content Modifier:

Looping Process Call Config:

 

 

 

 

 

LIP – SFTP Process:

Content Modifier:

Poll-Enrich:

When defining requirements for a file integration scenario using SAP BTP Cloud Integration, we can consider implementing the following file-level checks. These checks will aid in designing an efficient flow and enhance error handling.

1. No File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to address the scenario where no file is available on the SFTP server. In such cases, if the I-flow runs and attempts to poll the SFTP server, it could result in an error. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich:

${property.SAP_PollEnrichMessageFound} = ‘false’ and ${property.CamelLoopIndex} = ‘0’

If the condition is met, you can either terminate the flow or raise an exception with a specific error code.

2. No More Files to Process: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check if no more files are available on the SFTP server during processing. If the LIP I-flow continues to run and attempt to poll for files due to the configured number of iterations in the Looping Process Call, it may lead to errors. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich.

${property.SAP_PollEnrichMessageFound} = ‘false’ and ${property.CamelLoopIndex} > ‘0’

If the condition is met, you can either terminate the flow or raise an exception with a specific error code.

3. Multi File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check when during processing of the files, exact 1 file should be processed and the rest of files should go to error. However, due to the number of iterations configured in the Looping Process Call, the LIP I-flow might attempt to poll the 2nd file from the SFTP server. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich.

${property.SAP_PollEnrichMessageFound} = ‘true’ and ${property.CamelLoopIndex} > ‘0’ and ${header.CamelFileName} not contains ‘*’

If the condition is met, you can either terminate the flow or raise an exception with a specific error code.

4. Empty File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check  when during processing of the files, there is empty file available at SFTP server. To prevent the I-flow from processing and forwarding the polled empty file to the target, we can apply below condition in the Router:

${header.CamelFileLength} = ‘0’

If the condition is met, you can either terminate the flow or raise an exception with a specific error code or send the file to error folder.

Here is the Final Design of the I-flow after adding all the above conditions in the router branches in LIP – SFTP Process flow:

 I hope this blog post proves useful for implementing effective file-level checks for SFTP File Integration scenarios.

Thanks for reading!

 

​ Hi Folks,In the realm of SAP BTP Cloud Integration, we’ve observed a growing client demand for transferring data via file exchanges between SFTP servers. This is a common scenario that any integration developer is likely to encounter and design.However, if an external party is responsible for triggering the I-flow, we should consider using an I-flow with an SFTP Poll-Enrich approach rather than relying on the Sender SFTP adapter with its built-in scheduler.The primary setback for this scenario is that SFTP with Poll-Enrich can only poll one file per iflow trigger. To address this, we need a Main I-flow that utilizes a Looping Process Call to repeatedly invoke a Local Integration Process (LIP). This LIP will have SFTP with Poll-Enrich configured in it.Here is the I-flow Design:Main I-flow:Content Modifier:Looping Process Call Config:     LIP – SFTP Process:Content Modifier:Poll-Enrich:When defining requirements for a file integration scenario using SAP BTP Cloud Integration, we can consider implementing the following file-level checks. These checks will aid in designing an efficient flow and enhance error handling.1. No File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to address the scenario where no file is available on the SFTP server. In such cases, if the I-flow runs and attempts to poll the SFTP server, it could result in an error. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich:${property.SAP_PollEnrichMessageFound} = ‘false’ and ${property.CamelLoopIndex} = ‘0’If the condition is met, you can either terminate the flow or raise an exception with a specific error code.2. No More Files to Process: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check if no more files are available on the SFTP server during processing. If the LIP I-flow continues to run and attempt to poll for files due to the configured number of iterations in the Looping Process Call, it may lead to errors. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich.${property.SAP_PollEnrichMessageFound} = ‘false’ and ${property.CamelLoopIndex} > ‘0’If the condition is met, you can either terminate the flow or raise an exception with a specific error code.3. Multi File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check when during processing of the files, exact 1 file should be processed and the rest of files should go to error. However, due to the number of iterations configured in the Looping Process Call, the LIP I-flow might attempt to poll the 2nd file from the SFTP server. To prevent Iflow ending up with error, we can apply below condition in the Router immediately after the SFTP with Poll-Enrich.${property.SAP_PollEnrichMessageFound} = ‘true’ and ${property.CamelLoopIndex} > ‘0’ and ${header.CamelFileName} not contains ‘*’If the condition is met, you can either terminate the flow or raise an exception with a specific error code.4. Empty File Check: Considering SFTP with Poll-Enrich and an external party triggers the I-flow, it’s important to apply this check  when during processing of the files, there is empty file available at SFTP server. To prevent the I-flow from processing and forwarding the polled empty file to the target, we can apply below condition in the Router:${header.CamelFileLength} = ‘0’If the condition is met, you can either terminate the flow or raise an exception with a specific error code or send the file to error folder.Here is the Final Design of the I-flow after adding all the above conditions in the router branches in LIP – SFTP Process flow: I hope this blog post proves useful for implementing effective file-level checks for SFTP File Integration scenarios.Thanks for reading!   Read More Technology Blogs by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author