05-17-2006 1:20 PM
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.
05-17-2006 1:25 PM
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
05-17-2006 1:23 PM
05-17-2006 1:24 PM
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
05-17-2006 1:24 PM
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.
05-17-2006 1:25 PM
Hai,
Try the function module 'XXL_FULL_API'. I think it will solve your problem.
Cheers,
umasankar
05-17-2006 1:25 PM
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
05-17-2006 1:27 PM
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