‎2007 Nov 30 12:29 PM
Hi,
I want the backup program to be run in my application server
can anybody help me on this its very urgent.
‎2007 Nov 30 12:33 PM
Hi Sunil,
Try this code to backup in your presentation server.
REPORT YCL_GENERATE_BACKUP1.
----
Parameters Declaration *
----
parameters: p_file(500)
DEFAULT 'D:\BACKUP\'
OBLIGATORY. " File Name
----
Constants Declaration *
----
constants: c_txt(6) value '.txt'. " Store EXtension of file name
----
Data Declaration *
----
data w_file type string.
----
Field Strings Declaration *
----
DATA: FS_PROG TYPE PROGNAME.
----
Internal tables Declaration *
----
DATA: T_PROG TYPE PROGNAME OCCURS 10,
T_CODE(150) occurs 10.
----
Satrt of Selection *
----
Start-of-selection.
w_file = p_file.
perform read_programs. " Read Programs
perform Download_programs. " Download Programs
&----
*& Form read_programs
&----
text
----
FORM read_programs.
SELECT PROGNAME
FROM REPOSRC
INTO TABLE T_PROG
WHERE UDAT EQ sy-datum
AND UNAM EQ 'CLUSER03'
OR UNAM EQ 'CLUSER02'
OR UNAM EQ 'CLUSER01'.
ENDFORM. " Read_programs
----
*& Form Download_programs
&----
Download all our programs
----
FORM Download_programs .
WRITE: / text-001.
uline.
LOOP AT T_PROG INTO FS_PROG.
read report FS_prog into t_CODE.
concatenate p_file
FS_prog
c_txt
into w_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = w_file
TABLES
DATA_TAB = t_CODE
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
write: / text-000.
uline.
write: / fs_prog.
else.
write: / w_file.
ENDIF. " IF SY-SUBRC <> 0.
ENDLOOP. " LOOP AT T_PROG
ENDFORM. " Download_programs
plz Reward if help.
Mahi.
‎2007 Nov 30 12:33 PM
Hi Sunil,
Try this code to backup in your presentation server.
REPORT YCL_GENERATE_BACKUP1.
----
Parameters Declaration *
----
parameters: p_file(500)
DEFAULT 'D:\BACKUP\'
OBLIGATORY. " File Name
----
Constants Declaration *
----
constants: c_txt(6) value '.txt'. " Store EXtension of file name
----
Data Declaration *
----
data w_file type string.
----
Field Strings Declaration *
----
DATA: FS_PROG TYPE PROGNAME.
----
Internal tables Declaration *
----
DATA: T_PROG TYPE PROGNAME OCCURS 10,
T_CODE(150) occurs 10.
----
Satrt of Selection *
----
Start-of-selection.
w_file = p_file.
perform read_programs. " Read Programs
perform Download_programs. " Download Programs
&----
*& Form read_programs
&----
text
----
FORM read_programs.
SELECT PROGNAME
FROM REPOSRC
INTO TABLE T_PROG
WHERE UDAT EQ sy-datum
AND UNAM EQ 'CLUSER03'
OR UNAM EQ 'CLUSER02'
OR UNAM EQ 'CLUSER01'.
ENDFORM. " Read_programs
----
*& Form Download_programs
&----
Download all our programs
----
FORM Download_programs .
WRITE: / text-001.
uline.
LOOP AT T_PROG INTO FS_PROG.
read report FS_prog into t_CODE.
concatenate p_file
FS_prog
c_txt
into w_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = w_file
TABLES
DATA_TAB = t_CODE
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
write: / text-000.
uline.
write: / fs_prog.
else.
write: / w_file.
ENDIF. " IF SY-SUBRC <> 0.
ENDLOOP. " LOOP AT T_PROG
ENDFORM. " Download_programs
plz Reward if help.
Mahi.