Monday, November 22, 2010

EDIFACT Document Identification with Oracle B2B

When receive a "document protocol identification error" on an inbound native EDI transaction set, it is possible that extraneous characters e.g. CR/LF at the end of the EDI have been added to the file. For example:
The following property setting will have Oracle B2B checks and removes them.

b2b.edi.enablePreprocess= true

The properties will need to be set in the System Mbean Browser within Enterprise manager.
Below are the steps to navigate to the System Mbean Browser, and how to invoke the B2B config Mbean.

  1. Login into Enterprise manager.
  2. Expand SOA
  3. Right click on soa-infra
  4. Select Administration
  5. Select System Mbean browser
  6. Expand Application Defined Mbeans
  7. Expand oracle.as.soainfra.config
  8. Expand the soa server domain
  9. Expand B2B config
  10. Select Operations
  11. Select addProperty
  12. Enter the desired property for the key, such as b2b.edi.enablePreprocess.
  13. Enter the value, true.
  14. Add any comments if desired.
  15. Invoke the mbean and check the b2b-config.xml that the property is reflected in the file.
  16. Restart the managed server.

Wednesday, November 10, 2010

Working with array in Oracle BPEL

This is an extension usage of array based from my previous post.

In the following example the variable Variable_whileLoopIteration is the iteration counter in the WHILE activity.

Reading from a specific element in an array:
<assign name="Extract_ProductName">
<copy>
<from expression="bpws:getVariableData('Variable_PurchaseOrder',concat('/ns1:purchaseOrder/ns1:items/ns1:item[',bpws:getVariableData('Variable_whileLoopIteration'),']/ns1:productName'))"/>
<to variable="Variable_productName"/>
</copy>
</assign>
Writing to a specific element in an array:
<assign name="Assign_NewProductNameToPO">
<copy>
<from expression="'NewProductName'"/>
<to variable="Variable_PurchaseOrder" query="/ns1:purchaseOrder/ns1:items/ns1:item[position() = bpws:getVariableData('Variable_whileLoopIteration')]/ns1:productName"/>
</copy>
</assign>

My advise is don't rely on JDeveloper Design view alone. Most of the time you have to manually edit the source to get it to do exactly what you want.

Tuesday, November 09, 2010

Convert Gregorian Date to JD Edwards Date in XSLT

Q: How to convert Gregorian Date to JDE Date in XSLT?

The format is C-YY-DDD, which is used by JD Edwards software: the century after 1900, the year in that century and the Julian date within that year.  Here are a few examples:

Checkout JDE Julian Date Converter tool by David Macek.

Important: Make sure you declare the XSLT version 2.0!
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0">
...
<ns1:JDEDateNumber>
<xsl:variable name="InStringDate" select="'2010-11-09'"/>
<xsl:variable name="Year" select="substring($InStringDate,1,4)"/>
<xsl:variable name="ShortYear" select="substring($InStringDate,3,2)"/>
<xsl:variable name="StartOfYear" select='concat($Year,"-01-01")'/>
<xsl:value-of select="concat('1', $ShortYear, format-number(days-from-duration((xsd:date($InStringDate) - xsd:date($StartOfYear))) + 1, '000'))"/>
</ns1:JDEDateNumber>
...
</xsl:stylesheet>