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: 

Problem related to tab in write statement

Former Member
0 Kudos

Hi,

I want to use the 'tab' for the report layout, as the requirement is, user should be able to save the spool report to the excel sheet.

IF i use, simple stmts to displays values, in the excel sheet it comes in a single column.

If I use tab then it displays '#' between the fields.

like:

PERNR # Error

111 # Text

I want to supress this # symbol.Please help

5 REPLIES 5

Former Member
0 Kudos

Try to concatenate lt-cust-kunnr, lt_cust-name1, lt_cust-stras, lt_cust-ort01 int lt_tab-field1. Then CL_GUI_DOWNLOAD of lt_tab.

This will separate the fields into corresponding columns.

Former Member
0 Kudos

Try to concatenate lt-cust-kunnr, lt_cust-name1, lt_cust-stras, lt_cust-ort01 int lt_tab-field1. Then CL_GUI_DOWNLOAD of lt_tab.

This will separate the fields into its corresponding columns.

Former Member
0 Kudos

Hi Heena,

simple way is to download Spool to text file and use Text Import wizard to Import data from text file to Excel. (specify tab as delimiter).

If you want to do it programatically, read the content of spool in internal table and download it in Excel using GUI_DOWNLOAD function module.

Regards,

Mohaiyuddin

venkat_o
Active Contributor
0 Kudos

Hi Heena, Here is the sample program to read spool based on spool no and download into Excel as it is on the output with top of page . Check the program and use it in ur program .

REPORT  zvenkat_notepad.

PARAMETERS: spoolno TYPE tsp01-rqident,
            p_file  TYPE string DEFAULT 'c:\tmp\test1.xls'.

DATA:i_mem_tab      LIKE abaplist OCCURS 10,
     i_output(1000) TYPE c        OCCURS 10.

START-OF-SELECTION.

  SUBMIT rspolist EXPORTING LIST TO MEMORY AND RETURN
                  WITH rqident = spoolno.

  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = i_mem_tab
    EXCEPTIONS
      not_found  = 1
      OTHERS     = 2.

  CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listasci           = i_output
      listobject         = i_mem_tab
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename = p_file
    TABLES
      data_tab = i_output.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
I hope that it gives u some inputs. Regards, Venkat.O

Former Member
0 Kudos

Hi,

This u r telling from point of downloading the file pragrammatically.

I m talking abt SAP standard functionalty in from spool to save as "Spreadsheet".

Thanx in advance.