cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid empty file generation in BODS

Former Member
0 Kudos

Hi BODS Gurus,

I am very new to BODS area. Right now we are using BODS to extract data from HANA Calculation views and generated flat files.

One of the client requirement is to restrict the file generation, if there is no data. But now the BODS is by default generating a file with a header and 0 rows. Please help to get any setting to be maintained for this requirement.

Thank you.

Regards,

Mohan.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Mohan,

If you are generating flat files at the target, irrespective of the fact whether any data is populated or not, the files will be populated at the target. For the files that does not have any data would populate 0 byte files.

There are two processes that can be followed and depends on how you implement:

One, you can check the file size by implementing get_file_attributes() function

i.e.

get_file_ attibute(/<file_location>/<file_name>,'size')

which will output 0 bytes if no data is generated within the file. You can flag the files based on this output.Then you can use the exec() command to delete the files that are 0 byte files.

Two, you can populate the files in an intermediate folder/directory and then move those files based on the count of the rows in a file. If you find zero rows then don't move the files else move the files to the desired destination folder/directory.

You can use sample from this post for implementing the move from one folder to another:

http://scn.sap.com/thread/3888373

Thanks,

AJ

Answers (1)

Answers (1)

former_member187605
Active Contributor
0 Kudos

Use conditionals to prevent the data flows from running when there are no records.

You can use the total_rows built-in function in the condition.

Former Member
0 Kudos

Hi Dirk,

Thank you for providing the solution. As I mentioned earlier, I am beginner in BODS, can you please help me to get more details about the solution you have provided above. Thank you.

Regards,

Mohan.