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

Help , if there exists a Function Module

Former Member
0 Likes
456

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
Read only

Former Member
0 Likes
425

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.

Read only

Former Member
0 Likes
425

hi Sudha,

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

Regards,

Santosh

Read only

Former Member
0 Likes
425

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