Excel down load.

Hi, Is there any FM that will transfer the data(rows)from an internal table as columns of an Excel sheet? Please help me...Thanks.

DATA: g_v_excel           TYPE ole2_object,
      g_v_books           TYPE ole2_object,
      g_fullpt            TYPE rlgrap-filename,
      charts              TYPE ole2_object ,
      addchart            TYPE ole2_object ,
      g_v_range           TYPE ole2_object,
      select              TYPE ole2_object,
      worksheet           TYPE ole2_object,
      activesheet         TYPE ole2_object,
      activechart         TYPE ole2_object,
      applycustomtype     TYPE ole2_object,
      g_chk_change        TYPE c. " SMRX++ 27.01.06
*&      Form  DOWNLOAD_DATA_INTO_EXCEL
FORM download_data_into_excel .
  DATA :lws_cnt TYPE i,
        lws_cntc(5),
        lws_rng(5),
        lws_chtitle(50).
Opens the Excel file
  PERFORM fill_excelfile_headings.
  PERFORM download_data_to_excel.
  CREATE OBJECT   g_v_excel 'Excel.Application'.
  CALL METHOD OF g_v_excel 'workbooks' = g_v_books.
  CALL METHOD OF g_v_books 'Open'
    EXPORTING
      #1 = g_fullpt.
  SET PROPERTY OF g_v_excel 'Visible' = 1.
  IF sy-subrc <> 0 .
    FREE OBJECT g_v_books .
    EXIT .
  ENDIF .
ENDFORM.                    " DOWNLOAD_DATA_INTO_EXCEL
FORM fill_excelfile_headings .
  CLEAR g_v_header.
  REFRESH: g_t_header.
  g_v_header-colname = 'CUstomer no'. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-029. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-021. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-019. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-020. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-022. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-023. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-025. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-032. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-026. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-032. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-027. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-032. APPEND g_v_header TO g_t_header.
  g_v_header-colname = text-028. APPEND g_v_header TO g_t_header.
ENDFORM.                    " FILL_EXCELFILE_HEADINGS
FORM download_data_to_excel.
  DATA: l_filename   TYPE string,
        l_fullpath   TYPE string.
  CONCATENATE 'DATA' sy-uzeit+2(4) '.DAT' INTO l_filename.
  CALL FUNCTION 'RH_COMPILE_FILENAME'
    EXPORTING
      filename  = l_filename
      path_flag = 'W'
    IMPORTING
      fullpath  = l_fullpath
    EXCEPTIONS
      OTHERS    = 1.
  CLEAR: g_fullpt.
  MOVE l_fullpath TO g_fullpt.
  REFRESH: g_t_download_data.
  CLEAR: g_v_screen3.
  LOOP AT g_t_screen3 INTO g_v_screen3.
    MOVE-CORRESPONDING g_v_screen3 TO g_v_download_data.
    APPEND g_v_download_data TO g_t_download_data.
    CLEAR: g_v_download_data, g_v_screen3.
  ENDLOOP.
  CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      filename                = g_fullpt
      filetype                = 'DAT'
    TABLES
      data_tab                = g_t_download_data
      fieldnames              = g_t_header
    EXCEPTIONS
      file_open_error         = 1
      file_write_error        = 2
      invalid_filesize        = 3
      invalid_type            = 4
      no_batch                = 5
      unknown_error           = 6
      invalid_table_width     = 7
      gui_refuse_filetransfer = 8
      customer_error          = 9
      OTHERS                  = 10.
  IF sy-subrc <> 0.
  ELSE.
    g_chk_download = 'X'.
  ENDIF.
