I am loading my Infocube, a daily full load from a flatfile. Each day if the load is successful, i have to delete the previous day's load. Simple. But, it gets complicated because of the following scenario.
On some days it can happen that the flatfile contains zero records. When it happens, I do not want to delete my previous day's load. But even if the file contains zero records, the load will be successful and will not trigger an error message. So, simple controlling in the process chain might not work.
I need a mechanism that triggers an error or lets the chain know if the loaded number of records is zero. I am thinking of two options here.
1. In the start routine,
IF DATAPACKET  is Initial.
temp = 1/0.
When datapacket doesn't contain any data, the code fails because i'm dividing by zero and the load fails, which prevents the previous request from deleting.
This is not a very good idea as there'll be a failed request in the cube, can create problems with the reports.
2. Another idea is to include an ABAP program in the process chain and check the RSREQDONE-RECORDS for the load and if it's = 0, then send an error message.
How can we return a value to the chain from the program?? Can someone help me here.
Also please comment on this and suggest any ideas.