Sales Scheduling Agreement API

Manage sales scheduling agreements in SAP S/4HANA. Scheduling agreements define delivery schedules for recurring deliveries of materials to customers over a specified period.

OpenAPI Specification

sap-sd-sales-scheduling-agreement-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: SAP Sales and Distribution (SD) SAP Sales Scheduling Agreement API
  description: >-
    Manage sales scheduling agreements in SAP S/4HANA. This OData service
    (API_SALES_SCHEDULING_AGREEMENT) supports scheduling agreements that define
    delivery schedules for recurring deliveries of materials to customers over
    a specified period. Includes header, item, and schedule line entities.
  version: 1.0.0
  contact:
    name: SAP Support
    url: https://support.sap.com
  license:
    name: SAP Developer License
    url: https://www.sap.com/about/agreements/product-use-and-support-terms.html
servers:
  - url: https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_SALES_SCHEDULING_AGREEMENT
    description: SAP S/4HANA Cloud Sandbox
  - url: https://{host}:{port}/sap/opu/odata/sap/API_SALES_SCHEDULING_AGREEMENT
    description: SAP S/4HANA On-Premise
    variables:
      host:
        default: localhost
      port:
        default: '443'
security:
  - basicAuth: []
  - oauth2: []
tags:
  - name: Schedule Line
    description: Operations on delivery schedule lines
  - name: Scheduling Agreement
    description: Operations on scheduling agreement header
  - name: Scheduling Agreement Item
    description: Operations on scheduling agreement items
