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 downaload

Former Member
0 Likes
1,004

Hi Experts,

I need to download some data in a *.csv file. But the interanl table has a deep structure(nested table). While using the function module GUI_DOWNLOAD, i get a short dump.

Can someone please help me out in this case?

Is there any other way to do so?

Is there a way to insert the ASCII character for Carriage Return (Enter Key) in the string type of variable? If that is possible, then I might not be required to use the deep structure for my requirement.

Thanks & Regards,

Prabhas Kalele.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
871

for Carriage return : check the class

CL_ABAP_CHAR_UTILITIES & in attributes we have "CR_LF" field. you can use it in the program

we can use this in the program as:

CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.

CONSTANTS: C_CR_LF TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.

now wherever you want to insert this CR use the constant C_CR_LF.

regards

srikanth

6 REPLIES 6
Read only

Former Member
0 Likes
871

hi prabhas,

first use FM 'SAP_CONVERT_TO_CSV_FORMAT'

and then download using GUI_DOWNLOAD.

check this thread

and for carriage return use the method

CL_ABAP_CHAR_UTILITIES-> cr_lf

hope this helps,

priya.

Message was edited by: Priya

Read only

Former Member
0 Likes
871

Hai Prabhas try with the following Code

DATA: D_FILENAME TYPE STRING,

D_FILEPATH TYPE STRING,

D_FULLPATH TYPE STRING,

L_FILETYPE TYPE CHAR10.

IF L_FILETYPE = 'ASC'.

L_FILETYPE = 'ASC'.

ELSE.

L_FILETYPE = 'DAT'.

ENDIF.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILE_NAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • WITH_ENCODING =

  • PROMPT_ON_OVERWRITE = 'X'

CHANGING

FILENAME = D_FILENAME

PATH = D_FILEPATH

FULLPATH = D_FULLPATH

  • USER_ACTION =

  • FILE_ENCODING =

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

NOT_SUPPORTED_BY_GUI = 3

others = 4

.

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 NOT D_FULLPATH IS INITIAL.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = D_FULLPATH

FILETYPE = L_FILETYPE

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

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = T_DOWNLOAD

  • 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

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
871

Download into internal table of generic type, once u get into internal table, within the loop split the record separated by , (CSV file) and manipulate accordingly.

Read only

Former Member
0 Likes
871

Hai,

Try the function module 'XXL_FULL_API'. I think it will solve your problem.

Cheers,

umasankar

Read only

Former Member
0 Likes
872

for Carriage return : check the class

CL_ABAP_CHAR_UTILITIES & in attributes we have "CR_LF" field. you can use it in the program

we can use this in the program as:

CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.

CONSTANTS: C_CR_LF TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.

now wherever you want to insert this CR use the constant C_CR_LF.

regards

srikanth

Read only

0 Likes
871

To get a carriage return use this:

concatenate wa cl_abap_char_utilities=>CR_LF into wa separated by space.

Note - The "cl_abap_char_utilities=>CR_LF" - that is your ENTER