Help required in Transformations (XML Conversion)

Hi All,
Iam using transformations for reading the data from XML to Internal tables. Everything is working fine.
Here my question is, If some tags are missing in the XML file, program is giving error 'TAG XXX is missing'.
I dont want to get this error, if any tag is missing program should take the blank value instead of raising the error.
Please help. thanks.
Regards,
Sreedhar

Hi,
My transformation is as below... Please let me know you mail ID so that i will send XML format
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" template="temp">
  <tt:root name="ROOT"/>
  <tt:template name="temp">
    <tt:loop ref="ROOT">
      <!-- Read Header Details -->
      <DESPATCHADVICE>
        <!-- Profile ID -->
          <PROFILEID>
            <tt:value ref="$ref.profile"/>
          </PROFILEID>
        <!-- BOL Number -->
        <tt:s-cond check="not-initial($ref.bol)">
          <BOLID>
            <tt:value ref="$ref.bol"/>
          </BOLID>
        </tt:s-cond>
        <!-- CopyIndicator -->
        <tt:s-cond check="not-initial($ref.copy)">
          <COPYINDICATOR>
            <tt:value ref="$ref.copy"/>
          </COPYINDICATOR>
        </tt:s-cond>
        <!-- LineCountNumeric -->
        <tt:s-cond check="not-initial($ref.lcn)">
          <LCN>
            <tt:value ref="$ref.lcn"/>
          </LCN>
        </tt:s-cond>
        <!-- GrossWeightMeasure -->
        <tt:s-cond check="not-initial($ref.gwm)">
          <GWM>
            <tt:value ref="$ref.gwm"/>
          </GWM>
        </tt:s-cond>
          <!-- Pro Number -->
        <tt:s-cond check="not-initial($ref.pro)">
          <PROID>
            <tt:value ref="$ref.pro"/>
          </PROID>
        </tt:s-cond>
        <!-- DespatchAdviceTypeCode -->
        <tt:s-cond check="not-initial($ref.dac)">
          <DAC>
            <tt:value ref="$ref.dac"/>
          </DAC>
        </tt:s-cond>
        <!-- Reading Trailer Number and Scac code -->
        <DOCUMENT_CONF>
          <!-- Trailer Number -->
          <tt:s-cond check="not-initial($ref.trailer)">
            <TRAILERID>
              <tt:value ref="$ref.trailer"/>
            </TRAILERID>
          </tt:s-cond>
          <!-- SCAC Code -->
          <tt:s-cond check="not-initial($ref.scac)">
            <SCACCODE>
              <tt:value ref="$ref.scac"/>
            </SCACCODE>
          </tt:s-cond>
        </DOCUMENT_CONF>
        <!-- Reading PO Details -->
        <tt:loop name="details" ref="$ref.details">
          <DESPATCH_CONF>
            <!-- PO Number -->
            <tt:s-cond check="not-initial($details.po)">
              <PO_CONF>
                <tt:value ref="$details.po"/>
              </PO_CONF>
            </tt:s-cond>
            <!-- Item Number -->
            <tt:s-cond check="not-initial($details.item)">
              <ITEMID_CONF>
                <tt:value ref="$details.item"/>
              </ITEMID_CONF>
            </tt:s-cond>
            <!--Reading  Material Details -->
            <SHIPMENT_CONF>
              <!--Material Details -->
              <tt:s-cond check="not-initial($details.matnr)">
                <MATERAIL>
                  <tt:value ref="$details.matnr"/>
                </MATERAIL>
              </tt:s-cond>
              <!--Quantity -->
              <tt:s-cond check="not-initial($details.tiq)">
                <TIQ>
                  <tt:value ref="$details.tiq"/>
                </TIQ>
              </tt:s-cond>
              <!--Packing Slip -->
              <tt:s-cond check="not-initial($details.packing)">
                <PACKINGSLIP>
                  <tt:value ref="$details.packing"/>
                </PACKINGSLIP>
              </tt:s-cond>
              <!--Reading Serial Number Details -->
              <tt:loop name="serial" ref="$ref.serial">
                <THU_CONF>
                  <!--Serial Number -->
                  <tt:s-cond check="not-initial($serial.sernr)">
                    <SERNR>
                      <tt:value ref="$serial.sernr"/>
                    </SERNR>
                  </tt:s-cond>
                </THU_CONF>
              </tt:loop>
            </SHIPMENT_CONF>
          </DESPATCH_CONF>
        </tt:loop>
      </DESPATCHADVICE>
    </tt:loop>
  </tt:template>
</tt:transform>
We are reading the data from XML..Please suggest.. Please let me know how to use <tt:group>
Edited by: Sreedhar841 on May 27, 2010 4:09 PM

