cancel
Showing results for 
Search instead for 
Did you mean: 

Target Directory name

former_member309357
Participant
0 Kudos

Hello Team,

    I am using PI 7.11 SP 12, I have a new requirement in which I need to drop files on the target FTP and implemented by pass scenario..

    But the client requirement is "Folder shall be created with a naming convention of “<Country Code>_<date>_<time>” like “IND_112414_163000”." and the files should be placed in this sub-folder on daily basis in which date should change daily.

   Could you please let me know how this process can be approach.

   Thank you in advance.

Thanks

Ravi.

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member309357
Participant
0 Kudos

Hello All,

    Please find the below code I have used for the same :

String directoryname = new String("");

DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","Directory");

directoryname = "/1234/AA_";

conf1.put(key1,directoryname);

return directoryname;

And in mapping I have used concat the time stamp to it. But the directory name is not adding any time stamp at last. The directory is simply showing /1234/AA_. No time stamp(yyyymmdd_HHmmss) is adding.

Please correct my UDF.

Thanks

Ravi

former_member190624
Active Contributor
0 Kudos

Hi Ravi ,

You almost completed the requirment , just use "currentDate" function as shown in below to concat function.

Thanks

Hari.


former_member184720
Active Contributor
0 Kudos

>>>And in mapping I have used concat the time stamp to it. But the directory name is not adding any time stamp at last. The directory is simply showing /1234/AA_


If you concat after the UDF, it doesn't work.


You have to concat before the UDF then pass the value to UDF and set the dynamic directory in UDF.


You can do like this.


To your UDF pass  a variable. i.e. concat "/1234/AA_" + current date (require format).


Inside your UDF, just change conf1.put(key1,your input variable);

iaki_vila
Active Contributor
0 Kudos

Hi Ravi,

A few cents, to work with dates inside the UDF you can follow Aashish Sinha answer in this thread


Regards.

former_member309357
Participant
0 Kudos

Hi Hareesh,

     Please find the screen shot which I have used in mapping by concat function, kindly let me know if still any changes require.

Thanks

Ravi

former_member184720
Active Contributor
0 Kudos
former_member309357
Participant
0 Kudos

Hi Hareesh,

    I have tried using above mapping, still getting the error:

"Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: An error occurred while connecting to the FTP server 'ftp.xxx.com:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 550 Unexpected reply codeThe system cannot find the path specified. '. For details, contact your FTP server vendor."

    Kindly suggest.

Thanks

Ravi.

azharshaikh
Active Contributor
0 Kudos

Hi Ravi,

Can you check in monitoring - SXMB_MONI, what values it is displaying for Directory and Filename in Dynamic Config...as shown below...

Please give screenshot

Also check if the FTP User ID is having access/permissions to read&write on the FTP server that u have configured.

Regards,

Azhar

former_member309357
Participant
0 Kudos

Hi,

  The error before was due to not checking directory in ASMA in sender channel, now I have selected and the target directory is creating with required name.

  But I am unable to find the data in the file, rather getting xml tags as below :

"

<?xml version="1.0" encoding="UTF-8" ?>

<ns0:MT_Receiver xmlns:ns0="http://xx/xx/xx">/xx/xx/xx/xx/xx_20141125_020949</ns0:MT_Receiver>

"

   Suggest please.

Ravi.

azharshaikh
Active Contributor
0 Kudos

Hi Ravi,

What kind of file you are trying to post? Is it XML or flat file?

Have you done any FCC config in Sender / Receiver CC?

Are you using any Message Mapping?

Can you try to test in MM with your Input payload and chk?

Regards,

Azhar

former_member309357
Participant
0 Kudos

Hi Azhar,

    I am trying to post some PDF files and .KEY files. Its a bypass scenario, not used any FCC or any mapping, but for creating target directory, using dynamicConfiguration in mapping with once receiver field.

Thanks

Ravi

azharshaikh
Active Contributor
0 Kudos

Hi Ravi,

What is at your sender side? Are yo sending multiple files...what configuration u did at sender CC.

Are you able to view all the files/attachment in MONI ?

For FTP /File sender, you can refer to following:

SAPTechnical.COM - Picking multiple files using File-Adapter FTP

Sender File Adapter Frequently Asked Questions - Process Integration - SCN Wiki

Regards,

Azhar

former_member309357
Participant
0 Kudos

Hi Azhar,

    My scenario is FILE (NFS) to FILE (FTP), and used *.* at sender and ASMA for file name at both sender and receiver such that same files to be written in FTP as well.

    Yes, I am able to view the files in MONI.

Thanks

Ravi.

azharshaikh
Active Contributor
0 Kudos

Ravi,

If you are using MM, it will treat the incoming file as payload..and will map it to target structure as XML format..

For Pass through you should not create ESR object (dummy reference to be made in ID config)

But since you require Directory/File name Dynamically i believe you might need to do it using Java Mapping..

Please refer following for details:

Dynamic file name for pass-through scenario - Process Integration - SCN Wiki

Regards,

Azhar

iaki_vila
Active Contributor
0 Kudos

Hi Ravi,

You can use the ASMA properties of the receiver file adapter to achieve your goal.

Check this thread and this wiki Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...

Regards,

azharshaikh
Active Contributor
0 Kudos

Hi,

I believe you can achieve this by using the Dynamic Configuration - ASMA.

Please refer the following link:

Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...

(Check Adapter-Specific Message Attributes and Dynamic Configuration Option)

Tick / Unable Directory Option in Receiver CC and also Create Target Directory option in the CC. From your MM pass the required Names for Directory and File Name as shown in the blog.

Regards,

Azhar

Former Member
0 Kudos

Dear Ravi,

You can use the 'Variable Substitution' along with Add time stamp options on receiver file adapter.

thanks-
Rams