Problem in exporting ALV output to a spreadsheet.

Hi All,
We have an existing Aging report in our project where in the output in ALV  there is a row for Header data fields and a row below for Item data fields.Now the user wants that when he export the report to a spreadsheet the headings of Header and Item data should come in a single line without changing the layout in the report.
The report is calculating some totals which he wants to get in the same way as it is now.
Please guide me on how to go about this.
Thanks in Advance,
Saket.

Hi Saket Tiwari,
Your existing program must be storing all the values in an internal table and then displaying it in ALV format.
Try adding the following code to your existing code.
data : lv_filename type string,
         lv_filepath type string,
         lv_fullpath type string.
Add the following code to select the path where the user wants to save the excel sheet
the following method will take the path where the excel sheet is to be saved & the name of the excel sheet.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE         = 'Select The Path Where Error File Should Be Saved'
DEFAULT_FILE_NAME    = 'ExcelSheetName.xls'
CHANGING
FILENAME             = lv_filename
PATH                 = lv_filepath
FULLPATH             = lv_fullpath
EXCEPTIONS
CNTL_ERROR           = 1
ERROR_NO_GUI         = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS               = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
The following function module will take the path as its input and save the contents of internal table in the form of excel sheet at the required place.
call function 'GUI_DOWNLOAD'
EXPORTING
filename  = lv_fullpath
filetype                = 'ASC'
append                  = 'X'
write_field_separator   = 'X'
TABLES
data_tab                = itab_name
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.
itab_name is the name of internal table where the content is saved.
hope this piece of code helps you...add it in ur existing code after collecting all the data in an internal table.
Regards,
Radhika
Edited by: RadhikaS on May 29, 2009 9:23 PM

