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

File Format Issue

Former Member
0 Likes
437

Dear All,

I have a file on the application server. When i see the application server file content, it is seperated by special character #. and when i down load it to presentation server using function module, I am getting @ seperator on the presentation server file. How can i avoid this.

Thank you in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
405

Jyotsna,

  1. is represented as tab. When you are reading the data from application server between open data set and close data set.

Use SPLIT at "#" and split each value into the respective work area.

So now you will have data in internal table without "#".

While downloading it into a Presentation server using CALL FUNCTION 'GUI_DOWNLOAD'

make sure u give this export parameter

write_field_separator = '#'

Hope this works,

2 REPLIES 2
Read only

Former Member
0 Likes
405

Hi,

Use this code to get data from the path.

for example: prf_file = '/tmp/file.txt'

then u will get the data in a internal table later u can download that data to presentation server

TYPES:BEGIN OF lt_val,

val(50) TYPE c,

END OF lt_val.

DATA: gdt_data TYPE TABLE OF t_vk11.

DATA: gdt_field_split type TABLE OF lt_val.

DATA: gds_field_split type lt_val.

data: gdf_index TYPE sy-index VALUE 0,

gds_field TYPE string,

gds_data TYPE lt_val.

FIELD-SYMBOLS: <FS> .

data: w_data TYPE t_vk11.

if prf_file is NOT INITIAL.

OPEN DATASET prf_file FOR INPUT IN TEXT MODE ENCODING UTF-8.

data: l_len type i, " Length of string

gds_field1 type string.

constants:c_new_line type c value cl_abap_char_utilities=>CR_LF.

if sy-subrc <> 0.

MESSAGE i000(8i) WITH text-401.

ENDIF.

DO.

READ DATASET prf_file INTO gds_field.

if sy-subrc = 0.

gds_field1 = gds_field.

if gds_field1 ca c_new_line.

l_len = strlen( gds_field1 ).

l_len = l_len - 1.

clear gds_field.

if l_len = 0.

clear gds_field1.

else.

gds_field = gds_field1+0(l_len).

endif.

endif.

SPLIT gds_field AT cl_abap_char_utilities=>horizontal_tab

INTO TABLE gdt_field_split.

LOOP AT gdt_field_split into gds_field_split.

gdf_index = gdf_index + 1.

ASSIGN COMPONENT gdf_INDEX OF STRUCTURE w_DATA TO <FS>.

*--- Asigning the field value to a field symbol

MOVE gds_field_split TO <FS>.

ENDLOOP.

APPEND w_data TO gdt_data.

CLEAR:w_data,gdf_index,gds_field_split,gds_field.

refresh: gdt_field_split.

else.

exit.

ENDIF.

ENDDO.

CLOSE DATASET prf_file.

it_vk11 = gdt_data.

ELSE.

MESSAGE i000(8i) WITH text-402.

endif.

Regards,

Manesh.R

Note:replace the structure t_vk11with the structure present in application server(use AL11 tcode to see this file in app server)

Read only

Former Member
0 Likes
406

Jyotsna,

  1. is represented as tab. When you are reading the data from application server between open data set and close data set.

Use SPLIT at "#" and split each value into the respective work area.

So now you will have data in internal table without "#".

While downloading it into a Presentation server using CALL FUNCTION 'GUI_DOWNLOAD'

make sure u give this export parameter

write_field_separator = '#'

Hope this works,