Error in XXL_FULL_API function module for download report to excel

Hi all,
I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema        = t_gxxlt_s. in this table we have a fields called
i_sema-col_no  = 19.
  i_sema-col_src = 19.
  i_sema-col_typ = 'STR'.
  i_sema-col_ops = 'DFT'
here in 'col_typ' if we put STR in excel it will come as a text but i wnat the time field what i have to pass ?
and for filed 'col_ops' also ??
Thaks,
Sridhar

Hi sridhar joshi,
Please check this program
REPORT Excel.
TABLES:
  sflight.
* header data................................
DATA :
  header1 LIKE gxxlt_p-text VALUE 'Suresh',
  header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
* Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
        INCLUDE STRUCTURE sflight.
DATA END   OF t_sflight.
* Internal table for holding the horizontal key.
DATA BEGIN OF  t_hkey OCCURS 0.
        INCLUDE STRUCTURE gxxlt_h.
DATA END   OF t_hkey .
* Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
        INCLUDE STRUCTURE gxxlt_v.
DATA END   OF t_vkey .
* Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
        INCLUDE STRUCTURE gxxlt_o.
DATA END   OF t_online.
* Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
        INCLUDE STRUCTURE gxxlt_p.
DATA END   OF t_print.
* Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
        INCLUDE STRUCTURE gxxlt_s.
DATA END   OF t_sema.
* Retreiving data from sflight.
SELECT * FROM sflight
         INTO TABLE t_sflight.
* Text which will be displayed online is declared here....
t_online-line_no    = '1'.
t_online-info_name  = 'Created by'.
t_online-info_value = 'KODANDARAMI REDDY'.
APPEND t_online.
* Text which will be printed out..........................
t_print-hf     = 'H'.
t_print-lcr    = 'L'.
t_print-line_no = '1'.
t_print-text   = 'This is the header'.
APPEND t_print.
t_print-hf     = 'F'.
t_print-lcr    = 'C'.
t_print-line_no = '1'.
t_print-text   = 'This is the footer'.
APPEND t_print.
* Defining the vertical key columns.......
t_vkey-col_no   = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no   = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no   = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no   = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
* Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
* populating the SEMA data..........................
t_sema-col_no  = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
  EXPORTING
*   DATA_ENDING_AT          = 54
*   DATA_STARTING_AT        = 5
   filename                = 'TESTFILE'
   header_1                = header1
   header_2                = header2
   no_dialog               = 'X'
   no_start                = ' '
    n_att_cols              = 6
    n_hrz_keys              = 1
    n_vrt_keys              = 4
   sema_type               = 'X'
*   SO_TITLE                = ' '
  TABLES
    data                    = t_sflight
    hkey                    = t_hkey
    online_text             = t_online
    print_text              = t_print
    sema                    = t_sema
    vkey                    = t_vkey
EXCEPTIONS
   cancelled_by_user       = 1
   data_too_big            = 2
   dim_mismatch_data       = 3
   dim_mismatch_sema       = 4
   dim_mismatch_vkey       = 5
   error_in_hkey           = 6
   error_in_sema           = 7
   file_open_error         = 8
   file_write_error        = 9
   inv_data_range          = 10
   inv_winsys              = 11
   inv_xxl                 = 12
   OTHERS                  = 13
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
please refer this link
http://www.thespot4sap.com/Articles/Download_to_excel.asp
Best regards,
raam

