cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a .txt file using scripts in bods.

0 Kudos

Hi Friends,

I would like to know how to generate a .txt in the specific name like " s2_231_timestamp.txt in bods using scripts (in Windows, Linux environment).

Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello mr.X x

You can create a variable like below:

$File_Name = 's2_231_' || to_date(sysdate(),'YYYYMMDDHH24MISS') || '.txt'

Assuming s2_231 is default and file is generated after successful execution of Batch job and timestamp part will be changing every execution.You can define the format however you wanted.

This must be kept in script level.

Likewise you can have dynamic variable for '.csv' also.

Regards,

Iswarya

former_member231328
Participant
0 Kudos

Hello meer.9700

Depending on the environment of the job server you can utilize command line tools provided by the operating system.

You can read more on the exec() function in the Reference guide. There is also a sub chapter based on remote shell executions.

Below are two simple examples of creating a text file of the same name in the default 'workspace' folder. You can use these a template:

• in Linux environment exec('touch','/sap/SAP/dataservices/workspace/s2_231_timestamp.txt',0);

• in Windows exec('cmd', 'cd C:\PROGRA~3\SAPBUS~1\DATASE~1\WORKSP~1 && copy NUL >s2_231_timestamp.txt');

regards

Bon