sap commerce

Browser-based tools for SAP Commerce Cloud (Hybris) developers. No install, no login, runs entirely client-side.


# tools


# developer notes

impex tips

  • Always define $catalogVersion and $catalog macros at the top of the file — referencing undefined macros silently inserts blank strings.
  • Use INSERT_UPDATE for most data loads — it upserts without failing on duplicates. Use INSERT only when you need strict creation semantics.
  • Test imports on Staged catalog version first, sync to Online only after verification in HAC.
  • $contentCatalog:catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalogName]),CatalogVersion.version[default=Staged]) — the full path for CMS content catalog reference.
  • Batch size matters: large ImpEx files run faster with batchSize header (default 1, set to 20–100 for bulk inserts).

flexiblesearch gotchas

  • Always specify {catalogVersion} in the WHERE clause when querying product-catalog-aware types — without it you get all versions merged.
  • Use {item:pk} not {item.pk} — SAP FlexibleSearch uses curly-brace attribute access, not dot notation.
  • ?start and ?count parameters are positional — always add them last, in that order.
  • Joins across catalog versions are expensive — prefer subqueries or pre-filtered joins in the FROM clause.
  • Test in HAC → FlexibleSearch tab before putting into code — the HAC tool shows row count and execution time.

groovy hac patterns

  • Always wrap bulk operations in a transaction: Transaction.current().begin() / commit() / rollback() on catch.
  • Use Registry.getApplicationContext().getBean('serviceName') to get Spring beans — don't instantiate services directly.
  • Script output goes to the return value — return "done: ${count} items" shows in the HAC result pane.
  • For large datasets, use FlexibleSearchService with pagination (SearchResult.getResult()) — loading everything into memory causes OOM on large catalogs.
  • Import statements work: import de.hybris.platform.core.model.product.ProductModel at the top of the script.

occ api patterns

  • The client credentials token endpoint: POST /authorizationserver/oauth/token with grant_type=client_credentials — use this for server-to-server calls.
  • Customer token: grant_type=password + username + password — needed for customer-specific cart and order operations.
  • All OCC endpoints use /rest/v2/{baseSiteId}/ prefix by default — check your site's wsCommerceWebServicesContextPath if customised.
  • Fields projection parameter (?fields=BASIC|DEFAULT|FULL) controls response verbosity — always request only the fields you need in production.
  • OAuth2 tokens expire — implement token refresh logic or catch 401s and re-authenticate automatically.