Business Object Query Examples

These examples illustrate BQL queries that filter cost book codes and retrieve work order data using parameters and joins.

Cost Book Codes Excluding AVERAGE

{
  "viewQueries": {
    "CostBookBO": {
      "module": "oraScmCoreCostMgmtSetup",
      "businessObject": "CostBook",
      "view": "costBooksExtract",
      "fieldAliases": {
        "code": "codeValue"
      }
    }
  },
  "namedSelects": [
    {
      "name": "CostBookNamedSelect",
      "select": "SELECT cb.codeValue FROM CostBookBO cb"
    }
  ],
  "select": "SELECT DISTINCT cb.codeValue FROM CostBookNamedSelect cb WHERE cb.codeValue NOT LIKE '%AVERAGE%'",
  "return": [
    {
      "name": "codeValue",
      "type": "string"
    }
  ]
}

Work Order Query with Parameters

{
  "parameters": {
    "pWorkOrderNumber": "xxxxxxx",
    "pOrg": "xxxxxxx"
  },
  "viewQueries": {
    "WorkOrderBO": {
      "module": "oraScmCoreManufacturingWorkOrder",
      "businessObject": "WorkOrder",
      "view": "workOrderExtract",
      "fieldAliases": {
        "id": "workOrderIdValue",
        "workOrderNumber": "workOrderNumberValue",
        "workOrderStatus.id": "workOrderStatusIdValue",
        "transformFromItem.organizationId": "organizationIdValue"
      }
    },
    "OrganizationConfigurationBO": {
      "module": "oraScmCoreOrganization",
      "businessObject": "OrganizationConfiguration",
      "view": "organizationParametersExtract",
      "fieldAliases": {
        "id": "organizationIdValue",
        "organizationCode": "organizationCodeValue"
      }
    }
  },
  "namedSelects": [
    {
      "name": "workOrderNamedSelect",
      "select": "SELECT w.workOrderIdValue, w.workOrderNumberValue, w.workOrderStatusIdValue, w.organizationIdValue FROM WorkOrderBO w"
    },
    {
      "name": "organizationNamedSelect",
      "select": "SELECT o.organizationIdValue, o.organizationCodeValue FROM OrganizationConfigurationBO o"
    }
  ],
  "select": "SELECT w.workOrderNumberValue workOrderNumberDescription, w.workOrderNumberValue workOrderNumber, w.workOrderIdValue workOrderId, w.workOrderStatusIdValue workOrderStatusId FROM workOrderNamedSelect w JOIN organizationNamedSelect o ON w.organization..."
  "return": [
    {
      "name": "workOrderNumberDescription",
      "type": "string"
    },
    {
      "name": "workOrderNumber",
      "type": "string"
    },
    {
      "name": "workOrderId",
      "type": "int64"
    },
    {
      "name": "workOrderStatusId",
      "type": "int64"
    }
  ]
}