Skip to main content

DOWNLOADJSON & QUANTITYCHECK

DOWNLOADJSON

Class: OciDownloadJsonController
Purpose: Returns the complete product catalog as paginated JSON. The format follows the SAP Ariba catalog format (NEWITEM structure). Used to populate a procurement system's local catalog without an interactive punchout session.

Flow

  1. Read parameters (all optional with defaults)
  2. Load total product count: OciProductService::getProductsTotalCount($dataFeedContext)
  3. Calculate current page and clamp to totalPages
  4. Load product page: OciProductService::getProductsPage($pageSize, $currentPage, $dataFeedContext)
  5. Map each product to the NEWITEM structure
  6. Clear session
  7. Return JSON response

Parameters

ParameterDefaultDescription
pagesize50Number of products per page
requestedpage1Requested page (1-based, clamped to totalPages)
transactionidAuto UUIDTransaction ID; auto-generated if not provided
cti"X"Catalog Type Indicator (SAP convention)

Response structure

{
"CTI": "X",
"CURRENTPAGE": 1,
"TOTALITEMS": 150,
"TOTALPAGES": 3,
"TRANSACTIONID": "a1b2c3d4...",
"Items": [
{
"NEWITEM": {
"ATTACHMENTS": [
{
"descriptions": [{ "description": "item image", "languageCode": "" }],
"fileName": "https://example.com/media/product.jpg",
"mimeType": "image/jpeg",
"type": "01"
}
],
"ATTRIBUTES": [],
"CATALOG_NAME": "Category name",
"CURRENCY": "EUR",
"DESCRIPTION": [{ "description": "Product name", "languageCode": "" }],
"EXT_PRODUCT_ID": "SW-1234",
"ITEM_TYPE": "product",
"LEADTIME": "",
"MINORDER_QTY": 1,
"PRICE": "9.99",
"PRICE_QUANTITY": 1,
"PRICE_SCALES": [{ "low": 1, "price": "9.99", "scaleType": "01" }],
"TAX": "19.00",
"UNIT": "PCE",
"VENDOR": "Manufacturer name",
"VENDOR_NAME": "Sales channel name"
}
}
]
}

Price logic

  • If scale prices (calculatedPrices) are present: the first scale price is used
  • Otherwise: calculatedPrice.unitPrice
  • Format: 2 decimal places, dot as separator, no thousands separator

Error handling

If the controller throws an exception, it returns a JSON error response instead of an Items array:

{
"success": false,
"errorMessage": "..."
}
note

DOWNLOADJSON clears the ConnectorSession after the call. DataFields are not resolved for DOWNLOADJSON; fields are populated directly from SalesChannelProductEntity.


QUANTITYCHECK

Class: OciQuantityCheckController
Purpose: Returns the available stock for a single product. Used when the procurement system wants to check availability before placing an order.

Flow

  1. Check productid parameter (required)
  2. Load product by productNumber ($dataFeedContext)
  3. Clear session
  4. Return JSON response with availability

Parameters

ParameterRequiredDescription
productid✅ YesProduct number

Response (JSON)

{
"AVAILABLE_QUANTITY": 42,
"LEADTIME": ""
}
FieldSourceDescription
AVAILABLE_QUANTITYSalesChannelProductEntity::getAvailableStock()Available stock
LEADTIMEAlways empty string (not implemented)

Error behaviour

ErrorException
productid missing\RuntimeException: Parameter PRODUCTID is required and has not been provided.
Product not found\RuntimeException: Product with product number "..." was not found.