I am using GUI_DOWNLOAD FM to download my internal table entries into .xls

Hi
I am using GUI_DOWNLOAD FM to download my internal table entries into .xls file. but it's not download total records in final table.
in debugging it showing total records.
exporting:
filename
filetype
field-suprater
header
tables
data_tab
fieldnames
plz help me.
thanks
Sankar

Hi
Use as below:
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = p_file " path offile where u need to download
CREATE_PIVOT = 0
DATA_SHEET_NAME = ' '
PIVOT_SHEET_NAME = ' '
PASSWORD = ' '
PASSWORD_OPTION = 0
TABLES
PIVOT_FIELD_TAB =
data_tab = int_data "internal table with data
fieldnames = int_head "internal table with header
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.
Regards,
Sreeram

Similar Messages

  • Downloading the internal table contents into presentation server

    Hi
    I have a requirement like i need to download the contetns of my internal table into an excel sheet in the presemtation server and i am using GUI_DOWNLOAD.
    I would like to place my header also in the excel sheet can any one suggest me how to do that?
    thanks

    Hi,
    U can see the following example,
    TYPES:
    BEGIN OF TYPE_S_FLIGHT,
       MANDT(15) TYPE C,
       CARRID(15) TYPE C,
       CONNID(15) TYPE C,
       FLDATE(15) TYPE C,
    END OF TYPE_S_FLIGHT.
    data:
    T_HEADER TYPE TABLE OF TYPE_S_FLIGHT WITH HEADER LINE,
    t_sflight type table of SFLIGHT.
    T_HEADER-MANDT = 'MANDT'.
    T_HEADER-CARRID = 'CARRID'.
    T_HEADER-CONNID = 'CONNID'.
    T_HEADER-FLDATE = 'FLDATE'.
    APPEND T_HEADER.
    PERFORM GUI_DOWNLOAD TABLES T_HEADER USING ' '.
    select MANDT
            CARRID
            CONNID
            FLDATE
    from sflight into CORRESPONDING FIELDS OF table t_sflight.
    PERFORM GUI_DOWNLOAD TABLES T_SFLIGHT  USING 'X'.
    form GUI_DOWNLOAD  TABLES P_TABLE USING VALUE(P_APPEND).
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                      = 'C:\TEMP1\FLIGHT.XLS'
       APPEND                        = P_APPEND
       WRITE_FIELD_SEPARATOR         = 'X'
      tables
        data_tab                      = P_TABLE
    In this case u have to populate the one table for header. The other one is for data.
    Thanks,
    Nithya.
    Edited by: Nithya Murugesan on Feb 8, 2009 1:00 PM

  • How to download internal table data into xml file?

    Hi,
    Experts,
    I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
    Thank you,
    Shabeer ahmed.

    check this
    data : gd_repid type sy-repid.
    GD_REPID = SY-REPID.
    DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
           M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
           G_IXML TYPE REF TO IF_IXML,
           W_STRING TYPE XSTRING,
           W_SIZE TYPE I,
           W_RESULT TYPE I,
           W_LINE TYPE STRING,
           IT_XML TYPE DCXMLLINES,
           S_XML LIKE LINE OF IT_XML,
           W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
          BEGIN OF XML_TAB OCCURS 0,
          D LIKE LINE OF XML,
          END OF XML_TAB.
    data : l_element           type ref to if_ixml_element,
           xml_ns_prefix_sf     type string,
           xml_ns_uri_sf        type string.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
       NAME = 'REPAIRDATA'
       DATAOBJECT = IT_FINAL_LAST1[]
    IMPORTING
       DATA_AS_DOM = L_DOM
    CHANGING
       DOCUMENT = M_DOCUMENT
    EXCEPTIONS
       ILLEGAL_NAME = 1
       OTHERS = 2.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    *Start of code for Header
    * namespace
    t_mnr = sy-datum+4(2).
    CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
      EXPORTING
        LANGU         = 'E'
        MONTH         = t_mnr
    IMPORTING
       T247          = wa_t247
    concatenate sy-datum+6(2)
                wa_t247-ktx
                sy-datum(4) into t_var1.
    concatenate sy-uzeit(2)
                sy-uzeit+2(2)
                sy-uzeit+4(2) into t_var2.
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    l_element  = m_document->get_root_element( ).
    xml_ns_prefix_sf = 'TIMESTAMP'.
    concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
    clear : t_var1,
            t_var2,
            t_mnr,
            wa_t247.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'FILECREATOR'.
    xml_ns_uri_sf    =   'SAP'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMGROUP'.
    xml_ns_uri_sf    = '1'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMTYPES'.
    xml_ns_uri_sf    = 'W'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    *End of Code for Header
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
      DOCUMENT = M_DOCUMENT
    IMPORTING
      XML_AS_STRING = W_STRING
      SIZE = W_SIZE
    TABLES
      XML_AS_TABLE = IT_XML
    EXCEPTIONS
      NO_DOCUMENT = 1
      OTHERS = 2.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    *Start of Code for File name
    concatenate p_file
                '\R'
                '000_119481'
                sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
                sy-uzeit(2)   sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
    *End of Code for File name
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE = W_SIZE
      FILENAME = p_file
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = XML_TAB
    EXCEPTIONS
      OTHERS = 10.
    IF SY-SUBRC  = 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Downloading the internal table with header to FTP folder

    Hi All,
    I have one requirement in downloading the internal table details with the fixed header line to FTP folder. The header line having the fixed text of 425 characters length.
    Note: We are not suppose to use WS_DOWNLOAD and GUI_DOWNLOAD function modules.
    Thanks in advance for your reply.
    Regards
    Kamini.

    Hi,
    I can download the internal table details successfully to FTP folder using the FTP function modules like(FTP_CONNECT, FTP_COMMAND , FTP_R/3_TO_SERVER and FTP_DISCONNECT). Here my problem is I am unable to download the internation table with some header text.
    You can see the format (example) of file to be download.
    Here I can successfully download the below details without the header. But I am unable to download with header line. Could you please suggest me.
    seq_no|record_action|trans_date|sku|description|
    1|N|2008-01-03 07:52:31|TTASA5025CBO     
    2|N|2008-01-03 10:28:33|411014        
    3|N|2008-01-03 10:01:03|TTASA6030CBO  
    4|N|2008-01-03 10:01:15|TTASA6630CBO
    5|N|2008-01-03 10:01:25|TTASA7035CBO 
    6|N|2008-01-08 16:57:39|TT6G       
    Regards
    Kamini.

  • Downloading two internal tables in same text file

    I have one internal table as like below.
    Data:begin of itab1 occurs 0,
         rec(5),
         end of itab1.
    Itab1 is getting updated from input text file(Continuous text).
    Here Itab1 contains one record with Indicator '01 and n number of records with indicator '02'.
    This needs to be seperated in to two internal tables.
    data:Begin of Itab_Head occurs 0,
         Rec_ind(2) type C,
         Name(3) type C,
         end of itab_Head.
    data:Begin of Itab_Item occurs 0,
         Rec_ind(2) type C,
         Id(3) type C,
         Status(10,
         end of itab_Item.
    loop at itab1.
    If itab1-Rec+0(2) = '01'.
       Itab_Head-Rec_Ind = itab1-rec+0(2).
       Itab_Head-Name = itab1-rec+2(3).
       Append Itab_Head.
    elseif itab1-rec+0(2) = '02'.
       Itab_Item-Rec_Ind = itab1-rec+0(2).
       Itab_Item-Id = itab1-rec+2(3).
       Append Itab_Item.
    endif.
    endloop.
    After moving to the internal tables I am doing some processing and updating the status of Itab_item.
    After all these again I have to download the internal table as a text file.Now my question is.
    I have values in 2 diff internal tables.How to download the two in same file.

    See this sample code.
    data: itab1 type string occurs 0 with header line,
          itab2 type string occurs 0 with header line.
    itab1 = 'itab1_text'.
    append itab1.
    itab2 = 'itab2_text'.
    append itab2.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
        APPEND = 'X'
        changing
         DATA_TAB = itab1[].
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
          APPEND = 'X'
        changing
         DATA_TAB = itab2[].
    Svetlin

  • Downloading an internal table to presentation server from WebUI

    Hi All,
    We have a requirement to download an internal table as a CSV file from CRM 7.0 WebUI to the presentation server. The file path is fixed, so the user need not choose the download location. The data to be downloaded is not part of any view on the WebUI and is being collected through code from several context nodes.
    We have looked at CL_BSP_UTILITY, which is not solving our purpose, as the prepared data stream gets over written by CRM 7.0 framework during execution.
    Any suggestions on how we can achieve the functionality?
    Regards,
    Mugdha

    Hi,
         If you need to provide download window via the browser, check out this wiki - [http://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=187336093&version=6] . If you want to directly write to the presentation server, you have th efollowing ways. If you submit a report in background, you have the option of using CL_GUI_FRONTEND_SERVICES. Otherwise you can check out using a combination of javascript and activex objects ( [http://www.codingforums.com/showthread.php?t=136906] ).
    Regards,
    Arun Prakash

  • Downloading different internal table data in a single excel with diff tabs.

    Hi gurs,
    I have 4 internal tables  with me i can able to display in 4 different excel sheets using   CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
    But my requirement is i want to download 4 internal table in single excel sheets with different tabs. please send the code if u have.
    Thanks and regards.

    Hi,
    If you want to display the content of 4 internal table in different sheets of same workbook then go through below code,
    DATA : EXCEL         TYPE OLE2_OBJECT,
           WORKBOOKS     TYPE OLE2_OBJECT,
           WORKBOOK      TYPE OLE2_OBJECT,
           CELLS         TYPE OLE2_OBJECT,
           SHEET         TYPE OLE2_OBJECT,
           FONT          TYPE OLE2_OBJECT,
           H_COM1        TYPE OLE2_OBJECT,
           F             TYPE RLGRAP-FILENAME,
           FILEP         TYPE DRAW-FILEP,
           G_FILE_DEST   TYPE STRING,
           G_FILE_TEMP   TYPE STRING,
           G_SYSUBRC     TYPE SY-SUBRC,
           G_FILE_SRC    TYPE DRAW-FILEP.
    START THE EXCEL APPLICATION
      CREATE OBJECT excel 'EXCEL.APPLICATION'.
      CALL METHOD OF excel 'WORKBOOKS' = workbooks.
      SET PROPERTY OF excel  'VISIBLE' = 0.
      CALL METHOD OF workbooks 'OPEN' EXPORTING
                #1 = filep.
    For Sheet1
      CALL METHOD OF excel 'Worksheets' = sheet
       EXPORTING #1 = 1.
      CALL METHOD OF sheet 'Activate'.
      FREE  OBJECT sheet.
      CALL METHOD OF excel 'CELLS' = cells
          EXPORTING #1 = 1
                    #2 = 15.
      SET PROPERTY OF cells 'VALUE' = <value>
    CALL METHOD OF cells 'FONT' = font.
    SET PROPERTY OF font 'SIZE' = '20'.
      FREE OBJECT cells.
    For Sheet2
      CALL METHOD OF excel 'Worksheets' = sheet
       EXPORTING #1 = 2.
      CALL METHOD OF sheet 'Activate'.
      FREE  OBJECT sheet.
      CALL METHOD OF excel 'CELLS' = cells
          EXPORTING #1 = 1
                    #2 = 6.
      SET PROPERTY OF cells 'VALUE' = 'XYZ'.
      CALL METHOD OF cells 'FONT' = font.
      SET PROPERTY OF font 'SIZE' = '20'.
      GET PROPERTY OF excel 'ACTIVESHEET' = sheet.
      CALL METHOD OF sheet 'SAVEAS' EXPORTING
                      #1 = <destination file path where you want to store>
                      #2 = 1.
      CALL METHOD OF workbooks 'CLOSE'.
      CALL METHOD OF excel 'QUIT'.
      FREE OBJECT excel.
    Thanks!
    Brunda
    'Reward if useful'.

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • Format data in the flat file while downloading from internal table

    Just I used 'GUI_DOWNLOAD' with WRITE_FIELD_SEPARATOR = 'X'. In my case one of the field contains large quantity. Bcoz of this value , it pushes the remaining filed position values in that particular row. The fields in the internal table refers the stadard data elements.I need the field values should be under corresponding field names.Can anyone help me?

    Hi,
    declare another internal table in the format in which you want to download .
    say itab_text.
    itab is your orginal internal table .
    than loop at itab.
    MOVE-CORRESPONDING Itab TO Itab_text.
    APPEND ITab_text.
    endloop.
    now pass the itab_text to gui_download.
    Thanks

  • Reg: Downloading the internal table into excel file.

    Hi,
    My requirement is i am collecting data in the internal table and i have to download the contents in an excel file and i have declared like this.
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt'.
    I have given the default file path  like this and i am using the function module .
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                      = OUTPUT_PATH
          FILETYPE                      = 'DAT'
    IMPORTING
      FILELENGTH                      =
        TABLES
          DATA_TAB                        = INT_INPUT
      FIELDNAMES                      =
       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.
    My requirement is i dont want to change my extension as .txt from .exl to my parameter addition and in the function module the file type should be 'dat' only and in the runtime i want to change the file name which i have given in the .
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt' this file.txt into datas.xls.
    it would be grateful if some one share some valuable views to wards this query
    Thanks and Regards,
    Keny

    Hi,
    Use this code.
    It will ask for the file name...there u can change.
      data : l_filename type string,
             l_filetype type char10,
             l_path type string,
             l_fullpath type string.
      l_filetype = 'DAT'.
    *Get the file name
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          FILE_FILTER          = '*.DAT'
          INITIAL_DIRECTORY    = 'C:\'
        CHANGING
          FILENAME             = l_filename
          PATH                 = l_path
          FULLPATH             = l_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.
      check l_fullpath is not initial.
    *Download file
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = l_fullpath
          FILETYPE                = l_filetype
        CHANGING
          DATA_TAB                = t_data_sum[]
        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
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          others                  = 24.
      IF sy-subrc NE 0.
        MESSAGE e398(00) WITH sy-subrc ' Error downloading file' '' ''.
      ENDIF.
    Regards
    Sandeep REddy

  • How to download an Internal Table to a flat file

    Hi All,
    I have an Internal Table with 7 columns.I am using FM 'Gui_download'.The flat file is generating correctly.But I need to display the 7 fields vertically one after other instead of displaying horizontally.The internal table consists of only one record.
    Very Urgent
    Thanks

    Hi,
    do you know the ABAP Development? I think you should post your question there. Also have you tried the SDN Search?
    Regards
    Gregor

  • Problem with downloading the internal table onto the presentation server.

    Hey folks,
    I have a problem where in i am downloading one year of sales done by the company. I wrote a program to download the file onto the presentation server . The error occurs in the FM GUI_DOWNLOAD where if the file exceeds 105843504 bytes its giving me a dump saying that
    When the program was running , it was established that more memory was needed than the operating system is able to safely to provide.
    The current program has to be terminted because of the program already requested 105843504 bytes from the operating system with malloc when the operating system reported after further memory request that there was no more memory space available.
    Could somebody provide an alternative soltuion for this.
    Its really urgent as i can download the file with 70,000,000 bytes
    Regards
    Rock

    Hi Rock,
    Please download the files on to Application Server, else as suggested by Ashish download into 2 or 3 files and merge them manually.
    Declare same internal tables may be 5 times.
    When you fill the internal table check for a counter and when you hit a certain number stop appending to it and start appending to the next.
    After you are done so download all the internal tables.
    I guess this would be a good way. I am not sure if there are any ther alternative good methods.
    Hope this helps.
    Shreekant

  • Download internal table data into excel sheet with column heading and data

    Hi,
      I am having one internal table with column headings and other table with data.
    i want to download the data with these tables into an excel sheet.
    It should ask the user for file name to save it on their own name. They should give the file name in runtime and it should be downloaded into an excel sheet.
    Can anyone tell what is the right function module for downloading these two internal table data with column heading and data.
    what we have to do for storing the file name in runtime.
    Can anyone help me on this.
    Thanks,
    Rose.

    Hi Camila,
        Try this
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = PATH2
       FILETYPE                        = 'XLS'
      TABLES
        DATA_TAB                        = IT_DATA
       FIELDNAMES                      = IT_HEADINGS
    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

  • Re: How to download an internal table to application server.. Unicode

    Hi..
    i have populated an internal table of a big structure (custom table) which has more than 100 fields.
    i wanted to download it into the application server.. as a tab de-limited file..
    Can anyone guide me how to proceed with
    Thanks In Advance
    Guhapriyan..

    HI
    this program will convert the internal table to the xml document
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT Z_table_xml.
    PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    TYPES: BEGIN OF TURNOS,
    LU LIKE T552A-TPR01,
    MA LIKE T552A-TPR01,
    MI LIKE T552A-TPR01,
    JU LIKE T552A-TPR01,
    VI LIKE T552A-TPR01,
    SA LIKE T552A-TPR01,
    DO LIKE T552A-TPR01,
    END OF TURNOS.
    TYPE SOCIO *
    TYPES: BEGIN OF SOCIO,
    NUMERO LIKE PERNR-PERNR,
    REPOSICION LIKE PA0050-ZAUVE,
    NOMBRE LIKE PA0002-VORNA,
    TURNOS TYPE TURNOS,
    END OF SOCIO.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    DATA: BEGIN OF ACCESOS OCCURS 0,
    SOCIO TYPE SOCIO,
    END OF ACCESOS.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    START-OF-SELECTION.
    PERFORM LLENA_ACCESOS.
    PERFORM DESCARGA_XML.
    END-OF-SELECTION.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    FORM LLENA_ACCESOS.
    REFRESH ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
    'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
    '0' TO ACCESOS-SOCIO-REPOSICION,
    'T1' TO ACCESOS-SOCIO-TURNOS-LU,
    'T2' TO ACCESOS-SOCIO-TURNOS-MA,
    'T3' TO ACCESOS-SOCIO-TURNOS-MI,
    'T4' TO ACCESOS-SOCIO-TURNOS-JU,
    'T5' TO ACCESOS-SOCIO-TURNOS-VI,
    'T6' TO ACCESOS-SOCIO-TURNOS-SA,
    'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
    'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
    '0' TO ACCESOS-SOCIO-REPOSICION,
    'T1' TO ACCESOS-SOCIO-TURNOS-LU,
    'T2' TO ACCESOS-SOCIO-TURNOS-MA,
    'T3' TO ACCESOS-SOCIO-TURNOS-MI,
    'T4' TO ACCESOS-SOCIO-TURNOS-JU,
    'T5' TO ACCESOS-SOCIO-TURNOS-VI,
    'T6' TO ACCESOS-SOCIO-TURNOS-SA,
    'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    ENDFORM.
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    FORM DESCARGA_XML.
    DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
    M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
    G_IXML TYPE REF TO IF_IXML,
    W_STRING TYPE XSTRING,
    W_SIZE TYPE I,
    W_RESULT TYPE I,
    W_LINE TYPE STRING,
    IT_XML TYPE DCXMLLINES,
    S_XML LIKE LINE OF IT_XML,
    W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
    BEGIN OF XML_TAB OCCURS 0,
    D LIKE LINE OF XML,
    END OF XML_TAB.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    WRITE: / 'Converting DATA TO DOM 1:'.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
    NAME = 'ACCESOS'
    DATAOBJECT = ACCESOS[]
    IMPORTING
    DATA_AS_DOM = L_DOM
    CHANGING
    DOCUMENT = M_DOCUMENT
    EXCEPTIONS
    ILLEGAL_NAME = 1
    OTHERS = 2.
    IF SY-SUBRC = 0.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    SY-SUBRC.
    ENDIF.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    IF W_RC IS INITIAL.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    W_RC.
    ENDIF.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
    DOCUMENT = M_DOCUMENT
    IMPORTING
    XML_AS_STRING = W_STRING
    SIZE = W_SIZE
    TABLES
    XML_AS_TABLE = IT_XML
    EXCEPTIONS
    NO_DOCUMENT = 1
    OTHERS = 2.
    IF SY-SUBRC = 0.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    SY-SUBRC.
    ENDIF.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_SIZE
    FILENAME = GK_RUTA
    FILETYPE = 'BIN'
    TABLES
    DATA_TAB = XML_TAB
    EXCEPTIONS
    OTHERS = 10.
    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.
    FORM DESCARGA_XML *
    u can check the link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-samples/conversion  of abap data to xml.doc
    Regards,
    Naveen

  • Using aggregation in ABAP code for internal table

    I have written following code to get cumulative amount on a date but i have to hit database for each record.
    Can't I use some function similar to SUM for doing the same thing on internal table??It would increase my performance.
    code is:
        SELECT SUM( DEB_CRE_LC ) FROM /BIC/AZFIAR_O500
         INTO LV_BALMONTH   WHERE   DEBITOR = LV_DEBITOR AND
        CALMONTH GE LV_STARTMONTH AND CALMONTH  LE LV_LASTCALMON.
    I want to put  ZFIAR data to internal table and read and do SUM thing..is it possible?? withotut usiong loop.
    regards,
    rakesh

    Hi Rajesh,
    types : begin of ty_tab,
                date type dats,
                DEB_CRE_LC   type .....     " delare type & is the filed need to summerized
                end of ty_tab,
    data: itab type standard table of ty_tab.
    SELECT date
                  SUM( DEB_CRE_LC )  as DEB_CRE_LC  FROM /BIC/AZFIAR_O500
                  INTO corresponding fields of itab
                  where CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON
                  group by date.   " date is the field available in your ODS/transparent table
    simulate the above code in your program...
    Hope this will work..

Maybe you are looking for

  • MacBook Pro Freezing After Screen Replacement

    I recently took my MBP in to get the screen replaced due to a screen separation issue. When I got it back it froze every now and then, but it kept continuing. Everytime I restart the computer after a freeze it will freeze up sooner and sooner. At fir

  • Urgent !! -Please Help -Leaving action delimits IT 0017

    Hello Gurus, At the moment when you run the Action to make an employee a leaver in HR the Action delimits Infotype 0017 Travel Privileges.  This then means that if the Travel & Expense Department need to go and view expense claims for that employee t

  • In contacts app how can I move a contact from one group to another group?

    I find I cannot move a contact from one group to another group. If I delete a contact from one group I delete that contact from my total contact population. I did not have this problem in earlier IOS versions. Can anyone help me?

  • HTML linebreak br in xsl

    I want to render a xml document into html using xsl. My question is how do I create a html linebreak in the xsl document that will be successfully parsed? I tried , but this gets rendered as </br> which result in a double linebreak in the browser. I

  • Android 2.2 Reverts to Default email settings when roaming - Droid Incredible

    When traveling with my Droid Incredible and want to send an email the phone often will lose my SMTP settings. At the same time it reverts to default settings for send / receive which means it will delete messages from POP server! Is there a roaming s