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: 

Download

Former Member
0 Kudos
112

hi all,

Before download using GUI_DOWNLOAD, im adding a comma between the fields of itab sothat GUI_DOWNLOAD can download use comma as delimiter. Now the problem is i have an amount field which has commas in it as thousand separator. So, GUI_DOWNLOAD takes this amount field as more than one field like for eg, 5,000 is downloaded into 2 columns like 5 and 000 as there is a comma in it.

How to change the delimeter of GUI_DOWNLOAD from comma to anyother, say $?

Thanks & Regards,

Vinny

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos
56

hi vinny,

kindly note this.

Tab (09)

CONSTANTS: con_tab TYPE x VALUE '09'.

Carriage return (0D)

CONSTANTS: con_cr type x value '0D',

try any of this.

**********************************************

manipulate ur code exmaple

***********************************************

Check this code..

REPORT ZTESTAA.

TYPE-POOLS:TRUXS.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN

LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

END OF ITAB.

DATA:

ITAB1 TYPE TRUXS_T_TEXT_DATA.

SELECT VBELN POSNR UP TO

10 ROWS FROM VBAP INTO TABLE ITAB.

CALL FUNCTION

'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ';'

TABLES

I_TAB_SAP_DATA = ITAB

CHANGING

I_TAB_CONVERTED_DATA = ITAB1

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 = 'C:\TEMP\test.txt'

TABLES

DATA_TAB = ITAB1

EXCEPTIONS

OTHERS = 1.

rgds

anver

if hlped pls mark points

6 REPLIES 6

Former Member
0 Kudos
56

u have to manipulate the Upload file not with the FM .

Regards

Prabhu

anversha_s
Active Contributor
0 Kudos
57

hi vinny,

kindly note this.

Tab (09)

CONSTANTS: con_tab TYPE x VALUE '09'.

Carriage return (0D)

CONSTANTS: con_cr type x value '0D',

try any of this.

**********************************************

manipulate ur code exmaple

***********************************************

Check this code..

REPORT ZTESTAA.

TYPE-POOLS:TRUXS.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN

LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

END OF ITAB.

DATA:

ITAB1 TYPE TRUXS_T_TEXT_DATA.

SELECT VBELN POSNR UP TO

10 ROWS FROM VBAP INTO TABLE ITAB.

CALL FUNCTION

'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ';'

TABLES

I_TAB_SAP_DATA = ITAB

CHANGING

I_TAB_CONVERTED_DATA = ITAB1

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 = 'C:\TEMP\test.txt'

TABLES

DATA_TAB = ITAB1

EXCEPTIONS

OTHERS = 1.

rgds

anver

if hlped pls mark points

Former Member
0 Kudos
56

hi Anver,

you mean to say i have to replace commas in between itab fields with any of these 2 constants?

could you plz explain?

Thanks & Regards,

Vinny

0 Kudos
56

yes vinny,

if not worked, try that code i wrote above.

its a sample code.

rgds

anver

Former Member
0 Kudos
56

hi Anver,

i've replaced commas inbetween the itab fields with

tab(09), now plz let me know how exactly i have to mention to FM gui_download that the delimeter is tab but not comma? right now it is taking comma as delimeter and downloaded the entire report into 2 columns like

for eg, 10045 2800005413 0010 10,000 500 is downloaded as 100452800005413001010 and 000500. plz clarify this.

Regards,

Vinny

0 Kudos
56

hi,

try this.

  • Download internal table to presentation server file(PC)

  • <b>Separating fields/columns by a tab</b>

DATA: ld_filename TYPE string,

  • Pre version 4.7 declaration e_file like rlgrap-filename.

DATA: begin of it_datatab occurs 0,

col1(50) type c,

col2(50) type c,

col3(50) type c,

  • etc....

end of it_datatab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ld_filename

filetype = 'ASC'

  • APPEND = 'X'

write_field_separator = 'X'

  • CONFIRM_OVERWRITE = 'X'

TABLES

data_tab = it_datatab[]

EXCEPTIONS

file_open_error = 1

file_write_error = 2

OTHERS = 3.

rgds

anver