cancel
Showing results for 
Search instead for 
Did you mean: 

Need small on dynamic filename at Reciever Channel

Former Member
0 Kudos

HI

I am working on Proxy to File scenario.

i have to send the data with a dynamic filename.

So i have written a UDF for this and able to send the data.

But problem here is UDF function i have given the filename as "TESTFILE_YYYYMMDDHHMMSS"

But need to send this as *.DAT format.

I think in UDF i can write a code like "TESTFILE_YYYYMMDDHHMMSS.DAT"

It would be fine.

But the Problem is I have to send one more file which will be blank file with extension of "TESTFILE_YYYYMMDDHHMMSS.TXT"

And one more thing here is the DATE and TIME should be same for the both the files like as below:

"TESTFILE_20120712114550.DAT"

"TESTFILE_20120712114550.TXT"

So am i proceeding in the right way by writing the UDF function. If correct how i can send the second file(Blank file) with same time.

one more thing is i tried at the Reciever Channel level appending the .DAT and .TXT for the files like below

%filename%.dat

%filename%.txt

Please advise.......

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

two ways:

a) add a new receiver to the scenario and configure the second channel which will put the second

file to the folder (empty with the same name)

but I guess you want to be sure that DAT file is there first and only then create the TXT as a flag for DAT

so:

b) create an OS command (bat file) which will create a TXT file from the original filename (DAT)

and specify %f to the filename

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/frameset.htm

bat for empty file:

http://stackoverflow.com/questions/210201/how-to-create-empty-text-file-from-a-batch-file

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michal.

Thanks for the quick response....

So you mean the UDF for the main file is fine.....

Comming to the Blank file.....can you please elaborate....

You mean to say for the blank file no need to Channel seperately and write a OS level command and timeout....????

can you please provdie some sort of logic for the UNIX OS ??

Thanks in advance

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>>You mean to say for the blank file no need to Channel seperately and write a OS level command and timeout....????

OS comman only is enough if the file is supposed to be empty

>>>>can you please provdie some sort of logic for the UNIX OS ??

google it   

http://www.cyberciti.biz/tips/shell-scripting-bash-how-to-create-empty-temporary-file-quickly.html

Regards,

Michal Krawczyk

Former Member
0 Kudos

YOu mean to say in the same communication channel for the main file, we can write a OS command for the empty file also. right??

one more thing is the file name how can we capture???

because for the main file in the UDF, i have mention completely...like below

"TESTFILE_YYYYMMDDHHMMSS.DAT"

if i remove the DAT here and mention in the Channel level like

%filename%.DAT .......it is not taking .DAT

that is why complete filename with Extension also taken at UDF level it self.

Now in the OS level how can i call the filename with Extension .TXT ???

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>YOu mean to say in the same communication channel for the main file, we can write a OS command for the empty file also. right??

right

>>>>Now in the OS level how can i call the filename with Extension .TXT ???

specify %f to the OS command (as per my previous link)

and remove DAT in the script and add TXT instead in the script itself

Regards,

Michal Krawczyk

Former Member
0 Kudos

SO you mean to say some script needs to write, rather direct one line command???

one batch file and in that need to write the code and run the batch file???

For the main file if i mention in the Channel as

filename in UDF =TESTFILE_20120712114550

In Channel if i mention the file name like below

%filename%.DAT

will it not work???

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>>>In Channel if i mention the file name like below

%filename%.DAT

will it not work???

this will work for main file only - DAT

>>>SO you mean to say some script needs to write, rather direct one line command???

exactly - the script will take real file (with .DAT) as input

and replace it with TXT and write the file,

Regards,

Michal Krawczyk

Former Member
0 Kudos

The script for the Blank file need to be stored at which system??

We need to place this in Reciever system??

If yes....then any other option because whether the Reciever side they might accept this Script file at their level ...no idea???

THanks

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>>The script for the Blank file need to be stored at which system??

you're using NFS right ? and not FTP (with FTP it's not possible)

>>>If yes....then any other option because whether the Reciever side they

of course - go back to my first answer

Regards,

Michal Krawczyk

Former Member
0 Kudos

I am using FTP...So it is not possible...as per your message....

Comming to the your first optino....

a) add a new receiver to the scenario and configure the second channel which will put the second

file to the folder (empty with the same name)

I need to create second channel.....do i needto create agreements and determinations also for this channel???

while creating all these what should i mention in Serivice interface name and namespace and Software component???

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>> I need to create second channel.....do i needto create agreements and determinations also for this channel???

yes

>>>>while creating all these what should i mention in Serivice interface name and namespace and Software component???

yes - but you can use any dummy one

Regards,

Michal Krawczyk

Answers (0)