Parsing XML Files to ABAP
Hello All,
There is a requirement for parsing of XML files to ABAP.
1.How do we pick an XML file from Application server and also from FTP server?
2.After picking the XML file how to parse that XML file to process it to create material master?
Hi,
Ur scenario is File to R/3
For creating material master ..i guess there is IDoc named MATMAS.
U can make use of it and execute File to IDoc Scenario.
link for File to IDoc--
https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/fileToIDOC&
U need to pick XML file from FTP server...No need to parse XML file...just create data type which represents ur xml file structure and map it to IDoc fields.
regards,
Manisha
Similar Messages
-
Hello,
Can anyone help me to know how to parse xml in sap abap.
I have a xml file which i want to parse and store it in internal table.
<?xml version="1.0" encoding="UTF-8"?>##<data><name>menaka<name></data>
Regards,
Menaka.H.BHello,
For how to get the node name, you have to refer to this :
[https://wiki.sdn.sap.com/wiki/display/ABAP/Upload%20XML%20file%20to%20internal%20table|https://wiki.sdn.sap.com/wiki/display/ABAP/Upload%20XML%20file%20to%20internal%20table]
Check the code after:
WHEN if_ixml_node=>co_node_element
It tells you how to get the node name.
BR,
Suhas -
Store/persist XML file on ABAP stack
Hi everybody,
as the ABAP Database is a relational DB, I wonder where to store a XML file. Is there a dedicated table?
Thanks
Regards Mario
Edited by: Mario Müller on Sep 10, 2008 2:21 AMhi
try with this function module SMUM_XML_PARSE for parsing xml document into a table structure
also check this document for how an abap prog take xml and convert into an abap internal table
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492
convert an xml file into abap internal table using sap dom approach
XML DOM Processing in ABAP part II - Convert an XML file into an ABAP table using SAP DOM Approach.
regards
kummari -
Simple Transformation to deserialize an XML file into ABAP data structures?
I'm attempting to write my first simple transformation to deserialize
an XML file into ABAP data structures and I have a few questions.
My simple transformation contains code like the following
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:pp="http://www.sap.com/abapxml/types/defined" >
<tt:type name="REPORT" line-type="?">
<tt:node name="COMPANY_ID" type="C" length="10" />
<tt:node name="JOB_ID" type="C" length="20" />
<tt:node name="TYPE_CSV" type="C" length="1" />
<tt:node name="TYPE_XLS" type="C" length="1" />
<tt:node name="TYPE_PDF" type="C" length="1" />
<tt:node name="IS_NEW" type="C" length="1" />
</tt:type>
<tt:root name="ROOT2" type="pp:REPORT" />
<QueryResponse>
<tt:loop ref="ROOT2" name="line">
<QueryResponseRow>
<CompanyID>
<tt:value ref="$line.COMPANY_ID" />
</CompanyID>
<JobID>
<tt:value ref="$line.JOB_ID" />
</JobID>
<ExportTypes>
<tt:loop>
<ExportType>
I don't know what to do here (see item 3, below)
</ExportType>
</tt:loop>
</ExportTypes>
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
</QueryResponseRow>
</tt:loop>
</QueryResponse>
</tt:loop>
1. In a DTD, an element can be designated as occurring zero or one
time, zero or more times, or one or more times. How do I write the
simple transformation to accommodate these possibilities?
2. In trying to accommodate the "zero or more times" case, I am trying
to use the <tt:loop> instruction. It occurs several layers deep in the
XML hierarchy, but at the top level of the ABAP table. The internal
table has a structure defined in the ABAP program, not in the data
dictionary. In the simple transformation, I used <tt:type> and
<tt:node> to define the structure of the internal table and then
tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
can occur zero or more times. But every variation I try seems to get
different errors. Can anyone supply a working example of this?
3. Among the fields in the internal table, I've defined three
one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
XML file, I expect zero to three elements of the form
<ExportType exporttype='csv' />
<ExportType exporttype='xls' />
<ExportType exporttype='pdf' />
I want to set field TYPE_CSV = 'X' if I find an ExportType element
with its exporttype attribute set to 'csv'. I want to set field
TYPE_XLS = 'X' if I find an ExportType element with its exporttype
attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
an ExportType element with its exporttype attribute set to 'pdf'. How
can I do that?
4. For an element that has a value like
<ErrorCode>123</ErrorCode>
in the simple transformation, the sequence
<ErrorCode> <tt:value ref="ROOT1.CODE" /> </ErrorCode>
seems to work just fine.
I have other situations where the XML reads
<IsNew value='true' />
I wanted to write
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
but I'm afraid that the <tt:value> fails to deal with the fact that in
the XML file the value is being passed as the value of an attribute
(named "value"), rather than the value of the element itself. How do
you handle this?Try this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Creating an xml file from abap code
Hello All,
Please let me know which FM do I need to execute in order to create an XML file from my ABAP code ?
Thanks in advance,
Paul.This has been discussed before
XML files from ABAP programs -
Create XML file from ABAP with SOAP Details
Hi,
I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<CUNS:HeaderInfo>
<CUNS:InterfaceTypeId>10006</InterfaceTypeId>
<CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
<CUNS:SchemaVersion>1.0</SchemaVersion>
<CUNS:DateTime>sy-datum</DateTime>
</CUNS:HeaderInfo>
</SOAP:Header>
<SOAP:Body>
<xsl:copy-of select="*"/>
</SOAP:Body>
</SOAP:Envelope>
</xsl:template>
</xsl:transform>
In ABAP program, I have written below code for calling above Transformation.
call transformation ('Z_ID')
source tab = im_t_output[]
result xml xml_out.
call function 'SCMS_STRING_TO_FTEXT'
exporting
text = xml_out
tables
ftext_tab = ex_t_xml_data.
Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
Is there any easy way to create the XML file in CALL Transformation. Please help.
ThanksTry ABAP forum, as it seems not to be PI related.
-
Transforming XML File to abap structure
Hello,
I am working in a new project for making an input interface.
The problem to resolv is :
1>Reading an XML file on a unix Server
2>Transforming this file in abap structure with the instruction
call transformation.
Format of the input file :
<LISTEART>
<ART code="A01" label="Designation A01"/>
<ART code="A02" label="Designation A02"/>
<ART code="A03" label="Designation A03"/>
<ART code="A04" label="Designation A04"/>
<ART code="A05" label="Designation A05"/>
</LISTEART>
Format of the abap structure :
DATA : BEGIN OF ws_art,
code(4) TYPE c,
label(3) TYPE c,
END OF ws_art.
DATA : wt_art LIKE ws_art OCCURS 0 WITH HEADER LINE.
is it possible to transform the input file to an internal table
with the call transformation ?
CALL TRANSFORMATION transfo
SOURCE XML xml_string
RESULT para = result.
Somebody can explain me how to create links between xml file
and abap structure ?
with regards
JLuc Ledoux
[email protected]Hi,
try like this.
TYPES: BEGIN OF day,
name TYPE string,
work(1) TYPE c,
END OF day.
DATA: BEGIN OF week,
day1 TYPE day,
day2 TYPE day,
day3 TYPE day,
day4 TYPE day,
day5 TYPE day,
day6 TYPE day,
day7 TYPE day,
END OF week.
DATA xml_string TYPE string.
DATA result LIKE week.
week-day1-name = 'Monday'. week-day1-work = 'X'.
week-day2-name = 'Tuesday'. week-day2-work = 'X'.
week-day3-name = 'Wednesday'. week-day3-work = 'X'.
week-day4-name = 'Thursday'. week-day4-work = 'X'.
week-day5-name = 'Friday'. week-day5-work = 'X'.
week-day6-name = 'Saturday'. week-day6-work = ' '.
week-day7-name = 'Sunday'. week-day7-work = ' '.
CALL TRANSFORMATION ...
SOURCE root = week
RESULT XML xml_string.
CALL TRANSFORMATION ...
SOURCE XML xml_string
RESULT root = result.
Regards,
Vijay -
Error in retrieving and parsing XML File
Hi Folks
I am Working on People centric user interface, While i am custimizing a application in Business application Builder i am getting this error
" Error in retrieving and parsing XML File "
can any body look on this and give me the solution
it will be rewarded
Regards
M.S.KumarHello,
As mentionned by SAP_TECH, avoid to use the BAB.
Go to CRMC_BLUEPRINT_C and use the different option in the menu to customize the field group, toolbar group, events, ...
Use the PCUI cookbook to find your way.
Regards,
Fred -
How to parse XML files from normal FTP Servers?
I want to parse xml files from a normal FTP Servers , NOT the sap application severs itself. How can i do that?
I know how to use the SAPFTP getting and putting files ,but I don't want to download and then parse it.
Who knows how to parse it directly? I Just need to read the contents into a database.
Thanks.I want to parse xml files from a normal FTP Servers , NOT the sap application severs itself. How can i do that?
I know how to use the SAPFTP getting and putting files ,but I don't want to download and then parse it.
Who knows how to parse it directly? I Just need to read the contents into a database.
Thanks. -
How to compare after parsing xml file
Hi,
following code, parse the input.xml file, counts how many nodes are there and writes the node name and its value on screen.
1) i am having trouble writing only node name into another file instead of writing to screen.
2) after parsing, i like to compare each node name with another .xsd file for existence.
Please keep in mind that, input.xml is based on some other .xsd and after parsing i have comparing its tag with another .xsd
Need you help guys.
thanks
* CompareTags.java
import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
/** This class represents short example how to parse XML file,
* get XML nodes values and its values.<br><br>
* It implements method to save XML document to XML file too
public class CompareTags {
private final static String xmlFileName = "C:/input.xml";
int totalelements = 0;
/** Creates a new instance of ParseXMLFile */
public CompareTags() {
// parse XML file -> XML document will be build
Document doc = parseFile(xmlFileName);
// get root node of xml tree structure
Node root = doc.getDocumentElement();
// write node and its child nodes into System.out
System.out.println("Statemend of XML document...");
writeDocumentToOutput(root,0);
System.out.println("totalelements in xyz tag " + totalelements);
System.out.println("... end of statement");
/** Returns element value
* @param elem element (it is XML tag)
* @return Element value otherwise empty String
public final static String getElementValue( Node elem ) {
Node kid;
if( elem != null){
if (elem.hasChildNodes()){
for( kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling() ){
if( kid.getNodeType() == Node.TEXT_NODE ){
return kid.getNodeValue();
return "";
private String getIndentSpaces(int indent) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < indent; i++) {
buffer.append(" ");
return buffer.toString();
/** Writes node and all child nodes into System.out
* @param node XML node from from XML tree wrom which will output statement start
* @param indent number of spaces used to indent output
public void writeDocumentToOutput(Node node,int indent) {
// get element name
String nodeName = node.getNodeName();
// get element value
String nodeValue = getElementValue(node);
// get attributes of element
NamedNodeMap attributes = node.getAttributes();
System.out.println(getIndentSpaces(indent) + "NodeName: " + nodeName + ", NodeValue: " + nodeValue);
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
System.out.println(getIndentSpaces(indent + 2) + "AttributeName: " + attribute.getNodeName() + ", attributeValue: " + attribute.getNodeValue());
// write all child nodes recursively
NodeList children = node.getChildNodes();
//int totalelements = 0;
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
// System.out.println("child value.."+child);
if (child.getNodeType() == Node.ELEMENT_NODE) {
writeDocumentToOutput(child,indent + 2);
if(node.getNodeName() == "DATA"){
totalelements = totalelements+1;}
//System.out.println("totalelements in DATA tag " + totalelements);
/** Parses XML file and returns XML document.
* @param fileName XML file to parse
* @return XML document or <B>null</B> if error occured
public Document parseFile(String fileName) {
System.out.println("Parsing XML file... " + fileName);
DocumentBuilder docBuilder;
Document doc = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setIgnoringElementContentWhitespace(true);
try {
docBuilder = docBuilderFactory.newDocumentBuilder();
catch (ParserConfigurationException e) {
System.out.println("Wrong parser configuration: " + e.getMessage());
return null;
File sourceFile = new File(fileName);
try {
doc = docBuilder.parse(sourceFile);
catch (SAXException e) {
System.out.println("Wrong XML file structure: " + e.getMessage());
return null;
catch (IOException e) {
System.out.println("Could not read source file: " + e.getMessage());
System.out.println("XML file parsed");
return doc;
/** Starts XML parsing example
* @param args the command line arguments
public static void main(String[] args) {
new CompareTags();
}hi,
check out the following links
Check this blog to extract from XML:
/people/kamaljeet.kharbanda/blog/2005/09/16/xi-bi-integration
http://help.sap.com/saphelp_nw04/helpdata/en/fe/65d03b3f34d172e10000000a11402f/frameset.htm
Check thi link for Extract from any DB:
http://help.sap.com/saphelp_nw04s/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm
regards
harikrishna N -
How to parse xml file in midlet
Hi Guys,
i wish to parse xml file and display it in my midlet. i found api's supporting xml parsing in j2se ie., in java.net or j2se 5.0. Can u please help me what package to use in midlet?
how to parse xml info and display in midlet? Plz reply soon......Thanks in advance....i have exactly the same problem with KXml2, but using a j2me-polish netbeans project.
i've tried to work around with similar ways like you, but none of them worked. now i've spent 3 days for solving this problem, i'm a bit disappointed :( what is wrong with setting the downloaded kxml2 jar path in libraries&resources?
screenshot -
Hi
Anyone know about support for parsing XML files in LabVIEW?
(I mean specific XML support, I'm familiar with LabVIEWs file functions)
regards
Jan
Sent via Deja.com http://www.deja.com/
Before you buy.I assume you are referring to:
http://www.savarese.org/oro/software/OROMatcher1.1.html
Have you considered asking Savarese?
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Laurent Mentek" <[email protected]> wrote in message
news:[email protected]..
Hi all,
I'm started to develop with BEA WebLogic and I use ORACLE 8.1.6
database.
We need to map some XML tags as metadata in the database.
Here is a concrete example with part of our XML files:
XML files :
<target>EDU</target>
<question>
<para>
Please could you provide some references on nutritional status in
the frail elderly?
</para>
</question>
I use OROMatcher to parse xml files and it work fine.
I can extract every element in line with success , but don't extract the
value in <para> tag, for example.
I don't no how to use the MULTILINE_MASK option and the ^ or $ to get
this line.
Anyone could give me an example of metadatas extaction using or no the
MULTILINE_MASK option?
Thanks a lot for your help.
Laurent. -
Hi,
Is there any way to upload an XML file into ABAP WD?
I just saw a blog for Java WD.
<a href="/people/johann.marty/blog/2006/10/03/create-a-web-dynpro-tree-from-an-xml-file:///people/johann.marty/blog/2006/10/03/create-a-web-dynpro-tree-from-an-xml-file
Is there a similar facility in ABAP WD?
Regards,
Haresh.hey u can do this by using CALL Transformation id.. command..
here is the example code where i wrote this to convert it DATA to XML format...it may help u..
DATA : BEGIN OF l_xml_tab OCCURS 0,
a(100) TYPE c,
END OF l_xml_tab.
DATA : xml_out TYPE string .
DATA : lw_xml_tab LIKE LINE OF l_xml_tab.
XML
CALL TRANSFORMATION id "('ID')
SOURCE tab = gt_outtab[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = l_xml_tab.
OPEN DATASET p_lgfil1 FOR OUTPUT IN BINARY MODE.
LOOP AT l_xml_tab INTO lw_xml_tab.
TRANSFER lw_xml_tab TO p_lgfil1.
ENDLOOP.
CLOSE DATASET p_lgfil1. -
When using saxParser.parse(XMLfile, handler) to parse XML file, How to stop the parsing but not exit. I catched thread interrupted in startElement(), but can not stop it because it still go through all other startElement()s and endElement()s. Is there any method or class can stop parse XML?
Appreciate your help!
EdwardPlease look at the technote:
http://access1.sun.com/technotes/01185.html
Hope this helps.
Michelle Cope
Sun Microsystems. -
Reading XML file to ABAP internal table
Hi all,
Iam trying to convert a XLM file into abap internal table , am using XSLT transformation to parse the XML file and i am using "CALL METHOD cl_gui_frontend_services=>gui_upload" for reading the XML file.
below is the XML file.
===========================================================================
- <PIXBridge version="2.2" timestamp="2003-04-09T15:27:00">
- <PIX>
<TransactionType>605</TransactionType>
<TransactionCode>98</TransactionCode>
<TransactionNumber>6888965</TransactionNumber>
<SequenceNumber>40001</SequenceNumber>
- <SKUDefinition>
<Company>GZL</Company>
<Division>BMD</Division>
<Season />
<SeasonYear />
<Style>ORT002A</Style>
<StyleSuffix />
<Color>K13</Color>
<ColorSuffix />
<SecDimension />
<Quality />
<SizeRangeCode />
<SizeDesc>M</SizeDesc>
<SkuID>200140577</SkuID>
</SKUDefinition>
</PIX>
</PIXBridge>
=================================================================
and my Transformation code is as below
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IPIX>
<xsl:apply-templates select="//PIX"/>
</IPIX>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="PIX">
<item>
<TRANSACTIONTYPE>
<xsl:value-of select="TransactionType"/>
</TRANSACTIONTYPE>
<TRANSACTIONCODE>
<xsl:value-of select="TransactionCode"/>
</TRANSACTIONCODE>
<TRANSACTIONNUMBER>
<xsl:value-of select="TransactionNumber"/>
</TRANSACTIONNUMBER>
<SEQUENCENUMBER>
<xsl:value-of select="SequenceNumber"/>
</SEQUENCENUMBER>
<SKUDEFINITION>
<COMPANY>
<xsl:value-of select="Company"/>
</COMPANY>
<DIVISION>
<xsl:value-of select="Division"/>
</DIVISION>
<SEASON/>
<SEASONYEAR/>
<STYLE>
<xsl:value-of select="Style"/>
</STYLE>
<STYLESUFFIX/>
<COLOR>
<xsl:value-of select="Color"/>
</COLOR>
<COLORSUFFIX/>
<SECDIMENSION/>
<QUANTITY/>
<SIZERANGECODE/>
<SIZEDESC>
<xsl:value-of select="SizeDesc"/>
</SIZEDESC>
<SKUID>
<xsl:value-of select="SkuID"/>
</SKUID>
</SKUDEFINITION>
</item>
</xsl:template>
When i run my program i am getting the values only till the sequence number part and im not getting any values that is read in between <SKUDEFINITION> ..... </SKUDEFINITION>
I need help to sort this , kindly help me in this.
regs,
rajaI am not able to get a clue out of that, can Get Durairaj Athavan Raja in to loop for sorting this out.
I made changes to my transformation program , but still not getting the output of the components inside the
<SKUDefinition> , but when i debug the transformation i can able to see the output values for those components but when i get the values in the result table im not getting values of those components.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IPIX>
<xsl:apply-templates select="//PIX"/>
</IPIX>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="PIX">
<item>
<TRANSACTIONTYPE>
<xsl:value-of select="TransactionType"/>
</TRANSACTIONTYPE>
<TRANSACTIONCODE>
<xsl:value-of select="TransactionCode"/>
</TRANSACTIONCODE>
<TRANSACTIONNUMBER>
<xsl:value-of select="TransactionNumber"/>
</TRANSACTIONNUMBER>
<SEQUENCENUMBER>
<xsl:value-of select="SequenceNumber"/>
</SEQUENCENUMBER>
<xsl:for-each select="SKUDefinition">
<SKUDEFINITION>
<COMPANY>
<xsl:value-of select="Company"/>
</COMPANY>
<DIVISION>
<xsl:value-of select="Division"/>
</DIVISION>
<SEASON/>
<SEASONYEAR/>
<STYLE>
<xsl:value-of select="Style"/>
</STYLE>
<STYLESUFFIX/>
<COLOR>
<xsl:value-of select="Color"/>
</COLOR>
<COLORSUFFIX/>
<SECDIMENSION/>
<QUANTITY/>
<SIZERANGECODE/>
<SIZEDESC>
<xsl:value-of select="SizeDesc"/>
</SIZEDESC>
<SKUID>
<xsl:value-of select="SkuID"/>
</SKUID>
</SKUDEFINITION>
</xsl:for-each>
</item>
</xsl:template>
</xsl:transform>
==================
Below is my main program
===================
TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:\XMLABAP1.xml'.
This is the structure for the data from the XML file
TYPES: BEGIN OF ty_text,
TransactionType(3) type n,
TransactionCode(2) type n,
TransactionNumber(7) type n,
SequenceNumber(5) type n,
Company(3) type c,
Division(3) type c,
Season(3) type c,
SeasonYear(4) type c,
Style(8) type c,
Color(3) type c,
SecDimension(3) type c,
Quality(3) type n,
SizeRangeCode(2) type c,
SizeDesc(1) type c,
SkuID(10) type c,
END OF ty_text.
Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
data: xmlstr TYPE XSTRING.
Table and work ares for the data from the XML file
DATA: gt_person TYPE STANDARD TABLE OF ty_text,
gs_person TYPE ty_text.
Result table that contains references
of the internal tables to be filled
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
Get the XML file from your client
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Fill the result table with a reference to the data table.
Within the XSLT stylesheet, the data table can be accessed with
"IPERSON".
GET REFERENCE OF gt_person INTO gs_result_xml-value.
gs_result_xml-name = 'IPIX'.
APPEND gs_result_xml TO gt_result_xml.
Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION ZAUM_MANH_SYNC_RPT
SOURCE XML XMLSTR
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
Now let's see what we got from the file
LOOP AT gt_person INTO gs_person.
WRITE: / 'Transaction Type:', gs_person-TransactionType.
WRITE: / 'Transaction Code :', gs_person-TransactionCode.
WRITE: / 'Transaction Number :', gs_person-TransactionNumber.
WRITE: / 'SequenceNumber :', gs_person-SequenceNumber.
WRITE: / 'Company : ', gs_person-Company.
WRITE : /.
ENDLOOP. "gt_person.
Maybe you are looking for
-
Hi guys, I have recently purchased a mini displayport to hdmi off of ebay, i am able to get everything connected and working great but at random intervals the tv screen goes grey and fuzzy, a bit like noise you would used to get on older tvs that wer
-
Got my Tracking number this morning at 8am for my Note 4 but checking the number FedEx still shows nothing. Should I still be able to track even tho its 2 day ground I would think after 12 hours something should be showing up.
-
Hi All, I have a KF which has Aggregation character as 'Maximum' - 'Last Value'. In query I want to take a summation of this KF. But irrespective of the changes Im trying with this KF in the query the result is always giving me the 'Maximum last valu
-
ADSL Broadband Settings for Netgear DG834GT (no In...
A few weeks ago my DG834GT had been working with BT ADSL (not Infinity) for a year before it died, so I bought another GT with the latest firmware, but I can't get Internet access. I am currently using a HomeHub 2.0 which works fine, so I know my lin
-
Network ce0 interface goes down when reboots or does not come up
Hi, Have a V440 and on reboot the main ip ce0 is not up. I have to manually go in and ifconfig 192.168.1.3 up My hostname.ce0 192.168.1.3 # wc /etc/hostname.ce0 2 1 13 /etc/hostname.ce0 # ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAS