cancel
Showing results for 
Search instead for 
Did you mean: 

Sending an Email when incoming file is empty

Former Member
0 Kudos

Hi All,

My scenario is : File(flat file) - SAP PO - File(XML)

My requirement is if incoming file is empty then SAP PO should send email to a recipients list with a custom message  "subject,body with incoming file name".

Can anybody please help me for this scenario?

Accepted Solutions (0)

Answers (7)

Answers (7)

justin_santhanam
Active Contributor
0 Kudos

Reddy,

I forgot to mention this in document. Please make sure the below highlighted options match yours.

Empty File Handling

Adapter Specific Message Attributes

Thank you,

Justin.

justin_santhanam
Active Contributor
0 Kudos

Hi Anupam,

Yes I have FCC in sender comm.channel. Did you see the link I have posted? Please go through completely and let me know.

Thanks!

justin_santhanam
Active Contributor
0 Kudos

Reddy,

Please take a look at the below link.Sorry about the rough draft, didn't  have time to properly document it and explain. Hopefully things in the document are self-explanatory. If there are any issues, please let us know!

EmptyFile Handling.docx - Google Drive

Hope it helps!

Thank you,

Justin.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Justin,

              Did you use a FCC in sender communication channel in your scenario?? I guess not.

Regards

Anupam

Former Member
0 Kudos

Hi Justin

Thank you for sharing this Doc.

I am using SAP PO 7.4, So i created IFLOW for this Interface and i deployed to ID.

After  I select The software Component of service interface is BLANK

Under inbound processing Tab


when i select BLANK  the receivers are gon.


Is there any option in IFLOW  to select BLANK.

Hear  you select  the software Component of service interface is BLANK  Under inbound processing Tab

please Advise me

justin_santhanam
Active Contributor
0 Kudos

Hi Reddy,

Even this scenario I have created for you is developed in PO 7.4 as well..

>>when i select BLANK  the receivers are gone.

After selecting Blank, you can't add the receivers?

Thanks!


former_member182412
Active Contributor
0 Kudos

Hi Reddy,

You need to define dummy interface like below.

Regards,

Praveen.

Former Member
0 Kudos

Hi Praveen

how can we Select mapping for a dummy interface?

justin_santhanam
Active Contributor
0 Kudos

Hi Reddy,

Honestly I haven't created any IFlow scenarios till now. I'm content with ICO itself .. Does your scenario has to be created only with IFlow (as per your client mandate) or you can create with ICO as well? If you can create with ICO then I would say go ahead and definitely it will work as I have tested them.

Just my opinion..

Thanks!

former_member182412
Active Contributor
0 Kudos

Hi Reddy,

There is other option also to solve this problem. change the Interface pattern of the sender service interface to Stateless (XI30-Compatible)

Regards,

Praveen.

former_member182412
Active Contributor
0 Kudos

Hi Reddy,

You no need to create two receivers and create enhanced receiver determination mapping for this, you can create separate interface for to send the mail, in the interface split you can add the condition like below.(Using SourceFileSize predefined context object)

Regards,

Praveen.

justin_santhanam
Active Contributor
0 Kudos

Hello Reddy,

There might be other ways as well, but as very well pointed out by Anupam Ghosh , you can do multi mapping with 2 receivers. One Receiver for FILE and One Receiver for MAIL. We can very well achieve this in Message mapping itself. In ASMA, choose the File name and also SourceFileSize. In your mapping program check the SourceFileSize if it's 0 then generate the message for MAIL, if the SourceFileSize is <> 0 then generate the FILE message.

Hope it gives you a direction!

Thanks!

Former Member
0 Kudos

Hello  Justin Santhanam

Thanks for reply

I configured two receivers

Receiver 1 for original file,Receiver 2 for mail

I put the condition at receiver determination

if source file size != receiver 1

if source file size = receiver 2


i got following exception


based on source file sizemailTransmitting the message to endpoint using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.adapter.xi.routing.RoutingException: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: Premature end of file.




Please advise me

anupam_ghosh2
Active Contributor
0 Kudos

Hi Reddy,

                  Zero file content can lead to this error. In the java mapping you need to detect if the source file size is zero. Then create either msg1 or msg2.

Regards

Anupam

anupam_ghosh2
Active Contributor
0 Kudos

Hi Reddy,

                  You need a multi mapping here. Message mapping will not work here as file content can be blank. Thus you need a java mapping here. The mapping will produce mesg1 in case there is some file content or the mapping else will produce standard email body for msg2. ASMA  for filename will be included in the mapping itself.

Regards

Anupam

former_member186851
Active Contributor
0 Kudos

Hello Reddy,

As Pavan suggested it depends on number of mapping fields.

You can even have java code in the mapping to trigger mails with filename.

Let us know how many fields you have and based on any field can we check the condition for the file.

former_member183908
Active Contributor
0 Kudos

You have not mentioned about how many fields do you have in your flat file,try to create two different mappings one for the file and another for the email.For map2 use std xsd for email structure and use ASMA and dynamic to fetch the file name and map accordingly.

set the condition in interface determination when all the fields are null operation map2 should call and configure receiver email channel to trigger the email.

Cheers

Pawan