Skip to Content
avatar image
Former Member

Unzipping multiple files from Mail and creating IDoc in ECC

I have got a requirement where I will be receiving .zip file ( which has multiple files in it) via Mail.
I have to unzip the zip file and create an IDoc from each '+' seperated flat file.

I have referred the link below for java mapping of unzipping the zip file.

In the Modules tab of the Sender communication channel, I have specified 'AF_Modules/PayloadSwapBean' and the corresponding parameters in module key.

The error that I am getting while executing the scenario is :
exception caught during processing mail message[1];

Could you please help?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 02, 2015 at 11:21 PM

    Hi Sneha

    My article that you referred to is about unzipping the main payload into multiple attachments (of the same message.)

    Your scenario is a bit different and requires a combination of techniques to work.

    1) Getting the zip file attachment as the main payload

    You need to check if the zip file is coming as an attachment or as the main payload. Just try setting up a scenario without any mapping/modules and see how it looks like in the logs. If it is an attachment, then you need to use the PayloadSwapBean to swap it to the main payload. You can refer to the solution in the thread below for the parameters for the swap

    2) Unzip the main payload (with zip content from above swap)

    For this step, you can refer to my article on the logic to unzip using ZipInputStream/ZipEntry

    3) Create multiple IDocs

    My article creates attachments instead of multiple child messages. So, you need to adapt the logic to create multi child messages instead for each file in the zip file. You can achieve this via multi-mapping within the Java mapping. Refer to the wiki below for that.

    Multi-Mapping using Java Mapping - Process Integration - SCN Wiki

    Alternatively, if you don't want to complete this in one complex scenario, you can break it down into a few scenarios.

    - The first scenario gets the zip attachment, swaps it, unzip it into multiple attachment and saves all the attachment in a temporary file location

    - Second scenario picks up those files individually and maps it to IDoc and post to ECC


    Eng Swee

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2015 at 07:10 PM

    Hi Sneha,

    The document that you have mentioned is about the zipping in java mapping. If you are using PayloadSwapBean i think you want to replace the PI payload with the mail attachment. I haven't tried it but i think you can have any problem if the payload is not a XML, although per documentation you can try changing the content-disposition and it could work.

    On the other hand, you are doing the zipping process via java mapping, therefore why don't develop all the stuff inside the java mapping?, you can access to the attachments at mapping level (depending your PI version), like the java code shared by Vinay P in this blog Java mapping to read a csv file attachment and convert into required XML


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 20, 2015 at 09:05 AM


    Thank you all for your suggestions & help.

    Broke down the requirement into two steps :

    Step 1 ) Created a Java mapping to unzip the file received by email. After unzipping the file, the sub-files were created in the NFS directory

    Step 2) Created second interface to pick the files from NFS directory and created a Sales Order in ECC system.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 02, 2015 at 06:38 PM

    HI Sneha,

    Please provide the screen shot of the module tab



    Add comment
    10|10000 characters needed characters exceeded