Gyan Factory

Gyan Factory
SAP Technical Project Support

Tuesday, February 16, 2016

Download EXCEL using CALL TRANSFORMATION

 
DATA: t_t100 TYPE STANDARD TABLE OF t100.
DATA: lv_xml  TYPE STRING.
DATA: lo_xml_doc TYPE REF TO cl_xml_document.
 
*
SELECT *
  FROM t100
  INTO TABLE t_t100
  UP TO 100 ROWS
  WHERE SPRSL EQ sy-langu.
 
*
CALL TRANSFORMATION ID
   SOURCE data_node = t_t100
   RESULT XML lv_xml.
 
*
CREATE OBJECT lo_xml_doc.
lo_xml_doc->parse_string( lv_xml ).
lo_xml_doc->export_to_file( 'c:tempt100.xls' ).
 
Opening up the file in excel:
Excel_Open_XML_popup
Excel_Open_XML_popup_2
Excel_generated_by_XML_output
File as XML
Excel_as_XML

Remove VERSION from the File

 
DATA: t_t100 TYPE STANDARD TABLE OF t100.
DATA: lv_xml  TYPE STRING.
DATA: lo_xml_doc TYPE REF TO cl_xml_document.
 
*
SELECT *
  FROM t100
  INTO TABLE t_t100
  UP TO 100 ROWS
  WHERE SPRSL EQ sy-langu.
 
*
CALL TRANSFORMATION ID
   SOURCE data_node = t_t100
   RESULT XML lv_xml.
 
*
REPLACE FIRST OCCURRENCE OF
    '<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">'
  IN lv_xml
  WITH '<asx:abap xmlns:asx="http://www.sap.com/abapxml">'.
 
*
CREATE OBJECT lo_xml_doc.
lo_xml_doc->parse_string( lv_xml ).
lo_xml_doc->export_to_file( 'c:tempt100.xls' ).
 
No more version column:
Excel_generated_by_XML_output_no_version
Do you have a Code Snippet which you want to share, Submit Code Snippet here

No comments:

Post a Comment