cancel
Showing results for 
Search instead for 
Did you mean: 

help on operating system script

Former Member
0 Kudos

Hello,

I have a scenario where I'll need to poll 10 .xls files form a source directory, when a condition is met,

condition is only when one of the 10 files abc.xls persits then all other files should be polled and send to target,

my source(sender is nfs on unix)

I was trying to build a unix-script to run before message processing.

to move the files from one dir A to dir B if the condition is met, and poll form dir B, but it didn't work

seems like the message processing is independent of the external command. even though the script is working properly if we directly run on unix but via PI the files are being polled even the condition is not met.

did any one configured such scenario, is it possible to do vi a os script

George.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi George,

I think i have understood your requirement correctly, you want sender file adapter to check if abc.xls file available in DirectoryA, if its available then your script will run to pick all remaining file in DirectoryA and move to DirecotyB for further processing. If that's the case can you check below steps/configuration helpful for your requirement.

1. Configure sender CC to pick abc.xls in DirectoryA

2. Execute script to pick files from *.xls from DirectoryA to DirectoryB (Please note in your script you have to put condition to move files from DirectoryA to DirectoryB only if absolute path %F contains DirectoryA, otherwise skip the process)

3. Use Advanced Selection for Source file in same sender CC to pick *.xls files from DirectoryB

Sender CC:

Regards,

Praveen

Former Member
0 Kudos

Hi Praveen,

Thanks for your solution, Let me clarify a couple of things here.

My Scenario is a file to file scenario, no ESR is involved.

Look for files in one Directory-A on the sender side which is nfs

and send them to Target server which is ftp.

only one condition is in Directory-A(sender side) one of the file should exist (abc.xls)

Initially I wrote a script to move files form Dir-A to Dir-B at the source and poll form Dir-B and send to target.

The script is working with out any problem the files are moving from Dir-A to Dir-B.

but to make the script working I'll have to place a file(dummy.xls) in Dir-B.

only the dummy.xls is moving to the target.

if I make to run the script in Dir-A even if the condition fails the files are still moving,

seems the file-processing is independent of the os command.

I've tried with the Additionalfile(s) which files moves as attachment option, but seems it requires a SOAP Adapter and the file-name is not maintained.

I'll try the option you've just advised,

now since you've got the complete scenario do you suggest to proceed this way or any other short method is available..

also to make the script to terminate if the condition fails, i used exit 1 with in the script.

but it still polling the file.. and advise over her.

Thanks a Lot for your help.

Former Member
0 Kudos

I'm stuck here..

here are the steps I did

at this time i have about 20 .xml files in /usr/sap/temp

my sender c.c has

source directory /usr/sap/temp1

filename: abc.xml

Advanced Selection

directory temp1 file: 123.xls

and so.. all the 20 files

script(before message) to move from /usr/sap/temp to /usr/sap/temp1

once I execute this.

the script is moving files from temp to temp1

but the files are not being picked up.

how to make them to poll from temp1 after the scripts moves them from temp.

thanks for your advice.

Former Member
0 Kudos

Hi George,

Can you share your communication channel screenshot?

If files (*.xml) not being picked up in temp1 directory (after the script moved from temp to temp1 dir), below points might be the reason.

1. The channel configuration not having proper FileName Mask (From your above configuration you're moving *.xml files to temp1 dir, but you configured filename mask as *.xls i suppose)

2. check the files having necessary permission once its moved from temp to temp1 path by script.

Regards,

Praveen

Former Member
0 Kudos

Thanks Praveen for looking into this.

both places I am using the extension .xls, I tried with the wild character *.xls and also with specifying each file name.

but it didn't work.

as you see below all my .xls files are in

/usr/sap/ediftp/data/input/

and mandatory file is S_anaxmatl.xls

once this file exits scrip moves files from /usr/sap/ediftp/data/input/ to /usr/sap/ediftp/data/input_out/, I can see all the files are moved

and .xls files should be picked up from "/usr/sap/ediftp/data/input_out/" but this is not happening.

but for the next run of the CC the first thing it does is it is picking up all the files from "/usr/sap/ediftp/data/input_out/".

so I guess the CC is configured correctly, I've tried many options only thing I see is if there are no files before the CC starts in that directory they are not picked up.

even the script moving them is not making any difference.

Glad if you had such encounter before..

thanks for your help, and sorry about the typo in my previous reply xml to xls

mvXLS is a simple script using mv to move all the files from input to input_out

Answers (2)

Answers (2)

former_member189420
Active Participant
0 Kudos

Hi George,

I have similar situation. This is what I have done: Pick up the file that is to be polled in your case "abc.xls" and then in the mapping read the remaining files from the UDF and write them to the target. The must file i.e. abc.xls can be sent as part of the normal file transfer.

Let me know if it is not clear.

Cheers,

Anand

former_member184720
Active Contributor
0 Kudos

Please refer to question 4 in the below wiki

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

In your case abc.xls should e your trigger file.

Former Member
0 Kudos

Hi Gampa,

Thanks for the input, is there a some documentation I can read about this? I tried search but seems there is not where i can find it.

I tired to give the parameters.

TriggerFile.namePart    "Accounts_merge.xls"= ".trg"

TriggerFile.optional    NO

facing error (format must be originalNamePart" = "additional name part"

if there is some doc i can read then It will be very beneficial