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

Downloaded Text file format issue

former_member210804
Active Participant
0 Likes
1,670

Hi Experts,

I have download a text file with header and data. But it was not coming proper format like excel sheet where the data comes with corresponding column header. Could you please let me know how can i achieve it?

In the below screen, the headers are not in proper position.

Best regards,

Narasimha.

Hi Experts,

I have download a text file with header and data. But it was not coming proper format like excel sheet where the data comes with corresponding column header. Could you please let me know how can i achieve it?

In the below screen, the headers are not in proper position.

Best regards,

Narasimha.

7 REPLIES 7
Read only

rosenberg_eitan
Active Contributor
0 Likes
1,469

Hi,

How the end user is going to view the file ?

If you will use CSV format then Excel will do the alignment for you.

Have a look here:

Regards.

Read only

0 Likes
1,469

Hi Eitan,

I have a requirement for text file with proper alignment same like how we get in excel sheet . Could you please tell me how we can do it?

Best regards,

Narasimha>

Read only

0 Likes
1,469

You could have fun to align the titles giving them the same length as the data fields ... But what will happen if (when) a user changes his notepad options to use a non-proportional font...


Regards,

Raymond

Read only

0 Likes
1,469

Hi,

I did not think about this one.....

Regards.

Read only

0 Likes
1,469

Hi,

Have a look at the "WRITE" or "WRITE TO" commands additions.

  [pos][(len)]

[LEFT-JUSTIFIED|CENTERED|RIGHT-JUSTIFIED]

You can use those to write to data set or a character variable .

Regards .

Read only

Former Member
0 Likes
1,469

Hi narasimha,

This is purely aligned.

what I mean is, all the fields in the header and data are separated with a single tab.

But if you want them to be aligned like given below

PERNR     BEGDA         ENDDA

012003      01.01.2008    31.01.2015

Then please use same length  for all the data fields.

That means, the header label 'PERNR', 'BEGDA' and 'ENDDA' should be saved in the internal table with the same data type so that the labels and the data all have same length.

Read only

former_member809980
Participant
0 Likes
1,469

hi,

fm GUI_DOWNLOAD itself align the headers and the data.

please refer the following code..

  w_header-text = 'Sales Document'.

  APPEND w_header TO it_header .

  CLEAR w_header.

  w_header-text = 'Message Type'.

  APPEND w_header TO it_header .

  CLEAR w_header.

  w_header-text = 'Message'.

  APPEND w_header TO it_header .

  CLEAR w_header.

  CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

      filename                = lv_file

      filetype                = 'ASC'

      write_field_separator   = 'X'

      show_transfer_status    = 'X'

    TABLES

      data_tab                =  it_data

      fieldnames              = it_header

hope this will help..