Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Auto Genrated File in Background

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.

Former Member
Former Member replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question