Auto Genrated File in Background
In a program I am genrating a text file in c: of my desktop. Now the requirement is to schedule the same program in background and to genrate the files automatically somewhere. Can you please suggest, how to genrate text files from ABAP program scheduled in background and what changes I have to do in code.
Amuktha Naraparaju replied
Check this code.
Ref. from library.
OPEN DATASET <dsn> FOR OUTPUT.
If the file does not already exist, it is created automatically. If it does already exist, but is closed, its contents are overwritten. If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. If the system can open the file <dsn> successfully, SY-SUBRC is set to 0. If not, it is set to 8.
DATA: MESS(60), FNAME(10) VALUE '/tmp'. OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS. IF SY-SUBRC <> 0. WRITE: 'SY-SUBRC:', SY-SUBRC, / 'System Message:', MESS. ENDIF.