cancel
Showing results for 
Search instead for 
Did you mean: 

Empty File handling and raise alert.

Former Member
0 Kudos

Hi,

We have requirement where we are doing file pass through. But client wants PI to raise alert when it receives 0 byte file.

How can we achieve this using File/FTP/SFTP adapter when we are not reading the actual payload and doing only pass thru?

Thanks,

Vertika

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for suggestion's. Just wanted to get some more clarification on alert part.

When you say throw exception if size is not equals to 0, then how exactly we can raise the alerts. One way could be not defining any receiver for that condition, but in this case the exception would always say "InterfaceDetermination did not yield any actual interface".

Can you please elaborate on exception and alert part?

Thanks,

Vertika

former_member184720
Active Contributor
0 Kudos

If you handle this condition check in receiver determination and select the radio button for throw exception then you'll get an error message  as " no receiver found" and hence your alert email will contain the same.

I don't think you'll get the error text as(alert) as zero kb file.

If you would like to get that then you can define another inbound interface(file- mail) and execute it when the file size is 0. You can handle the mail content in the mapping and of-course this is independent of your alerting part.

Former Member
0 Kudos

Hello,

>>One way could be not defining any receiver for that condition, but in this case the exception would always say "InterfaceDetermination did not yield any actual interface".

In my previous reply i have just given u a pointer about how to check file size using standard way and route/fail interface.

And yes, indeed if u want to throw custom alert (stating that file size if zero or something else) then u have to add another receiver and send mail using mail adapter - that's the easy solution i can think of.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi ,

You can easily handle the scenario using Custom module .

Here is the logic:

1)Create the sender data type with additional field status 0..1

2)In sender channel check process empty files option .

3In custom module read the payload and check whether it is empty .

If it is empty then populate xml o/p payload as your    mt mt,namespace<status>NV</status><mt>

If it is not empty then add this <status>V</status> after main namespace tags and then actual xml payload ,populate as custom module xml o/p

Now in receiver determination check the status field value and based on that draft either mail or actual mapping .

Here you have 2 mappings

1 Mail

1 Normal mapping .

I just given a rough idea.Think on it you can find better sol.

Former Member
0 Kudos

Hi Venkat,

As I mentioned the interface would be file pass through interface so we are not having ESR objects created.

Thanks,

Vertika

Former Member
0 Kudos

Hello,

Check ASMA-> FileSize (SourceFileSize) property in file sender adapter and use context object "FileSize" in Receiver Determination step, so in RD step check if file size is not equal to zero then route message otherwise throw exception.

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

Hi Vertika - You can follow Amit's suggestion. The context object is "SourceFileSize".

However in case of SFTP sender,you might have to change the namespace under " adapter specific attributes" to "http://sap.com/xi/XI/System/File" as i don't see any context object for SFTP adapter.

For some reason if you can't change the namespace may be you can make use of below..

Former Member
0 Kudos

Hi ,

I thought of suggesting the above as well ,but strike to my mind lately .Any how above is the better solution than above suggested by me  .

In RD-->XPATH editor select context Object-->SourceFileSize  Notequals 0 targetsystem

If no receiver found ,Process as Follows :

select the following receiver (MAILCOMPONENT)

Regards

Venkat

Harish
Active Contributor
0 Kudos

Hi Vertika,

AFAIK - there is no standard way for pass through interface to raise alert (for empty file). so you need to develop adapter module to raise the alert for empty file.

Please refer the help page

Configuring the Sender File Adapter - Advanced Adapter Engine - SAP Library

Under Handling of Empty Files, specify how empty files (length 0 bytes) are to be handled:

  • Do Not Create Message No XI messages are created from empty files.The files are processed according to the selected processing mode.For example, if the processing mode is Delete, empty files are deleted in the source directory.
  • Process Empty Files XI messages are created with an empty main payload.The files are processed according to the selected processing mode.
  • Skip Empty Files No XI messages are created from empty files.Empty files are skipped and remain in the source directory.
Former Member
0 Kudos

Hi Harish,

I know the empty file handling configuration is available in adapter channel. But in order to raise the alert as you said adapter module will be required.

Can you please provide some details on adapter module?

Thanks,

Vertika