cancel
Showing results for 
Search instead for 
Did you mean: 

How to rename a file when move to archive ?

jegathees_waran
Active Participant
0 Kudos

Hello Friends,

I have one requirement.

The source system places the input file. The input file is picked and the mapping is executed.

We have some validations in mapping like Account No, Currency Code through RFC lookup call in ECC.

If validation fails, we need to move the input file name to the archive directory with the naming convention <input file name>+<datetime>+"_ERR".

If mapping is success, we follow the normal process to move the input file to archive. (<input file name>+<datatime>)

I could not find the way/method how to do this (moving file based on mapping status)

Could you please clarify, Friends?

Thanking you.

Kind regards,

Jegatheeswaran P.

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi ,

If validation fails are your throwing mapping error or sending an email? i would prefer to use enhanced receiver determination concept here , dont throw error when validation fails just call file receiver when validation fails and use archive directory in target directory and even you can change name using dynamic config.

Regards,

Raj

jegathees_waran
Active Participant
0 Kudos

Hi Raja Sekhar,

As you said, the requirement is to send mail also if the validation fails. My concern is when the file is picked from the source channel it is moved to archive directory. How to rename the file when the validaton fails.

I will try your and Gagandeep suggested solution and let you know.

Ambrish, they want to know which input file is not having the correct account number. that's the reason they ask to rename the file.

Thank you very much all your reply on time. I will let you know after my try.

Kind regards

Jegathees P.

ambrish_mishra
Active Contributor
0 Kudos

Hi,

I would go with Raja's suggestion of a file receiver. Pick the file in delete mode.

If RFC look up fails, rename the file to <input file name>+<datetime>+"_ERR through dynamic configuration class and trigger an email (use mail package API) and if success, create the file with  <input file name>+<datatime> in the archive directory + do anything additional.

Cheers

Ambrish

Answers (2)

Answers (2)

ambrish_mishra
Active Contributor
0 Kudos

Hi Jegatheeswaran,

Before we provide the solution, one point needs to be clear:

Do you want to fail the entire file if the validation through RFC look up fails ?

or

Suppose file has 10 records, do you want to split the records based on validation as error and success ?

Ambrish

gagandeep_batra
Active Contributor
0 Kudos

Hi JP,

You can do this using multimapping,

First add the condition in mapping on look-up output, if it is in error the call the error message other wise call the normal process,

in error message at message mapping add dynamic configuration and create a file with require name,

and receiver CC put this file into archive folder.

now at Receiver CC you can use OS command to delete the file with original name.

Regards

Gagan