05-18-2009 7:12 AM
Hi Friends,
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.
KRaheja.
05-18-2009 7:19 AM
Hi Krishnan,
Check this code.
Ref. from library.
Syntax
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.
Much Regards,
Amuktha.
05-18-2009 7:13 AM
you can generate the files in the AL11 application server path..
what ever may be the file,you can fix some path in the AL11 and when you run the program background the files will be generated and placed in the particluar foleder specified by you...
05-18-2009 7:14 AM
Hi,
You cannot create a file into PC in Background Instead you can write a file into Application Server using
OPEN DATASET
CLOSE DATASET.
Thanks
Partha.
05-18-2009 7:15 AM
Hi,
You cannot download a file in presentation server anywhere when the program is run in background.
You can download it to the application server, you need to modify your program.
Regards,
Pankaj
05-18-2009 7:17 AM
Hi,
You will not be able to use GUI function modules in background. Save the file in application server.
One other way is [Communication to PresentationServer in Background Mode|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2]
Regards
05-18-2009 7:19 AM
Hi Krishnan,
Check this code.
Ref. from library.
Syntax
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.
Much Regards,
Amuktha.