paths:
  /A_SchAgrmtHeader:
    get:
      operationId: listSchedulingAgreements
      summary: Retrieve a list of scheduling agreements
      description: >-
        Returns a collection of scheduling agreement headers. Supports
        filtering by agreement type, validity dates, customer, and status.
      tags:
        - Scheduling Agreement
      parameters:
        - $ref: '#/components/parameters/top'
        - $ref: '#/components/parameters/skip'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/orderby'
        - $ref: '#/components/parameters/select'
        - $ref: '#/components/parameters/expand'
        - $ref: '#/components/parameters/inlinecount'
      responses:
        '200':
          description: Successfully retrieved scheduling agreements
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    type: object
                    properties:
                      results:
                        type: array
                        items:
                          $ref: '#/components/schemas/SchAgrmtHeader'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
    post:
      operationId: createSchedulingAgreement
      summary: Create a new scheduling agreement
      description: >-
        Creates a new scheduling agreement with deep insert support for items
        and schedule lines.
      tags:
        - Scheduling Agreement
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchAgrmtHeaderCreate'
      responses:
        '201':
          description: Scheduling agreement successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    $ref: '#/components/schemas/SchAgrmtHeader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /A_SchAgrmtHeader('{SchedulingAgreement}'):
    get:
      operationId: getSchedulingAgreement
      summary: Retrieve a single scheduling agreement
      description: >-
        Returns a single scheduling agreement by its document number.
      tags:
        - Scheduling Agreement
      parameters:
        - name: SchedulingAgreement
          in: path
          required: true
          description: Scheduling agreement number (10 characters)
          schema:
            type: string
            maxLength: 10
        - $ref: '#/components/parameters/select'
        - $ref: '#/components/parameters/expand'
      responses:
        '200':
          description: Successfully retrieved the scheduling agreement
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    $ref: '#/components/schemas/SchAgrmtHeader'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    patch:
      operationId: updateSchedulingAgreement
      summary: Update a scheduling agreement
      description: >-
        Updates an existing scheduling agreement header.
      tags:
        - Scheduling Agreement
      parameters:
        - name: SchedulingAgreement
          in: path
          required: true
          description: Scheduling agreement number
          schema:
            type: string
            maxLength: 10
        - $ref: '#/components/parameters/ifMatch'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchAgrmtHeaderUpdate'
      responses:
        '204':
          description: Scheduling agreement successfully updated
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /A_SchAgrmtHeader('{SchedulingAgreement}')/to_Item:
    get:
      operationId: listSchedulingAgreementItems
      summary: Retrieve items for a scheduling agreement
      description: >-
        Returns a collection of items for the specified scheduling agreement.
      tags:
        - Scheduling Agreement Item
      parameters:
        - name: SchedulingAgreement
          in: path
          required: true
          description: Scheduling agreement number
          schema:
            type: string
            maxLength: 10
        - $ref: '#/components/parameters/top'
        - $ref: '#/components/parameters/skip'
        - $ref: '#/components/parameters/select'
      responses:
        '200':
          description: Successfully retrieved agreement items
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    type: object
                    properties:
                      results:
                        type: array
                        items:
                          $ref: '#/components/schemas/SchAgrmtItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /A_SchAgrmtScheduleLine:
    get:
      operationId: listScheduleLines
      summary: Retrieve delivery schedule lines
      description: >-
        Returns a collection of delivery schedule lines across scheduling
        agreements.
      tags:
        - Schedule Line
      parameters:
        - $ref: '#/components/parameters/top'
        - $ref: '#/components/parameters/skip'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/select'
      responses:
        '200':
          description: Successfully retrieved schedule lines
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    type: object
                    properties:
                      results:
                        type: array
                        items:
                          $ref: '#/components/schemas/SchAgrmtScheduleLine'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://{tenant}.authentication.{landscape}.hana.ondemand.com/oauth/token
          scopes:
            API_SALES_SCHEDULING_AGREEMENT: Access to Scheduling Agreement API
  parameters:
    top:
      name: $top
      in: query
      schema:
        type: integer
        minimum: 0
    skip:
      name: $skip
      in: query
      schema:
        type: integer
        minimum: 0
    filter:
      name: $filter
      in: query
      schema:
        type: string
    orderby:
      name: $orderby
      in: query
      schema:
        type: string
    select:
      name: $select
      in: query
      schema:
        type: string
    expand:
      name: $expand
      in: query
      schema:
        type: string
    inlinecount:
      name: $inlinecount
      in: query
      schema:
        type: string
        enum:
          - allpages
          - none
    ifMatch:
      name: If-Match
      in: header
      required: true
      schema:
        type: string
  schemas:
    SchAgrmtHeader:
      type: object
      description: Scheduling agreement header entity
      properties:
        SchedulingAgreement:
          type: string
          maxLength: 10
          description: Scheduling agreement number
        SchedulingAgreementType:
          type: string
          maxLength: 4
          description: Document type
        SalesOrganization:
          type: string
          maxLength: 4
          description: Sales organization
        DistributionChannel:
          type: string
          maxLength: 2
          description: Distribution channel
        OrganizationDivision:
          type: string
          maxLength: 2
          description: Division
        SoldToParty:
          type: string
          maxLength: 10
          description: Sold-to party
        CreationDate:
          type: string
          format: date
          description: Creation date
        SchedulingAgreementDate:
          type: string
          format: date
          description: Document date
        SchAgrmtValidityStartDate:
          type: string
          format: date
          description: Valid-from date
        SchAgrmtValidityEndDate:
          type: string
          format: date
          description: Valid-to date
        TotalNetAmount:
          type: string
          description: Net value
        TransactionCurrency:
          type: string
          maxLength: 5
          description: Document currency
        PurchaseOrderByCustomer:
          type: string
          maxLength: 35
          description: Customer PO number
        OverallSDProcessStatus:
          type: string
          maxLength: 1
          description: Overall processing status
    SchAgrmtHeaderCreate:
      type: object
      required:
        - SchedulingAgreementType
        - SalesOrganization
        - DistributionChannel
        - OrganizationDivision
      properties:
        SchedulingAgreementType:
          type: string
          maxLength: 4
        SalesOrganization:
          type: string
          maxLength: 4
        DistributionChannel:
          type: string
          maxLength: 2
        OrganizationDivision:
          type: string
          maxLength: 2
        SoldToParty:
          type: string
          maxLength: 10
        SchedulingAgreementDate:
          type: string
          format: date
        SchAgrmtValidityStartDate:
          type: string
          format: date
        SchAgrmtValidityEndDate:
          type: string
          format: date
    SchAgrmtHeaderUpdate:
      type: object
      properties:
        PurchaseOrderByCustomer:
          type: string
          maxLength: 35
        SchAgrmtValidityEndDate:
          type: string
          format: date
    SchAgrmtItem:
      type: object
      description: Scheduling agreement item entity
      properties:
        SchedulingAgreement:
          type: string
          maxLength: 10
          description: Scheduling agreement number
        SchedulingAgreementItem:
          type: string
          maxLength: 6
          description: Item number
        Material:
          type: string
          maxLength: 40
          description: Material number
        TargetQuantity:
          type: string
          description: Target quantity
        TargetQuantityUnit:
          type: string
          maxLength: 3
          description: Target quantity unit
        NetAmount:
          type: string
          description: Net value
        Plant:
          type: string
          maxLength: 4
          description: Plant
    SchAgrmtScheduleLine:
      type: object
      description: Scheduling agreement schedule line entity
      properties:
        SchedulingAgreement:
          type: string
          maxLength: 10
          description: Scheduling agreement number
        SchedulingAgreementItem:
          type: string
          maxLength: 6
          description: Item number
        ScheduleLine:
          type: string
          maxLength: 4
          description: Schedule line number
        DeliveryDate:
          type: string
          format: date
          description: Delivery date
        OrderQuantity:
          type: string
          description: Scheduled quantity
        OrderQuantityUnit:
          type: string
          maxLength: 3
          description: Order unit
        DeliveredQuantity:
          type: string
          description: Delivered quantity
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: object
              properties:
                lang:
                  type: string
                value:
                  type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'