XML File Creation using Wrapper Functio in EnterpriseOne

Purpose of Document

Purpose of this document is to provide an example of XML creation through B0000201 (XERCES XML Wrapper Functions).

Note that this example may not be the best practice in parsing an XML file for outbound and JD Edwards EnterpriseOne does not have any standard UBE which transforms into XML format file.

 


This document is to provide one example for XML transformation for outbound.

XML (Extensible Markup Language):


Parsers: function reference here is based on DOM (Document Object Model ) parser - Tree Structure based API:

Generally, DOM parser is used when,

         The parser has a drawback of higher consumption of memory/cache because string/text values are being stored in memory in order to manipulate it

What is Xerces?
Xerces is Apache's collection of software libraries for parsing, validating, serializing and manipulating XML. The library implements a number of standard APIs for XML parsing, including DOM, SAX and SAX2. The implementation is available in Java, C++ and Perl programming languages. Refer to external link for detail: http://xerces.apache.org/xerces2-j/


 

 

Before you proceed, refer to the Oracle Documentation (Oracle Technical Network)
http://www.oracle.com/technetwork/index.html
    |-- Documentation (http://www.oracle.com/technetwork/indexes/documentation/index.html)
          |-- JD Edwards EnterpriseOne (http://www.oracle.com/technetwork/documentation/jdedent-098169.html)
                |-- JD Edwards EnterpriseOne Tools Documentation (http://docs.oracle.com/cd/E24705_01/index.htm)
                      |-- EnterpriseOne Tools Interoperability Reference Implementations Guide (http://docs.oracle.com/cd/E24705_01/doc.91/e24253/toc.htm)
                               |-- XML Transformation (http://docs.oracle.com/cd/E24705_01/doc.91/e24253/understnd_xml_transform.htm#g8d6ab57f7cedeaac_ef90c_10a77c8e3f7__6f80)





Business Function for parsing SQL format file to XML file format:

EventFunction Data StructurePurpose
Initialize Section B0000201 CreateXMLDocumentXercesWrapper (Create XML Document Serces Wrapper Function) D0000201A Initialize Xerces engine and create handles for xml documents and document elements.
    AddXMLAttributeXercesWrapper (Add XML Attribute Xerces Wrapper) D0000201B Add name space attribute to document elements
Do Section   AddXMLElementStringXercesWrapper (Add XML Element String Xerces Wrapper) D0000201C To parse Data Type string value
    AddXMLElementDateXercesWrapper (Add XML Element Date Xerces Wrapper) D0000201D To parse data type Date
    AddXMLElementMathXercesWrapper (Add XML Element Math Numeric Xerces Wrapper) D0000201E To prase data type Math Numeric
    AddXMLElementCharXercesWrapper (Add XML Element Character Xerces WRapper) D0000201F To parse data type character
    AddXMLDelementUTCXercesWrapper (Add XMLElement UTC Xerces Wrapper) D0000201I Do Not Use (OBSOLETE)!
To parse UTC data type with format of 2013-12-31T12:59:59-00:00. You are not able to override Timeformat and Timezoneformat through jdeUTime_Format(). So timeformat is always 24 hour format and timezone is coming from your user profile F00921.UTCTIME
    AddXMLElementUTimeXercesWrapper (Add XML Element UTC Xerces Wrapper) D0000201J To parse UTC Data type with mask. You can override Timeformat and Timezone format through jdeUTime_FormatEx(). Note that Daylight saving rule is coming from your user profile (F00921.FUTTIME4)
End Section   FreeXMLElementXercesWrapper (Free XML Element Xerces Wrapper) D0000201G Free the document level element
    WriteXMLDocumentXercesWrapper (Write XML Document Xerces Wrapper) D0000201H Write the xml document to the location specified in the processing option (if any)
    FreeXMLElementXercesWrapper (Free XML Element Xerces Wrapper) D0000201G To free memory which is used by WriteXMLDocumentXercesWrapper

 

Note:

 


 



Business Function:
B0000201 - CreateXMLDocumentXercesWrapper (Create XML Document Xerces Wrapper Function)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
szDocumentName DTA4 char OPT INPUT A 256 byte field used to hold miscellaneous data.
This string determines 1st component of output XML file.
Example: R55XML01_021713_192832.xml
hXMLDocument GENLNG ID OPT OUTPUT Pointer to hold document information.
hDocumentElement GENLNG ID OPT OUTPUT Pointer to hold document elements.

 





B0000201 - AddXMLAttributeXercesWrapper (Add XML Attribute Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
hXMLDocument GENLNG ID OPT INPUT hXMLDocument from create XML
hElement GENLNG ID OPT INPUT hDocumentElement from create XML
szAttributeName DTA4 char OPT INPUT "xmlns"
szAttributeValue DTA4 char OPT INPUT "http://www.schemas.e1.oracle.com"

 





B0000201 - AddXMLElementStringXercesWrapper (Add XML Element String Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT An option that specifies the type of processing for an event.
0 for parent
1 for detail elements
cCreateEmptyElementFlag EV01 char OPT INPUT An option that specifies the type of processing for an event. Set 1 to create.
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
hParentElement GENLNG ID OPT INPUT hDocumentElement
szElementName DTA4 char OPT INPUT Name to be appeared in XML file
szElementString DTA4 char OPT INPUT Value of database value (e.g., F03012.CO)
hNewElement GENLNG ID OPT OUTPUT Not In Use




B0000201 - AddXMLElementDateXercesWrapper (Add XML Element Date Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT Set 1 to write detail.
cCreateEmptyElementFlag EV01 char OPT INPUT Set 1 to write detail element.
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
hParentElement GENLNG ID OPT INPUT hDocumentElement
szElementName DTA4 char OPT INPUT Description to be written in XML file (e.g, Testdate)
jdElementDate DATE01 JDEDATE OPT INPUT Database column (e.g., F03012.TRDJ)
hNewElement GENLNG ID OPT OUTPUT No in use unless you want to manipulate memory
szDateFormatMask FFU3 char OPT INPUT Default: OSASE
Depending on request from your business party




B0000201 - AddXMLElementMathXercesWrapper (Add XML Element Math Numeric Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT 1 for detail
cCreateEmptyElementFlag EV01 char OPT INPUT 1 for detail element.
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
hParentElement GENLNG ID OPT INPUT hDocumentElement
szElementName DTA4 char OPT INPUT Numeric type data to be written in XML
mnElementMathNumeric MATH01 MATH_NUMERIC OPT INPUT Database column to map (e.g., F03012.AN8) 
hNewElement GENLNG ID OPT OUTPUT N/A




B0000201 - AddXMLElementCharXercesWrapper  (Add XML Element Character Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT 1 for detail
cCreateEmptyElementFlag EV01 char OPT INPUT 1 for detail element
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
hParentElement GENLNG ID OPT INPUT hDocumentElement
szElementName DTA4 char OPT INPUT Character Description to be appeared XML file
cElementCharacter EV01 char OPT INPUT Character Type database value
hNewElement GENLNG ID OPT OUTPUT N/A




B0000201 - FreeXMLElementXercesWrapper (Free XML Element Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
hElement GENLNG ID OPT INPUT hParentElement
hDocumentElement




B0000201 - WriteXMLDocumentXercesWrapper (Write XML Document Xerces Wrapper )

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
szFilePathandName DTA4 char OPT INPUT Path for output

 

Exposed API's In XercesWrapper in custom BSFN, the please explorer the following options.
.
EXTERNC XRCS_Status  XRCS_serializeDocumentToFileWithEncoding_putDoubleQuotes (const XRCS_hDocument hDoc, const JCHAR *szFileName, const JCHAR *szEncoding, const int putdoubleQuotes)
.
EXTERNC XRCS_Status  XRCS_serializeDocumentToXMLString_putDoubleQuotes (const XRCS_hDocument hDoc, JCHAR **pszXMLString, const int putdoubleQuotes)

.
EXTERNC XRCS_Status  XRCS_serializeDocumentToXMLStringWithEncoding_putDoubleQuotes (const XRCS_hDocument hDoc, JCHAR **pszXMLString, const JCHAR *szEncoding, const int putdoubleQuotes)
.
EXTERNC XRCS_Status  XRCS_serializeDocumentToXMLStringNoEncoding_putDoubleQuotes (const XRCS_hDocument hDoc, JCHAR **pszXMLString, const int putdoubleQuotes)
.

Note:  There are several customers who would like R744002 to generate the Document xmlns in double quotes.  However, this UBE uses B74XML01 to generate it.  
The application development team concluded that this is a limitation: Bug 11063238  - IMPLEMENT SEPA PAYMENTS FOR GERMANY (PAIN.001.002.03)).

 

 





B0000210 - AddXMLElementUTCXercesWrapper (Add XML Element UTC Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT An option that specifies the type of processing for an event.
cCreateEmptyElementFlag EV01 char OPT INPUT An option that specifies the type of processing for an event.
hXMLDocument GENLNG ID OPT INPUT General purpose ID variable.
hParentElement GENLNG ID OPT INPUT General purpose ID variable.
szElementName DTA4 char OPT INPUT A 256 byte field used to hold miscellaneous data.
szUTime CNTRGUTM JDE Utime OPT INPUT A UTime data item for generic use.
hNewElement GENLNG ID OPT OUTPUT General purpose ID variable.

 






B0000201 - AddXMLElementUTimeXercesWrapper  (Add XML Element UTC Xerces Wrapper)

Parameter NameData ItemData TypeReq/OptI/O/BothOthers
cFreeElementFlag EV01 char OPT INPUT 1 for detail
cCreateEmptyElementFlag EV01 char OPT INPUT 1 for detail element
hXMLDocument GENLNG ID OPT INPUT hXMLDocument
hParentElement GENLNG ID OPT INPUT hDocumentElement
szElementName DTA4 char OPT INPUT JDEUTime data item to be written into XML File
szUTime CNTRGUTM JDE Utime OPT INPUT Database value (e.g., F03012.DTEE)
hNewElement GENLNG ID OPT INPUT N/A
szDateFormatMask FFU3 char OPT INPUT Default: OSASE
  For other combination, refer to <Document 660527.1> - E1: BSFN: How to Convert a String to a Julian Date
szTimeFormat IEC1 char OPT INPUT Default: 24
  Available values: 12, 24
  If you set 12 which shows AM or PM  (e.g., 07/25/2012 05:44:24PM)
szTimeZoneFormat IEC2 char OPT INPUT Timezone from User Profile which is UDC H91/TZ (Timezones).

 





Example of XML output <R55XML01_021713_192832.xml>

  <?xml version="1.0" encoding="utf-8" ?>
-<R55XML01xmlns="http://www.schemas.e1.oracle.com">
    -<customer syncmode="0">
          <Environment>PD910</Environment>
          <AddressNumber>4242</AddressNumber>
          <Company>00000</Company>
          <BeginningEffectiveDate>02/17/2013</BeginningEffectiveDate>
          <PersonCorporationCode>A</PersonCorporationCode>
          <DateEntered>01/01/1970 10:00:00AM (UTC+10:00)</DateEntered>
        </customer>
    -<customer syncmode="0">
          <Environment>PD910</Environment>
          <AddressNumber>4242</AddressNumber>
          <Company>00001</Company>
          <BeginningEffectiveDate>02/17/2013</BeginningEffectiveDate>
          <PersonCorporationCode>C</PersonCorporationCode>
          <DateEntered>07/25/2012 05:44:24PM (UTC+10:00)</DateEntered>
        </customer>
  </R55XML01>

Note:

 


 



Possible Implemenation:
Refer to attached file.


1. (Optional) Create Processing Option template to indicate Path to write output file (e.g., \\DeploymentServer\XMLOutbound\Test\ ). This enables you to set output path dynamically
2. Associate Processing option to report template
3. Associate Business View (source data) to pull. For this example, custom business view based on F03012
(Now you implement detail routine)
4. Create (at least) 4 global variable which are to be used from initialization of variables to termination
    For example,
     rpt_hXMLDocument_GENLNG
     rpt_hDocumentElement_GENLNG
     rpt_hParentElement_GENLNG
     rpt_szFileName_DL01

(Initialize Section) which initializes once

5. (Optional) If needed, set additional selection
6. Call "Create XML Document Xerces Wrapper Function" to initialize Document and Document Elements pointer based on input report name
7. Call "Create XML Document Xerces Wrapper Function" to  add attribute based on pointer returned by 6

(Do Section) which calls below routine row by row based on business view you have associated

8. Call "Add XML Element String Xerces Wrapper" to add parent level element (for this example, customer)
9. Call "Add XML Attribute Xerces Wrapper" to append syncmode = 0
10. (Optional) call "Add XML Element String Xerces Wrapper" to indicate environment
11. Call "Add XML Element Math Numeric Xerces Wrapper" to parse MATH_NUMERIC value (for example, F03012.AN8)
12. Call "Add XML Element String Xerces Wrapper" to parse JCHAR value (for example, F03012.CO)
13. Call "Add XML Element Date Xerces Wrapper" to part JDEDATE value
14. Call "Add XML Element Character Xerces Wrapper" to parse JCHAR (a single character)
15. Call "Add XML Element UTC Xerces Wrapper" to parse JDEUTIME

(End Section)

16. (Optional) Call "Free XML Element Xerces Wrapper" to free Parent Element
17. Call "Free XML Element Xerces Wrapper" to free document level element
18. Create string to use for output file name (e.g., _021713_192832.xml which is _mmddyy_hhmmss.xml)
19. Call "Write XML Document Xerces Wrapper" to write document as indicated patch in processing option
20. Call "Free XML Element Xerces Wrapper" to free XML Document

 


 



Relation between BSFN and output
Refer below,


XML mapping detail

 



Considerations:

 


 

 

 

<Internal_Only>

We do not have business function for Inbound XML though it appears we can convert XML file line by line through conversion tool. 

JD Edwards EnterpriseOne Tools Interoperability Guide
    9 Understanding XML Transaction

</Internal_Only>