Skip to Content

Mail to File

Hello Experts,

I am working in mail to file scenario. The requirement is that emails with attachments will be read and will be posted to AL11 directory. While doing so the files should be renamed with XY*. Also the mails only from certain email IDs should be accepted

The source and target structures are the same with the following fields and mapped 1:1


In Directory created the Sender Mail channel as per this blog

Can I use Variable Substitution or Dynamic configuration in receiver file channel to rename the file as XY* ?

Really appreciate quick reply.

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 09, 2018 at 10:49 AM

    For accepting the emails only from certain Email IDs, there are different approaches,

    1. Create a specific folder in the email inbox, create a rule to route all emails from specific senders to the folder created. Then read all the emails from that specific folder instead of reading from inbox.

    2. Enable ASMA & Variable transport binding in Mail sender communication channel, in receiver determination add condition that only when the context object "SHeaderFROM" equal to the certain EMail ID, the message should be routed to receiver.

    3. Filter it in mapping by checking the From address.

    I would recommend approach 1. Refer SAP Note # 2040884 that create PI messages based on attachments.

    You mentioned File name should be XY*. what does the "*" actually refer? Is it a payload value from attachment file or timestamp or something else?

    If it is a fixed text or message ID or timestamp then you can just design Mail to file pass through scenario and follow steps mentioned in above SAP note, and in File receiver channel mention the File name as just "XY" and then processing tab specify the "File Construction Mode" as "Add Timestamp" or "Add Message ID" or "Add counter" etc.

    If it is payload value, then you need to create ESR objects, mapping and use variable substitution.


    Add comment
    10|10000 characters needed characters exceeded

  • Mar 05, 2018 at 12:00 PM

    Thanks Priyanka, it worked with your inputs.

    Add comment
    10|10000 characters needed characters exceeded