Skip to Content
author's profile photo Former Member
Former Member

export data to excel in alv

hi everybody ,

could you give me an example about export data to excel with no ole objects?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Sep 18, 2007 at 11:33 AM

    Use the function module GUI_DOWNLOAD

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename              = 'c:temptest_xl.xls'
        filetype              = 'ASC'
        write_field_separator = 'X'
        DAT_MODE              = 'X'
        TRUNC_TRAILING_BLANKS = 'X'
      TABLES
        data_tab              = itab.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 11:35 AM

    Hello,

    For transferring data from itab to excel u can use

    FMs

    GUI_DOWNLOAD

    SAP_CONVERT_TO_XLS_FORMAT

    Reward if helpful,

    Regards,

    LIJO

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 11:37 AM

    Hi,

    you have a button in ALV application toolbar to export the data in excel

    why do u need code for that?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 11:37 AM

    You can use FM - ALV_XXL_CALL , it exports the data with formatting and column heading.

    REPORT  ZSKC_ALV_XXL.
    
    TYPE-POOLS : KKBLO.
    
    DATA : ITAB LIKE T100 OCCURS 0,
           T_FCAT_LVC TYPE LVC_S_FCAT OCCURS 0 WITH HEADER LINE,
           T_FCAT_KKB TYPE KKBLO_T_FIELDCAT.
    
    
    START-OF-SELECTION.
    
    * Get data.
      SELECT * UP TO 20 ROWS
      FROM   T100
      INTO   TABLE ITAB
      WHERE  SPRSL = SY-LANGU.
    
      CHECK SY-SUBRC EQ 0.
    
    * Create the field catalog.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
          I_STRUCTURE_NAME             = 'T100'
        CHANGING
          CT_FIELDCAT                  = T_FCAT_LVC[]
        EXCEPTIONS
          INCONSISTENT_INTERFACE       = 1
          PROGRAM_ERROR                = 2
          OTHERS                       = 3.
    
      CHECK SY-SUBRC EQ 0.
    * make sure you pass the correct internal table name in the field catalog.
      t_fcat_lvC-tabname = 'ITAB'.
      MODIFY T_FCAT_LVC TRANSPORTING TABNAME WHERE TABNAME NE SPACE.
    
    * Transfer to KKBLO format.
      CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
        EXPORTING
          IT_FIELDCAT_LVC                 = T_FCAT_LVC[]
        IMPORTING
          ET_FIELDCAT_KKBLO               = T_FCAT_KKB
       EXCEPTIONS
         IT_DATA_MISSING                 = 1
         IT_FIELDCAT_LVC_MISSING         = 2
         OTHERS                          = 3.
    
      CHECK SY-SUBRC EQ 0.
    
    * Call XXL.
      CALL FUNCTION 'ALV_XXL_CALL'
        EXPORTING
          I_TABNAME                    = 'ITAB'
          IT_FIELDCAT                  = T_FCAT_KKB
        TABLES
          IT_OUTTAB                    = ITAB[]
        EXCEPTIONS
          FATAL_ERROR                  = 1
          NO_DISPLAY_POSSIBLE          = 2
          OTHERS                       = 3.
    
      IF SY-SUBRC <> 0.
      ENDIF.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 11:50 AM

    you go to the list and press cntrlshftF7 to download the data into an excel sheet or use the FM SAP_TO_CONVERT_XLS_FORMAT.

    regards,

    srinivas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.