Application Development 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: 

Help , if there exists a Function Module

Former Member
0 Kudos

Hello everybody,

I want a help whether SAP has some Function Module which can take an "Internal Table" as an Import Parameter and give us "CSV File" as an export parameter , more-or-less like the "GUI_DOWNLOAD" Function Module , which downloads the file as ".DAT" or ".ASC" .

Please remember that i would need a CSV file , which i can read later through Opening a Dataset and transferring the contents into a file.

Your immediate answers is most needed.

Thanks,

Suddha Laik

3 REPLIES 3

Former Member
0 Kudos

Please check FM

<b>SAP_CONVERT_TO_CSV_FORMAT</b>

or u could do the following

CONSTANTS: C_FIELD_SEPARATOR VALUE ','.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = C_FIELD_SEPARATOR

I_LINE_HEADER = I_LINE_HEADER

I_FILENAME = I_FILENAME

TABLES

I_TAB_SAP_DATA = I_TAB_SAP_DATA

CHANGING

I_TAB_CONVERTED_DATA = I_TAB_CONVERTED_DATA

EXCEPTIONS

CONVERSION_FAILED = C_RC4.

Former Member
0 Kudos

hi Sudha,

Try Giving the file type as CSV in GUI_DOWNLOAD and check .. i guess it works

Regards,

Santosh

Former Member
0 Kudos

hi suddha,

try with GUI_DOWNLOAD with filetype as 'ASC' and

give the filename as 'C:\TEST.CSV'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\TEST.CSV'

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'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

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

do reward if it helps,

regards,

priya.

Message was edited by: Priya