Similar Messages

  • Problem in downloading ALV output in excel

    Dear Abapers,
                           I am facing a problem while downloading alv output in spreadsheet. Report headers and data headings are coming in excle but contents are missing instead of that No Data is displaying on excel sheet. I have debug that and observed the deep structure name T_OUTTAB using by the FM ALV_DATA_EXPORT is empty, It should contain the contents of my output data.
    Below I am giving my code. 
    ***********************************************declaration****************
          BEGIN OF d_file_out,
            index           TYPE i,                      "Index no
            msg             TYPE string,              "Message
            msgtyp(1)       TYPE c,                 "Message type
           END OF d_file_out,
    DATA:t_file_out       TYPE TABLE OF d_file_out.
    DATA:wa_file_out          TYPE d_file_out.
    Display Error Logs
    PERFORM display_logs USING text-006.
    FORM display_logs USING p_text TYPE string.
      CONSTANTS:  c_count    TYPE char5 VALUE 'INDEX',
                  c_mestyp   TYPE char6 VALUE 'MSG',
                  c_message  TYPE char7 VALUE 'MSGTYP'.
    *Field catalog
      PERFORM: z_field_catalog USING c_count   text-010,  "Record number
               z_field_catalog USING c_mestyp  text-011,  "Message type
               z_field_catalog USING c_message text-012.  "Message
    *Top of page event
      PERFORM z_event USING t_events.
    wa_layout-colwidth_optimize = c_x.
    ALV grid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
         i_buffer_active          = 'X'
           i_callback_program = sy-repid
         is_layout          = wa_layout
         I_STRUCTURE_NAME   = wa_file_out
          it_fieldcat        = t_field
          it_events          = t_events
        TABLES
          t_outtab           = t_file_out
        EXCEPTIONS
          program_error      = 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.
    ***********************************Fieldcatalog**********************************************
    FORM z_field_catalog USING p_field TYPE any
                                                p_name  TYPE any.
      wa_field-fieldname = p_field.
      wa_field-seltext_l = p_name.
      IF p_field = 'INDEX'.
        wa_field-outputlen = '14'.
        wa_field-col_pos = 1.
      ELSEIF p_field = 'MSG'.
        wa_field-outputlen = '120'.
        wa_field-col_pos = 2.
      ELSEIF p_field = 'MSGTYP'.
        wa_field-outputlen = '08'.
        wa_field-col_pos = 3.
      ENDIF.
      APPEND wa_field TO t_field.
      CLEAR wa_field.
    ENDFORM. 
    Here I have given my code, which contain the building of field catalog and Calling ALV Grid. I have already checked the excel micros settings. Other programs are working fine on my system and downloading in excel is also working.
    Hope to get reply soon.
    Regards,
    Himanshu

    Hi ,
    use this to down load to xcel
    v_file = lv_file.
      DATA:  BEGIN OF s_head OCCURS 0,
             head(40) TYPE c ,
             END OF s_head.
      s_head-head = text-015."'Sales price'.   * for header
      APPEND s_head.
      s_head-head = text-016."'Purchase price'.   * for header
      APPEND s_head.
      s_head-head = text-017."'Listing Procedure'.   * for header
      APPEND s_head.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_file
         filetype                        = 'ASC'
         write_field_separator           = '#'
        TABLES
          data_tab                        = it_output1[]
          fieldnames                      = s_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.

  • Problem While Exporting the Output

    Dear All ,
    I am facing a problem while exporting the ALV output to Spreadsheet.
    When I click on Menu LIST->Export-->Spreadsheet, One pop is coming with title "Save XXL list object in SAPOffice" In that it is asking me to save Name of the List object and a Title.
    Please guide me what needs to be done for this.
    Regards,
    Nikhil

    Hi, Nikhil
    You can USE a Short Cut Key Ctrl + Shift + F9 and than select the type in you want to download in your case you will select Spreadsheet
    Regards,
    Faisal

  • Problem in exporting ALV Report to excel sheet

    Hi All,
    I have developed a Report and now facing problem in exporting the same to excel sheet.
    When we click the "Locate File" icon in the report layout, the system will pop up a window with radio buttons. I have opted for 'Spreadsheet'.
    When i save the excel sheet into my desktop, the excel file has all the report headers (Title of each column). But no value is exported.
    There are around 15 columns in the report and the excel sheet shows value of last 2 columns which has some text.
    I have been into ALV report development and developed around 30+ reports in the same fashion.
    What might be the reason behind this issue?
    When i export other reports into excel sheet, everything is perfect without any flaws......
    Kindly help me out......
    Regards
    Pavan

    Hi,
    Here's my suggestion: Install OpenOffice.org and ask SAP to deliver good integration with OpenOffice.org.
    Alternative suggestion: re-install SAP Gui on the PC where the integration is not working. If that does not help, re-install Microsoft Office as well.
    Here's my comment: I think you should ask this question in a different forum, e.g. in the Duet forum. That may not be the correct forum either, but as it is a Microsoft/SAP integration technology forum, someone there may know the solution.
    Regards,
    Raj.

  • Problem: User has problems to export ALV Grid to Excel...

    Hello experts,
    I have a very strange problem with an single user: when she tries to export ALV Grid data from SAP into Excel by List/Export/Spreadsheet, she's only able to export this to an xml-based file on her local client, every other user gets the popup to choose the spreadsheet format (XXL...).
    What I did so far:
    - Look up Excel Makro Security --> the same as on other desktops
    - SAP GUI Patch Level --> the same as on other desktops
    - Test with an different user on her desktop on SAP Report S_ALR_87012284 --> it worked perfectly
    - User parameters are the same as for the test user
    - Security regarding ALV is the same (S_GUI ACTVT = 61...)
    Has there ever been a similar problem to anyone else?
    Many thanks in advance for your feedback!

    Hi ,
    This problem looks very weired. Just try running that FM from SE37 from the same system and see that what is happening there.... if the problem is similar then it is not the problem of your report and some patch may be missing in that system.

  • Total problem in Exporting ALV GRID to Excel

    Hi all,
    I have manipulated the Total of ALV Grid by using GET_SUBTOTALS and REFRESH method of CL_GUI_ALV_GRID. The ALV Output is also correct. When i export to Excel,only the Original total is displaying not the calculated one. How to download the exact output which is displaying in the ALV Grid to Excel.
    Please help me out to solve this.
    Thanks,
    Ramesh

    DEAR,
    AS U WANT UPLOAD WITH THE SUB TOTAL YOU TRY THIS.
    FIRST to get subtotal in ALV output you select at least one column of total and then press ctrl + F6 . u will see the sub total .
    and now how to download it so press  ctrl + shift + F9 .
    now screen appears and select second option ie spreadsheet and press enter
    now a screen appear  in wich u have to give file name.
    so double click on search button of file name . click on desktop  give ur file name as u want suppose zreport u have given.
    and save type = excel file.
    now save it and then generate it your output bytes will be transmitted .
    now u can see in your desktop in your file name . ur output with subtotal.
    regards
    navin

  • Problem in Download ALV Output to Excel

    Hi All,
    When iam going to Download the ALV ( Grid ) Output to Excel, all columns are not coming in Output.
    But the ALV Output Contains 140 Columns.
    How to solve this issue.
    Points Rewarded.
    Thanks & Regards,
    Kiran . I

    Hi,
    You can download the report by going to menu option
    List->export->local file.. in this select spreadsheet and give the name for this to download.
    You can view all the columns here in xls sheet.
    Regards,
    Ram Mohan
    Pls reward poins if useful...

  • Problem in download ALV output

    Hi experts,
         When I try to download my ALV report output, its giving dump  'Field symbol has not yet been assigned.
         In my ALV output, I have 46 fields/columns. When I have 18 fields/columns or less, I able to download, but if it is more than 18. Its giving the above dump.
    *Error details:*
    Runtime Errors         GETWA_NOT_ASSIGNED
    Date and Time          05.09.2009 17:56:13
    Short text
         Field symbol has not yet been assigned.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLKKBL" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         You attempted to access an unassigned field symbol
         (data segment 110).
         This error may occur if
         - You address a typed field symbol before it has been set with
           ASSIGN
         - You address a field symbol that pointed to the line of an
           internal table that was deleted
         - You address a field symbol that was previously reset using
           UNASSIGN or that pointed to a local field that no
           longer exists
         - You address a global function interface, although the
           respective function module is not active - that is, is
           not in the list of active calls. The list of active calls
           can be taken from this short dump.
    Please provid the solution for this.
    Thanks and regards,
    Subbu

    Hi Sandra,
    As you told, There is a problem  in populating field catalog.
    Actually, I had passed the same field name 2 times while populating field catalog table. Thats why, the issue has been raised. Now I changed it accordingly.
    Thanks and regards
    Subbu
    Edited by: subbu_1983 on Sep 6, 2009 11:10 AM

  • Problem in downloading alv output to spreadsheet using sap standard downlo.

    Hi all,
    I have an ALV report Output of approx 120 columns , But when I am downloading the output to spreadsheet using standard download button , thefile is downloaded but the columns in multiple lines, is there any method/setting by which i can download the column output in same line. using the same sap standard button
    thanks
    bobby

    answered

  • Problem when export ALV.

    Hello,
    I have a problem with the function REUSE_ALV_GRID_DISPLAY.
    When click to the button Local File... (CrtlShiftF9) my report give me a run timer error.
    Runtime Errors         GETWA_NOT_ASSIGNED                                                         
    Date and Time          16.03.2009 11:43:34                                                                               
    Short text                                                                               
    Field symbol has not yet been assigned.                                                                               
    What happened?                                                                               
    Error in the ABAP Application Program                                                                               
    The current ABAP program "SAPLKKBL" had to be terminated because it has                      
         come across a statement that unfortunately cannot be executed.                                                                               
    Error analysis                                                                               
    You attempted to access an unassigned field symbol                                           
         (data segment 75).                                                                               
    This error may occur if                                                                      
         - You address a typed field symbol before it has been set with                               
           ASSIGN                                                                               
    - You address a field symbol that pointed to the line of an                                  
           internal table that was deleted                                                            
         - You address a field symbol that was previously reset using                                 
           UNASSIGN or that pointed to a local field that no                                          
           longer exists                                                                               
    - You address a global function interface, although the                                      
           respective function module is not active - that is, is                                     
           not in the list of active calls. The list of active calls                                  
           can be taken from this short dump.                                                                               
    Trigger Location of Runtime Error                                                                
         Program                                 SAPLKKBL                                             
         Include                                 LKKBLF99                                             
         Row                                     3.840                                                
         Module type                             (FORM)                                               
         Module Name                             GEN_FIELD_OUT2                                                                               
    Source Code Extract                                                                               
    Line  SourceCde                                                                               
    3810       format hotspot on.                                                                   
      3811     elseif gs_fc-hotspot = 'V'                                                             
      3812        and gs_out_flags-hotline is initial and not <field> is initial                      
      3813        and gt_stack-is_layout-no_hotspot is initial.                                       
      3814       format hotspot on.                                                                   
      3815     endif.                                                                               
    3816 *>>> new API                                                                               
    3817     perform salv_set_cell_hotspot using l_celltype.                                        
      3818 *<<< new API                                                                               
    3819     if gs_fc-input = 'X' and                                                               
      3820        gt_stack-is_layout-no_input is initial and                                          
      3821        gs_fc-checkbox is initial.                                                          
      3822       format input on.                                                                     
      3823       format intensified off.                                                              
      3824     endif.                                                                               
    3825     if not gs_fc-emphasize is initial and gs_out-info is initial.                          
      3826       perform field_color_normal using gs_fc                                               
      3827 *                                      gt_stack-is_layout                                  
      3828                                        gs_out-info.                                        
      3829     endif.                                                                               
    3830                                                                               
    3831 *   complex logic with internal table for color description                                
      3832     data: lr_tabledescr  type ref to cl_abap_tabledescr,                                   
      3833           ls_lvc_color   type lvc_s_scol,                                                  
      3834           lt_kkbl_color  type kkblo_t_specialcol,                                          
      3835           ls_kkbl_color  type kkblo_specialcol.                                            
      3836                                                                               
    3837     if gs_out_flags-mcoltab = 'X' and gs_out_flags-slave ne 'X' and                        
      3838        gs_out_flags-sum ne 'X'.                                                            
      3839       lr_tabledescr ?= cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ).                
    >>>>>       if lr_tabledescr->applies_to_data( <coltab_any> ) eq 'X'.                            
      3841         loop at <coltab_lvc> into ls_lvc_color.                                            
      3842           move-corresponding ls_lvc_color to ls_kkbl_color.                                
      3843           ls_kkbl_color-fieldname = ls_lvc_color-fname.                                    
      3844           append ls_kkbl_color to lt_kkbl_color.                                           
      3845         endloop.                                                                           
      3846         assign lt_kkbl_color to <coltab>.                                                  
      3847       endif.                                                                               
    3848       perform field_color_complex using <coltab>                                           
      3849                                         gs_fc                                              
      3850                                         gs_out_flags-color                                 
      3851                                         gs_out_flags-intensified                           
      3852                                         gs_out_flags-inverse.                              
      3853     elseif gs_out_flags-scoltab = 'X' and gs_out_flags-slave = 'X' and                     
      3854            gs_out_flags-sum ne 'X'.                                                        
      3855       lr_tabledescr ?= cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ).                
      3856       if lr_tabledescr->applies_to_data( <coltab_any_slave> ) eq 'X'.                      
      3857         loop at <coltab_lvc_slave> into ls_lvc_color.                                      
      3858           move-corresponding ls_lvc_color to ls_kkbl_color.                                
      3859           ls_kkbl_color-fieldname = ls_lvc_color-fname.                                     
    I verify the internal table it has 315 values export to excel.
    How can i solve this problem?

    I try to download the output from SYSTEM>LIST>SAVE LOCAL FILE, but it was disable.
    here is the report code:
    REPORT zfir0021.
    TABLES: bsid, yypcl_fiboleto.
    TYPE-POOLS: slis.
    TYPES: BEGIN OF tp_bsid,
    bukrs     TYPE bukrs,
    kunnr     TYPE kunnr,
    umsks     TYPE umsks,
    umskz     TYPE umskz,
    augdt     TYPE augdt,
    augbl     TYPE augbl,
    zuonr     TYPE dzuonr,
    gjahr     TYPE gjahr,
    belnr     TYPE belnr_d,
    buzei     TYPE buzei,
    END OF tp_bsid.
    TYPES: BEGIN OF tp_dd03l,
    fieldname TYPE dd03l-fieldname,
    position  TYPE dd03l-position,
    keyflag   TYPE dd03l-keyflag,
    rollname  TYPE dd03l-rollname,
    datatype  TYPE dd03l-datatype,
    END OF tp_dd03l.
    +*----
    *+
    *** Variáveis
    +*----
    *+
    DATA w_catalogo TYPE slis_fieldcat_alv.
    DATA w_layout   TYPE slis_layout_alv.
    DATA t_catalogo TYPE slis_t_fieldcat_alv.
    DATA: v_layout TYPE slis_layout_alv,
    t_dd03l TYPE STANDARD TABLE OF tp_dd03l WITH HEADER LINE.
    DATA t_bsid TYPE STANDARD TABLE OF bsid WITH HEADER LINE.
    DATA: t_bsid_aux TYPE STANDARD TABLE OF bsid WITH HEADER LINE,
    t_yypcl_fiboleto TYPE STANDARD TABLE OF yypcl_fiboleto WITH HEADER LINE,
    t_reg_ok TYPE STANDARD TABLE OF yypcl_fiboleto3 WITH HEADER LINE,
    t_reg_err TYPE STANDARD TABLE OF yypcl_fiboleto3 WITH HEADER LINE.
    +*----
    *+
    *** Parâmetros de seleção
    +*----
    *+
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-s02.
    SELECT-OPTIONS: s_blart FOR bsid-blart,
    s_situa FOR yypcl_fiboleto-situacao,
    s_data  FOR bsid-budat.
    SELECTION-SCREEN END OF BLOCK bl1.
    * Execução do Programa
    START-OF-SELECTION.
    PERFORM seleciona_dados.
    PERFORM imprime_resultado.
    PERFORM catalogo.
    PERFORM gerar_alv.
    END-OF-SELECTION.
    +*&----
    *+
    *&      Form  seleciona_dados
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    +FORM seleciona_dados .+
    +*  DATA lr_situacao TYPE RANGE OF yypcl_fiboleto-situacao WITH HEADER LINE.+
    *  lr_situacao-sign = 'I'.
    *  lr_situacao-option = 'EQ'.
    *  lr_situacao-low = '1'.
    *  APPEND lr_situacao.
    *  lr_situacao-low = '4'.
    *  APPEND lr_situacao.
    SELECT * INTO TABLE t_bsid
    FROM bsid
    WHERE bukrs EQ '0050'
    AND blart IN s_blart
    AND budat IN s_data
    AND anfbn <> ''.
    SELECT *
    INTO TABLE t_yypcl_fiboleto
    FROM yypcl_fiboleto
    WHERE empresa   EQ '0050'
    AND dtemissao IN s_data
    AND situacao  IN s_situa
    AND tpdoc     IN s_blart.
    ENDFORM.                    " seleciona_dados
    +*&----
    *+
    *&      Form  imprime_resultado
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    FORM imprime_resultado.
    SORT t_bsid BY bukrs kunnr gjahr belnr buzei.
    SORT t_yypcl_fiboleto BY empresa cdcliente gjahr nudoc_cont itdoc_cont.
    LOOP AT t_bsid.
    READ TABLE t_yypcl_fiboleto WITH KEY empresa = t_bsid-bukrs
    cdcliente = t_bsid-kunnr
    gjahr = t_bsid-gjahr
    nudoc_cont = t_bsid-belnr
    itdoc_cont = t_bsid-buzei
    BINARY SEARCH.
    IF NOT sy-subrc IS INITIAL.
    t_bsid_aux = t_bsid.
    APPEND t_bsid_aux.
    ENDIF.
    ENDLOOP.
    ENDFORM.                    " imprime_resultado
    +*&----
    *+
    *&      Form  catalogo
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    FORM catalogo.
    DATA l_cont TYPE i.
    SELECT fieldname position keyflag rollname datatype
    INTO TABLE t_dd03l
    FROM dd03l
    WHERE tabname = 'BSID'
    AND rollname <> '.INCLUDE' AND
    rollname <> 'MANDT' .
    SORT t_dd03l BY position.
    LOOP AT t_dd03l.
    ADD 1 TO l_cont.
    PERFORM insert_catalogo USING:
    t_dd03l-fieldname
    t_dd03l-keyflag
    'L'
    t_dd03l-datatype
    l_cont
    'C410'.
    ENDLOOP.
    ENDFORM.                    " catalogo
    +*&----
    *+
    *& Form INSERT_CATALOGO
    +*&----
    *+
    FORM insert_catalogo USING f_campo
    f_tamanho
    f_texto
    f_alinhamento
    f_somatorio
    f_tipo
    f_decimais
    f_checkbox
    f_input
    f_hotspot
    f_no_out
    f_pos
    f_cor.
    CLEAR w_catalogo.
    w_catalogo-col_pos = f_pos.
    w_catalogo-fieldname = f_campo.
    w_catalogo-key = ' '.
    w_catalogo-outputlen = f_tamanho.
    w_catalogo-seltext_s = f_texto.      " descrição curta
    w_catalogo-seltext_m = f_texto.      " descrição média
    w_catalogo-seltext_l = f_texto.      " descrição longa
    w_catalogo-just = f_alinhamento.
    w_catalogo-do_sum = f_somatorio.     " totalizar coluna
    w_catalogo-datatype = f_tipo.
    w_catalogo-decimals_out = f_decimais.
    w_catalogo-checkbox = f_checkbox.    " exibir como checkbox
    w_catalogo-input = f_input.          " modificação permitida
    w_catalogo-hotspot = f_hotspot.      " chama form USER_COMMAND
    w_catalogo-no_out = f_no_out.        " Ocultar campo inicialmente
    IF w_catalogo-datatype <> 'CHAR'.
    w_catalogo-no_zero = 'X'.
    ENDIF.
    w_catalogo-emphasize = f_cor.
    APPEND w_catalogo TO t_catalogo.
    ENDFORM.                               " INSERT_CATALOGO
    +*&----
    *+
    *&      Form  gerar_alv
    +*&----
    *+
    +*       Gera o ALV com as informações da T_YYPCL_FIBOLETO_AUX+
    +*----
    *+
    FORM gerar_alv.
    v_layout-colwidth_optimize = 'X'.  " Largura melhor possível da coluna
    v_layout-no_input = 'X'.
    v_layout-info_fieldname = 'COLOR_LINE'.
    v_layout-coltab_fieldname = 'CELL_COLOUR'.
    v_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program      = sy-repid
    i_structure_name        = 'BSID'
    *      i_callback_user_command = 'Z_USER_COMMAND'
    is_layout               = v_layout
    it_fieldcat             = t_catalogo
    i_save                  = 'A'
    TABLES
    t_outtab                = t_bsid_aux
    EXCEPTIONS
    program_error           = 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.
    ENDFORM.                    " gerar_alv

  • Problem in exporting ALV Layout to excelsheet!!!

    Hi,
    I am facing a problem while trying to export an ALV layout to Excel sheet. While the values appear correctly, the order of the columns gets distorted. So the table in Excel appears with correct values but with columns in disarray. I have checked the settings of Excel (SECURITY LEVEL is Medium and TRUSTED SOURCES "Trust All Installed Add-Ins and Templates" and "Trust Access to Visual Basic Project" is checked.) and its doesn’t seem to be change anything.
    Any suggestions?

    Hi,
    Follow the below procedures to export data to excel.
    Normal ALV :
    Click on the local file option and select spreadsheet option from the radio button list and click on ok , file save window will open , select the correct directory path and give the file name , then ALV contents will be downloaded into Excel sheet.
    In OO ALV :
    click on the Export button in the ALV toolbar ->click on the spreadsheet , then information message window will open , select ok button , then you will get three options , click on the table option and press ok , data will be exported to Excel sheet , then save the excel data in specified directory.
    Regards
    Appana

  • Problem while exporting ALV column header to excel sheet.

    Hi,
    I am able to export an ALV grid details to an excel sheet. But the ALV column headers when exported to excel sheet are getting truncated.
    For eg: if my column header in ALV grid is displayed as 'Material' then the column header in excel sheet is 'Mater' only. Remaining portion is getting truncated.
    How can I view the entire column header text?
    Kindly assist.
    Thanks.

    I have the same problem with you, when user export to excel. I fixed it by using
    w_layo-colwidth_optimize = 'X'. <<<<<<<<<<<<This
    perform generate_fcat_reftab
        using 'PRUEFLOS' 'T_INPUT' '' '' 'Inspection Lot' 0.
    form generate_fcat_reftab  using    p_fieldname
                                        p_tabname
                                        p_ref_tabname
                                        p_ref_fieldname
                                        p_output_text
                                        p_output_lenght.
      clear w_fcat.
      w_fcat-fieldname = p_fieldname.
      w_fcat-tabname   = p_tabname.
      w_fcat-ref_fieldname = p_ref_fieldname.
      w_fcat-ref_tabname = p_ref_tabname.
      w_fcat-seltext_s = p_output_text.
      w_fcat-seltext_m = p_output_text.
      w_fcat-seltext_l = p_output_text.
      w_fcat-outputlen = p_output_lenght.
      w_fcat-ddictxt = 'L'. <<<<<<<<<<<<<<<<<<This
      append w_fcat to t_fcat.
    endform.

  • Problem in downloading ALV output to Excel

    Here are the details of short dump.
    Run time Error OBJECTS_NOT_CHARLIKE
    The current statement only supports character-type data objects.
    What happened?
    Error in ABAP application program.
    The current ABAP program "SAPLKKBL" had to be terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    In statement
       "STRLEN( obj )..."
    the argument "obj" can only take a character-type data object.
    In this case, the operand "obj" has the non-character type "P".

    Declare another variable of same length as 'obj' let us say its obj1 , then move 'obj' to 'obj1', now findout the length of 'obj1', which wil be the same value.
    MOVE obj TO obj1.
    STRLEN(obj1).
    Hope ur dump wil not trigger again.
    Regards,
    Sujatha.

  • Problem with alv output export to text file

    hi experts,
    when iam exporting alv output to text file,
    some data is missing in text file.say for example sold-to-party value is 1155027 in alv out put,but in text file it is showeing only 115502 ,
    the last digit is missing,
    can anyone help urgent!!!!!

    and when you export it to excel?
    from here you could save it as text file too...
    A.

  • Problem in alv output download

    HI All,
    My problem is
    My alv output table contains long text with value as 1000 characters.
    when i am downloading my alv output into excel, it is downloading only 255 characters length.
    is there any ways to download the entire long text into excel.
    Please help me on this...
    Thanks in advance.
    Maruthi Konijeti

    see the following example.
    REPORT z_down_xml LINE-SIZE 132 NO STANDARD PAGE HEADING.
    Databases
    TABLES:
      makt,                                "Mat description
      marc,                                "Material / plant
      t001w,                               "plant name
      bhdgd.                               "Batch heading
    Internal tables
    DATA:
      BEGIN OF gt_marc OCCURS 0,
        werks LIKE marc-werks,
        matnr LIKE marc-matnr,
      END OF gt_marc,
    Table to be downloaded as xml. Each line stores start and end tags
    and the value
      BEGIN OF gt_xml OCCURS 0,
        line(120),
      END OF gt_xml,
      g_maktx(120).
    User-input
    SELECT-OPTIONS:
      s_werks FOR marc-werks,
      s_matnr FOR marc-matnr.
    START-OF-SELECTION.
    Extract all required data
      PERFORM main_processing.
    END-OF-SELECTION.
      SORT gt_marc BY werks matnr.
      LOOP AT gt_marc.
        AT FIRST.                          "First tag must be root
          CLEAR gt_xml.
          gt_xml-line = ''.
        APPEND gt_xml.
        CLEAR gt_xml.
    display data
        FORMAT COLOR 2 ON.
        WRITE :/ gt_marc-matnr, makt-maktx.
        FORMAT COLOR 2 OFF.
      ENDLOOP.
    The last tag must be the root closing tag --*
      gt_xml-line = '</LOCATIONS>'.
      APPEND gt_xml.
      CLEAR gt_xml.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename = 'C:PLANT1.XML'
                filetype = 'ASC'
           TABLES
                data_tab = gt_xml.
    TOP-OF-PAGE.
      MOVE sy-title TO bhdgd-line1.
      MOVE sy-repid TO bhdgd-repid.
      MOVE sy-uname TO bhdgd-uname.
      MOVE sy-datum TO bhdgd-datum.
      MOVE '0' TO bhdgd-inifl.
      MOVE '132' TO bhdgd-lines.
      FORMAT INTENSIFIED ON COLOR COL_HEADING.
      PERFORM batch-heading(rsbtchh0).     "report header
    Form READ_PLANT
    FORM read_plant.
    Get plant name
      CLEAR t001w.
      SELECT SINGLE name1
        INTO t001w-name1
        FROM t001w
       WHERE werks EQ gt_marc-werks.
    ENDFORM.                               " READ_PLANT
    Form MAIN_PROCESSING
    FORM main_processing.
    Material and plant basic data
      SELECT werks matnr
        INTO TABLE gt_marc
        FROM marc
       WHERE werks IN s_werks
         AND matnr IN s_matnr.
    ENDFORM.                               " MAIN_PROCESSING
    Form READ_DESCRIPTION
    FORM read_description.
    Material name
      CLEAR g_maktx.
      SELECT SINGLE maktx
        INTO g_maktx
        FROM makt
       WHERE matnr EQ gt_marc-matnr
         AND spras EQ 'E'.
    Replace special character
      DO.
        REPLACE '&' WITH '*ù%;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '/' WITH '&#47;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
    ENDFORM.                               " READ_DESCRIPTION

Maybe you are looking for