This blog topic has been a very common integration requirement in SAP XI/PI integration world and unfortunately there is no simple solution for this requirement. Some solutions were provided by forum experts such as run OS script (not actually using XI), using extra administrative scenario and checking for time stamp, using script with extra administrative scenario etc. The below discussions and blog will explain sample such requirements and solutions.
Links,
http://scn.sap.com/thread/1358164
http://scn.sap.com/thread/1507647
http://scn.sap.com/thread/1650060
http://scn.sap.com/thread/2016961
Grzegorz Glowacki’s blog - http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/03/07/what-if-file-is-not-there-active-monitoring-of-once-a-day-sender-file-scenarios
I started thinking if this requirement can be achieved in a better way but yet with only classical configuration (no BPM & no extra administrative scenario). After some deep thinking, I came up with two ideas. One option is to use very simple alert to send email to business Admin user for failing sender channel indicating no business data for the day (ah, how sender channel can fail?). The second option is to configure an end to end scenario and send either actual business data or email accordingly (again how?). The below steps will explain my solutions.
Scenario:-
Steps:-
- Obviously, we need a trigger file(.txt) which should be pooled in TEST mode by a scheduled Sender File channel as per business requirement.
- The trigger file should have same structure as main business payload (.xml), but however with only one field
. The field value will be very useful in evaluating conditions either in Receiver determination or in multi-mapping, to decide the actual receiver i.e., Target (or) an email to Target system business owner/administrator e.g., If Business data payload has <MT xmlns:ns0=”abc.com”><f1/><f2/><f3/>…<fn/></MT>, then trigger file can have data <MT xmlns:ns0=”abc.com”><f1>SendEmail</f1></MT>.
- Two solutions,
- First simple solution:- Use "Additional files" option in sender file channel to pick up business data as a MANDATORY attachment. i.e., the file channel will fail with error if there is no attachment (actual business Data). Note:- With this solution, step2 trigger file can be empty or can have any dummy data
- Second Solution:- Use the same "Additional files" option in sender file channel to pick up business data but as an OPTIONAL attachment. i.e., the file channel will never fail with error when there is no attachment.
- Now,
- For solution 3a,
- configure a simple alert and send alert to the subscribed business user as an email indicating that there is no actual business data for the day
- Use PayloadSwapBean to treat attachment as main business data and rest the configured scenario will take to send business data to target system
- For Solution3b,
- - use PayloadSwapBean to treat attachment as main business data.
- - With simple routing conditions (details as explained in step-2), now you can decide the actual receiver. Obviously, when there is no attachment for business data, the “SendEmail” condition will match.
5. Since File sender channel is configured in TEST mode, use script in the channel under “Run OS command after message processing” to archive the business data(.xml) to ARCHIVE folder. Step 5 is common for both 3 a&b solutions.
I tested both the solutions and they are working like a charm for File NFS protocol. The solution can be extended to File FTP protocols as well but with a custom adapter module. The custom adapter module for FTP protocol should have functionality similar to "Additional Files" option in Sender File channel with NFS protocol. i.e., the custom adapter module should be able to attach actual business data and then it should archive after processing.
Hope this new solutions helps.
Regards,
Praveen Gujjeti