ENDFORM.                    "DOWNLOAD_DATA_TO_EXCEL
*&      Form  DOWNLOAD_DATA_TO_EXCEL
FORM download_data_to_excel.
  DATA: l_filename   TYPE string,
        l_fullpath   TYPE string.
  CONCATENATE 'DATA' sy-uzeit+2(4) '.DAT' INTO l_filename.
  CALL FUNCTION 'RH_COMPILE_FILENAME'
    EXPORTING
      filename  = l_filename
      path_flag = 'W'
    IMPORTING
      fullpath  = l_fullpath
    EXCEPTIONS
      OTHERS    = 1.
  CLEAR: g_fullpt.
  MOVE l_fullpath TO g_fullpt.
  REFRESH: g_t_download_data.
  CLEAR: g_v_screen3.
  LOOP AT g_t_screen3 INTO g_v_screen3.
    MOVE-CORRESPONDING g_v_screen3 TO g_v_download_data.
    APPEND g_v_download_data TO g_t_download_data.
    CLEAR: g_v_download_data, g_v_screen3.
  ENDLOOP.
  CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      filename                = g_fullpt
      filetype                = 'DAT'
    TABLES
      data_tab                = g_t_download_data
      fieldnames              = g_t_header
    EXCEPTIONS
      file_open_error         = 1
      file_write_error        = 2
      invalid_filesize        = 3
      invalid_type            = 4
      no_batch                = 5
      unknown_error           = 6
      invalid_table_width     = 7
      gui_refuse_filetransfer = 8
      customer_error          = 9
      OTHERS                  = 10.
  IF sy-subrc <> 0.
  ELSE.
    g_chk_download = 'X'.
  ENDIF.
ENDFORM.                    "DOWNLOAD_DATA_TO_EXCEL