Similar Messages

  • Help Please ! -- transform XML to HTML using xslt tag in JSP

    Hello,
    I have problem to do XSL transform in JSP.
    I have an XSL : test.xsl
    I have an XML : test.xml
    In JSP I have:
    <x:xslt media="html" xml="test.xml">
    <x:stylesheet media="html" uri="test.xsl" />
    </x:xslt>
    But It doesn't work the way it suppose to. What is wrong in my code ? I followed the URL http://e-docs.bea.com/wls/docs81/xml/xml_apps.html
    Thanks in advance,
    Christina

    Basically:
        try{
          //Setting up parameters.
          xml=new StreamSource(new File(xmlInput));
          xsl=new StreamSource(new File(xslInput));
          baos=new ByteArrayOutputStream();
          htmlResult=new StreamResult(baos);
          //Transform input(xml, xsl) onto html output.
          TransformerFactory tfactory=TransformerFactory.newInstance();
          Transformer transformer=tfactory.newTransformer(xsl);
          transformer.transform(xml, htmlResult);
          baos.writeTo(out);
          //System.err.println(htmlResult.getOutputStream().toString());
        catch(...){
        }I havent tested and I havent use this for a while, but I hope this can serve as a staring point.
    Regards,
    OO

  • Help required on Datetime string conversion

    Hello Experts,
    I have a string with value '2010-07-16T07:30:00+03:00' which came from a webservice string data.Please advice how to declare variable in abap to get the correct date and time from this string?
    From my previous exp, if I had the xml structure with this field as xsddatetime and in abap proxy, if I assign it to a char/string variable it used to do the calculation based on the timezone and give me the value as 20100716043000.
    Please advice.
    (I'm not sure if I had to post this in the ABAP forum, but thought the PI experts might have faced and solved this problem before)
    Mat

    Thanks Sandeep for your time and effort, but the problem here is this wont consider the +3 timezone in below example.
    Generally if you have a date time field in xml structure, while generating proxy ..it creates the field in abap with XSDDATETIME_Z dataelement and automatically converts to the correct  date time.(below ex date = '2010-07-16'  time = 04:30:00'
    If I offset and do the math myself, I have to handle various cases like different time zones as well as time closer to midnights( then the date has to be changed too ).
    I was hoping for a straight forward way of declaring it and getting the values.
    Thanks again.
    Mat

  • Help required in Getting XML output as Required

    Hi All,
    I have below xml
    INSERT INTO XMLTABLE VALUES (4,'<?xml version="1.0"?>
    <Node_1 empID="202" empName="Pro1" oper="Update">
    <Node_2 empID="20" empName="Pro2" oper="Update">
    <Bode_3 empID="2" empName="Pro3" oper="Update">
    <Bode_4 empID="22" empName="Pro4" oper="Update">
    <Bode_5 empID="12" empName="Pro5" oper="Delete"/>
    <Bode_6 empID="223" empName="Pro6" oper="Insert"/>
    <Bode_7 empID="201" empName="Pro7" oper="All"/>
    <Node_3 empID="21" empName="Pro71" oper="ll">
    </Bode_4>
    </Bode_3>
    </Node_2>
    </Node_1>');
    I have a sequence seq_i
    seq_i start with 1 increment by 1
    am able to display output as below,
    Node|EMPID|OPER|EMPNAME|MGRID
    Node_1|202|Update|Pro1|Null
    Node_2|20|Update|Pro2|Node_1
    Bode_3|2|Update|Pro3|Node_2
    Bode_4|22|Update|Pro4|Bode_3
    Bode_5|12|Delete|Pro5|Bode_4
    Bode_6|223|Insert|Pro6|Bode_4
    Bode_7|201|All|Pro7|Bode_4
    Node_3|21|ll|Pro71|Bode_4
    Now I want below one as output
    All nodes starting with Bode_, I need to replace that with sequence, seq_i
    so for the seq_i (starting with i and incrementing by 1)
    Please note when ever node changes to sequence, corresponding mgrid also changes,
    Node|EMPID|OPER|EMPNAME|MGRID
    Node_1|202|Update|Pro1|Null
    Node_2|20|Update|Pro2|Node_1
    1|2|Update|Pro3|Node_2
    2|22|Update|Pro4|1
    3|12|Delete|Pro5|2
    4|223|Insert|Pro6|2
    5|201|All|Pro7|2
    Node_3|21|ll|Pro71|2
    Please let me know your thoughts on this to acheive the same,
    Thanks,

    Well you've already said you can get your XML into the initial flattened hierarchy structure, so you just need to manipulate that to assign a sequence (row number) as appropriate.
    Something like...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (
      2  select 'Node_1' as node, 202 as empid, 'Update' as oper, 'Pro1' as empname, Null as mgrid from dual union all
      3  select 'Node_2', 20, 'Update', 'Pro2', 'Node_1' from dual union all
      4  select 'Bode_3', 2, 'Update', 'Pro3', 'Node_2' from dual union all
      5  select 'Bode_4', 22, 'Update', 'Pro4', 'Bode_3' from dual union all
      6  select 'Bode_5', 12, 'Delete', 'Pro5', 'Bode_4' from dual union all
      7  select 'Bode_6', 223, 'Insert', 'Pro6', 'Bode_4' from dual union all
      8  select 'Bode_7', 201, 'All', 'Pro7', 'Bode_4' from dual union all
      9  select 'Node_3', 21, 'All', 'Pro71', 'Bode_4' from dual
    10  )
    11  -- end of test data obtained from flattening XML - just use query below against own data
    12  select rpad(' ',(level-1)*2,' ')||coalesce(bode_no, node) as tree
    13        ,coalesce(bode_no, node) as node
    14        ,empid
    15        ,oper
    16        ,empname
    17        ,case when bode_no is not null then prior coalesce(bode_no, node) else mgrid end as mgrid
    18  from (
    19    select node
    20          ,case when node like 'Bode%' then
    21                     to_char(row_number() over (partition by case when node like 'Bode%' then 1 else 0 end order by node))
    22                else null
    23           end as bode_no
    24          ,empid
    25          ,oper
    26          ,empname
    27          ,mgrid
    28    from t
    29    )
    30  connect by mgrid = prior node
    31* start with mgrid is null
    SQL> /
    TREE                 NODE                                EMPID OPER   EMPNA MGRID
    Node_1               Node_1                                202 Update Pro1
      Node_2             Node_2                                 20 Update Pro2  Node_1
        1                1                                       2 Update Pro3  Node_2
          2              2                                      22 Update Pro4  1
            Node_3       Node_3                                 21 All    Pro71 Bode_4
            3            3                                      12 Delete Pro5  2
            4            4                                     223 Insert Pro6  2
            5            5                                     201 All    Pro7  2
    8 rows selected.

  • Help required to edit xml document

    I am new to java and xml compatibility.I just had familiarised SAX parser.
    I now want to familiarse the technology to edit xml document from a java program(more precisely write to an xml file).I came to know about many methods - JAXP DOM method,JAXB api method - and is totally confused.
    Can any body give me guidance about these api's and suggest a method that
    i should follow?
    i repeat that my application will have to frequently edit xml files
    Thank you

    Hi,
    it's very easy to edit and create XML. See examples in docs: http://livedocs.adobe.com/flex/3/langref/XML.html#includeExamplesSummary
    There are many examples how to get attributes and other data.
    You also can set attributes the same way.
    If you have concrete questions, ask.

  • Help required File Content Conversion.

    Hi All,
    Kindly help me in this topic i.e. File Content Conversion.
    -  What is File Content Conversion?
    -  Is knowledge of any programming language required?
    -  What is its function?
    -  How do I use it?
    Thanks in Advance.
    Regards,
    Sreedhar, Av

    Hi Sreedhar,
    Reward points if this helps
    What is File Content Conversion?
    File content conversion is used for converting flat files (fixed lenght, comma seperated) into XML messages for further processing by an integration engine. The internal XI processing (mapping, routing etc) is based on XML messages hence you need messages to be converted to XML.
    SAP By default understands xml data structure. If your file is coming in an xml format you can process it as it is.
    In case of file that is coming with a delimiter then you need to have File content conversion for SAP adpater to conver file into an XML structure which will then go to next step of Message Mapping.
    Is knowledge of any programming language required?
    No
    What is its function?
    Check these blogs for content conversion,
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    *How do I use it? *
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Reward points if this helps
    Regards
    Pragathi.

  • Transformation XML - abap

    dear abap experts,
    i currently want to read an xml file and convert it to an internal table in abap program.
    in sap help, i find TRANSFORMATION, but the example there is convert from data in abap to xml format.
    i have tried to convert from xml file to data in abap program and i face a short dump with error message XML_FORMAT_ERROR. do i need to make a proper structure for keeping my xml format ?
    or is there something miss in my program ?
    beside using transformation, is there any way to convert string that content xml file content to an internal table ?
    please advice
    regards
    eddhie

    <i>XML_FORMAT_ERROR</i>
    this happens if the XML is not well formed. to make sure its well formed, just copy paste the xml in question into a notepad and save it as .xml. now double click it, it should open in Internet explorer and show the xml in tree format. if the xml is not well formed, browser wont render it and throw error message.
    if the xml is a small document, post it here we can see whats wrong.
    to convert XML to ABAP you can use CALL TRANSFORMATION key word which will require to you do develope XLST program to do the conversion.
    of you can use FM SMUM_XML_PARSE.
    (search this forum, i have already provided code sample for this FM)
    Regards
    Raja

  • XSLT Transform XML 2 HTML does not work well

    Hi,
    This is my first attempt to use XSLT to convert my XML file into HTML using Java. I have included below the java code I used for the transformation, the xsl file and the xml file.
    As per the xml file, I would like to display the carrier's common-name for each host. However, I can only get to display the carrier-id using the code line
    <xsl:value-of select="./@carrier"/>
    as shown in the last part of the xsl file, but cannot get the carrier's commonname from the carrierid using the code,
    <xsl:variable name="hostCarr" select="./@carrier"/>
    <xsl:variable name="hostcomName" select="id($hostCarr)/common-name"/>
    <xsl:value-of select="$hostcomName"/>
    However this works well if I were to use XML SPY for the conversion, instead of the Transform class in Java. I am using version 1.4.1 of Java.
    Please help.
    Thanks,
    Prasuna
    XML file
    <pathinfo pathogen-name="Brucella spp.">
         <taxonomy>
              <carrier carrierID="wild">
                   <common-name>Wild cies</common-name>
              </carrier>
              <carrier carrierID="sheepandgoats">
                   <common-name>Domestic Pig</common-name>
              </carrier>
              <carrier carrierID="lab">
                   <common-name>Laboratory environment</common-name>
              </carrier>
         </taxonomy>
         <host-list>
              <host carrier="wild"></host>
              <host carrier="lab"></host>
              <host carrier="sheepandgoats"></host>
         </host-list>
    </pathinfo>
    XSL file
    <xsl:stylesheet version="1.0" xmlns:a="http://www.xmlspy.com/schemas/orgchart" xmlns:ipo="http://www.altova.com/IPO" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" indent="no" media-type="text/html"/>
         <xsl:template match="pathinfo">
              <html>
                   <head><title><xsl:value-of select="@pathogen-name"/></title>
                   </head>
                   <body bgcolor="#ffffe5" text="#000000" link="#007a00" vlink="#7a0000" alink="#ff0000">
                        <xsl:apply-templates select="host-list"/>
                   </body>
              </html>
         </xsl:template>
         <xsl:template match="host-list">
              <ol>
                   <xsl:for-each select="host">
                        <li>
                             <xsl:variable name="hostCarr" select="./@carrier"/>
                             <xsl:variable name="hostcomName" select="id($hostCarr)/common-name"/>
                             <!--
                             <xsl:value-of select="./@carrier"/>
                             <xsl:value-of select="$hostcomName"/>
                             -->
                             <xsl:value-of select="$hostcomName"/>
                        </li>
                   </xsl:for-each>
              </ol>
         </xsl:template>
    </xsl:stylesheet>
    Java Code
    import javax.xml.transform.*;
    import java.net.*;
    import java.io.*;
    public class Xml2Html {
    public static void main(String[] args) {
    try {
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer =
    tFactory.newTransformer
    (new javax.xml.transform.stream.StreamSource
    ("temp.xsl"));
    transformer.transform
    (new javax.xml.transform.stream.StreamSource
    ("temp.xml"),
    new javax.xml.transform.stream.StreamResult
    ( new FileOutputStream("temp.html")));
    catch (Exception e) {
    e.printStackTrace( );

    From Michael Kay's book "XSLT Programmer's Reference":
    'A non-validating XML parser isn't required to read attribute definitions from an external DTD. In this situation the XSLT processor will assume there are no ID attributes present, and the id() function will always return an empty result."
    Presumably you didn't set your transformer to use a validating parser, and I don't even see a reference to a DTD there. However the expression id('X') is equivalent to //*[@id='X'], Kay goes on to say. Try that instead.

  • XSLT mapping Help Required.

    XSLT mapping Help Required.
    Hi Experts,
    I am New to XSLT Mapping. I am practising the below Example:
    InputXML File:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
    <ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
    <Person>
    <FirstName>Anshul</FirstName>
    <LastName>Chowdhary</LastName>
    <Gender>Male</Gender>
    <Address>
    <Street>2nd Main</Street>
    <Houseno>83/b</Houseno>
    <City>Mysore</City>
    </Address> </Person>
    </ns0:MT_XSLT_Source>
    XSL StyleSheet File:
    <?xml version='1.0' encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/Gen"
    Xmlns:ns1=”http://XYZ.com/Test”>
    <xsl:template match="/">
    <ns1:MT_XSLT_Target>
    <Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title>
    <Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/>
    </Name>
    <Street> <xsl:value-of select="concat(concat(ns0:Mt_XSLT_Source/Person/Address/Houseno,' '),
    ns0:Mt_XSLT_Source/Person/Address/Street)"/> </Street>
    <City> <xsl:value-of select="ns0:Mt_XSLT_Source/Person/Address/City"/> </City>
    </ns1:MT_XSLT_Target>
    </xsl:template>
    </xsl:stylesheet>
    The Desired Output shuold be:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:MT_XSLT_Target xmlns:ns1="http://XYZ.com/Test">
    <Title>Male</Title>
    <Name>Anshul Chowdhary</Name>
    <Street>83/b 2nd Main</Street>
    <City>Mysore</City>
    </ns1:MT_XSLT_Target>
    I have refered the xsl in xml and i am getting the below Oupt in a Single line like this:
    Anshul Chowdhary Male 2nd Main 83/b Mysore
    I am Unable to display in Target XML Fomrat as shown above. Please check and do the needful.
    Regards,
    GIRIDHAR

    Hi,
    I have used below for testing.
    Input xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
    <ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
    <Person>
    <FirstName>Anshul</FirstName>
    <LastName>Chowdhary</LastName>
    <Gender>Male</Gender>
    <Address>
    <Street>2nd Main</Street>
    <Houseno>83/b</Houseno>
    <City>Mysore</City>
    </Address> </Person>
    </ns0:MT_XSLT_Source>
    xsl code:
    <?xml version='1.0' encoding="UTF-8"?> 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/gen" 
        xmlns:ns1="http://XYZ.com/Test"> 
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 
        <xsl:template match="/"> 
            <ns1:MT_XSLT_Target> 
                <Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title> 
                <Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/> 
                </Name> 
                <Street> <xsl:value-of select="concat(concat(/ns0:MT_XSLT_Source/Person/Address/Houseno,' '), 
                    /ns0:MT_XSLT_Source/Person/Address/Street)"/> </Street> 
                <City> <xsl:value-of select="/ns0:MT_XSLT_Source/Person/Address/City"/> </City> 
            </ns1:MT_XSLT_Target> 
        </xsl:template> 
    </xsl:stylesheet>
    For testing in PI ,change the extension from .txt to .xsl and zip it and upload into PI as an imported archive .
    Regards
    Venkat

  • Error in Java Mapping for Single XML conversion

    We are working on ABAP Proxy --> SAP PI 7.1 --> SOAP (Synchronous Scenario).
    (ECC -> PI -> Legacy CRM)
    Client has provided a WSDL with Single Node of XML and asking us to pass the whole structure as an single string along with all the nodes of data structure. To perform mapping we are using Java Mapping.
    Message which we are getting after Java Mapping:
    Input
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject">
       <ITEM>
          <sSlsOrderCode>1001</sSlsOrderCode>
          <sDlrCode>A250</sDlrCode>
          <sRejectReason>Z2</sRejectReason>
          <nCircleCode>2</nCircleCode>
       </ITEM>
    </ns0:MT_SOReject_Sender>
    Output
    <?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"&gt;&lt;ITEM&gt;&lt;sSlsOrderCode&gt;1001&lt;/sSlsOrderCode&gt;&lt;sDlrCode&gt;A250&lt;/sDlrCode&gt;&lt;sRejectReason&gt;Insufficient Stock Balance&lt;/sRejectReason&gt;&lt;nCircleCode&gt;2&lt;/nCircleCode&gt;&lt;/ITEM&gt;&lt;/ns0:MT_SOReject_Sender&gt;</stringinp></MT_Trg>
    Is ther any way from which we can convert &gt; as u201C>u201D and &lt; as u201C<u201D.  Required result is as follows
    Required Output
    <?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
    We are using following Java Code for the same.
    import java.io.BufferedReader;
              import java.io.FileInputStream;
              import java.io.FileOutputStream;
              import java.io.InputStream;
              import java.io.InputStreamReader;
              import java.io.OutputStream;
              import java.util.Map;
              import javax.xml.parsers.DocumentBuilder;
              import javax.xml.parsers.DocumentBuilderFactory;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;
              import org.w3c.dom.Element;
              import org.w3c.dom.Document;
              import org.w3c.dom.Text;
              import com.sap.aii.mapping.api.*;
              import com.sap.aii.mapping.api.StreamTransformation;
    public class SingleStr implements StreamTransformation{
          * @author user
          * To change the template for this generated type comment go to
          * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
                    public static void main(String args[]) throws Exception {
                FileInputStream inFile =
                 new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
                FileOutputStream outFile =
                 new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
                 SingleStr xml = new SingleStr();
                xml.execute(inFile, outFile);
                System.out.println("Success");
               public void setParameter(Map param) {
                Map map = param;
               public void execute(InputStream in, OutputStream out)
                throws com.sap.aii.mapping.api.StreamTransformationException {
                try {
                 //************************Code To Generate The XML Parsing Objects*****************************//    
                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                 DocumentBuilder db = dbf.newDocumentBuilder();
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transform = tf.newTransformer();
                 //Document doc = db.parse(in);
                 Document docout = db.newDocument();
                 Element root = docout.createElement("MT_Trg");
                 root.setAttribute("xmlns:ns","urn:Test_File_to_File");
                 docout.appendChild(root);
                 Element stringinp = docout.createElement("stringinp");
                 root.appendChild(stringinp);
                 BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
                 StringBuffer buffer = new StringBuffer();
                 String line="";
                 while ((line = inpxml.readLine()) != null)
                 buffer.append(line);
                 String inptxml=buffer.toString();
                 Text srcxml = docout.createTextNode(inptxml);
                 stringinp.appendChild(srcxml);
                 DOMSource domS = new DOMSource(docout);
                 transform.transform((domS), new StreamResult(out));
                 } catch (Exception e) {
                   System.out.print("Problem parsing the file: " + e.getMessage());
                   e.printStackTrace();
    Please help!!

    We are using following Java Code for the same.
    import java.io.BufferedReader;
              import java.io.FileInputStream;
              import java.io.FileOutputStream;
              import java.io.InputStream;
              import java.io.InputStreamReader;
              import java.io.OutputStream;
              import java.util.Map;
              import javax.xml.parsers.DocumentBuilder;
              import javax.xml.parsers.DocumentBuilderFactory;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;
              import org.w3c.dom.Element;
              import org.w3c.dom.Document;
              import org.w3c.dom.Text;
              import com.sap.aii.mapping.api.*;
              import com.sap.aii.mapping.api.StreamTransformation;
    public class SingleStr implements StreamTransformation{
               public static void main(String args[]) throws Exception {
                FileInputStream inFile =
                 new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
                FileOutputStream outFile =
                 new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
                 SingleStr xml = new SingleStr();
                xml.execute(inFile, outFile);
                System.out.println("Success");
               public void setParameter(Map param) {
                Map map = param;
               public void execute(InputStream in, OutputStream out)
                throws com.sap.aii.mapping.api.StreamTransformationException {
                try {
                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                 DocumentBuilder db = dbf.newDocumentBuilder();
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transform = tf.newTransformer();
                 //Document doc = db.parse(in);
                 Document docout = db.newDocument();
                 Element root = docout.createElement("MT_Trg");
                 root.setAttribute("xmlns:ns","urn:Test_File_to_File");
                 docout.appendChild(root);
                 Element stringinp = docout.createElement("stringinp");
                 root.appendChild(stringinp);
                 BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
                 StringBuffer buffer = new StringBuffer();
                 String line="";
                 while ((line = inpxml.readLine()) != null)
                 buffer.append(line);
                 String inptxml=buffer.toString();
                 Text srcxml = docout.createTextNode(inptxml);
                 stringinp.appendChild(srcxml);
                 DOMSource domS = new DOMSource(docout);
                 transform.transform((domS), new StreamResult(out));
                 } catch (Exception e) {
                   System.out.print("Problem parsing the file: " + e.getMessage());
                   e.printStackTrace();
    Please help!!

  • Mapping error in FCC to XML conversion

    hiii friends,
    im donig a simple fcc to xml conversion
    my Sender msg type is like
    TXT_mt
          records                             1.1   
                row                             1.n
                    id                             1
                    Name                       1
                    address                   1
    My receiver msg type like
    Xml_mt
          records                             1.1   
                row                             1.n
                    id                             1
                    Name                       1
                    address                   1
    msg mapping like
    records--->records
    id--->id
    Name-->Name
    address-->address
    **Im getting a mapping error like**
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_pepsi_fcc_file_mm_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_pepsi_fcc_file_mm_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    I ve checked my adapeters they r green.
    Could u tell me the problem here and how to solve it???
    Regards
    Balaji

    Hii Volker,
    I have tried to understand the trace msg,. i got one interesting error message i hope it will tell the exact problem im facing,,,
    <Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_pepsi_fcc_file_mm_</Trace>
      <Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ns:xml_mt/record/row. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram
    My Sender CC  contains the following FCC parameters
    Document Name -
    > txt_mt
    Recordset Name -
    > records
    recordset Structure -
    >  row, *
    row.fieldNames -
    > id, Names,address
    row.fieldSeparator -
    > , (comma)
    row.endSeparator--- >  'nl'
    row.processConfiguration  -
    > FromConfiguration
    my TXT_in.txt contain
    100,balaji,chennai
    200,raj,orissa
    300,charakrat,bangalore
    Regards,
    Balaji
    Edited by: Balaji Pichaimuthu on Jul 1, 2009 3:44 PM

  • Flat files to XML conversion module?

    Hi Experts,
    I would like to know from where I can have free download for flat files to XML conversion module which I can test in development server. Your help will be well appreciated.
    Thanks and Regards,
    Praveen.

    u have file adapter with FCC which does the flat file to XML conversion. wat is ur requirement?
    refer the help or search on SDN for file content conversion.
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    few examples:-
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Key value:
    How to send a flat file with various field lengths and variable substructures to XI 3.0
    File Receiver with Content Conversion
    chirag

  • Transforming XML source to (X)HTML StreamResult outputs long comment

    Hi,
    I'm using javax.xml.transform.* to transform XML data into an XHTML page. The XML data represents a document (contains information about headers, paragraphs, related pages, etc.) and an XSL file is used to properly transform that data into an XHTML compatible file. All transformations go just as they should, however, the XHTML output contains a very lenthy comment about elements and attributes concerning HTML. Obviously, I do not want this comment in my final output. As a side note: I'm using a StreamSource(File) for the XML data source, a StreamSource(File) for the XSL file and a StreamResult(HttpServletResponse.getOutputStream()) for the HTML output. I'm not sure wether the problem is with using a StreamResult directly (rather than a SAXResult), or because I'm outputting directly to the servlet output stream. All input and output is in UTF-8, and the HttpServletResponse has been configured using setCharacterEncoding("UTF-8") and setContentType("text/html").
    Everything works fine, except I get this stinkin' long comment, which I want gone.
    Thanks,
    Yuthura

    I get the following result.html file (properly transformed and displayed in my browser, except for the comment):
    <!--================== Imported Names ====================================-->
    <!-- media type, as per [RFC2045] -->
    <!-- comma-separated list of media types, as per [RFC2045] -->
    <!-- a character encoding, as per [RFC2045] -->
    <!-- a space separated list of character encodings, as per [RFC2045] -->
    <!-- a language code, as per [RFC3066] -->
    <!-- a single character, as per section 2.2 of [XML] -->
    <!-- one or more digits -->
    <!-- space-separated list of link types -->
    <!-- single or comma-separated list of media descriptors -->
    <!-- a Uniform Resource Identifier, see [RFC2396] -->
    <!-- a space separated list of Uniform Resource Identifiers -->
    <!-- date and time information. ISO date format -->
    <!-- script expression -->
    <!-- style sheet data -->
    <!-- used for titles etc. -->
    <!-- nn for pixels or nn% for percentage length -->
    <!-- pixel, percentage, or relative -->
    <!-- integer representing length in pixels -->
    <!-- these are used for image maps -->
    <!-- comma separated list of lengths -->
    <!--=================== Generic Attributes ===============================-->
    <!-- core attributes common to most elements
    id document-wide unique id
    class space separated list of classes
    style associated style info
    title advisory title/amplification
    -->
    <!-- internationalization attributes
    lang language code (backwards compatible)
    xml:lang language code (as per XML 1.0 spec)
    dir direction for weak/neutral text
    -->
    <!-- attributes for common UI events
    onclick a pointer button was clicked
    ondblclick a pointer button was double clicked
    onmousedown a pointer button was pressed down
    onmouseup a pointer button was released
    onmousemove a pointer was moved onto the element
    onmouseout a pointer was moved away from the element
    onkeypress a key was pressed and released
    onkeydown a key was pressed down
    onkeyup a key was released
    -->
    <!-- attributes for elements that can get the focus
    accesskey accessibility key character
    tabindex position in tabbing order
    onfocus the element got the focus
    onblur the element lost the focus
    -->
    <!--=================== Text Elements ====================================-->
    <!-- these can occur at block or inline level -->
    <!-- these can only occur at block level -->
    <!-- %Inline; covers inline or "text-level" elements -->
    <!--================== Block level elements ==============================-->
    <!-- %Flow; mixes block and inline and is used for list items etc. -->
    <!--================== Content models for exclusions =====================-->
    <!-- a elements use %Inline; excluding a -->
    <!-- pre uses %Inline excluding big, small, sup or sup -->
    <!-- form uses %Block; excluding form -->
    <!-- button uses %Flow; but excludes a, form and form controls -->
    <!--================ Document Structure ==================================-->
    <!-- the namespace URI designates the document profile -->
    <!--================ Document Head =======================================-->
    <!-- content model is %head.misc; combined with a single
    title and an optional base element in any order -->
    <!-- The title element is not considered part of the flow of text.
    It should be displayed, for example as the page header or
    window title. Exactly one title is required per document.
    -->
    <!-- document base URI -->
    <!-- generic metainformation -->
    <!--
    Relationship values can be used in principle:
    a) for document specific toolbars/menus when used
    with the link element in document head e.g.
    start, contents, previous, next, index, end, help
    b) to link to a separate style sheet (rel="stylesheet")
    c) to make a link to a script (rel="script")
    d) by stylesheets to control how collections of
    html nodes are rendered into printed documents
    e) to make a link to a printable version of this document
    e.g. a PostScript or PDF version (rel="alternate" media="print")
    -->
    <!-- style info, which may include CDATA sections -->
    <!-- script statements, which may include CDATA sections -->
    <!-- alternate content container for non script-based rendering -->
    <!--=================== Document Body ====================================-->
    <!-- generic language/style container -->
    <!--=================== Paragraphs =======================================-->
    <!--=================== Headings =========================================-->
    <!--
    There are six levels of headings from h1 (the most important)
    to h6 (the least important).
    --> ... (more to come)

  • Problem transforming XML/XSL Using Xalan

    Hi, I am using the xalan apis to transform XML/XSL in a servlet..My servlet code is like...
    response.setContentType("text/html; charset=UTF-8");
    // Output goes in the response stream.
    PrintWriter out = response.getWriter();
    boolean environmentOK = (new org.apache.xalan.xslt.EnvironmentCheck()).checkEnvironment (out);
    try
    TransformerFactory tFactory = TransformerFactory.newInstance();
    // Get the XML input document and the stylesheet.
    Source xmlSource = new StreamSource("D:\\DATA\\jrun\\test\\test.xml");
    Source xslSource = new StreamSource("D:\\DATA\\jrun\\test\\test.xsl");
    // Generate the transformer.
    Transformer transformer = tFactory.newTransformer(xslSource);
    // Perform the transformation, sending the output to the response.
    transformer.transform(xmlSource, new StreamResult(out));
    I am getting the error ..
    javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: Namespace not supported by SAXParserjavax.xml.transform.TransformerConfigurationException
    That's why I have added the line..
    boolean environmentOK = (new org.apache.xalan.xslt.EnvironmentCheck()).checkEnvironment (out);
    But that gives me the following error diagnostic information...
    ERROR.version.DOM=ERROR attempting to load DOM level 2 class: java.lang.NoSuchMethodException
    I have put all the 3 required classes, xml-apis.jar, xercesImpl.jar and xalan.jar in my application servers classpath..
    Please let me know what I am doing wrong..and how this can be fixed.
    Thanks
    Surajit

    hey Surajit
    Your code is unable to create a transformer from a factory instance.
    I would check why it is not creating the Transformer.On my win32 system i usee two forward slashes..to identify the file path
    D://xyz//abc....instead of D:\\...i wonder if thats one reason why your code is not able to create a transformer based on the StreamSource u create for the file paths.
    Code i use..that works
    javax.xml.transform.TransformerFactory tFactory =
                                                                javax.xml.transform.TransformerFactory.newInstance();
                                                      javax.xml.transform.Source xmlSource = new javax.xml.transform.stream.StreamSource                              (xmlInputSource);
                                                 javax.xml.transform.Source xslSource = new javax.xml.transform.stream.StreamSource
                                       (xslInputSource);
                                                                                                        // Generate the transformer.
                                                                javax.xml.transform.Transformer transformer = tFactory.newTransformer(xslSource);
                                                                                                   // Perform the transformation, sending the output to the response.
                                                                transformer.transform(xmlSource,new javax.xml.transform.stream.StreamResult(out));
                                                                                                        I used jaxp-1.2 with tomcat 4.1.12
    Hope that helps.

  • Help on Call Transformation

    Hi
    i have created a RFC and thru that i am submitting a report and calling that RFC in my EP.
    i make use of the FM "WWW_HTML_TO_LISTOBJECT" so that data mirror image of my report is also displayed in my portal.
    But the problem is i can't control it, For eg: if i click on "download to excel" it isnt working properly.
    how should i overcome this problem.
    Once Mr.Raja (one of the sdn member) suggested to use
    "call transformation" method, can you be specific to that, how should i use that in ALV report. where should i write "call transoformation" method. A sample code would be helpful.
    Thank you

    <b>Call Transformation</b>
    is for transforming XML using XSLT into a xml/html/abap itab, etc formats.
    of transforming abap itab to xml format.
    you cannot convert the html returned by your program into your required format using this mechanism.
    if you want to use this feature , then your report should be returning XML output.
    possible tranformation scenarios
    from XML to XML (only for XSLT),
    from XML to ABAP (for XSLT and simple transformations),
    from ABAP to XML (for XSLT and simple transformations),
    from ABAP to ABAP (only for XSLT),
    Regards
    Raja

Maybe you are looking for

  • How to restore iCal using Time Machine with Lion OS

    Just got off the phone with Apple Support.  With Lion, your User/Library/Calendar file is now hidden.  Here is how to find it in order to restore data to your iCal. Close iCal Open FINDER Use "GO" button located across top Hit and hold the OPTION key

  • How to create a custom button in Excel while log on to BI through BEx

    Hi all,     I have an requirement to add a button in excel application, while we log on to BI through BEx.    I know only that it has to be done with macros. I dont have any idea in this.     When i click on that button an RFC should get executed.   

  • Bex Issue Query

    Hello, I have a query about Bex.  I have 2 Bex Queries with different Keyfigures on different providers. Query 1: Customer     Material     Plant     Quantity Sold Query 2: Customer Material Plant Quantity Available This is what i want to do.  Basica

  • Internet Explorer 11 management

    Hi all: A few weeks ago I rebuilt a server we use to run WSUS. When I finished I forgot to turn off loading updates for Internet Explorer as I wanted Version 9 to remain on our Windows 7 workstations. So now everyone has version 11. Now we have a new

  • 0000-00-00 Date Problems

    com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.DateIn my application I need to have some Date fields has 0000-00-00 value. When loading