Similar Messages

  • Function module for custom report for cost center group

    Hello all,
    I wonder, if there is any SAP function module for following query:
    We have got a custom program, which evaluates cost centers. We would like to evaluate a cost center group, like it is available within the report painter - the output screen is splitted into two parts, on the left part there is the cost centre group hierarchy and on the right side, there are the values for the node, which is selected within the hierarchy.
    Is there any standard function module od do we have to program it ourself?
    Thanks in advance

    Hi Peter,
    You have a BAPI which gives you the details of cost centre group, if this is what you are looking for:
    BAPI_COSTCENTERGROUP_GETLIST
    Regards,
    Eli

  • Error while activation Function module for generic data extraction

    Hi,
    I have created a generic data source ZMATERIAL in which i have selected the Extraction by Function module. I copied the function module RSAX_BIW_GET_DATA_SIMPL to ZMATERIAL_FM, but when i activate this module it gives me error
    REPORT/PROGRAM statement missing, or program type is I (INCLUDE).
    The main program of the function "Z_BWGENDATAMATERIAL" does not begin with "FUNCTION-POOL".
    Please help me in this.

    Hi Dipika,
                  I think a similar issue is discussed
    Refer this thread
    REPORT/PROGRAM statement missing, or program type is I (INCLUDE).
    Compiling INCLUDE progam
    question related to includes
    question related to includes
    Hope these helps
    Regards
    Karthik

  • Wht are the function modules for download upload excel files in bdc.

    hi all,
    this question seems to be silly but i had open office excel files i am getting problems to upload or down loading.  can you tell which function modules can upload or down load open office excel files.
    another dought this is not need full but i need to get some of graphics which are in se78  .
    how can we dowload them from sap.
    thanq,
    rajesh.k

    Hi,
      use  :   CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
       REPORT  YKC_XL_UPLOAD.
    TYPE-POOLS TRUXS.
    TABLES : ZMARA.
    * Selection screen
    PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT
    'C:\Kris\TEST_UPLOAD.xls'.
    TYPES:  BEGIN OF T_TAB,
            MATNR   LIKE ZMARA-MATNR,
            ERSDA  LIKE ZMARA-ERSDA,
            ERNAM  LIKE ZMARA-ERNAM,
            END OF T_TAB.
    DATA :  T_UPLOAD  TYPE STANDARD TABLE OF T_TAB WITH HEADER LINE ,
            WA_UPLOAD TYPE T_TAB,
            IT_RAW TYPE TRUXS_T_TEXT_DATA.  "work table internal table
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE '
        IMPORTING
          FILE_NAME     = P_FILE.
    START-OF-SELECTION.
    * Uploading the data in the file into internal table
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
    *   I_FIELD_SEPERATOR =
    *   I_LINE_HEADER  = 'X'
        I_TAB_RAW_DATA = IT_RAW
        I_FILENAME     = P_FILE
      TABLES
        I_TAB_CONVERTED_DATA = T_UPLOAD[]
      EXCEPTIONS
        CONVERSION_FAILED = 1
        OTHERS            = 2.
      IF SY-SUBRC NE  0.
        MESSAGE ID SY-MSGID
                TYPE SY-MSGTY
                NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    END-OF-SELECTION.
    * Uploading the data into the database table
      LOOP AT T_UPLOAD INTO T_UPLOAD.
        ZMARA-MATNR = T_UPLOAD-MATNR.
        ZMARA-ERSDA = T_UPLOAD-ERSDA.
        ZMARA-ERNAM = T_UPLOAD-ERNAM.
        INSERT  ZMARA.
    Endloop.
    Tks,
    Krishna

  • Function module to download data into excel file

    Hi Friends,
    Please tell me the function module name which popsup a popup box to specify a filename and the location and when clicking on the OK button, the file should be downloaded to the specified location.
    I need it ASAP.
    Thanks,
    Jaffer Ali.S

    Hi Shamshudeen,
    You have to use two funtion modules to acheive this.
    1. To get the file path from user.
    2. To download the excel sheet in prescribed path.
    For 1 use following code
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath .
        CALL FUNCTION 'F4_FILENAME'
         EXPORTING
           program_name        = syst-cprog
           dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
         IMPORTING
           file_name           = p_fpath  .
    The file path will be stored in p_fpath.
    Now use GUI_DOWNLOAD function module and pass the file name p_fpath to it along with filetype as .xls
    Hope this helps you.
    Thanks,
    Arun

  • Function Module to DownLoad data in excel.

    Hi All,
    Is there a FM to download data in excel sheet.
    Regards,
    Vidya.

    Hi use this works.
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    Uploading data from Local system to SAP.
    PARAMETERS: p_file TYPE  rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          field_name = 'P_FILE'
        IMPORTING
          file_name  = p_file.
    START-OF-SELECTION.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
        I_FIELD_SEPERATOR        =
          i_line_header            =  'X'
          i_tab_raw_data           =  it_raw            " WORK TABLE
          i_filename               =  p_file
        TABLES
          i_tab_converted_data     = i_spread[]         "ACTUAL DATA
       EXCEPTIONS
          conversion_failed        = 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.

  • Function module for interactive reporting in alv

    hi,
             any one knows about f.m used in interactive reporting .
              plz forward pseudo code .
                                                          praveen

    hi,
    check my example:
    REPORT  ZSR_ALV_INTERACTIVE.
    TABLES : LFA1,EKKO,EKPO.
    SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
    DATA : BEGIN OF ITAB OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           NAME1 LIKE LFA1-NAME1,
           END OF ITAB.
    DATA : BEGIN OF JTAB OCCURS 0,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           END OF JTAB.
    DATA : BEGIN OF KTAB OCCURS 0,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           END OF KTAB.
    TYPE-POOLS : SLIS.
    DATA : REPID LIKE SY-REPID.
    DATA :LFA1_B TYPE SLIS_T_FIELDCAT_ALV,
          LFA1_W TYPE SLIS_FIELDCAT_ALV,
          EKKO_B TYPE SLIS_T_FIELDCAT_ALV,
          EKKO_W TYPE SLIS_FIELDCAT_ALV,
          EKPO_B TYPE SLIS_T_FIELDCAT_ALV,
          EKPO_W TYPE SLIS_FIELDCAT_ALV,
          EVENTS_B TYPE SLIS_T_EVENT,
          EVENTS_W TYPE SLIS_ALV_EVENT.
    PERFORM GET_VAL.
    REPID = SY-REPID.
    SELECT LIFNR NAME1 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN VENDOR.
    *perform val USING USER_COMMAND sel.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM = REPID
        IT_FIELDCAT        = LFA1_B
        IT_EVENTS          = EVENTS_B
      TABLES
        T_OUTTAB           = ITAB.
    *&      Form  GET_VAL
          text  this is to put column headings
    FORM GET_VAL.
      LFA1_W-FIELDNAME = 'LIFNR'.
      LFA1_W-REF_TABNAME = 'LFA1'.
      LFA1_W-REF_FIELDNAME = 'LIFNR'.
      APPEND LFA1_W TO LFA1_B.
      LFA1_W-FIELDNAME = 'NAME1'.
      LFA1_W-REF_TABNAME = 'LFA1'.
      LFA1_W-REF_FIELDNAME = 'NAME1'.
      APPEND LFA1_W TO LFA1_B.
      EKKO_W-FIELDNAME = 'EBELN'.
      EKKO_W-REF_TABNAME = 'EKKO'.
      EKKO_W-REF_FIELDNAME = 'EBELN'.
      APPEND EKKO_W TO EKKO_B.
      EKKO_W-FIELDNAME = 'AEDAT'.
      EKKO_W-REF_TABNAME = 'EKKO'.
      EKKO_W-REF_FIELDNAME = 'AEDAT'.
      APPEND EKKO_W TO EKKO_B.
      EKPO_W-FIELDNAME = 'EBELP'.
      EKPO_W-REF_TABNAME = 'EKPO'.
      EKPO_W-REF_FIELDNAME = 'EBELP'.
      APPEND EKPO_W TO EKPO_B.
      EKPO_W-FIELDNAME = 'MATNR'.
      EKPO_W-REF_TABNAME = 'EKPO'.
      EKPO_W-REF_FIELDNAME = 'MATNR'.
      APPEND EKPO_W TO EKPO_B.
      EVENTS_W-NAME = 'USER_COMMAND'.
      EVENTS_W-FORM = 'VAL'.
      APPEND EVENTS_W TO EVENTS_B.
    ENDFORM.                    "GET_VAL
    *&      Form  VAL
          text
         -->USER_COMMANtext
         -->SEL        text     for retrieving data
    FORM VAL USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
      DATA : VEN(10) TYPE N,
             PO(10) TYPE N.
      DATA : MAT(10) TYPE C.
      IF SEL-FIELDNAME = 'LIFNR'.
        VEN = SEL-VALUE.
        SELECT EBELN AEDAT FROM EKKO INTO TABLE JTAB WHERE LIFNR = VEN.
       CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM             = REPID
         I_STRUCTURE_NAME               = EKKO_B
          IT_FIELDCAT                    = EKKO_B
          IT_EVENTS                      = EVENTS_B
         TABLES
           T_OUTTAB                       = JTAB.
      ENDIF.
      IF SEL-FIELDNAME = 'EBELN'.
        PO = SEL-VALUE.
        SELECT EBELP MATNR FROM EKPO INTO TABLE KTAB WHERE EBELN = PO.
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
            I_TITLE            = 'ITEM DETAILS'
            I_TABNAME          = 'EKPO'
            IT_FIELDCAT        = EKPO_B
            I_CALLBACK_PROGRAM = REPID
          IMPORTING
            ES_SELFIELD        = SEL
          TABLES
            T_OUTTAB           = KTAB.
      ENDIF.
    logic to select a record
      IF SEL-FIELDNAME = 'MATNR'.
        MAT = SEL-VALUE.
        SET PARAMETER ID 'MAT' FIELD MAT.
        CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
      ENDIF.
    ENDFORM.                    "VAL

  • Function module for F4 help download

    HI Experts
    What is the function module for F4 help download.
    Thanks in advance

    Hi,
      Function module is F4IF_FIELD_VALUE_REQUEST.
    Use the Function moduel like this in this i create screen 100 by using se51.
    REPORT zcl_f4_help.
    TYPES: BEGIN OF values,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF values.
    DATA: carrier(3) TYPE c,
          connection(4) TYPE c.
    DATA: progname TYPE sy-repid,
          dynnum   TYPE sy-dynnr,
          dynpro_values TYPE TABLE OF dynpread,
          field_value LIKE LINE OF dynpro_values,
          values_tab TYPE TABLE OF values.
    CALL SCREEN 100.
    MODULE init OUTPUT.
      progname = sy-repid.
      dynnum   = sy-dynnr.
      CLEAR: field_value, dynpro_values.
      field_value-fieldname = 'CARRIER'.
      APPEND field_value TO dynpro_values.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE value_carrier INPUT.
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
           EXPORTING
                tabname     = 'DEMOF4HELP'
                fieldname   = 'CARRIER1'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CARRIER'.
    ENDMODULE.
    MODULE value_connection INPUT.
      CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname             = progname
                dynumb             = dynnum
                translate_to_upper = 'X'
           TABLES
                dynpfields         = dynpro_values.
      READ TABLE dynpro_values INDEX 1 INTO field_value.
      SELECT  carrid connid
        FROM  spfli
        INTO  CORRESPONDING FIELDS OF TABLE values_tab
        WHERE carrid = field_value-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'CONNID'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CONNECTION'
                value_org   = 'S'
           TABLES
                value_tab   = values_tab.
    ENDMODULE.
    you use this exaple  code.
    Plz Reward if Help,
    Mahi.

  • Error in function module  for inbound processingwhile testing from we19

    hi,
    I have developed a custom function module for processing inbound idoc for creating material using bdc...the problem is that when i am trying to test my idoc using we19 and calling my function module in debug mode an error is displayed showing 'interface for function module is incorrect' and also i am unable to see my function module in debugging mode.It is only displaying the error message...
    I have given all the parameters necessary (import,export or tables) and found no error in the interface...I think the problem is appearing before my function module is being called....Also on seeing the short dump analysis I have seen that the error is in the form 'Idocs passed to application' which is not a part of the function module developed by me...
    I am unable to understand why this error message is being displayed...
    Please help me out of this..

    ya i know that ..But I wanted to create a simple one..moreover the problem is not with bdc....It is with the function module interface..
    Also I want to ask a question that I had to define all the parameters (in the function module ) by data declaration statements in the function group top include..
    If i dont do that say the first error is when i write loop at idoc_contrl ..idoc_contrl is not declared by a data statement..So IO had to write a data statement:
    Idoc_contrl type table of edidc..I have seen that in other function modules (idoc inbound processing)  no such data declaration is done..

  • CO03 function module for cost analysis report

    Hi
    Can anybody pls let me know the function module for which gives the cost analysis data in CO03 transaction. 
    Regards

    Hi
    I'm sorry; BAPI_INTERNALORDER_GETDETAIL, this BAPI did serve my purpose
    Pls let me know if any other FM.
    Thanks for your help.
    Regards

  • Function module to download into excel sheet in crm

    Hi,
            Needed the Function module to download the data from internal table into the excel sheet in the CRM
    <b></b>

    use
    FM :- GUI_DOWNLOAD
    Example Code.
    lv_file_name = 'c:abcd.xls'
    *----Load Detail Report Data to Excel File
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename                = lv_file_name
            filetype                = 'DAT'
            write_field_separator   = 'X'
            codepage                = '4103'
          TABLES
            data_tab                = lt_det_report
          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.
      ENDIF.
      IF sy-subrc <> 0.
    *   202 : Error Occurred while writing data to the file.
        MESSAGE e202(zusm_gen) .
        EXIT.
      ELSE.
        WRITE :/ text-042 , lv_file_name.
      ENDIF.
    :- lt_det_report---> is table for storing data .
                         it can be any type
    <b>Please Reward Points & Mark Helpful Answers</b>
    To mark Helpful Answers ;click radio Button next to the post.
    RadioButtons
    <b>o</b> Helpful Answer
    <b>o</b> Very helpful Answer
    <b>o</b> Problem Solved.
    Click any of the above button next to the post; as per the anwers
    <b>To close the thread; Click Probelm solved Radio Button next to the post , which u feel is best possible answers</b>

  • Function module to download to Excel worksheet.

    Hi All,
            Need a function module to download internal table data to exact worksheet number in the excel sheet, that too it sholud be appended from some row number.
    The regular function modules are helping just to create an excel sheet and fill data, But not to append to exact work sheet, like work sheet no.5 or 6 of excel on presentation.
    Thanks in Advance,
    Regards,
    Yogesh

    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API

  • Function module to download to excel sheet

    what is the function module to download the report into excel  sheet??..
    Thanks
    Sri

    hi,
    use the alv list or alv grid  for the report output  then that functionality will be provided by default....
    In general Gui_download is used and the final internal table which is used for displaying the output of the report is passed to the FM.
    Regards,
    Rohan.

  • How to use functional module in crystal report

    Hi all,
          I have imported my functional module to crystal report,
          but when i am previewing it  i am not getting data in that, according to my functional module.
          how to run my functional module through crystal report.
    thanks in advance

    Post Author: mewdied
    CA Forum: .NET
    'EXPORT to EMAIL        ''' Code for exporting the report to Mapi (.Net Windows application)        ''' *For a Web application you must export to disk as a PDF file first.
            crReportDocument.Load(Application.StartupPath + "\World Sales Report.rpt")        crMicrosoftMailDestinationOptions = New MicrosoftMailDestinationOptions        With crMicrosoftMailDestinationOptions            .MailCCList = "[email protected]"            .MailToList = "[email protected]"            .MailSubject = "Attached exported report"            .UserName = "admin"            .Password = "password"        End With
            crExportOptions = crReportDocument.ExportOptions        With crExportOptions            .DestinationOptions = crMicrosoftMailDestinationOptions            .ExportDestinationType = ExportDestinationType.MicrosoftMail            .ExportFormatType = ExportFormatType.PortableDocFormat        End With
            'Add some error handling        Try            crReportDocument.Export()            MsgBox("Report exported successfully.")        Catch err As Exception            MessageBox.Show(err.ToString())        End Try
    Hope this helps

  • Function Module for some sBDOC does not work on

    Hi Experts,
    We have transported on QA landscape sBDOC definition. For sBDOC CNBCCPCUS602,  CNBCCPCUS603,  CNBCCPCUS604 function module seems to be not the right one, so no message of this BDOC are creted when a site extract is done. Error on smohqueue says: "Could not determine function module for processing AC messages".
    Have You encountered a problem like this?
    BR
    Roberto

    Hi All,
    We resolved the problem re-generating CDB pricing condition table using report CND_MAST_GEN_TRANSFER_OBJECTS.
    BR
    Roberto

Maybe you are looking for

  • Error when connecting to socket

    OK, ive got tomcat 5 up and running and have created a servlet from an example i found on the internet and so to my knowledge it should work. When trying to open a socket on the ip 127.0.0.1:2083 i get the error ... javax.microedition.io.ConnectionNo

  • Problems Connecting to the Internet

    Please bear with me I am new to Cisco Routers. Back Ground: Small company that has 2 public IP addesses. The company has 2 buiildings across the street from each other and no way to directly connect them together. Currently the company has 2 NetGear

  • Another window keeps popping, how to get rid of that

    another window keeps popping in spontaneously. Have i got a virus/malware. Mac cleaner keeps popping in. How do I avoid that?

  • Why can't I send any messages?

    Hi I have an iPhone 4S using iOS 8.2. The problem is that I can't send any messages at all. First off, I tried turning the iMessage feature off and then on again but now it's stuck. I can't turn it on again. Secondly any texts I send out will just gi

  • About voided payment accounting line

    I voided a payment before submitting Payables Accounting Process or creating accounting lines. Then I submitted request of Payables Accounting Process. And I found there's no accounting lines created. The version is 11.5.6 . Could anybody tell me thi