ALV TO XML

Hi Experts !!
I have created an ALV which shows some Data!!
Now I want to add a parameter in my selection screen which work as follows, When I click on it, it let me choose the path or the target where I want to download my XML file (like the browse button).
Then what should I do to create an XML file which contain only the data returned by the function module 'REUSE_ALV_GRID_DISPLAY'  ?!!
Can you please help in doing this?
Thanx in Advance.
Regards,
SMAALI Achraf
Edited by: SMAALI90 on Mar 22, 2011 11:45 AM
Edited by: SMAALI90 on Mar 22, 2011 11:46 AM

Hi Smamli,
Pls refer the code to convert Internal table data to XML in this lnk [Convert to XML|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b2dcbdfc-0801-0010-97bd-b3f39420759c?quicklink=index&overridelayout=true]
If u want to use transformations refer this link  http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm
Hope this will be helpful to u.,
Thanks
Regards
Kiran

Similar Messages

  • OBJECTS_OBJREF_NOT_ASSIGNED error while exporting ALV to XML

    Hi,
    We've developed an ALV report that uses a dynamic internal table to populate its data (this is beacause we needed dynamic columns). ALV displays properly and cells have INT4 type because we needed to print totals and subtotals. All export functions work properly (I can export to XLS without any problem) except XML export which throws the following error:
    OBJECTS_OBJREF_NOT_ASSIGNED
    Posición desencadenante de error tiempo ejecución                                    
             Programa                                     CL_SALV_BS_DATA_TABLE=========CP         
             Include                                      CL_SALV_BS_DATA_TABLE=========CM00N      
             Línea                                        53                                       
             Tp.módulo                                    (METHOD)                                 
             Nombre módulo                                GET_ATTRIBUTE_DESCR       
       39       clear l_reffieldtype.                                                  
       40       l_reffieldtype = ls_attribute-reference_field_type.                    
       41                                                                              
       42       if ls_attribute-reference_field is not initial.                        
       43         l_reffieldvalue = reference_value.                                   
       44       endif.                                                                 
       45                                                                              
       46       data:                                                                  
       47         l_decimals type i.                                                   
       48                                                                              
       49       clear l_decimals.                                                      
       50                                                                              
       51       try.                                                                   
       52           lr_elemdescr ?= ls_attribute-rtti.                                 
    >>>>>           l_decimals = lr_elemdescr->decimals.                               
       54         catch cx_sy_move_cast_error.                        "#EC NO_HANDLER  
       55       endtry.                                                                
       56                                                                              
       57     *... determine attribute description                                     
       58       field-symbols:                                                         
       59          type any.                                               
       60                                                                              
    Any help will be appreciated.
    Many thanks,
    Josep

    I found something else..
    If I disable totals and subtotals in my ALV export to XML works!
    I simply commented the line wa_fieldcat-do_sum = 'X'. and it worked fine.
    Is there any kind of restriction with subtotals/totals and export?
    Many thanks
    Josep

  • ALV to XML conversion

    Dear all ,
    I have one report that gives the output in ALV. Now i want to convert this output to XML tagged format. The columns in ALV will be treated as differant tags in XML file.
    Can you please help in doing this?
    Thanx in Advance.
    Regards,
    Nikhil

    Hi,
    Please refer the link below:
    http://www.erpgenie.com/abap/code/abap27.htm
    Thanks,
    Sriram Ponna.

  • ALV to XML format

    Hi all,
    My requirement is to download the ALV output into XML based on the variant.
    For example: If my ALV displays 3 fields in the output,only those field's information should be displayed in the downloaded XML file.
    Your suggestions would be really valuable.
    Thanks..

    For example say your ALV output table is gt_output, and the frontend field catalog is gt_fcat:
    FIELD-SYMBOLS: <field> type any.
    loop at gt_output assigning <output>.
      loop at gt_fcat assigning <fcat> where tech eq abap_false and no_out eq abap_false. "Ignore hidden entries
          assign component <fcat>-fieldname of structure <output> to <field>.
          "Now write the field to your XML structure.
      endloop.
    endloop.
    Alternatively you can build the output into an internal table with a key-value pair eg FIELDNAME and VALUE and then use a Simple transformation to convert to XML - personally this might be a better way to go if you know transformations.
    Cheers
    Alex
    Edited by: Alex Cook on Jan 4, 2011 4:51 PM
    Tidied up code - XML write isn't working

  • File Conversion in alv's

    Hi
       What is procedure for file conversion in alv's
    Thanks.

    Hi
    Go through the link given below :
    this will converse ALV to XML.
    ALV to XML conversion
    also go through
    http://help.sap.com/saphelp_erp2004/helpdata/en/33/206bc8012e11d3b495006094192fe3/content.htm
    With Regards
    Nikunj Shah

  • OfficeControl and POI

    I bind OfficeControl's property dataSource with type com.sap.ide.webdynpro.uielementdefinitions.Resource, and can show excel in OfficeControl.
    Then I use POI to create a excel and bind it with OfficeControl , but it has errors: ERRO|20080416133953|KHFA.OfficeCompView.OfficeControl_592|CIOS_GeneralDocumentContainer_Acf::|OleLoad|HRESULT=-2147221164(&#27809;&#26377;&#27880;&#20876;&#31867;&#21035;)
    CODE:
    ByteArrayOutputStream os = new ByteArrayOutputStream();
              HSSFWorkbook wb = new HSSFWorkbook();
              HSSFSheet s = wb.createSheet();
              wb.setSheetName(0, "Matrix");
              for(short i=0; i<50; i++) {
                   HSSFRow row = s.createRow(i);
                   for(short j=0; j<50; j++) {
                        HSSFCell cell = row.createCell(j);
                        cell.setCellValue(""i","+j);
              try {
                   wb.write(os);     
              } catch (IOException e) {
                   e.printStackTrace();
              try {
                   IWDResource resource = WDResourceFactory.createCachedResource(os.toByteArray(),"name",WDWebResourceType.XLS);
                   wdContext.currentContextElement().setResource(resource);
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    Anyone can help me?
    Thanks!

    Hi, and thanks for the input.
    Since by manually exporting an ALV list to XML format, i get the data in the desired XML format, I assume that there already are function modules or classes in the system to do the conversion for me; or is it a wrong assumption?
    I'm looking at class CL_SALV_WD_EXPORT_UTIL, which exposes a method to convert ALV to XML format, but i can't seem to understand how to use it; and in a Webdynpro context I can't use anything which is GUI-dependent.
    I thought that OfficeControl UI was for "Office Integration", that means there should be a well-defined set of common function, and that i was simply missing how to use them, not that i should learn how to use Microsoft internal XML representation of data.
    So, the OfficeControl is intended to provide an IFrame-like embedding to an Office Document with no high-level support?

  • XML download of REUSE ALV Grid's Output

    Hi,
    I have a ALV Report from which I can download the report into a XML file.
    I need the XML download to happen automatically along with the report display.
    Please suggest how I can do this.
    Thanks,
    Suryakiran D.

    HI,
    try these function modules.
    LIST_DOWNLOAD
    LIST_DOWNLOAD_HTML
    Regards,
    HRA

  • ALV list downloading to XML file

    hi experts,
    im working on ALV reports. i have displayed the list using grid, im also displaying the subtotals and grand total also.
    its all working fine.
    my problem is, when i try to download it using  list -> export -> spreadsheet, im getting only the data. the top of page, end of list and totals are not getting into the xml file.
    can some one help me to solve this problem please.
    one more problem is when i download using local file button (ctrlshftF9) im gtting header footer and all. but here the problem is its getting some additional coloms and also a list header, which i didnt gave. how to avoid those. please help me to slove these problems.
    thanks in advance.

    hi,
    i cannot understand y u r not getting totals and headings in xml file.
    check this sample program,i have downloaded now to desktop and iam getting all headings,subtotals and totals.
    REPORT  ZGM_ALV_SUBTOTAL_TEXT                   .
    *& Table declaration
    TABLES: ekko.
    *& Type pool declaration
    TYPE-POOLS: slis. " Type pool for ALV
    *& Selection screen
    SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
    *& Type declaration
    Type declaration for internal table to store EKPO data
    TYPES: BEGIN OF x_data,
           ebeln  TYPE char30,  " Document no.
           ebelp  TYPE ebelp,   " Item no
           matnr  TYPE matnr,   " Material no
           matnr1 TYPE matnr,   " Material no
           werks  TYPE werks_d, " Plant
           werks1 TYPE werks_d, " Plant
           ntgew  TYPE entge,   " Net weight
           gewe   TYPE egewe,   " Unit of weight                          
           END OF x_data.
    *& Internal table declaration
    DATA:
      i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
    Internal table for storing field catalog information
      i_fieldcat TYPE slis_t_fieldcat_alv,
    Internal table for Top of Page info. in ALV Display
      i_alv_top_of_page TYPE slis_t_listheader,
    Internal table for ALV Display events
      i_events TYPE slis_t_event,
    Internal table for storing ALV sort information
      i_sort TYPE  slis_t_sortinfo_alv,
      i_event TYPE slis_t_event.
    *& Work area declaration
    DATA:
      wa_ekko TYPE x_data,
      wa_layout     TYPE slis_layout_alv,
      wa_events         TYPE slis_alv_event,
      wa_sort TYPE slis_sortinfo_alv.
    *& Constant declaration
    CONSTANTS:
       c_header   TYPE char1
                  VALUE 'H',                    "Header in ALV
       c_item     TYPE char1
                  VALUE 'S'.
    *& Start-of-selection event
    START-OF-SELECTION.
    Select data from ekpo
      SELECT ebeln " Doc no
             ebelp " Item
             matnr " Material
             matnr " Material
             werks " Plant
             werks " Plant
             ntgew " Quantity
             gewei " Unit
             FROM ekpo
             INTO TABLE i_ekpo
             WHERE ebeln IN s_ebeln
             AND ntgew NE '0.00'.  IF sy-subrc = 0.
        SORT i_ekpo BY ebeln ebelp matnr .
      ENDIF.
    To build the Page header
      PERFORM sub_build_header. "* To prepare field catalog
      PERFORM sub_field_catalog. "* Perform to populate the layout structure
      PERFORM sub_populate_layout."* Perform to populate the sort table.
      PERFORM sub_populate_sort."* Perform to populate ALV event
      PERFORM sub_get_event.
      END-OF-SELECTION.
    * Perform to display ALV report
      PERFORM sub_alv_report_display.
    *&      Form  sub_build_header
          To build the header
          No Parameter
    FORM sub_build_header .
    Local data declaration
      DATA: l_system     TYPE char10 ,          "System id
            l_r_line     TYPE slis_listheader,  "Hold list header
            l_date       TYPE char10,           "Date
            l_time       TYPE char10,           "Time
            l_success_records TYPE i,           "No of success records
            l_title(300) TYPE c.                " Title
    Title  Display
      l_r_line-typ = c_header.               " header
      l_title = 'Test report'(001).
      l_r_line-info = l_title.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR l_r_line.
    * Run date Display
      CLEAR l_date.
      l_r_line-typ  = c_item.                " Item
      WRITE: sy-datum  TO l_date MM/DD/YYYY.
      l_r_line-key = 'Run Date :'(002).
      l_r_line-info = l_date.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR: l_r_line,
             l_date.ENDFORM.                    " sub_build_header
    *&      Form  sub_field_catalog
          Build Field Catalog
          No Parameter
    FORM sub_field_catalog .
    Build Field Catalog
      PERFORM sub_fill_alv_field_catalog USING:     '01' '01' 'EBELN'
      'I_EKPO' 'L'
         'Doc No'(003) ' ' ' ' ' ' ' ',     '01' '02' 'EBELP' 'I_EKPO' 'L'
         'Item No'(004) 'X' 'X' ' ' ' ',     '01' '03' 'MATNR' 'I_EKPO' 'L'
         'Material No'(005) 'X' 'X' ' ' ' ',     '01' '03' 'MATNR1' 'I_EKPO'
         'L'
         'Material No'(005) ' ' ' ' ' ' ' ',
         '01' '04' 'WERKS' 'I_EKPO' 'L'
         'Plant'(006) 'X' 'X' ' ' ' ',     '01' '04' 'WERKS1' 'I_EKPO' 'L'
         'Plant'(006) ' ' ' ' ' ' ' ',     '01' '05' 'NTGEW' 'I_EKPO' 'R'
         'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM.
    " sub_field_catalog*&----
    *&     Form  sub_fill_alv_field_catalog
    *&     For building Field Catalog
    *&     p_rowpos   Row position
    *&     p_colpos   Col position
    *&     p_fldnam   Fldname
    *&     p_tabnam   Tabname
    *&     p_justif   Justification
    *&     p_seltext  Seltext
    *&     p_out      no out
    *&     p_tech     Technical field
    *&     p_qfield   Quantity field
    *&     p_qtab     Quantity table
    FORM sub_fill_alv_field_catalog  USING  p_rowpos    TYPE sycurow
                                            p_colpos    TYPE sycucol
                                            p_fldnam    TYPE fieldname
                                            p_tabnam    TYPE tabname
                                            p_justif    TYPE char1
                                            p_seltext   TYPE dd03p-scrtext_l
                                            p_out       TYPE char1
                                            p_tech      TYPE char1
                                            p_qfield    TYPE slis_fieldname
                                            p_qtab      TYPE slis_tabname.
                                           Local declaration for field
                                           catalog
      DATA: wa_lfl_fcat    TYPE  slis_fieldcat_alv.
      wa_lfl_fcat-row_pos        =  p_rowpos.     "Row
      wa_lfl_fcat-col_pos        =  p_colpos.     "Column
      wa_lfl_fcat-fieldname      =  p_fldnam.     "Field Name
      wa_lfl_fcat-tabname        =  p_tabnam.     "Internal Table Name
      wa_lfl_fcat-just           =  p_justif.     "Screen Justified
      wa_lfl_fcat-seltext_l      =  p_seltext.    "Field Text
      wa_lfl_fcat-no_out         =  p_out.        "No output
      wa_lfl_fcat-tech           =  p_tech.       "Technical field
      wa_lfl_fcat-qfieldname     =  p_qfield.     "Quantity unit
      wa_lfl_fcat-qtabname       =  p_qtab .
      "Quantity table
      IF p_fldnam = 'NTGEW'.
        wa_lfl_fcat-do_sum  = 'X'.
      ENDIF.
      APPEND wa_lfl_fcat TO i_fieldcat.
      CLEAR wa_lfl_fcat.
    ENDFORM.
    " sub_fill_alv_field_catalog*&----
    *&      Form  sub_populate_layout
          Populate ALV layout
          No Parameter
    FORM sub_populate_layout .  CLEAR wa_layout.
      wa_layout-colwidth_optimize = 'X'.
    " Optimization of Col width
    ENDFORM. " sub_populate_layout*&----
    *&      Form  sub_populate_sort
          Populate ALV sort table
          No Parameter
    FORM sub_populate_sort .
    Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.
    " sub_populate_sort*&----
    *&      Form  sub_get_event
          Get ALV grid event and pass the form name to subtotal_text
          event
          No Parameter
    FORM sub_get_event .
      CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
    'SUBTOTAL_TEXT'.  DATA: l_s_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 4
        IMPORTING
          et_events       = i_event
        EXCEPTIONS
          list_type_wrong = 0
          OTHERS          = 0.
    Subtotal
      READ TABLE i_event  INTO l_s_event
                        WITH KEY name = slis_ev_subtotal_text.
      IF sy-subrc = 0.
        MOVE c_formname_subtotal_text TO l_s_event-form.
        MODIFY i_event FROM l_s_event INDEX sy-tabix.
      ENDIF.ENDFORM.
    " sub_get_event*&----
    *&      Form  sub_alv_report_display
          For ALV Report Display
          No Parameter
    FORM sub_alv_report_display .
      DATA: l_repid TYPE syrepid .
      l_repid = sy-repid .
    This function module for displaying the ALV
    report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
       MESSAGE i000 WITH 'Error in ALV report display'(055).
      ENDIF.
      ENDFORM.
    " sub_alv_report_display*&----
          FORM sub_alv_top_of_page
          Call ALV top of page
          No parameter
    FORM sub_alv_top_of_page.                                   "#EC CALLED*
    *To write header for the ALV
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_alv_top_of_page.
    ENDFORM.
    "alv_top_of_page*&----
    *&      Form  subtotal_text
          Build subtotal text
          P_total  Total
          p_subtot_text Subtotal text info
    FORM subtotal_text CHANGING
                   p_total TYPE any
                   p_subtot_text TYPE slis_subtot_text.
    Material level sub total
      IF p_subtot_text-criteria = 'MATNR'.
        p_subtot_text-display_text_for_subtotal
        = 'Material level total'(009).
      ENDIF.
    Plant level sub total
      IF p_subtot_text-criteria = 'WERKS'.
        p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
      ENDIF.
    ENDFORM.                    "subtotal_textSelection screen:

  • How to convert ALV output into XML format.

    Hi all,
    I just want to know how to convert an ALV output into a XML format, this is really urgent.
    regards,
    Ruchika saini

    This program exports an internal table to an XML file. *----
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT ZPRUEBA_MML_13.
    PANTALLA SELECCION *
         PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    PANTALLA SELECCION *
    TYPE TURNOS *
    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 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.
    Message was edited by:
            Hymavathi Oruganti

  • Download greater than 255 characters from alv into excel sheet

    Hi,
    I have an ALV grid display report where the last field contains close to 600 characters of text.
    When I use the Export -> Local File -> Spreadsheet option and save it in an excel sheet, only first 255 characters are getting downloaded into excelsheet and rest is not gettting downloaded.
    Solution I have is: Keep a button on the screen. If that button is clicked, use GUI_DOWNLOAD FM  and the entire text (all 600 chars) gets downloaded.
    Is there any other solution to the above problem?
    I tried downloading the alv report into XML format and opened as an excel document, but even then only first 255 characters are apearing in excel cell.
    The domain has length 2048 chars for the final internal table in alv, so there is no problem with data element or domain.
    OIn debugging mode, I am able to see all the 600 chars in the final internal table before alv display.
    It looks like there is a constraint in alv that is can display only 255 characters in a cell.
    ALso, I tried converting the grid display to list display and then download into excel , but the result is same.
    Please help.

    please search first:
    http://www.sdn.sap.com/irj/scn/advancedsearch;jsessionid=%28J2EE3417400%29ID0634234250DB10563517489488469157End?query=downloadmorethan255char

  • XML file to ABAP report..gidance needed on approach

    Hello All,
    We have an existing ccBPM enabled interface between SAP-ECC and a 3rd party via PI. Currently after all the to-and-fro processing, 3rd party sends an XML FINAL-RESPONSE-FILE to PI, which resides on a folder in PI server. ( Interface ends here)
    Now the requirement is that we need to enhance this interface or create a new one which would pick the XML FINAL_RESPONSE_FILE and format the XML data and present it in user-friendly form in terms of a report /alv.
    What I want to know is:
    1> Should we enhance the existing interface and ccBPM to wait for this final-response file to come and then trigger some BAPI or maybe a proxy to send this data to ECC for further processing.
    OR
    2> Should we create a sepaarte interface which picks this file asynchronously and sends to ECC for further processing.
    OR
    3> Should a create an ABAP report, which would pick this file from PI server and format the data and create an report out of it. ( Here I assume SAP must be havinga  fm to convert XML to some internal table readable format)...please advise if there is such an FM.
    OR
    4> Is there any better approach for my scenario - I am a newbie in ccBPM.
    Many thanks
    Shirin

    Hi,
    1> Should we enhance the existing interface and ccBPM to wait for this final-response file to come and then trigger some BAPI or maybe a proxy to send this data to ECC for further processing.
    No...if you are planning to make the ccBPM wait then avoid this design...it will keep on utilising system resources till the response gets back...
    OR
    2> Should we create a sepaarte interface which picks this file asynchronously and sends to ECC for further processing.
    you can try this one.....rather I would have tried this one:)
    If you have a guarentee that the response will come within a stipulated time-period (say X secs...not very large) and if you are not supposed to create a new interface...then go for change in BPM
    Regards,
    Abhishek.

  • REUSE_ALV_GRID_DISPLAY Download to XML

    I'm trying to export an ALV report into XML format from our ECC 6 system.  From the export->spreadsheet option, I selected the 2003 XML spreadsheet format; however, when Excel 2010 starts up, it displayed a "Problem During Load" pop up box with the text "Table" in it.  I  recently upgraded to Office 2010.
    G

    Looks like I need to load the latest SAP GUI to correct the problem.

  • Problem in alv output download

    HI All,
    My problem is
    My alv output table contains long text with value as 1000 characters.
    when i am downloading my alv output into excel, it is downloading only 255 characters length.
    is there any ways to download the entire long text into excel.
    Please help me on this...
    Thanks in advance.
    Maruthi Konijeti

    see the following example.
    REPORT z_down_xml LINE-SIZE 132 NO STANDARD PAGE HEADING.
    Databases
    TABLES:
      makt,                                "Mat description
      marc,                                "Material / plant
      t001w,                               "plant name
      bhdgd.                               "Batch heading
    Internal tables
    DATA:
      BEGIN OF gt_marc OCCURS 0,
        werks LIKE marc-werks,
        matnr LIKE marc-matnr,
      END OF gt_marc,
    Table to be downloaded as xml. Each line stores start and end tags
    and the value
      BEGIN OF gt_xml OCCURS 0,
        line(120),
      END OF gt_xml,
      g_maktx(120).
    User-input
    SELECT-OPTIONS:
      s_werks FOR marc-werks,
      s_matnr FOR marc-matnr.
    START-OF-SELECTION.
    Extract all required data
      PERFORM main_processing.
    END-OF-SELECTION.
      SORT gt_marc BY werks matnr.
      LOOP AT gt_marc.
        AT FIRST.                          "First tag must be root
          CLEAR gt_xml.
          gt_xml-line = ''.
        APPEND gt_xml.
        CLEAR gt_xml.
    display data
        FORMAT COLOR 2 ON.
        WRITE :/ gt_marc-matnr, makt-maktx.
        FORMAT COLOR 2 OFF.
      ENDLOOP.
    The last tag must be the root closing tag --*
      gt_xml-line = '</LOCATIONS>'.
      APPEND gt_xml.
      CLEAR gt_xml.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename = 'C:PLANT1.XML'
                filetype = 'ASC'
           TABLES
                data_tab = gt_xml.
    TOP-OF-PAGE.
      MOVE sy-title TO bhdgd-line1.
      MOVE sy-repid TO bhdgd-repid.
      MOVE sy-uname TO bhdgd-uname.
      MOVE sy-datum TO bhdgd-datum.
      MOVE '0' TO bhdgd-inifl.
      MOVE '132' TO bhdgd-lines.
      FORMAT INTENSIFIED ON COLOR COL_HEADING.
      PERFORM batch-heading(rsbtchh0).     "report header
    Form READ_PLANT
    FORM read_plant.
    Get plant name
      CLEAR t001w.
      SELECT SINGLE name1
        INTO t001w-name1
        FROM t001w
       WHERE werks EQ gt_marc-werks.
    ENDFORM.                               " READ_PLANT
    Form MAIN_PROCESSING
    FORM main_processing.
    Material and plant basic data
      SELECT werks matnr
        INTO TABLE gt_marc
        FROM marc
       WHERE werks IN s_werks
         AND matnr IN s_matnr.
    ENDFORM.                               " MAIN_PROCESSING
    Form READ_DESCRIPTION
    FORM read_description.
    Material name
      CLEAR g_maktx.
      SELECT SINGLE maktx
        INTO g_maktx
        FROM makt
       WHERE matnr EQ gt_marc-matnr
         AND spras EQ 'E'.
    Replace special character
      DO.
        REPLACE '&' WITH '*ù%;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '/' WITH '&#47;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
    ENDFORM.                               " READ_DESCRIPTION

  • ALV GRID FORMAT IN BACKGROUND

    Dear All,
             There is t code called MB51 which the user use, we recommend them to execute that report in the background using this method -- t code-- execute in background--- enter the printer name and generate the temporary spool to veiw the report, however when we veiw that report using spo2, the <b>tool bar</b> (that comes when we execute  in the foreround) is missing, which is used to veiw it in the ALV grid format, actually the user easily select the feilds in that format and download them to excel sheets, in the background that <b>" Details"</b> <b>option</b> is not there, is there any work around for this.
    Thanks,..
    Ravi.

    Hi Clemens,
    Thanks for that valuable suggestion, atleast I got a direction to think about, so from here on its gotta be xml...
    But, since I have no idea about xml coding, also I went through those 2 links you had sent, but I'm still unable to understand the following points:
    1.How do I generate the xml code, relevant to formatting that I did in ALV Grid using the FM "REUSE_ALV_GRID_DISPLAY"?
    2. How do I go about saving the xml file onto the Application server?
    3. Can you please provide any sample ALV report code, where such XML formatting has been used?
    Thanks in advance.
    Regards,
    Azeem Ahmed Matte

  • ALV Excel in-place in Portal

    Dear gurus,
    i wonder if:
    1) ALV Excel inplace can be used within portal
    2) if yes, what configuration steps I must maintain (if there is any document about it, could anybody point me to it?)
    3) if not, can anybody suggest any alternative? I need to have my Excels formatted (like using OLE or when I generate a XML Office file, but that would take me too long to create all the outputs one by one) and if possible opened from the portal. If that could not be done, my users would accept to save it first and open the file then.
    4) I need this functionality because on my portal the users access the standard ERP transactions (through ITS or WebGUI or how exactly that is called). If I could do any programming, I would use Office UI WebDynpro container, but obviously I cannot do that. That is the reason I look for some SAP standard way how to do this.
    Thank you for your time and effort if you ave read this far:))¨
    Have a nice day everybody, regards Otto

    Looks like there is not real progress regarding this topic. Excel in-place is not supported in any GUI version except the SAP GUI for windows. For anybody who would struggle and waste time like me, please read here:
    Note 512068 - Office integration and SAP GUI for HTML
    Note 822867 - Desktop Office Integration: No support for ITS & Java GUI
    Regards Otto

Maybe you are looking for