Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

*&---------------------------------------------------------------------*

*& Report ZDOWNLOADSY *                                                 *

*&---------------------------------------------------------------------*

*& Author : Gowrishankar                                                    *

*& Descripton : The main aim of this program is used to download *

*& all the programs come under one particular package. *

*&---------------------------------------------------------------------*
REPORT ZDOWNLOADSY.
*table decleration
tables : tadir.
*data decleration
TYPES: abapline(255).

DATA: i_repsrc TYPE STANDARD TABLE OF abapline WITH HEADER LINE.

data: begin of itab occurs 0,

pgmid type tadir-pgmid,

object type tadir-object,

obj_name type tadir-obj_name,

devclass type tadir-devclass,

end of itab.

data: prog(60) .

data : mc_filename like rlgrap-filename.

data : FILENAME type string.

parameters: p_dev type tadir-devclass.
*select statement.
select pgmid object obj_name devclass from tadir into table itab

where pgmid = 'R3TR' and

object = 'PROG' and

devclass = p_dev.

loop at itab.

prog = itab-obj_name.

read report prog into i_repsrc.

concatenate 'D:\reports\'

prog

'.txt'

into mc_filename.

FILENAME = mc_filename.
*function module for download files into local system
CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

* BIN_FILESIZE =

FILENAME = FILENAME

* FILETYPE = 'ASC'

* APPEND = ' '

* WRITE_FIELD_SEPARATOR = ' '

* HEADER = '00'

* TRUNC_TRAILING_BLANKS = ' '

* WRITE_LF = 'X'

* COL_SELECT = ' '

* COL_SELECT_MASK = ' '

* DAT_MODE = ' '

* CONFIRM_OVERWRITE = ' '

* NO_AUTH_CHECK = ' '

* CODEPAGE = ' '

* IGNORE_CERR = ABAP_TRUE

* REPLACEMENT = '#'

* WRITE_BOM = ' '

* IMPORTING

* FILELENGTH =

TABLES

DATA_TAB = i_repsrc

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.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear prog.

clear i_repsrc.

endloop.

MESSAGE s001(00) WITH 'Check your folder for the Programs downloaded'.