cancel
Showing results for 
Search instead for 
Did you mean: 

Archiving file in different folder in sender file adapter

Former Member
0 Kudos

Hi,

I have a requirement in witch i have to pick 7 different file from seven different folder.

for this I am using advance selection tab and defining all the other folder path.

but my problem is I have to archive the different file in different folder .

For exm..

/folder1/file1.txt need to be archive in /archive_filder1/file1.txt

/folder2/file2.txt need to be archive in /archive_filder2/file2.txt

/folder3/file3.txt need to be archive in /archive_filder3/file3.txt

can any one tell me that how to define the dynamic archive folder path??.

regards,

Navneet

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Thanks. we use only one directory to archive all the file and than writing a small script at FTP end to move the file to corresponding folder according to there naming convention.

former_member185881
Active Participant
0 Kudos

.

Edited by: Dheeraj Kumar on Jan 11, 2010 6:10 PM

former_member185881
Active Participant
0 Kudos

Hi Navneet

In File Access parameters --> Target Directory

Use this type of Directory name

\XIDEV_STORES\%store%\sapoutbound

here %store% will be changed accordingly

e.g. if file will come for store 001 then this %Store% will be replaced by 001 and file will be placed in this 001 folder and if file will come for store 002 then this %Store% will be replaced by 002 and file will be placed in this 002 folder over FTP.

For to achieve this Go to Advanced tab

For Variable Substitution check mark Enable

Now speciofy the parameter values for Variable Name and Reference

Under Vriable name specify = store

Under Reference specify = payload:WP_PLU02,1,IDOC,1,EDI_DC40,1,RCVPRN,1 -


You have to give full path name here that where this store variable is located into IDOC.

Hope this example will help you

Regards

Dheeraj Kumar

Former Member
0 Kudos

Hi,

Create the mapping which does the determination of the path (i.e directory use Dynamic Configuration for the same)

and use one more receiver agreement apart from the target for the same with the above mapping name in interface determination

and use FTP receiver adapter with Adapter specific message attributes enabled...

This will allow you to archive the files in the required folders...

HTH

Rajesh

Former Member
0 Kudos

Hello,

Try to use variable substitution options of File Adapter to achive your goal. It works for file name and i think that should work for archiving.

Advanced Tab Page

Variable Substitution (Target Directory/File Name Scheme)

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm

And several blogs on this theme:

/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12

/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i

And of course as described above you can write your script and use it in OS command line of File adapter.

BR,

Dzmirty

udo_martens
Active Contributor
0 Kudos

Hi Dzmirty,

>Try to use variable substitution options of File Adapter to achive your goal

We are speaking about a file sender adapter. How can you use payload variables there?

Regards,

Udo

former_member185881
Active Participant
0 Kudos

Hi Udo

Hi Dzmirty,

Try to use variable substitution options of File Adapter to achive your goalWe are speaking about a file sender adapter. How can you use payload variables there?

Regards,
Udo

We are speaking about Receiver file adapter not sender file adapter so using variable substitution we can achieve this. So we can use Payload variables there.

Regards

Dheeraj Kumar

udo_martens
Active Contributor
0 Kudos

Hi Dheeraj Kumar

please have a look to the original question / message from navneet:

>I have a requirement in witch i have to pick 7 different file from seven different folder

If you send messaage from a file (pick up) -> file sender

If you write messages to a file -> file receiver

Regards,

Udo

former_member185881
Active Participant
0 Kudos

Hi Navneet

I dont think so it is possible coz you cannot run OS commands if you are using FTP. So you cannot sent to different target folders.

Using a single channel, answer is No. Try using multiple channels.

Regards

Dheeraj Kumar

udo_martens
Active Contributor
0 Kudos

Hi Dheeraj Kumar,

>you cannot run OS commands if you are using FTP.

I ve got some doubts. If you choose "FTP protocol" in the adapter, the fields still exist. Where did you get the information that FTP adapter cant handle a OS command?

Regards,

Udo

former_member185881
Active Participant
0 Kudos

Hi

I mean to say Move command (OS command) you cannot use over ftp through XI.

Regards

Dheeraj Kumar

Edited by: Dheeraj Kumar on Jan 11, 2010 5:57 PM

udo_martens
Active Contributor
0 Kudos

Hi Dheeraj Kumar,

>I mean to say Move command (OS command) you cannot use over ftp through XI.

I spoke about executing a script.

It would be helpful if you could support your predictions with a link or a descripion of a scenrio you tested.

Regards,

Udo

udo_martens
Active Contributor
0 Kudos

Hi Navneet,

of coz the easiest way is just to copy the adapter 7x.

Another way would be to run a operation system command after processing what is calling a script. That script copies archived files depending on file name to the required folders.

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

Thanks for the reply.

I have the requirement to use only single Communication channel , So i cant make 7 channel.

Please let me know that how OS command can be used . do u have any release or link which deals with OS command.

regards,

Navneet

udo_martens
Active Contributor
0 Kudos

Hi Navneet,

Santoshs blog describes a similar scenario:

[Glimpse at OS Command: Yet Another Scenario|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/10392] [original link is broken] [original link is broken] [original link is broken];

Michals blog handles OS commands at all:

[XI/PI: Command line sample functions|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5814] [original link is broken] [original link is broken] [original link is broken];

Please notice that the script will be executed on that server so you need to write the script in a fitting language.

Regards,

Udo

former_member185881
Active Participant
0 Kudos

Hi Navneet

go to this blog and read option 1 there it is clearly mentioned "This will only work when the file system is NFS (not FTP). "

http://wiki.sdn.sap.com/wiki/display/XI/DifferentwaystokeepyourInterfacefromprocessingduplicate+files

We cannot move file from one location to another location at FTP without using communication channel.

Regards

Dheeraj Kumar

former_member185881
Active Participant
0 Kudos

Hi Udo

Santoshs blog describes a similar scenario:
Glimpse at OS Command: Yet Another Scenario

In this blog see its Archive directory it is local means it is not related to FTP it is NFS

Michals blog handles OS commands at all:
XI/PI: Command line sample functions

This blog is dealing with Receiver File communication channel not Sender File Communication channel.

If i am wrong somewhere then please do correct me.

Regards

Dheeraj kumar

Edited by: Dheeraj Kumar on Jan 11, 2010 7:40 PM

udo_martens
Active Contributor
0 Kudos

Hi Dheeraj kumar,

>in this blog see its Archive directory it is local means it is not related to FTP it is NFS

Yes, if you know a blog where we have just the required scenario please dont hesitate to post it. I wrote it would be "similar"

>This blog is dealing with Receiver File communication channel not Sender File Communication channel.

Yes, as i said it gives an overview or an introduction to OS command. I m glad you agree with a sender channel

Regards,

Udo

former_member185881
Active Participant
0 Kudos

Hi Udo

definitely i will agree boss if i will come to know that i have misunderstood the requirement. We are not doing group discussion here to win, we have to provide suitable solutions right na so i was trying my best.

K let me ask you one thing -


can we perform operation over FTP using OS Commands or any other solution?

please tell me with explanation.

Regards

Dheeraj Kumar

Former Member
0 Kudos

Hi Udo and Dheeraj,

Thanks for all your reply.

After going with all the threads posted I can understood that OS command can only be executed on NFS not in FTP. But Dheeraj please see the Link below which says ,FTP server can be hit by opening the FTP connection in script only(not a good practice).

http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/10392. [original link is broken] [original link is broken] [original link is broken]

But my requirement is to archive the file in different archive folder.

Can it be possible to define the archive folder path dynamically instead of hard coding it in sender Communication Channel.

Regard,

Navneet