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: 

downloading into excel sheet

0 Kudos

Hi,

I Have a requirement a Reopt Downlod to excel sheet i have done .

but the problem is when i download to excel sheet it showing some space

for example

Row MNumber Plant

1 24-1002-00XXXX G00

2 AS07230XXXXXX G00

material number Right side some space is there please remove the space

XXXXX is a space

pleae can you help how to remove the space ..

thanks

BRS

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Before passing the values to itab, try CONDENSE the value.

Check this [link|http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm]

7 REPLIES 7

Former Member
0 Kudos

Hi,

Before passing the values to itab, try CONDENSE the value.

Check this [link|http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm]

0 Kudos

before meands download table r final table

Former Member
0 Kudos

Hi Shankar,

Try using the below code which I used to download data to excel sheet.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension = 'XLS'
        IMPORTING
          filename          = fnam
          fullpath          = file_name.

wa_head-fileds = text-001.   " Here it_head is internal table having one field of char type and append it with column                                                                                "name
  APPEND wa_head TO it_head.    
  CLEAR  wa_head.

  wa_head-fileds = text-002.
  APPEND wa_head TO it_head.
  CLEAR  wa_head.

  wa_head-fileds = text-003.
  APPEND wa_head TO it_head.
  CLEAR  wa_head.


      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = fnam                    
          filetype                = 'ASC'
          write_field_separator   = 'X'
        TABLES
          data_tab                = it_data              "Ur internal table having data to be downloaded
          fieldnames              = it_head
        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.

      IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

Hope it will solve your problem. If you are still facing some issues then please let us know.

Cheers

VJ

Former Member
0 Kudos

Hi,

U have to initialize that field as Matnr(18) type c in that structure, i think u have initialized that likethis matnr like mara-matnr or matnr type matnr.

it might help u.

Edited by: Vamshimahi on Sep 29, 2011 9:43 AM

0 Kudos

Hi vamshimahi,

In Report foreground execution no prblem its working good. but think is when i execution in back ground mode then sm37 spool download to excel sheet it cpming space. that is issue.

thanks

BRS

0 Kudos

Hi,

You say:

In Report foreground execution no prblem its working good

How are you outputting data in foreground, with an ALV grid or just WRITE statement? That's not very clear...

If you typed your material fields with TYPE mara-matnr or TYPE matnr, a conversion routine (CONVERSION_EXIT_MATN1_INPUT/OUTPUT, and user exits can also be processed in those) will automatically be called based on the domain name. That routine will use some customizing data from table TMCNV. In that table some length attributes can be set... Can you check that?

In order to avoid automatic conversion, simply change the declaration with a TYPE char18.

Kr,

m.

Former Member
0 Kudos

Hi BRsankar

Call the function module 'GUI_DOWNLOAD".

Pass the exporting parameters - File name,File type,Write Field Separator as 'X'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'Filename.XLS'. ********File name means you need to specify the path where you want to store it.

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X '

TABLES

DATA_TAB = 'IT_TABLE' ****Final internal table suppose 'IT_TABLE'..

.

File name = 'C:\Documents and Settings\E50039\Desktop\filename.xls'.

Pass in this way i think it will be very useful for you.

Regards

G.Aditya