cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

Can anyone help me in writing a script in BODS.

Requirement is like:

  • After a job has run, the output (executed file) should move from the target folder to other server.

Please help me as I am new to BODS.

Regards,

Anurag.

0 Likes
View Entire Topic
Former Member
0 Likes

Hi Naha anurag,

We have new functions added in BODS 4.2

1. file_copy

2. file_move

you can move files using  any of the above functions.

or you can also use the above logic posted by madhusudhan.

please refer the below link for more information on file_copy and file_move functions.

http://help.sap.com/businessobject/product_guides/sbods42/en/ds_42_reference_en.pdf

Thanks,

Ravi Kiran.

0 Likes

Hi Ravi,

Will this thing works with the below scenario:

  • picking up file from FTP and transferring it to Job server?

Many thanks for your reply.

Regards,

Naga Anurag S

former_member187605
Active Contributor
0 Likes

Yes!

0 Likes

Hi Dirk

can you give an example for this?

That would be grateful.

Thanks in Advance!

regards,

Anurag.

former_member187605
Active Contributor
0 Likes

Sure, check out section 2.3.12 File location object in the SAP Data Services Reference Guide (url as given before). The function you need is actually called copy_from_remote_system:

     copy_from_remote_system(“flo_ftp_1”, “prod.txt”)

This function uses the FTP information in the file location object flo_ftp_1 to copy the file named prod.txt that is located in a remote directory.

Former Member
0 Likes

Here's a sample script which I had written..

@echo off

set USER=user_name

set "PASSWORD=password"

set LOCAL_DIR=D:\Data\Proj\Source

set FILE_NAME=filename.txt

set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2%

del D:\Data\Proj\ftpcommand.txt

echo USER %USER%>>D:\Data\Proj\ftpcommand.txt

echo %PASSWORD%>>D:\Data\Proj\ftpcommand.txt

echo lcd D:\Data\Proj\Source>>D:\Data\Proj\ftpcommand.txt

echo CD /FTP_Folder>>D:\Data\Proj\ftpcommand.txt

echo ascii>>D:\Data\Proj\ftpcommand.txt

echo MGET filename.txt>>D:\Data\Proj\ftpcommand.txt

echo disconnect>>D:\Data\Delfi\ftpcommand.txt

echo bye>>D:\Data\Proj\ftpcommand.txt

ftp -n -i -s:D:\Data\Proj\ftpcommand.txt  FTP_SERVER_IP

/* Copy File from Source folder to Backup Folder on Job Server */

copy D:\Data\Proj\Source\filename.txt D:\Data\Proj\Backup\filename.txt_%dt%.txt

Dont do a copy paste Use your own logic as per the requirement

Regards

Arun Sasi

0 Likes

Hi Arun,

can you please tell me the script to be written in a batch file where

  • I have to pickup a file from FTP and copy to some other place.

PF attached script, please tell me what changes to be done to the script to acquire the above mentioned scenario.

Thanks in Advance!

regards,

Anurag.

Former Member
0 Likes

looks good!!

Try to run the above script in a batch file from command prompt and check if you have any issues.

If its doing the required then try running the script from BODS job

Regards

Arun Sasi

0 Likes

PFA the script is it good???

But the above script is working with scenario:

  • uploading files to FTP from job server.

My scenario is:

  • Download files from FTP and place it in job server.

Can you suggest any idea.

Regards,

Anurag.