JDBC Driver for SAP Ariba Procurement

Build 23.0.8839

CreateChildElementSchema

Creates a schema file for an array of documents in the view template. It is possible to vertically flatten existing view templates using the driver's CreateChildElementSchema stored procedure.

Vertical flattening enable you to retrieve array of documents as if they were a separate table.

The schema files generated by the procedure are plain text configuration files that are easy to modify.

You can invoke the procedure using EXECUTE. It accepts these five parameters:

  • ViewTemplateName is the name of an existing view template.
  • ChildElement is a child element/array of documents in the view template in dot notation.
  • TableName is the name of the new table to be created.
  • FileName is the absolute path where you want to save the generated schema.
  • FileStream is an instance of an output stream where file data is written to.

The below result set and API response JSON structure show that the example view includes a LineItems child element, and, deeper in, another SplitAccountings child element.

+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+
| UniqueName                                                                       | LineItems                                                                        |
+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------
| PO11                                                                             | [  {    "TaxDetail.Description": "",    "BasePrice": {      "AmountInR..         |
| PO12                                                                             | [  {    "TaxDetail.Description": "",    "BasePrice": {      "AmountInR..         |
| PO13                                                                             | [  {    "TaxDetail.Description": "",    "BasePrice": {      "AmountInR..         |
| PO14                                                                             | [  {    "TaxDetail.Description": "",    "BasePrice": {      "AmountInR..         |
| PO15                                                                             | [  {    "TaxDetail.Description": "",    "BasePrice": {      "AmountInR..         |
+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------

{
    "Records": [
        {
            "ApprovedState": "Approved",
            "LineItems": [
                {
                    "SplitAccountings": [
                        {
                            "NumberInCollection": 1,
                        }
                    ],
                    "Description.Description": "Sample",
To generate a schema for the LineItems array of documents, you can execute the below query:
EXECUTE CreateChildElementSchema ViewTemplateName='View', ChildElement='LineItems', TableName = 'View_LineItems', FileName='C:/Users/User/AppData/Roaming/CData/SAPAribaProcurement Data Provider/Schema/OperationalReportingAPIForProcurement-V2/View_LineItems.rsd'
To generate a schema for the LineItems.SplitAccountings array of documents, you can execute the below query:
EXECUTE CreateChildElementSchema ViewTemplateName='View', ChildElement='LineItems.SplitAccountings', TableName = 'View_LineItems_SplitAccountings', FileName='C:/Users/User/AppData/Roaming/CData/SAPAribaProcurement Data Provider/Schema/OperationalReportingAPIForProcurement-V2/View_LineItems_SplitAccountings.rsd'

Additionally, you can query the ViewChildElements view to discover array of documents in a view template and valid values for the ChildElement input. For example:

SELECT * FROM ViewChildElements WHERE ViewTemplateName='OrderView'
Note that for the generated schema files to be used in queries they must be present in the API schema folder within the Location connection property.

Assuming the Location connection property points to "C:/Users/User/AppData/Roaming/CData/SAPAribaProcurement Data Provider/Schema", the generated schema file should be within an "OperationalReportingAPIForProcurement-V2" folder.

If an array or object name in the path contains a '.' (dot) character, you can escape the dot by enclosing the name in square brackets, as an example:

ChildElement='[ObjectN.ame].Array'

{
    "Records": [
        {
            "ObjectN.ame": [
                {
                    "Array": [
                        {
                            "NumberInCollection": 1,
                        }
                    ],
                    "Description.Description": "Sample",

Input

Name Type Accepts Output Streams Description
ViewTemplateName String False The name of an existing view template.
ChildElement String False A child element/array of documents in the view template in dot notation. For example, 'LineItems.SplitAccountings'
TableName String False The name for the new table. For example, 'View_LineItems_SplitAccountings'.
FileName String False The file name, if generating relative to Location, or absolute path where you want to save the generated schema. For example, 'C:/Users/User/AppData/Roaming/CData/SAPAribaProcurement Data Provider/Schema/OperationalReportingAPIForProcurement-V2/View_LineItems_SplitAccountings.rsd'.
FileStream String True An instance of an output stream where file data is written to. Only used if LocalPath is not set.

Result Set Columns

Name Type Description
FileData String If the LocalPath and FileStream inputs are empty, file data will be output encoded in base64.
Result String The result of the operation.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839