Similar Messages

  • Alv to excel down load through local file (cntrl + shift + F9 ) Urgent

    Hello all ,
            In ALV i am getting the out put correct . But when i try to download it to excel . Though local file -- Spread sheet .
    In ALV i am getting the feilds like this
    Material description of BOM component material (MAKT-MAKTX   
    Base Unit of Measure of BOM component material (MARA-MEINS)
    X-plant material status of BOM component material (MARA-MSTAE)
    BOM base quantity (STKO-BMENG)
    UoM of BOM base quantity (STKO-BMEIN)
    BOM component quantity (STPO-MENGE)
    UoM of BOM component quantity (STPO-MEINS)
    Relevant for sales indicator of BOM component material (STPO-RVREL)
    But in Excel out put i am getting like this :
    Material description of BOM component ma
    UoM of BOM component quantity
    UoM of BOM component quantity
    BOM base quantity
    UoM of BOM base quantity
    BOM component quantity
    Relevant for sales indicator of BOM comp
    I am not at all getting Why it is comming like this .
    Please let me know if any one can help  me on this issue .
    Thanks and Regards ,
    Prem .

    In ur .....FORM alv_fieldcatalog-settings .
      fieldcatalog-fieldname = 'MAKTX'
      fieldcatalog-col_pos = 1.
      fieldcatalog-fieldname = 'MEINS'
      fieldcatalog-col_pos = 2.
    add the fieldcatalog-col_pos statement in ur code...
    reward if useful.

  • Problem while down loading data into Excel

    Hi friend's,
    I am getting a error while down loading header
    internal table to excel.
    since in my header internal table there is no p
    type field..but i am getting this error..
    Only flat, character-type data objects are supported at the argument
    position "dest" for the statement
      "WRITE src TO dest".
    In this case, the operand "dest" has the non-character-type or deep type
    "P". The current program is flagged as a Unicode program. In the Unicode
    context, type X fields are seen as non-character-type, as are
    structures that contain non-character-type components.
    i have coded like this
    REPORT  ZACG_CCA_EXCEL                          .
    Tables : zacg_cca.
    data: P_file like RLGRAP-FILENAME.
    Data: Begin of it_header occurs 0,
          ccode(10) ,
          mat_cd(12) ,
          ingr_desc(30),
          con(10),
          quan(10),
          percqty(10),
          DATE(10),
          rsamnos(10),
          flag(5),
          end of it_header.
    Data : begin of it_final occurs 0,
           ccode type zacg_cca-ccode,
           mat_cd type zacg_cca-mat_cd,
           ingr_desc type zacg_cca-ingr_desc,
           conc type zacg_cca-conc,
           quantity type zacg_cca-quantity,
           percqty type zacg_cca-percqty,
           APP_DATE type zacg_cca-app_date,
           rsamnos type zacg_cca-rsamnos,
           flag ,
           end of it_final.
           SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text-000.
           select-options : s_Date for zacg_cca-app_date.
           SELECTION-SCREEN  : END OF BLOCK blk.
           it_header-ccode = 'Samp_code'.
           it_header-mat_cd = 'Mat_code'.
           it_header-ingr_desc = 'Ingr_Desc'.
           it_header-con = 'Conc'.
           it_header-quan = 'Quantity'.
           it_header-percqty = 'Perc'.
           it_header-date = 'Date'.
           it_header-rsamnos = 'Rsamnos'.
           it_header-flag = 'Flag'.
           Append it_header.
           select ccode mat_cd ingr_desc conc quantity percqty
            app_date rsamnos from zacg_cca  into corresponding
            fields of table
           it_final where  zacg_cca~app_date in s_date.
           loop at it_final.
           it_final-flag = 'T'.
           modify it_final.
           it_final-quantity = it_final-quantity * 2 .
           Modify it_final.
           endloop.
           CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
             EXPORTING
               FILE_NAME                       = 'C:\amol\p_file'
              CREATE_PIVOT                    = 0
             DATA_SHEET_NAME                 = ' '
             PIVOT_SHEET_NAME                = ' '
             PASSWORD                        = ' '
             PASSWORD_OPTION                 = 0
              TABLES
             PIVOT_FIELD_TAB                 =
              DATA_TAB                        =   it_final
             FIELDNAMES                      =  it_header
            EXCEPTIONS
              FILE_NOT_EXIST                  = 1
              FILENAME_EXPECTED               = 2
              COMMUNICATION_ERROR             = 3
              OLE_OBJECT_METHOD_ERROR         = 4
              OLE_OBJECT_PROPERTY_ERROR       = 5
              INVALID_PIVOT_FIELDS            = 6
              DOWNLOAD_PROBLEM                = 7
              OTHERS                          = 8
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
    can any one....

    hii
    for title this FM have some restriction as it can not take value if its more then 10 length so you need to give length as 10 only for every string then append it with FIELDNAMES = it_header
    regards
    twinkal

  • I have a mac osx 10.411G4 powre pc and recently I down loaded excel for mac 2004 the problem that iam having is that the two other programs i downloaded one program it says unable to read the dictionary of the application of the extension because it is no

    I have a mac osx 10.411 power pc and recently i downloaded excel for mac 2004 so that i could download some program that only would work if i have excel for mac but what happen was it went to script and said that unable to read the dictionary of the application of the extension because it is not scriptable and the second pop up said the document autorun,inf could not open script editor can not open files in script editor app can any one help me how do i get these program working  thank you norro460

    good afternoon  Limnos i think  i didnt give the right info I didnt download well in a way i did i bought a copy of microsoft excel for mac 2004 i loaded on to my mac then i went and down loaded some software that said i needed to have excel you see my mac is osx 10.4,11 power pc G4 and that is were i had the problem now  the excell loaded allright but the the other programs did not the pop ups say it is not scriptable or can not read dictionary if you can help m,e iam not great with computers but i  along

  • Truncation of leading Zeros when Down Loading into Excel - OLE Objects

    Hi,
    Can any one help me on this.
    I am using <b>OLE Objects</b> to download Data into Excel Sheet. Data with leading Zeros is getting truncated in Excel.
    Ex: Report Output is showing Plant Number as 0002. But when i am downloading to Excel Plant value will become 2 .
       I would like to have it as 0002 in Excel.
    I have declared Werks as CHAR of 4.I am using OLE Obects for Downloading into Excel Sheet.
    I am using "OLE2_OBJECT" I can not use any other FMs to down load to Excel.As i am modifying this program not creating.
    Thanks In Advance.
    K.Nirmala
    Message was edited by: Nirmala Reddy

    Hi Nirmala,
    While downloading to excel sheet, u need to change the number format of cell from General to Text, then leading zero's won't get deleted. For that u need to set the property of the cell. Please check this sample code,
    INCLUDE OLE2INCL.
    tables : zobrent.
    data : it_kna1 type table of zobrent with header line.
    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
    DATA  H TYPE I.
    DATA: cell1 TYPE ole2_object.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
      select * from zobrent into table it_kna1
               where zopanid = '10001'
                and zo_brent = '050'.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 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.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'EDate'.
      PERFORM FILL_CELL USING 1 2 1 'Brent'.
      PERFORM FILL_CELL USING 1 3 1 'Zopanid'.
      PERFORM FILL_CELL USING 1 4 1 'Contract Type'.
      PERFORM FILL_CELL USING 1 5 1 'Price Type'.
      PERFORM FILL_CELL USING 1 6 1 'Installation Type'.
      PERFORM FILL_CELL USING 1 7 1 'Volume'.
      PERFORM FILL_CELL USING 1 8 1 'AQ'.
      PERFORM FILL_CELL USING 1 9 1 '00000123'.
      LOOP AT IT_KNA1.
    copy values to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_KNA1-zo_effdat.
        PERFORM FILL_CELL USING H 2 0 IT_KNA1-zo_brent.
        PERFORM FILL_CELL USING H 3 0 IT_KNA1-zopanid.
      ENDLOOP.
      CALL METHOD OF h_excel 'Cells' = cell1
        EXPORTING
          #1 = 1
          #2 = 1.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      if sy-subrc eq 0.
       write : / 'year'(001).
      endif.
         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.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ***Changing the format of the cell from General to Text
      <b>SET PROPERTY OF H_ZL 'NumberFormat' = '@'.</b>
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    U just paste this code in a sample program & see.
    Please reward, if found helpful.

  • ALV report down load to EXCEL

    When I am trying to down load the ALV report to EXCEL. The report fields are not coming in the same order as they are in the report.
    Please advice.
    <b><REMOVED BY MODERATOR></b>
    Thank you.
    Gouri.
    Message was edited by:
            Alvaro Tejada Galindo

    Hi,
    You can use the FM - ALV_XXL_CALL.
    It is the same function module invoked when you click on the export to excel button of the ALV.
    You can pass teh field catalog of the ALV here along with the name of ur internal table and the internal table itself. It will download everything to Excel alongwith the Column headers ( depending on ur field catalog definition). Just make sure ur field catalog has the COL_Heading correctly populated.
    <b>
    Sample Code -</b> CALL FUNCTION 'ALV_XXL_CALL'
    EXPORTING
    i_tabname = 'T_GRID' " Name of the Internal table
    it_fieldcat = t_fcatk[] " Field catalog
    TABLES
    it_outtab = t_grid " Interbnal table with data
    EXCEPTIONS
    fatal_error = 1
    no_display_possible = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE e806(bk).
    ENDIF.
    Regards
    Sudheer

  • ALV Logo is not down loading to excel.

    Hi All,
    when we are downloading the ALV output to excel  logo is not appearing..
    please tell me how to down load logo to excel file,
    Thanks in advance..

    Hi Satya,
    Can you kindly share how?
    I am also facing the same requirement.
    Thanks!

  • Problem in down loading Grid out to Excel

    Hi all ,
    when i down load grid output into excel using list->export->localfile ->spread sheet,
    Some columns headings are down loaded with medium texts and some with short texts (seltext_s) .The same is displayed in default output(with out dragging) .  I found that fields with short texts are because of field  data length is less than 10 char .customer is asking to  medium or long texts in excel when down loaded..
    1)Hence i expanded fileds and then down loaded , same short texts are down loaded to XL.
    2)I incresed output length for those  fields so as to take medium or long texts in default output of report(no need of dragging ) and then  down loaded to excel .Still it is taking short texts only in XL .
    Will there be any default settings to consider text to considered while down loading or do ineed to set explicitley .Please advise me ..
    a bit urgent .
    I constructed fieldcat  as follows
    ls_fieldcat-fieldname    = c_cname.
      ls_fieldcat-seltext_l    = text-004.
      ls_fieldcat-seltext_s    = text-004.
      ls_fieldcat-seltext_m    = text-004.
      ls_fieldcat-reptext_ddic = text-004.
      MODIFY p_fieldcat FROM ls_fieldcat TRANSPORTING seltext_l seltext_m
    seltext_s reptext_ddic WHERE fieldname = ls_fieldcat-fieldname.
    Many Thanks
    Dharma P

    Hi  A. Caglar Ozkor,
    Basically the parmeter layout-colwidth optimization  is set to  'X'. I tried out to increase outputlength after setting it to '   '  , then down loaded to excel .In that case also it picked only short texts , Hence I thought there would be  some settings  to decide what text to be picked while down loading  in to excel .
    Guys , Any ideas to solve this problem   ...
    Dharma P

  • Se16 down load into excel sheet problem with PO number

    Dear All,
    While I download vbak table data using se16 from table VBAK ( using System > List> save --> local File --> Spreadsheet ), I get the PO number converted as error like at it's end, the last digit is becoming zero when po number is of 16 digits.  means only the last digit is converted to 0.
      For example : se16 -> vbak table -> the po numbers
    1238643210249039, when I down load in the excel sheet it is appearing as 1238643210249030
    (I means the last digit of the PO number is downloaded with error, it is always a u201C0u201D.
    if the PO number is of less than 16 digits... the above problem is not there )
    How to correct the error ? How to tell solution to functional consultant ? Can you please suggest me
    Do we need to apply any OSS message ?
    Thanks in ADVANCE.
    Edited by: sam kumar on Dec 8, 2008 5:40 PM

    Hi,
    Just found that 'Numbers in Microsoft Excel can never have more than 15 significant digits'.
    check this link from Microsoft: [http://support.microsoft.com/kb/158071|http://support.microsoft.com/kb/158071]
    check this  [http://office.microsoft.com/en-us/excel/HA102748231033.aspx|http://office.microsoft.com/en-us/excel/HA102748231033.aspx]
    [http://office.microsoft.com/en-us/excel/HA102748231033.aspx#5|http://office.microsoft.com/en-us/excel/HA102748231033.aspx#5]
    What i can suggest is, put a apostrophe (') for the value of first cell content at the beginning.
    Use Format painter to apply the same for all values in that column.
    Regards
    Raj
    Edited by: Rajasekhar Dinavahi on Dec 8, 2008 10:59 PM
    Edited by: Rajasekhar Dinavahi on Dec 8, 2008 11:00 PM
    Edited by: Rajasekhar Dinavahi on Dec 8, 2008 11:05 PM

  • Password Protection to the Excel File that was down loaded

    Hi Friends,
    I had an requirement regarding the excel file.whenever the excel file is down loaded on the desktop it should be password protected.i..e, no one should be able to open the file unless they have the password.

    REPORT ZWMI_TRUCK_DOWNLOAD no standard page heading.
    ======================================================================
    Program Name : ZWMI_TRUCK_DOWNLOAD                                   *
    Description  : This Program is used to get all truck load status     *
                   and download into XLS File and fields are Route #,    *
                   Dispatch time ,Closing time ,Scan Details.            *
    Author       : Seshu                                                 *
    Date         : 02/15/2007                                            *
    MODIFICATION HISTORY                                                 *
    DATE    | AUTHOR   | CHANGE #   | DESCRIPTION OF MODIFICATION        *
    --|||--
    02/15/07| Seshu    | DEVK922058 | Initial                            *
    02/20/07| Seshu    | DEVK922068 | Changed the name as per Naming     *
                                      Convention                         *
    03/14/07| Seshu    | DEVK922126 | Included date as Range             *
    ======================================================================
    Tables
    tables : zsdcarton,
             ztruck,
             ztruckstatus.
    Constants
    constants: c_werks(4) type c value '1000'.
    Internal table for Ztruck
    data : begin of i_ztruck occurs 0,
           werks  like ztruck-werks," Plant
           vdatu like ztruck-vdatu, " Delivery date
           ZZTRKNO like ztruck-ZZTRKNO, " Route #
           ZZSHIPTIME like ztruck-ZZSHIPTIME, " Dispatch time
           ZCLTIME like ztruck-ZCLTIME, " Truck close time
           end of i_ztruck.
    Internal table for ZSDCARTON
    data : begin of i_zsdcarton occurs 0,
           lateflag like zsdcarton-lateflag,
           zzslot like zsdcarton-zzslot,
           status like zsdcarton-status,
           end of i_zsdcarton.
    Internal table for Final output
    data : begin of i_final occurs 0,
           vdatu like ztruck-vdatu, " Delivery Date
           ZZTRKNO like ztruck-ZZTRKNO, " Route #
           ZZSHIPTIME like ztruck-ZZSHIPTIME, " Dispatch time
           ZCLTIME like ztruck-ZCLTIME, " Truck close time
           load_compl_c(5)     type n , " Load Complted Time
           status_s_total(5) type n,  " No Scan/Load
           status_l_total(5) type n,  " Late Scan
           end of i_final.
    Internal Table XLS File Header
    DATA: BEGIN OF i_head OCCURS 0,
          field(30) TYPE c,
          END OF i_head.
    Variables
      status couter
    data: status_total(5)   type n,
      no scan / no load
          status_s(3)       type n,
          status_s_total(5) type n,
      good
          status_g(3)       type n,
          status_g_total(5) type n,
      late
          status_l(3)       type n,
          status_l_total(5) type n,
      manual
          status_m(3)       type n,
          status_m_total(5) type n,
      alternative
          status_a(3)       type n,
          status_a_total(5) type n.
    S E L E C T I O N    -   S C R E E N *************************
    selection-screen : begin of block blk with frame title text-001.
    select-options : p_vdatu for zsdcarton-vdatu obligatory
                    default sy-datum.
    selection-screen : end of block blk .
    S T A R T  -  O F  - S E L E C T I O N  ******************
    start-of-selection.
    Get the data from ZTRUCK and
      perform get_data_tables.
    Down load the data into XLS file
      perform get_download.
    S T A R T  -  O F  - S E L E C T I O N  ******************
    end-of-selection.
    *&      Form  get_data_tables
    FORM get_data_tables.
      data : lv_time like sy-uzeit.
      select werks
             vdatu
             zztrkno
             zzshiptime
             zcltime from ztruck into table i_ztruck
                                 where werks = c_werks
                                 and   vdatu in p_vdatu.
      if sy-subrc ne 0.
        message e000(zwave) with 'No data found for given current date'.
      endif.
      loop at i_ztruck.
        refresh : i_zsdcarton.
        clear :   i_zsdcarton,
                  lv_time.
    Get the Scan Status for Every route
        select lateflag zzslot status from zsdcarton into table i_zsdcarton
                               where werks =  i_ztruck-werks
                               and   vdatu = i_ztruck-vdatu
                               and   zztrkno = i_ztruck-zztrkno.
        if sy-subrc eq 0.
          loop at i_zsdcarton.
            case  i_zsdcarton-lateflag.
    late cartons
              when  'X'.
    late and never loaded
                if i_zsdcarton-zzslot = space.
                  add 1 to status_s.
                else.
                  add 1 to status_l.
                endif.
    all other exceptions
              when  space.
    check if scanned
                case i_zsdcarton-zzslot.
    good scan
                  when 'S'.
                    add 1 to status_g.
    never scanned
                  when space.
                    if i_zsdcarton-status = space.
    no scan
                      add 1 to status_s.
                    else.
    no load -> no scan
                      add 1 to status_s.
                    endif.
    manual scanned
                  when 'M'.
                    if i_zsdcarton-status = 'M'.
                      add 1 to status_g.
                    elseif i_zsdcarton-status = 'E'.
    exceprtion -> manual
                      add 1 to status_g.
                    endif.
                endcase.
            endcase.
    add totals
            add status_g   to  status_g_total.
          Late Scan
            add status_l   to  status_l_total.
            add status_a   to  status_a_total.
          No Scan and Load
            add status_s   to  status_s_total.
            clear : status_g,
                    status_l,
                    status_a,
                    status_s.
          endloop.
        else.
          continue.
        endif.
    Get the Load Complete Time
        select single uzeit from ztruckstatus into lv_time
                                       where   werks = i_ztruck-werks
                                       and     lgnum = '100'
                                       and     vdatu = i_ztruck-vdatu
                                       and     zztrkno = i_ztruck-zztrkno
                                       and     tstat = 'L'.
        if sy-subrc eq 0.
          write: lv_time(5)
                  to i_final-load_compl_c     using edit mask '__:__'.
        endif.
    Delivery Date
        i_final-vdatu = i_ztruck-vdatu.
    Route #
        i_final-zztrkno = i_ztruck-zztrkno.
    Dispach time
        i_final-zzshiptime = i_ztruck-zzshiptime.
    Truck Close Time
        i_final-zcltime = i_ztruck-zcltime.
    No Scan/ Load
        i_final-status_s_total = status_s_total .
    Late Scan
        i_final-status_l_total = status_l_total.
        append i_final.
        clear : status_g_total,
                status_l_total,
                status_a_total,
                status_s_total,
                lv_time,
                i_final.
      endloop.
    ENDFORM.                    " get_data_tables
    *&      Form  get_download
          Download the data
    FORM get_download.
      data : lv_file like rlgrap-filename,
             lv_date(8) type c.
      lv_date = sy-datum.
      concatenate 'C:/Truckload'  lv_date into lv_file.
    Fill the Header Values
    Delivery Date
      i_head-field = 'Delivery Date'.
      append i_head.
    Route #
      i_head-field = 'Route'.
      APPEND i_head.
    Dispatch Time
      i_head-field = 'Dispatch Time'.
      append i_head.
    Closing Time
      i_head-field = 'Closing Time'.
      append i_head.
    Load Completed Time
      i_head-field = 'Load Completed Time'.
      append i_head.
    No Scan/Load
      i_head-field = 'No Scan/Load'.
      append i_head.
    Late Scan
      i_head-field = 'Late Scan'.
      append i_head.
      CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          FILE_NAME                       = lv_file
      CREATE_PIVOT                    = 0
          DATA_SHEET_NAME                 = 'TruckLoad'
      PIVOT_SHEET_NAME                = ' '
      PASSWORD                        = ' '
      PASSWORD_OPTION                 = 0
       TABLES
      PIVOT_FIELD_TAB                 =
          DATA_TAB                        = i_final
          FIELDNAMES                      = i_head
       EXCEPTIONS
         FILE_NOT_EXIST                  = 1
         FILENAME_EXPECTED               = 2
         COMMUNICATION_ERROR             = 3
         OLE_OBJECT_METHOD_ERROR         = 4
         OLE_OBJECT_PROPERTY_ERROR       = 5
         INVALID_FILENAME                = 6
         INVALID_PIVOT_FIELDS            = 7
         DOWNLOAD_PROBLEM                = 8
         OTHERS                          = 9
      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.                    " get_download
    In function module you have option like password protect..

  • Down load itab data from Debugging screen as excell file - problem

    Hi,
    I am using 4.6 C version.
    While debugg, I am not able to see spread sheet icon to down load my internal table data into excell sheet.
    Are there any setting I need to do OR How can I get down load my internal table data into excell sheet.
    Your help is highly appreciated.

    in 4.6 its not available
    try this
    in debugging mode
    in menu   goto-display data object-structure editor
    u will get one report
    in menu  system->list>save--->local file

  • How can I access my Excel and MS word docs now that I down loaded Lion?

    How can I access my Excel and MS word docs now that I down loaded Lion?

    Isn't it the kind of question which would have been better asked before switching to Lion ?
    Of course it would be more logical to ask in a M…oSoft dedicated forum.
    In case you forgot it, here you are in a forum dedicated to an Apple product named Numbers
    Yvan KOENIG (VALLAURIS, France) samedi 23 juillet 2011 12:43:13
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Down load to excel sheet

    friends,
    I have a requirement to down load a list which is displayed hierarchially into an excel sheet.
    1000
             18271218         qiuwiquw
              289283           djksdjskd
    1001
             23232             ssdsdsd

    check parameters.
    and pass it according to your req,
    like file name & type 
    separated by...!!
    and atlast pass the formated internal table
    and generate file.
    reward if helpful
      call function 'GUI_DOWNLOAD'
        exporting
        BIN_FILESIZE                    =
          filename                        = txtfile
         filetype                        = 'ASC'
        APPEND                          = ' '
         write_field_separator           = 'X'
         confirm_overwrite               = 'X'
        tables
          data_tab                        = it2_oh

  • Problem in down loading to excel sheet from ALV report

    Hi Experts,
    I have used the funtion module REUSE_ALV_GRID_DISPLAY, and for field catalog I have individually written the field catalog  as there are not many fields instead of using the funtion module REUSE_ALV_FIELDCATALOG_MERGE.
    Report is getting displayed well but while getting  down load to xls only numeric fields are appearing and character fields are not appearing.
    Have  I selected the function module formats correctly.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
            I_BYPASSING_BUFFER          =
            I_BUFFER_ACTIVE             =
            I_INTERFACE_CHECK           = ' '
             I_CALLBACK_PROGRAM          = 'ZHR_DETAILS'
            I_CALLBACK_PF_STATUS_SET    = ' '
            I_CALLBACK_USER_COMMAND     = ' '
            I_CALLBACK_TOP_OF_PAGE      = ' '
            I_CALLBACK_HTML_TOP_OF_PAGE = ' '
            I_CALLBACK_HTML_END_OF_LIST = ' '
            I_STRUCTURE_NAME            =
            I_BACKGROUND_ID             = ' '
             I_GRID_TITLE                = 'Active ETA Details'
            I_GRID_SETTINGS             =
            IS_LAYOUT                   =
             IT_FIELDCAT                 =  RT_FCAT
            IT_EXCLUDING                =
            IT_SPECIAL_GROUPS           =
            IT_SORT                     =
            IT_FILTER                   =
            IS_SEL_HIDE                 =
            I_DEFAULT                   = 'X'
            I_SAVE                      = ' '
            IS_VARIANT                  =
            IT_EVENTS                   =
            IT_EVENT_EXIT               =
            IS_PRINT                    =
            IS_REPREP_ID                =
            I_SCREEN_START_COLUMN       = 0
            I_SCREEN_START_LINE         = 0
            I_SCREEN_END_COLUMN         = 0
            I_SCREEN_END_LINE           = 0
            I_HTML_HEIGHT_TOP           =
            I_HTML_HEIGHT_END           =
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER     =
            ES_EXIT_CAUSED_BY_USER      =
         TABLES
              T_OUTTAB                    = ITAB
       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.
    Please advice me.
    Thanks in advance.
    Regards,
    Irfan Hussain

    Hi Irfan,
      This looks strange !!1
      Try to use the layout option also and checkout if it works

  • Down loading ALV List to local file /print

    hi ,
    We have a program that displays data on an ALV list. Then, when you click on the 'Print' icon, or try to download to a local file, it gives a short dump with a message 'OBJECTS_NOT_CHARLIKE'.
    Any solutions on the same ....
    thanks

    Hi,
    i hope you have all your data in and internal table.
    If this is so use the following code,
    *--- Down load the file
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    filename = lv_file
    filetype = 'DAT'
    TABLES
    data_tab = gt_excel1
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10.
    IF sy-subrc = 0.
    MESSAGE i000(zf) WITH text-017.
    ELSE.
    MESSAGE e939(zf) WITH lv_file. "Errors while downloading.
    ENDIF.
    Following should be passed,
    v_file --> file path with file name (provide filename with '.xls' extension)
    gt_excel --> Internal table which has to be downloaded to excel.
    thanks
    vijay
    reward points if helpful.

Maybe you are looking for

  • How can I create a new screen to upload an attachment in SRM?

    Hi everyone, I need to create a new screen that will upload a new attachment in a BID. I already know how to create the screen and ITS. According the standard screen 0100 in program SAPLBBP_PDH_TEXT, I need an applet called "CFILESAPP" and then use t

  • How do I change the base color  in the recolor Artwork settings?

    How do I change the base color  in the recolor Artwork settings? I know this seems like a silly thing but I really need to figure this out and I have read and gone through the manual and the help forum to no avail. Please help.

  • Is Garageband the One I Need?

    I just upgraded from a Powerbook G4 running Cubase SE 1.0.7 to a MacBook Pro with Leopard. Now it loooks like Cubase won't run under Leopard. Obviously I don't need a full fledged DAW like Cubase 4, but I do need some features like automated faders,

  • How to make my iphone 3g have more ram(i only have 2.5 mb free)

    help my iphone 3g is very slow. it only has 2.5 mb of ram!how do i get clear out the ram?

  • R/3 - SNC 7.0 - oracle integration using PI 7.0

    Hi All There are three systems in our landscape R/3, SCM (SNC 7.0) and oracle based third party system and we are integrating these with PI 7.0. for R/3 to SNC we are going to use standard mappings and for communication between R/3 - Oracle and SNC -