Parser-independent document creation with JAXP?

Is it possible to do the following in a parser-independent
way with JAXP apis? Thanks
DOMImplementation domImpl =
new org.apache.xerces.dom.DOMImplementationImpl();
org.apache.xerces.dom.DocumentTypeImpl docTypeImpl
= new org.apache.xerces.dom.DocumentTypeImpl(null, "bean", null, null);
docTypeImpl.setInternalSubset(
"<!ELEMENT bean (property*)>" + NL +
"<!ELEMENT property (#PCDATA)>" + Format.NL +
"<!ATTLIST bean className CDATA #REQUIRED>" + NL +
"<!ATTLIST property type CDATA #REQUIRED>" + NL +
"<!ATTLIST property name CDATA #REQUIRED>"
Document doc = domImpl.createDocument(null, "bean", docTypeImpl);
Element root = doc.getDocumentElement();
// add elements etc.

Hi,
Its is possible thru the following code.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
DOMImplementation domImpl = db.getDOMImplementation();
DocumentType docType = domImpl.createDocumentType("PERSON",null,strSystemID);
document = domImpl.createDocument(null,"STUDENT",docType);and use the javax.xml.transformer api to transform this in memory java dom object to xml.
Regards / Rajan Kumar

Similar Messages

  • Sales Document Creation with SD_SALESDOCUMENT_CREATE

    Hi All,
    I am trying to create a Sales Order using FM SD_SALESDOCUMENT_CREATE. I have the following questions:
    1). Do I need to specify the Line Item Numbers? If I don't need to then how does SAP know which line items in SALES_ITEMS_INX and SALES_SCHEDULES_IN tables are referring to the items in SALES_ITEMS_IN?
    2). How do I add the pricing conditions? I see the table SALES_CONDITIONS_IN but what fields do I need to fill in?
    Do I need to fill in the Step number, Condition Count, Condition Type, and Condition Value fields?
    Any suggestions will be greatly appreciated.
    Regards.

    Hi Aurag,
    Why dont you use the BAPI "BAPI_SALESORDER_CREATEFROMDAT2" - the line item numbers can be assigned by you or system will assign them as per configuration setup. Look at the documentation for this BAPI and you will understand what needs to be populated.
    Cheers

  • Flash can not parse this document.  What's up with this?

    I've never seen this one before.  I'm using CS5
    On windows 7
    I'm developing a component.  I have it in the Components panel.
    But I update it alot, and copy the shim to the prototype file quite often.
    Every now and then I get the error that the file cannot be opened.
    In the output panel is says Flash can not parse this document.
    I have lost access to one of my files.
    If I save as CS4 it always loads.
    So now I'm saving in both formats.
    I don't understand what is happening.
    Is this a bug?  I've checked for updates.
    I have the latest build for CS5 Flash Prof

    Did you use any special character like & ^ $ etc... in any of the components field? Flash CS4 was more lenient with special character compare to Flash CS5. One way to fix CS5 files is to change .fla extension to .zip. Unzip the file, go through the DOMDocument.xml file or xml file inside LIBRARY folder and remove the special character. After that double click the fla file you see inside the zip folder and Resave this file in Flash.
    Quynh
    Flash Pro, QE

  • Problem with JAXP

    I have a following xml file AddressBook.xml
    <?xml version = �1.0�?>
    <addressbook>
    <person>
    <lastname>Idris</lastname>
    <firstname>Nazmul</firstname>
    <company>The Bean Factory, LLC.</company>
    <email>[email protected]</email>
    </person>
    </addressbook>
    and following java file
    // JaxpXmlDomExample.java
    // Core Java APIs
    import java.io.File;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    // JAXP
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    // DOM
    import org.w3c.dom.Node;
    import org.w3c.dom.Element;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.NamedNodeMap;
    * Used to provide an example of how to build a DOM Tree from an example XML
    * file provided on the command line. This example uses Sun Microsystem's JAXP
    * API's.
    * COMPILE:
    * javac JaxpXmlDomExample.java
    * RUN PROGRAM:
    * java JaxpXmlDomExample AddressBook.xml
    public class JaxpXmlDomExample {
    private static void printNode(Node node, String indent) {
    switch (node.getNodeType()) {
    case Node.DOCUMENT_NODE:
    System.out.println("<xml version=\"1.0\">\n");
    // recurse on each child
    NodeList nodes = node.getChildNodes();
    if (nodes != null) {
    for (int i=0; i<nodes.getLength(); i++) {
    printNode(nodes.item(i), "");
    break;
    case Node.ELEMENT_NODE:
    String name = node.getNodeName();
    System.out.print(indent + "<" + name);
    NamedNodeMap attributes = node.getAttributes();
    for (int i=0; i<attributes.getLength(); i++) {
    Node current = attributes.item(i);
    System.out.print(
    " " + current.getNodeName() +
    "=\"" + current.getNodeValue() +
    System.out.print(">");
    // recurse on each child
    NodeList children = node.getChildNodes();
    if (children != null) {
    for (int i=0; i<children.getLength(); i++) {
    printNode(children.item(i), indent + " ");
    System.out.print("</" + name + ">");
    break;
    case Node.TEXT_NODE:
    System.out.print(node.getNodeValue());
    break;
    public static void main(String[] args) {
    if (args.length != 1) {
    System.err.println ("\nUsage: java JaxpXmlDomExample filename\n");
    System.exit (1);
    // Create File object from incoming file
    File xmlFile = new File(args[0]);
    try {
    // Get Document Builder Factory
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    // Turn on validation, and turn off namespaces
    factory.setValidating(true);
    factory.setNamespaceAware(false);
    // Obtain a document builder object
    DocumentBuilder builder = factory.newDocumentBuilder();
    System.out.println();
    System.out.println("Passed in File : " + args[0]);
    System.out.println("Object to Parse (File) : " + xmlFile);
    System.out.println("Parser Implementation : " + builder.getClass());
    System.out.println();
    // Parse the document
    Document doc = builder.parse(xmlFile);
    // Print the document from the DOM tree and feed it an initial
    // indentation of nothing
    printNode(doc, "");
    System.out.println("\n");
    } catch (ParserConfigurationException e) {
    System.out.println("The underlying parser does not support " + "the requested features.");
    e.printStackTrace();
    } catch (FactoryConfigurationError e) {
    System.out.println("Error occurred obtaining Document Builder " + "Factory.");
    e.printStackTrace();
    } catch (Exception e) { e.printStackTrace();}
    The above java program cmpiles perfectly, but when I try to exeecute the program
    ( c:\>java JaxpXmlDomExample AddressBook.xml )
    the following error occuring:-
    java.lang.SecurityException: sealing violation
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at org.apache.crimson.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder
    (DocumentBuilderFactoryImpl.java:88)
    at JaxpXmlDomExample.main(JaxpXmlDomExample.java:113)
    Please tel me ASAP what should I do.
    I am using
    O/S :: Windows 2000
    JDK :: 1.4.0
    JAXP :: 1.1ea2 (Early Access 2)
    Regards

    Sealing violations usually mean that you are compiling with one version of a jar file, and trying to run against another.

  • XDK9.2.0.2, pb with JAXP and XSL Processor

    Hello,
    I'm using XDK 9.2.0.2 and I try to use JAXP.
    I have a difference between using the Oracle XSL processor directly and through JAXP.
    Through JAXP, the processor don't care about the xsl:outpout encoding attribute !
    Why ?
    It take care of method, indent, ... but not encoding !
    I try to set the property with : transformer.setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
    It works but I don't want to do that this way !
    TIA
    Didier
    sample (from XSLSample2):
    /* $Header: XSLSample2.java 07-jan-2002.02:24:56 sasriniv Exp $ */
    /* Copyright (c) 2000, 2002, Oracle Corporation. All rights reserved. */
    * DESCRIPTION
    * This file gives a simple example of how to use the XSL processing
    * capabilities of the Oracle XML Parser V2.0. An input XML document is
    * transformed using a given input stylesheet
    * This Sample streams the result of XSL transfromations directly to
    * a stream, hence can support xsl:output features.
    import java.net.URL;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XMLDocument;
    import oracle.xml.parser.v2.XMLDocumentFragment;
    import oracle.xml.parser.v2.XSLStylesheet;
    import oracle.xml.parser.v2.XSLProcessor;
    // Import JAXP
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    public class XSLSample2
    * Transforms an xml document using a stylesheet
    * @param args input xml and xml documents
    public static void main (String args[]) throws Exception
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL xslURL;
    URL xmlURL;
    try
    if (args.length != 2)
    // Must pass in the names of the XSL and XML files
    System.err.println("Usage: java XSLSample2 xslfile xmlfile");
    System.exit(1);
    // Parse xsl and xml documents
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    // parser input XSL file
    xslURL = DemoUtil.createURL(args[0]);
    parser.parse(xslURL);
    xsldoc = parser.getDocument();
    // parser input XML file
    xmlURL = DemoUtil.createURL(args[1]);
    parser.parse(xmlURL);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLProcessor processor = new XSLProcessor();
    processor.setBaseURL(xslURL);
    XSLStylesheet xsl = processor.newXSLStylesheet(xsldoc);
    // display any warnings that may occur
    processor.showWarnings(true);
    processor.setErrorStream(System.err);
    // Process XSL
    processor.processXSL(xsl, xml, System.out);
    // With JAXP
    System.out.println("");
    System.out.println("With JAXP :");
    TransformerFactory tfactory = TransformerFactory.newInstance();
    String xslID = xslURL.toString();
    Transformer transformer = tfactory.newTransformer(new StreamSource(xslID));
    //transformer.setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
    String xmlID = xmlURL.toString();
    StreamSource source = new StreamSource(xmlID);
    transformer.transform(source, new StreamResult(System.out));
    catch (Exception e)
    e.printStackTrace();
    My XML file :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ListePatients>
    <Patient>
    <Nom>Zeublouse</Nom>
    <NomMarital/>
    <Prinom>Agathe</Prinom>
    </Patient>
    <Patient>
    <Nom>Stick</Nom>
    <NomMarital>Laiboul</NomMarital>
    <Prinom>Ella</Prinom>
    </Patient>
    <Patient>
    <Nom>`ihnotvy</Nom>
    <NomMarital/>
    <Prinom>Jacques</Prinom>
    </Patient>
    </ListePatients>
    my XSL file :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" omit-xml-declaration="yes" indent="yes" encoding="ISO-8859-1"/>
    <xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
    <xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>
    <xsl:template match="/">
    <HTML>
    <HEAD>
    <TITLE>Liste de patients</TITLE>
    </HEAD>
    <BODY>
    <xsl:apply-templates select='ListePatients'/>
    </BODY>
    </HTML>
    </xsl:template>
    <xsl:template match='ListePatients'>
    <TABLE>
    <xsl:for-each select='Patient'>
    <xsl:sort select='Nom' order='ascending' data-type='text'/>
    <TR TITLE='`ihnotvy'>
    <TD><xsl:value-of select='Nom'/></TD>
    <TD><xsl:value-of select='NomMarital'/></TD>
    <TD><xsl:value-of select='Prinom'/></TD>
    </TR>
    </xsl:for-each>
    </TABLE>
    </xsl:template>
    </xsl:stylesheet>
    The result :
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <TITLE>Liste de patients</TITLE>
    </HEAD>
    <BODY>
    <TABLE>
    <TR TITLE="`ihnotvy">
    <TD>`ihnotvy</TD>
    <TD></TD>
    <TD>Jacques</TD>
    </TR>
    <TR TITLE="`ihnotvy">
    <TD>Stick</TD>
    <TD>Laiboul</TD>
    <TD>Ella</TD>
    </TR>
    <TR TITLE="`ihnotvy">
    <TD>Zeublouse</TD>
    <TD></TD>
    <TD>Agathe</TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
    With JAXP :
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <TITLE>Liste de patients</TITLE>
    </HEAD>
    <BODY>
    <TABLE>
    <TR TITLE="C C)C(C.C/C4C6C9">
    <TD>C C)C(C.C/C4C6C9</TD>
    <TD></TD>
    <TD>Jacques</TD>
    </TR>
    <TR TITLE="C C)C(C.C/C4C6C9">
    <TD>Stick</TD>
    <TD>Laiboul</TD>
    <TD>Ella</TD>
    </TR>
    <TR TITLE="C C)C(C.C/C4C6C9">
    <TD>Zeublouse</TD>
    <TD></TD>
    <TD>Agathe</TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    You can also use a PrintWriter to wrap a JspWriter
    since PrintWriter has a constructor that takes any
    Writer instance.I'm having the same problem, I've spent a lot of time
    on it but I can't get it work.
    Could you post some working code that shows how you
    can do it?
    Thanks.
    It works now, I have used the code:
    result = processor.processXSL(stylesheet, xml);
    PrintWriter pw = new PrintWriter(out);
    result.print(pw);
    I had tried this before but there was an error in other place that prevented it to work.
    Thank you anyway.

  • Validating error with JAXP

    i wrote a small app that read a COLLADA instance document and convert it to a html document. First I wrote some xsl stylesheets and now I'm using a JAXP DOM parser to parse the instance document and a JAXP xslt transformer to perform the transformation.
    When I use a non-validating parser it seems all work well but when i try to use a validating parser i get this message error:
    org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.
    What does it mean?
    When I'm at my home pc,I get the error above but when I'm at university lab pc I don't get any error. WHY!? I'm using the same files.
    Thx for your help

    i'm using jdk 1.5.0_11 and here is my java code.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    // For JFileChooser
    import javax.swing.*;
    // For write operation
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class StylizerMio2 {
        // Global value so it can be ref'd by the tree-adapter
        static Document document;
        // Constants you'll use when configuring the factory
        static final String JAXP_SCHEMA_LANGUAGE="http://java.sun.com/xml/jaxp/properties/schemaLanguage";
        static final String W3C_XML_SCHEMA="http://www.w3.org/2001/XMLSchema";
         //Constants used to specify the schema in the application
         static final String schemaSource="COLLADASchema_141.xsd";
         static final String JAXP_SCHEMA_SOURCE="http://java.sun.com/xml/jaxp/properties/schemaSource";
        public static void main(String[] argv) {
            /*if (argv.length != 2) {
                System.err.println("Usage: java StylizerMio stylesheet xmlfile");
                System.exit(1);
            // Generating a parser
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             //Configure the factory to generate a namespace-aware,validating parser
            factory.setValidating(true);  
            factory.setNamespaceAware(true);
             try{
                  factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
              // Associate a document with a schema
              factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(schemaSource));
             catch (IllegalArgumentException x) {
                  // Happens if the parser does not support JAXP 1.2
                  x.printStackTrace();
            // Associating the document with the schema
            try {
              JFileChooser chooser = new JFileChooser();
            ExampleFileFilter daeFilter = new ExampleFileFilter();
            daeFilter.addExtension("dae");
            daeFilter.setDescription("documenti istanza COLLADA");
            chooser.setFileFilter(daeFilter);
            chooser.setCurrentDirectory(new File("."));
              int returnVal = chooser.showOpenDialog(null);
              if(returnVal == JFileChooser.APPROVE_OPTION) {
              System.out.println("You chose to open this file: " +
                   chooser.getSelectedFile().getName());
                File stylesheet = new File("trasformazione.xsl");
              //"Moon Buggy/lunar_vehicle_tris.dae"
                File datafile = chooser.getSelectedFile();
                DocumentBuilder builder = factory.newDocumentBuilder();
              //Handling validation errors
              builder.setErrorHandler(
              new org.xml.sax.ErrorHandler(){
                   // ignore fatal errors (an exception is garaunteed)
                   public void fatalError(SAXParseException exception)
                        throws SAXException{}
                             //treat validation errors as fatal
                             public void error(SAXParseException e)
                                  throws SAXParseException
                                  throw e;
                             // dump warnigs too
                             public void warning(SAXParseException err)
                                  throws SAXParseException
                                  System.out.println("** Warning"
                                  + ", line " + err.getLineNumber()
                                  + ", uri " + err.getSystemId());
                                  System.out.println("   " + err.getMessage());
                document = builder.parse(datafile);
                // Use a Transformer for output
                TransformerFactory tFactory = TransformerFactory.newInstance();
                StreamSource stylesource = new StreamSource(stylesheet);
                Transformer transformer = tFactory.newTransformer(stylesource);
                DOMSource source = new DOMSource(document);
                // SaveDialogue JFileChooser
                ExampleFileFilter htmlFilter = new ExampleFileFilter();
                htmlFilter.addExtension("html");
                htmlFilter.setDescription("documento html");
                chooser.setFileFilter(htmlFilter);
                 chooser.showSaveDialog(null);
                  //"Moon Buggy/lunar_vehicle_tris.html"
                File htmlFile= chooser.getSelectedFile();
                StreamResult result = new StreamResult(htmlFile);
                transformer.transform(source, result);
            } catch (TransformerConfigurationException tce) {
                // Error generated by the parser
                System.out.println("\n** Transformer Factory error");
                System.out.println("   " + tce.getMessage());
                // Use the contained exception, if any
                Throwable x = tce;
                if (tce.getException() != null) {
                    x = tce.getException();
                x.printStackTrace();
            } catch (TransformerException te) {
                // Error generated by the parser
                System.out.println("\n** Transformation error");
                System.out.println("   " + te.getMessage());
                // Use the contained exception, if any
                Throwable x = te;
                if (te.getException() != null) {
                    x = te.getException();
                x.printStackTrace();
            } catch (SAXException sxe) {
                // Error generated by this application
                // (or a parser-initialization error)
                Exception x = sxe;
                if (sxe.getException() != null) {
                    x = sxe.getException();
                x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
                // I/O error
                ioe.printStackTrace();
        } // main
    }

  • Error when I replaced  the DOM parcer with JAXP

    I replaced the DOM parcer with JAXP ....
    We moved from DOM parcer �import org.apache.xerces.parsers.DOMParser;� to JAXP.
    Here is my code:
    // Step 1: create a DocumentBuilderFactory and setNamespaceAware
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    // Step 2: create a DocumentBuilder
      DocumentBuilder db = dbf.newDocumentBuilder();
    // Step 3: parse the input file to get a Document object
    Document doc = db.parse(location);
      root = doc.getDocumentElement();
      root.normalize();
    AND when we run stress test after a while we start getting error
    java.lang.NullPointerException
    at org.apache.xerces.dom.DeepNodeListImpl.nextMatchingElementAfter(Unknown Source)
    at org.apache.xerces.dom.DeepNodeListImpl.item(Unknown Source)
    at org.apache.xerces.dom.DeepNodeListImpl.getLength(Unknown Source)
    at com.xxx.yyy.WfStartTasksXmlDAO.getActionPerformed(Unknown Source)
    at com.xxx.yyy.WfStartTasksXmlDAO.getAction(Unknown Source)
    - Any idea why we are getting this error. Is this server (Linux) problem? or JAXP?
    Message was edited by:
    TamerBasha

    This is happening because JAXP is not thread safe. need to synchronize bracket or use thread safe parser.

  • Could not parse XMBMessage due to Can't parse the document

    *Dear all,*
    *i have a SOAP to RFC Scenario. XML Validation by Adapter is turned on in SenderAgreement.*
    *XSD Files are placed in the correct directory. Incoming requests are validated. However,*
    *it seems that responses produce an error in the soap adapter.*
    *This is the error message i am getting:*
    +SOAP:Fault>+
             +<faultcode>SOAP:Server</faultcode>+
             +<faultstring>Server Error</faultstring>+
             +<detail>+
                +<s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">+
                   +<context>XIAdapter</context>+
                   +<code>ADAPTER.JAVA_EXCEPTION</code>+
                   +<text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not parse XMBMessage due to Can't parse the document+
    +     at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1173)+
    +     at sun.reflect.GeneratedMethodAccessor678.invoke(Unknown Source)+
    +     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)+
    +     at java.lang.reflect.Method.invoke(Method.java:592)....+
    *In SXMB_MONI my response includes the following passages*
    +- <!--  ************************************+
      -->
      +<Trace level="3" type="T">Pipeline Service = PLSRV_XML_VALIDATION_RS_OUT</Trace>+
      +<Trace level="3" type="T">Skip Inbound Validation =</Trace>+
      +<Trace level="3" type="T">Skip Outbound Validation =</Trace>+
      +<Trace level="3" type="T">Area = XML_VALIDATION_OUT</Trace>+
      +<Trace level="1" type="T">Reading sender agreement</Trace>+
      +<Trace level="3" type="T">Validation Mode = Validation by Adapter</Trace>+
      +<Trace level="1" type="T">Outbound validation of response takes place</Trace>+
      +<Trace level="3" type="T">Interface Name = SI_xxx_xxx_xxx_Sync_Outbound</Trace>+
      +<Trace level="3" type="T">Interface Namespace = http://xxx.de/xxx</Trace>+
      +<Trace level="3" type="T">Software Component Version = D390B9E10A6B11DF8C15C7540A484C06</Trace>+
      +<Trace level="2" type="T">Java Validation Service Call</Trace>+
      +<Trace level="1" type="T">System error occurred during XML validation</Trace>+
      +<Trace level="1" type="E">CL_XMS_PLSRV_VALIDATION~ENTER_PLSRV</Trace>+
      +</Trace>+
      +<Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST" />+
    +- <!--  ************************************+
      -->
      +<Trace level="3" type="T">Persisting message Status = 023</Trace>+
      +<Trace level="3" type="T">Message version 009</Trace>+
      +<Trace level="3" type="T">Pipeline CENTRAL</Trace>+
      +</SAP:Trace>+
    *I see the following error message:*
      +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>+
    +- <!--  Aufruf eines Adapters+
      -->
    - <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="XML_VALIDATION_OUT">CX_XMS_SYSERR_VALIDATION</SAP:Code>
      <SAP:P1>Schema xxx.response.xsd not found in J:\usr\sap\xxx\SYS\global\xi\runtime_server\validation\schema\00000000000000000000000000000000\ u00D3u00B9u00E1 k u00DFŒ u00C7T HL \SI_xxx_xxx_xxx_Sync_Outbound\urnsap-comdocumentsaprfc~functions\xxx.response.xsd (J:\usr\sap\xxx\SYS\global\xi\runtime_server\validation\schema)</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>not used at the moment.</SAP:AdditionalText>
      <SAP:Stack>System error occurred during XML validation</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    There seems to be an error in the adapter trying to validate the response. Does anyone has a clue as to why ?

    Since i cannot get i running, i helped myself using a java mapping, that i packaged into a jar
    along with the xsd files. See code below:
    import com.sap.aii.*;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.BufferedReader;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.io.UnsupportedEncodingException;
    import java.io.InputStreamReader;
    import java.io.Reader;
    import javax.xml.transform.sax.SAXResult;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    @SuppressWarnings("unused")
    public class CustomValidator extends AbstractTransformation {
         public void transform(TransformationInput arg0, TransformationOutput arg1)
                   throws StreamTransformationException {
              Validator validator;
              InputStreamReader insr;
              String inputPayloadString;
              try {
                   // Trace
                   getTrace().addInfo("com.xxx.pi.mapping.validation.CustomValidator called");
                   InputStream inputPayloadStream = arg0.getInputPayload()
                             .getInputStream();
                   insr = new InputStreamReader(inputPayloadStream);
                   InputHeader inpHeader = arg0.getInputHeader();          
                   String intfName = inpHeader.getInterface();
                   getTrace().addInfo("Interface Name is :" + intfName);
                   String xsdName = "";
                   if (intfName
                             .equalsIgnoreCase("SI_xxx_Sync_Outbound")) {
                        xsdName = "Z_xxx.xsd";
                   if (intfName.equalsIgnoreCase("SI_xxx")) {
                        xsdName = "Z_xxx.xsd";
                   if (intfName
                             .equalsIgnoreCase("SI_xxx_Sync_Outbound")) {
                        xsdName = "Z_xxx.xsd";
                   if (intfName
                             .equalsIgnoreCase("SI_xxxx_Sync_Outbound")) {
                        xsdName = "Z_xxx.xsd";
                   getTrace().addInfo("Using schema: " + xsdName);
                   if (xsdName.equals(""))
                        throw new StreamTransformationException("Schema für "
                                  + intfName + " nicht gefunden.");
                   BufferedReader reader = new BufferedReader(new InputStreamReader(
                             getClass().getResourceAsStream(
                                       "/com/xxx/pi/mapping/xsd/" + xsdName)));
                   // prepare document validator:
                   String schemaLang = "http://www.w3.org/2001/XMLSchema";
                   SchemaFactory jaxp = SchemaFactory.newInstance(schemaLang);
                   Schema schema = jaxp.newSchema(new StreamSource(reader));
                   validator = schema.newValidator();
              } catch (SAXException saxe) {
                   throw new StreamTransformationException(saxe.getMessage());
              // validate
              try {
                   SAXSource source = new SAXSource(new InputSource(insr));
                   validator.validate(source);
              } catch (Exception e) {
                   getTrace().addInfo(e.getMessage());
                   String trace = e.getMessage();
                   throw new StreamTransformationException(trace, e.getCause());
              // Write the response
              try {
                   inputPayloadString = convertStreamToString(arg0.getInputPayload()
                             .getInputStream());
                   arg1.getOutputPayload().getOutputStream()
                             .write(inputPayloadString.getBytes("UTF-8"));
                   getTrace().addInfo("Schema Validierung erfolgreich !");
              } catch (Exception e) {
                   throw new StreamTransformationException(e.getMessage());
         // helper to convert to String
         private static String convertStreamToString(InputStream in) {
              StringBuffer sb = new StringBuffer();
              try {
                   InputStreamReader isr = new InputStreamReader(in);
                   BufferedReader reader = new BufferedReader(isr);
                   String line;
                   while ((line = reader.readLine()) != null) {
                        sb.append(line);
              catch (Exception exception) {
              return sb.toString();

  • How can I use a 3rd party XML parser such as xerces with OC4J ?

    Hi all tech experts,
    I am using Oracle Application Server 10g Release 2 (10.1.2) and i have
    installed Portal and Wireless and OracleAS Infrastructure on the same
    computer.
    i tried all the solutions on this thread
    Use of Xerces Parser in out application with Oracle App Server 9.0.4
    but still fighting.
    I have also posted this query on OTN on following thread
    How can I use a 3rd party XML parser such as xerces with OC4J?
    but no reply....
    Please help me on this issue.
    Since OC4J is preconfigured to use the Oracle XML parser which is xmlparserv2.jar.
    i have read the following article which states that
    OC4J is preconfigured to use the Oracle XML parser. The Oracle XML parser is fully JAXP 1.1 compatible and will serve the needs of applications which require JAXP functionality. This approach does not require the download, installation, and configuration of additional XML parsers.
    The Oracle XML parser (xmlparserv2.jar) is configured to load as a system level library of OC4J through it's inclusion as an entry in the Class-Path entry of the oc4j.jar Manifest.mf file. This results in the Oracle XML parser being used for all common deployment and packaging situations. You are not permitted to modify the Manifest.mf file of oc4j.jar.
    It must be noted that configuring OC4J to run with any additional XML parser or JDBC library is not a supported configuration. We do know customers who have managed to successfully replace the system level XML parser and the Oracle JDBC drivers that ship with the product, but we do not support this type of configuration due to the possibility of unexpected system behavior and system errors that might occur from replacing the tested and certified libraries.
    If you absolutely must use an additional XML parser such as xerces, then you have to start OC4J such that the xerces.jar file is loaded at a level above the OC4J system classpath. This can be accomplished using the -Xbootclasspath flag of the JRE.
    i have also run the following command
    java -Xbootclasspath/a:d:\xerces\xerces.jar -jar oc4j.jar
    but no success.
    How could i utilize my jar's like xerces.jar and xalan.jar for parsing instead of OC4J in-built parser ?
    All reply will be highly appreciated.
    Thnx in advance to all.
    Neeraj Sidhaye
    try_catch_finally @ Y !

    Hi Neeraj Sidhaye,
    I am trying to deploy a sample xform application to the Oracle Application Server (10.1.3). However, I encountered the class loader issue that is similar to your stuation. I tried all the three solutions but the application is still use the Oracle xml paser class. I am wondering if you have any insight about this?
    Thanks for your help.
    Xingsheng Qian
    iPass Inc.
    Here is the error message I got.
    Message:
    java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
    Stack Trace:
    org.chiba.xml.xforms.exception.XFormsException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.initModels(Unknown Source)
         at org.chiba.xml.xforms.Container.init(Unknown Source)
         at org.chiba.xml.xforms.ChibaBean.init(Unknown Source)
         at org.chiba.adapter.servlet.ServletAdapter.init(ServletAdapter.java:153)
         at org.chiba.adapter.servlet.ChibaServlet.doGet(ChibaServlet.java:303)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Instance.iterateModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.initializeModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.init(Unknown Source)
         at org.chiba.xml.xforms.Initializer.initializeBindElements(Unknown Source)
         at org.chiba.xml.xforms.Model.modelConstruct(Unknown Source)
         at org.chiba.xml.xforms.Model.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.dispatchEvent(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)
         ... 18 more

  • Excise Invoice List-Pending for ARE document creation

    Dear All,
    Is there any standard Tcode for getting the list of excise invoice which are pending for ARE documents creation or with the status of ARE documents.
    Thanks & Regards,
    Antima

    Hi,
    No there is no standard report available for this requirement.  You may need to develop a Z report.
    J1ARE_AGE gives u the status after creation of ARE1.
    Thanks
    Krishna.

  • How can I parse the document in WebI using sdk?

    I wanna to parse the document in WebIntelligence using sdk. My question is :
    1) By which sdk, I can parse the document.  'Report Application Server SDK' ?
    2) I wanna to parse the 'Self-Defined SQL' and 'Query' components of the document. Can the sdk support this request ?
    My enviroment is  BO XI Release 2.
    Thanks all.

    Hi shao,
    1) By which sdk, I can parse the document. 'Report Application Server SDK' ?
    'Report Application Server SDK' is For Crystal reports so for WebIntelligence or DesktopIntelligence Report it is  "Report Engine SDK".
    Apart from this if you want to do more on these reports "BusinessObjects Enterprise SDK" can be used.
    You can get more information on below link for XI R2.
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
    For question 2,
    I am not sure about it but Report Engine SDK provides classes and interface of Data Providers.
    i.e. Building and Editing Data Providers   and  Working with Recordsets.
    Also you can have look on
    Report Engine SDK's
    Interface "Query"
    Hope these helps you.
    Thanks,
    Praveen.

  • Error message display for PO creation with reference to internal orders

    Sir,
    While creating PO with Tcode ME21N (item category I) with reference to ' Internal Order with Funds provided (Tcode KO12), system displaying error message  when Budget is exceeded.
    But when Funds provision is not mentioned (Funds value is initial in KO12) , error message is not being given by the system during Po creation with ME21N.
    Where should I configure in img(Tcode SPRO) , so that system will throw error mesage while creating PO without Budget Provision (Funds not mentioned ) in Internal Orders.
    Regards,
    Srinivasa Murthy

    Hi Anupam,
    The error message display as follows. (when the PO Price exceeds the Planned Funds kept for internal order)
    This error comes during PO creation Process and PO can not be saved. This error message display is correct.
    Item 001 Order 600643 budget exceeded
    Message no. BP604
    Diagnosis
    In document item 001 Order 600643, budget  for fiscal year 2009 was exceeded by 99,960,000.00 INR.
    But  my question is 'when funds have not at all been mentioned for the internal order' then system has to throw the same error as mentioned above. But it is not happening. System is allowing the PO to save which is not correct.
    Regards,
    Srinivasa Murthy

  • Regarding material wise purchase order creation with reference to pr

    Dear sir
    I have a scenario depending on the  material wise pos creation
    I have two type of material
    1) raw material
    2) consumables
    When user will create purchase order for raw material, system should ask purchase requisition. ( i.e with out purchase requisition for raw material , system should not allow to create the purchase order)
    Where as for all consumables materials system should allow to create the purchase order
    Without purchase requisition also, for user.
    Regards
    Jrp.

    You have to create two different document type for purchase order.
    1) Raw Material Purchase
    2) Consumables Purchase
    You can create two different document type for purchase order with below mention path: -
    SPRO >> Materials Management >> Purchasing >> Purchase Order >> Define Document Types.
    After define two different document type, You can change field status for two different document type with below mention path.
    SPRO >> Materials Management >> Purchasing >> Purchase Order >> Define Screen Layout at Document Level.
    Select document type and change field status of purchase requisition.
    Regards,
    Mahesh Wagh

  • SRM 7.0 PCW. Follow-on document creation

    Dear experts: we are in SRM 7.0 and have implemented PCW with approval at item level. Our end users want to have automatic follow-on document creation inmediatlly after SC item approval. However, as per standard SAP SRM, they have to wait untill all levels for all items have been approved.
    One example will illustrate: A shopping cart with two items. Due to the threshold, item1 requires only one level of approval, while item2 requires two levels. Both items will result in a dfferent purchaisng document in the backend system in a classic scenario: Item1 will result in a PReq, while item2 will result in a Purchase Order.
    Once first level for the two items have been approved, would it be possible to generate the follow-on document for the first item as no further approval for this item is needed is needed?
    Our end users are familiar with Preqs in MM, where item approval process is done at item level and the follow-on document can be created even when the other items in the PReq are not yet approved.
    Thanks in advance for your valuable  help.
    Regards
    Valentí

    Hi,
       No, this is not possible, once all the item in a SC approved, then only system will create a follow-on-documents. As per your scenario , item1 will still wait until item2 gets approved. This is standard.
    Saravanan

  • Service PO creation with BAPI

    Hi All,
    I have to create a file upload program to create service PO's with BAPI_PO_CREATE1. Please if anyone can give me a example of it it would be great.
    Thanks.
    Malinda

    Hi ,
           Check out this program .
    use this program for creating service po's using bapi.
    *& Report ZMM_PO_CREATE1 *
    REPORT ZMM_PO_CREATE1 .
    data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
    POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
    POITEM like BAPIMEPOITEM occurs 0 with header line,
    POITEMX like BAPIMEPOITEMX occurs 0 with header line,
    POESLLC like BAPIESLLC occurs 0 with header line,
    POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
    POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
    POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
    POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
    POCOND like BAPIMEPOCOND occurs 0 with header line,
    RETURN like BAPIRET2 occurs 0 with header line.
    data : po_no(10).
    data : begin of it_head occurs 0,
    ref(10),
    bsart like ekko-bsart,
    lifnr like ekko-lifnr,
    ekorg like ekko-ekorg,
    ekgrp like ekko-ekgrp,
    bukrs like ekko-bukrs,
    verkf like ekko-verkf,
    telf1 like ekko-telf1,
    ihrez like ekko-ihrez,
    unsez like ekko-unsez,
    kdatb(10),
    kdate(10),
    end of it_head.
    data : begin of it_det occurs 0,
    ref(10),
    knttp like ekpo-knttp,
    pstyp like ekpo-pstyp,
    txz01 like ekpo-txz01,
    matkl like ekpo-matkl,
    werks like ekpo-werks,
    afnam like ekpo-afnam,
    ktext1 like esll-ktext1,
    srvpos like esll-srvpos,
    frmval1 like esll-frmval1,
    frmval2 like esll-frmval2,
    menge like esll-menge,
    kostl like eskn-kostl,
    sakto like eskn-sakto,
    zzcode like eskn-zzcode,
    kbetr like konv-kbetr,
    end of it_det.
    data : c_col1 TYPE i VALUE '0001',
    c_col2 TYPE i VALUE '0002',
    c_col3 TYPE i VALUE '0003',
    c_col4 TYPE i VALUE '0004',
    c_col5 TYPE i VALUE '0005',
    c_col6 TYPE i VALUE '0006',
    c_col7 TYPE i VALUE '0007',
    c_col8 TYPE i VALUE '0008',
    c_col9 TYPE i VALUE '0009',
    c_col10 TYPE i VALUE '0010',
    c_col11 TYPE i VALUE '0011',
    c_col12 TYPE i VALUE '0012',
    c_col13 TYPE i VALUE '0013',
    c_col14 TYPE i VALUE '0014',
    c_col15 TYPE i VALUE '0015',
    c_col16 TYPE i VALUE '0016'.
    data : v_currentrow type i,
    v_currentrow1 type i.
    data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
    itab_det like ALSMEX_TABLINE occurs 0 with header line.
    data : file_head type RLGRAP-FILENAME,
    file_item type RLGRAP-FILENAME.
    file_head = 'C:Documents and SettingsDesktophead.xls'.
    file_item = 'C:Documents and SettingsDesktopitem.xls'.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = file_head
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 12
    i_end_row = 50
    tables
    intern = itab_head
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = file_item
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 16
    i_end_row = 50
    tables
    intern = itab_det
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF itab_head[] IS INITIAL.
    WRITE:/ 'No Header Data Exists '.
    STOP.
    ELSE.
    sort itab_head by row col.
    read table itab_head index 1.
    v_currentrow = itab_head-row.
    loop at itab_head.
    if itab_head-row ne v_currentrow.
    APPEND it_head.
    v_currentrow = itab_head-row.
    ENDIF.
    CASE itab_head-col.
    WHEN c_col1.
    it_head-ref = itab_head-value.
    WHEN c_col2.
    it_head-bsart = itab_head-value.
    WHEN c_col3.
    it_head-lifnr = itab_head-value.
    WHEN c_col4.
    it_head-ekorg = itab_head-value.
    WHEN c_col5.
    it_head-ekgrp = itab_head-value.
    WHEN c_col6.
    it_head-bukrs = itab_head-value.
    WHEN c_col7.
    it_head-verkf = itab_head-value.
    WHEN c_col8.
    it_head-telf1 = itab_head-value.
    WHEN c_col9.
    it_head-ihrez = itab_head-value.
    WHEN c_col10.
    it_head-unsez = itab_head-value.
    WHEN c_col11.
    it_head-kdatb = itab_head-value.
    WHEN c_col12.
    it_head-kdate = itab_head-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_head.
    CLEAR it_head.
    ENDIF.
    IF itab_det[] IS INITIAL.
    WRITE:/ 'No Item Data Exists '.
    STOP.
    ELSE.
    sort itab_det by row col.
    read table itab_det index 1.
    v_currentrow1 = itab_det-row.
    loop at itab_det.
    if itab_det-row ne v_currentrow1.
    APPEND it_det.
    v_currentrow1 = itab_det-row.
    ENDIF.
    CASE itab_det-col.
    WHEN c_col1.
    it_det-ref = itab_det-value.
    WHEN c_col2.
    it_det-knttp = itab_det-value.
    WHEN c_col3.
    it_det-pstyp = itab_det-value.
    WHEN c_col4.
    it_det-txz01 = itab_det-value.
    WHEN c_col5.
    it_det-matkl = itab_det-value.
    WHEN c_col6.
    it_det-werks = itab_det-value.
    WHEN c_col7.
    it_det-afnam = itab_det-value.
    WHEN c_col8.
    it_det-srvpos = itab_det-value.
    WHEN c_col9.
    it_det-ktext1 = itab_det-value.
    WHEN c_col10.
    it_det-frmval1 = itab_det-value.
    WHEN c_col11.
    it_det-frmval2 = itab_det-value.
    WHEN c_col12.
    it_det-menge = itab_det-value.
    WHEN c_col13.
    it_det-kostl = itab_det-value.
    WHEN c_col14.
    it_det-sakto = itab_det-value.
    WHEN c_col15.
    it_det-zzcode = itab_det-value.
    WHEN c_col16.
    it_det-kbetr = itab_det-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_det.
    CLEAR it_det.
    ENDIF.
    loop at it_head.
    poheader-doc_type = it_head-bsart.
    poheader-vendor = it_head-lifnr.
    poheader-purch_org = it_head-ekorg.
    poheader-pur_group = it_head-ekgrp.
    poheader-comp_code = it_head-bukrs.
    poheader-sales_pers = it_head-verkf.
    poheader-telephone = it_head-telf1.
    poheader-REF_1 = it_head-ihrez.
    poheader-OUR_REF = it_head-unsez.
    poheader-VPER_START = it_head-kdatb.
    poheader-VPER_END = it_head-kdate.
    loop at it_det where ref = it_head-ref.
    poitem-acctasscat = it_det-knttp.
    poitem-item_cat = it_det-pstyp.
    poitem-short_text = it_det-txz01.
    poitem-matl_group = it_det-matkl.
    poitem-plant = it_det-werks.
    poitem-PREQ_NAME = it_det-afnam.
    POESLLC-SERVICE = it_det-srvpos.
    POESLLC-SHORT_TEXT = it_det-ktext1.
    POESLLC-FORM_VAL1 = it_det-frmval1.
    POESLLC-FORM_VAL2 = it_det-frmval2.
    POESLLC-QUANTITY = it_det-menge.
    POACCOUNT-COSTCENTER = it_det-kostl.
    POACCOUNT-GL_ACCOUNT = it_det-sakto.
    POCONDHEADER-COND_TYPE = 'R000'.
    POCONDHEADER-COND_VALUE = it_det-kbetr.
    endloop.
    endloop.
    poheaderx-doc_type = 'X'.
    poheaderx-vendor = 'X'.
    poheaderx-purch_org = 'X'.
    poheaderx-pur_group = 'X'.
    poheaderx-comp_code = 'X'.
    poheaderx-sales_pers = 'X'.
    poheaderx-telephone = 'X'.
    poheaderx-REF_1 = 'X'.
    poheaderx-OUR_REF = 'X'.
    poheaderx-VPER_START = 'X'.
    poheaderx-VPER_END = 'X'.
    poitemx-acctasscat = 'X'.
    poitemx-item_cat = 'X'.
    poitemx-short_text = 'X'.
    poitemx-matl_group = 'X'.
    poitemx-plant = 'X'.
    poitemx-PREQ_NAME = 'X'.
    *POESLLCx-SHORT_TEXT = 'X'.
    POACCOUNTx-COSTCENTER = 'X'.
    POACCOUNTx-GL_ACCOUNT = 'X'.
    POCONDHEADER-cond_type = 'X'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = poheader
    POHEADERX = poheaderx
    POADDRVENDOR =
    TESTRUN =
    MEMORY_UNCOMPLETE =
    MEMORY_COMPLETE =
    POEXPIMPHEADER =
    POEXPIMPHEADERX =
    VERSIONS =
    NO_MESSAGING =
    NO_MESSAGE_REQ =
    NO_AUTHORITY =
    NO_PRICE_FROM_PO =
    IMPORTING
    EXPPURCHASEORDER = po_no
    EXPHEADER =
    EXPPOEXPIMPHEADER =
    TABLES
    RETURN = return
    POITEM = poitem
    POITEMX = poitemx
    POADDRDELIVERY =
    POSCHEDULE =
    POSCHEDULEX =
    POACCOUNT = poaccount
    POACCOUNTPROFITSEGMENT =
    POACCOUNTX = poaccountx
    POCONDHEADER = pocondheader
    POCONDHEADERX = pocondheaderx
    POCOND =
    POCONDX =
    POLIMITS =
    POCONTRACTLIMITS =
    POSERVICES = poesllc
    POSRVACCESSVALUES =
    POSERVICESTEXT =
    EXTENSIONIN =
    EXTENSIONOUT =
    POEXPIMPITEM =
    POEXPIMPITEMX =
    POTEXTHEADER =
    POTEXTITEM =
    ALLVERSIONS =
    POPARTNER =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    if sy-subrc = 0.
    loop at return.
    write return-MESSAGE_V1.
    write po_no.
    endloop.
    endif.
    Also check this link
    [Service Order through BAPI|Service PO creation with BAPI;

Maybe you are looking for