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

GUI_UPLOAD separator

Former Member
0 Likes
4,572

Hi

I am using this function to upload a file CSV composed by line where each line is composed by fields separated by semicolon " ; ". What I would like to know is if there is a way to say to GUI_UPLOAD that the separator is the ; because I see there is a flag has_separator, but reading here on sdn it seems that checking this the separator is the tab.

thanks

gabriele

Edited by: Gabriele Montori on Jun 5, 2009 9:54 AM

4 REPLIES 4
Read only

Former Member
0 Likes
1,838

for CSV separator is ',' and not ';'....

if u want ';' or any other separators for ur functionality, please just search in sdn...there are a huge lot of posts regrading this.,

Read only

Former Member
0 Likes
1,838

The GUI_UPLOAD function recognize only tab delimeted files when you pas 'X' at parameter

HAS_FIELD_SEPARATOR

try FM

CALL FUNCTION 'FILE_READ_AND_CONVERT_SAP_DATA'
      EXPORTING
        I_FILENAME                 = S_IFILE
        I_SERVERTYP                =  'PPRS' "GUI UPLOAD
*       i_fileformat                = SFILEFORMAT
         I_FIELD_SEPERATOR          = ';'
*     I_LINE_HEADER              =
*   IMPORTING
*     E_BIN_FILELENGTH           =
   TABLES
     I_TAB_RECEIVER             = I_TABLE
   EXCEPTIONS
     FILE_NOT_FOUND             = 1
     CLOSE_FAILED               = 2
     AUTHORIZATION_FAILED       = 3
     OPEN_FAILED                = 4
     CONVERSION_FAILED          = 5
     OTHERS                     = 6 .

Read only

Former Member
0 Likes
1,838

Use the below code

FM for the desired field sepator

DATA: gt_format_tab TYPE truxs_t_text_data.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = ';' "Give the field sepetor

TABLES

i_tab_sap_data = itab

CHANGING

i_tab_converted_data = gt_format_tab

EXCEPTIONS

conversion_failed = 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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = file name

TABLES

data_tab = gt_format_tab1 "this table has the field seperated by ;

EXCEPTIONS

Read only

Former Member
0 Likes
1,838

Hi,

In GUI_UPLOAD you can give field separator as 'X',

or to upload CSV file you can use,

DATA: it_raw TYPE truxs_t_text_data .

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

i_field_seperator = 'X'

i_line_header = 'X'

i_tab_raw_data = it_raw

i_filename = p_file_path "selection screen file path name

TABLES

i_tab_converted_data = it_upload[] "internal table having same struc as that of the flat files

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF it_upload[] IS INITIAL.

MESSAGE e002(zmsg).

ELSE.

ENDIF.

Hope it helps

Regards

Mansi