Skip to Content
avatar image
Former Member

How to send ALV Report in excel format from SAP

Hi Gurus,

We are using SAP 4.7 and using different SAP reports.Now I want to send SAP ALV report in excel format directly from SAP in background.Now we send these reports in background weekly by using autimetic scheduling but this is PDF format.Now I want to change this pdf format to excel format.In SCOT T.Code I am able to find any excel format.Please help me out.

I am waiting for your reply.

Advance Thanks

Nirmal

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Nov 15, 2010 at 05:22 AM

    Hi , u can use this Fun Mod 'SAP_CONVERT_TO_XLS_FORMAT'

    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

    EXPORTING

    i_field_seperator = 'X'

    • I_LINE_HEADER =

    i_filename = p_pcfile

    • I_APPL_KEEP = 'X'

    TABLES

    i_tab_sap_data = it_excel

    • CHANGING

    • I_TAB_CONVERTED_DATA =

    EXCEPTIONS

    conversion_failed = 1

    OTHERS = 2

    S.Saravana

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 28, 2013 at 03:19 AM

    Hi Sharma,

    I am also facing the same problem as you.

    I tried to configure different output type in TCODE SCOT but not able to get the required EXCEL out in th recipent mail box.

    Have you resolve the issue?

    if yes, can you share it with me?

    I have tried reporting in BI. It works as the system can send out in excel.

    bye

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 02, 2013 at 05:39 AM

    Hi Nirmal,

    I have done the same in my previous organisation.For this particular solution you need to ask your basis guys to upgrade the support package so that BCS classes could be available in the system.

    API interafces five some problem with attachemnts and SAP has recommended to use BCS classes.

    Currently BCS classes won't be availbale in 4.7.

    Once the BCS classes are available

    use below code

       CONSTANTS:

        lc_tab          TYPE c VALUE cl_bcs_convert=>gc_tab,
        lc_crlf         TYPE c VALUE cl_bcs_convert=>gc_crlf,

       lc_codepage     TYPE abap_encod VALUE '4103',

    data :

       lv_string      TYPE string,

       binary_content TYPE solix_tab,
       size           TYPE so_obj_len,

       *" Set Heading of Excel File
      CONCATENATE 'Employee DATA'
                   lc_crlf lc_crlf
                   INTO lv_string.

       *" Set Header for Excel Fields
      CONCATENATE lv_string
                  lc_header1 lc_tab
                  lc_header2 lc_tab
                  lc_header3 lc_tab
                  lc_header4 lc_tab
                  lc_header5 lc_tab
                  lc_header6 lc_tab
                  lc_header7 lc_tab
                  lc_header8 lc_tab
                  lc_header9 lc_tab
                  lc_header10 lc_crlf
                  INTO lv_string.

    "lc_header1 to 10 could be your field headers

       "Move Internal table data
      LOOP AT gt_final1 INTO gwa_final1.

        CONCATENATE lv_string
                    gwa_final1-field1     lc_tab
                    gwa_final1-field2      lc_tab
                    gwa_final1-field3    lc_crlf
                    INTO lv_string.

      ENDLOOP.

       *" convert the text string into UTF-16LE binary data including
    *" byte-order-mark. Mircosoft Excel prefers these settings
    *" all this is done by new class cl_bcs_convert (see note 1151257)
      TRY.
          cl_bcs_convert=>string_to_solix(
            EXPORTING
              iv_string   = lv_string
              iv_codepage = lc_codepage  "suitable for MS Excel, leave empty
              iv_add_bom  = abap_true     "for other doc types
            IMPORTING
              et_solix  = binary_content
              ev_size   = size ).
        CATCH cx_bcs.
          MESSAGE e445(so).
      ENDTRY.

      TRY.

    *" create persistent send request

          send_request = cl_bcs=>create_persistent( ).

      

          document = cl_document_bcs=>create_document(

            i_type    = lc_doc

            i_text    = main_text

            i_subject = lc_sub  ).     

      

          document->add_attachment(

            i_attachment_type    = lc_attach                    "#EC NOTEXT
            i_attachment_subject = lc_sub                       "#EC NOTEXT
            i_attachment_size    = size
            i_att_content_hex    = binary_content ).

       send_request->set_document( document ).

       recipient = cl_cam_address_bcs=>create_internet_address( email ).

       CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient = recipient.

       IF recipient IS NOT INITIAL.
            sent_to_all = send_request->send( i_with_error_screen = abap_true ).
            COMMIT WORK.
    *        MESSAGE text-014 TYPE gc_succ  .
          ENDIF.

        CATCH cx_bcs INTO bcs_exception.
          MESSAGE i865(so) WITH bcs_exception->error_type.
      ENDTRY.

    For BCS decalartion u can go to se 38 and see program BCS_EXAMPLE_1 to BCS_EXAMPLE_7.

    Rewrads if helpful.

    Cheers

    Ramesh Bhatt

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 14, 2013 at 05:08 AM

    Hi

    Please checkĀ  this note -439948 if it helps,

    Thanks

    Mansi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 14, 2013 at 05:09 AM

    Hi

    Refer to following notes for more information on errors

    837300

    690020

    684031

    629966

    600570

    595553

    439948

    530991

    For setting related information, kindly refer to site

    http://help.sap.com/saphelp_nw04/helpdata/en/44/5b2341144ba52fe10000000a155106/frameset.htm

    Hope it works for you.

    Add comment
    10|10000 characters needed characters exceeded