Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

File Handling

Former Member
0 Likes
1,293

Dear All,

Please help me in below topic:

I have to create one text file through my Report and load it to given logical path. How to do it?

Thanks in advance,

Prasad

Dear All,

Please help me in below topic:

I have to create one text file through my Report and load it to given logical path. How to do it?

Thanks in advance,

Prasad

9 REPLIES 9
Read only

Former Member
0 Likes
1,244

Hi,

You can write a report to create a text file...guess that will be nothing hard..Then use the function module WS_FILENAME_GET to get the file and load it in the path. This is one way to get this done.

Regards,

Read only

Former Member
0 Likes
1,244

hiPrasad,

select the data from SAP tables whuch ever u want to download into the file.

use the fm GUI_DOWNLOAD to put the data into the specified file.

to get the file from presentaion server use fm WS_FILENAME_GET

<b>Reward points if useful</b>

Chandra

Read only

Former Member
0 Likes
1,244

I want the FM name to load the file on given logical path

Read only

0 Likes
1,244

hi,

try this. <b>LIST_DOWNLOAD</b>

CALL FUNCTION 'LIST_DOWNLOAD'

EXPORTING

LIST_INDEX = sy-lsind

METHOD = ' NOCO'

  • EXCEPTIONS

  • LIST_DOWNLOAD_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

RTF - Save in rich text format

DAT - Save as spreadsheet

NOCO - Save without converting

Hope it will b helpful.

Read only

0 Likes
1,244

Prasad,

you say you want the FM to load the file on a given logical path.....

So...you know the destination ..as to where you file has to be stored...

say( Application Server).

Am i right????

Read only

Former Member
0 Likes
1,244

hi

i think u can use CG3Z transaction for downloading file to application server

and CG3Y for presentation server...

there u can specify both source patha and target path...

hope it helps..

Read only

Former Member
0 Likes
1,244

hi,

create a internal table and using select populate data into that table

and use Gui_download fm for downlaoding data n WS_FILENAME_GET for selecting path for download

as

data: p_file type rlgrap-filename.

CALL FUNCTION 'FILENAME_GET'

EXPORTING

filename = p_file

title =

  • IMPORTING

  • FILENAME =

.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = p_file

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = ' X'

  • 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 = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • IMPORTING

  • FILELENGTH =

tables

data_tab = itab

  • FIELDNAMES =

  • 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.

if helpful reward some points.

with regards,

Suresh Aluri.

Read only

Former Member
0 Likes
1,244

Could anyone tell me what value should be passed to 'has_field_seperator' parameter of FM GUI_UPLOAD, to uplaod text file, having fields seperated by SPACE in internal table?

Prasad.

Read only

Former Member
0 Likes
1,244

Hi Marvin,

Yes exactly, I want to load data on the application server in text format(*.txt). Do u know the code/FM for this?

Thanks in advance.

Prasad