Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

DeepFCCBean - The better FCC at meeting your deep (structure) needs! (Part 1 - Deep XML to Flat File)

$
0
0

Introduction

In my recent two-part series on using XSLT to handle FCC of deep structures, I mentioned that even after 10 years, the standard FCC functionality provided has not changed significantly. This is unlikely to change as there are other areas of interest which SAP is focusing on these days. Borne out of my preference for reusable and configurable solutions, I decided to challenge myself to come up with an adapter module solution to hopefully fill this gap, if possible maybe once and for all!

 

In this two-part series, I will share about DeepFCCBean, the custom adapter module for handling conversion of flat files to deep XML structures and vice versa. As much as possible, the module's behaviors and functionalities are similar to standard SAP's FCC.

 

This first part covers deep XML to flat file conversion, while the upcoming second part covers flat file to deep XML conversion.

 

 

Source Code

The full source code can be found in the following public repository on GitHub.

GitHub repository for DeepFCCBean

 

EAR deployment file is also available for download from the following GitHub repository release. This EAR can be used for direct deployment in order to use the Adapter Module Bean. Note that this EAR is created based on EJB3.0 version on NWDS 7.31 SP13 Patch 0. For earlier versions of PI, the EJB and EAR file will have to be manually built and compiled using the source code provided.

 

 

Module Parameter Reference

Below is a list of the parameters for configuration of the module for deep XML to flat file conversion (conversionType = 'DeepXML2Plain'). Certain parameters will automatically inherit the default values if it is not configured.

 

Parameter NameAllowed valuesDefault valueRemarks
conversionTypeDeepXML2PlainRequired field. Determines conversion type
encodingUTF-8Defines encoding of output plain text file
recordsetStructureRequired field. List of substructure names separated by comma
defaultFieldSeparator

Defines a default field separator for all substructures that do not have <StructureName>.fieldSeparator explicitly configured

Note: Cannot be used together with <StructureName>.fieldFixedLengths

<StructureName>.fieldFixedLengthsInteger separated by commasEither <StructureName>.fieldFixedLengths or <StructureName>.fieldSeparator must be populated
<StructureName>.fieldSeparator

 

Either <StructureName>.fieldFixedLengths or <StructureName>.fieldSeparator must be populated
<StructureName>.endSeparatorSystem specific new lineDefines end of record separator
<StructureName>.fixedLengthTooShortHandling

Error,

Cut,

Ignore

ErrorApplicable when <StructureName>.fieldFixedLengthsis configured. Determines behavior when actual length of field exceeds corresponding length configured:
  • Error = Document processing is cancelled
  • Cut = Value is cut to the maximum permitted length
  • Ignore = The value is accepted even though its length exceeds the permitted value. Subsequent columns are moved accordingly
messageLog

pre,

post

Saves a log version of the message that is viewable in Message Monitor
  • pre = saves payload before conversion
  • post = saves payload after conversion
logLocationdefaultName of log version when messageLog is populated

 

Similar to standard FCC functionality, fieldSeparator and endSeparator parameters support non-printable ASCII characters as follows:

  • characters encoded as hexadecimal values in the form of '0xHH' (including quotation marks)
  • line break specified using 'nl' (including quotation marks)

 

 

Example Scenarios

Here are some example scenarios of the behavior of the conversion based on different configuration options.

 

Scenario 1

3 level deep input XML with delimited output

Field separator: Delivery and Order using comma. Item using tab (specified in hexadecimal)

End separator: Delivery has additional ZZZZ followed by line break. Order and Item not specified therefore using default line break

 

Module parameters

Parameter NameParameter Value
conversionTypeDeepXML2Plain
recordsetStructureDelivery,Order,Item
Delivery.fieldSeparator,
Delivery.endSeparatorZZZZ'nl'
Item.fieldSeparator'0x09'
Order.fieldSeparator,

 

Result

Input

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_Deep xmlns:ns0="urn:equalize/DeepFCC">

  <Delivery>

  <Type>D</Type>

  <DeliveryNo>Delivery2</DeliveryNo>

  <Order>

  <Type>O</Type>

  <DeliveryNo>Delivery2</DeliveryNo>

  <OrderNo>Order2_A</OrderNo>

  <Item>

  <Type>I</Type>

  <OrderNo>Order2_A</OrderNo>

  <ItemNo>10</ItemNo>

  <Quantity>90</Quantity>

  </Item>

  <Item>

  <Type>I</Type>

  <OrderNo>Order2_A</OrderNo>

  <ItemNo>20</ItemNo>

  <Quantity>80</Quantity>

  </Item>

  </Order>

  </Delivery>

</ns0:MT_Deep>

Outputout1.png

 

Scenario 2

3 level deep input XML with fixed length output

Length too short handling: Order set to ignore so long fields can potentially push subsequent fields. Item set to cut to maximum configured length

 

Module parameters

Parameter NameParameter Value
conversionTypeDeepXML2Plain
recordsetStructureDelivery,Order,Item
Delivery.fieldFixedLengths5,10
Order.fieldFixedLengths5,5,10
Order.fixedLengthTooShortHandlingIgnore
Item.fieldFixedLengths5,5,10,10
Item.fixedLengthTooShortHandlingCut

 

Result

Input

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_Deep xmlns:ns0="urn:equalize/DeepFCC">

  <Delivery>

  <Type>D</Type>

  <DeliveryNo>Delivery2</DeliveryNo>

  <Order>

  <Type>O</Type>

  <DeliveryNo>Delivery2</DeliveryNo>

  <OrderNo>Order2_A</OrderNo>

  <Item>

  <Type>I</Type>

  <OrderNo>Order2_A</OrderNo>

  <ItemNo>10</ItemNo>

  <Quantity>90</Quantity>

  </Item>

  <Item>

  <Type>I</Type>

  <OrderNo>Order2_A</OrderNo>

  <ItemNo>20</ItemNo>

  <Quantity>80</Quantity>

  </Item>

  </Order>

  </Delivery>

</ns0:MT_Deep>

Outputout2.png

 

 

Scenario 3

Finally for the third scenario, we will the same input file that was used in the XSLT approach. Actual configuration and testing screenshots are shown.

Default field separator for all substructures is used.

A log version of the message payload after conversion is saved.

 

Module configuration on an SFTP receiver channel.

module.png

 

The 'plain' log version shows the payload after conversion of deep XML to flat file.

plain.png

 

The audit log shows the trace of steps being executed by the module.

log.png

 

 

Conclusion

With DeepFCCBean, hopefully content conversion of deeply nested flat files no longer require new custom development.

 

Do note that it is technically possible for DeepFCCBean to handle the flat files that can be converted by standard FCC. However, it is not the intention of DeepFCCBean to replace SAP's standard functionality, but to complement it in handling deep structures. As such, for flat files that can be converted by standard FCC, it is recommended that standard FCC is used.

 

Upcoming will be the second part of this series covering flat file to deep XML conversion with DeepFCCBean. Watch this space!


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>