# API_PURCHASEREQ_PROCESS_SRV ?Purchase Requisition (OData V2, DEPRECATED)

> **Service Root:** `/sap/opu/odata/sap/API_PURCHASEREQ_PROCESS_SRV/`
> **Protocol:** OData V2
> **Status:** DEPRECATED (since SAP S/4HANA Cloud 2402; successor: `API_PURCHASEREQUISITION_2` OData V4)
> **Application Component:** `MM-PUR` (Purchasing)

---

## Overview

This synchronous OData V2 service enables you to create, read, update, and delete purchase requisitions (PR) from external systems. A purchase requisition is an internal document requesting the purchasing department to procure materials or services. The service exposes header, item, account assignment, delivery address, and item note entities.

---

## Entity Summary

| Entity | Description |
|---|---|
| `A_PurchaseRequisition` | Purchase Requisition Header |
| `A_PurchaseRequisitionItem` | Purchase Requisition Item |
| `A_PurchaseRequisitionItemAccount` | Account Assignment |
| `A_PurchaseRequisitionItemAddress` | Delivery Address |
| `A_PurchaseRequisitionItemNote` | Item Note / Text |

---

## CRUD Endpoints

| Method | URL | Description |
|---|---|---|
| `GET` | `/A_PurchaseRequisition` | Read multiple purchase requisitions |
| `GET` | `/A_PurchaseRequisition('{PurchaseRequisition}')` | Read single PR header |
| `POST` | `/A_PurchaseRequisition` | Create purchase requisition |
| `PATCH` | `/A_PurchaseRequisition('{PurchaseRequisition}')` | Update PR header |
| `DELETE` | `/A_PurchaseRequisition('{PurchaseRequisition}')` | Delete purchase requisition |
| `GET` | `/A_PurchaseRequisitionItem` | Read multiple items |
| `GET` | `/A_PurchaseRequisitionItem(PurchaseRequisition='{PR}',PurchaseRequisitionItem='{Item}')` | Read single item |
| `POST` | `/A_PurchaseRequisition('{PR}')/to_PurchaseRequisitionItem` | Create item under header |
| `PATCH` | `/A_PurchaseRequisitionItem(...)` | Update item |
| `DELETE` | `/A_PurchaseRequisitionItem(...)` | Delete item |
| `GET` | `/A_PurchaseRequisitionItemAccount` | Read account assignments |
| `POST` | `/A_PurchaseRequisitionItem(...)/to_PurchaseRequisitionItemAccount` | Create account assignment |
| `GET` | `/A_PurchaseRequisitionItemAddress` | Read delivery addresses |
| `POST` | `/A_PurchaseRequisitionItem(...)/to_PurchaseRequisitionItemAddress` | Create delivery address |
| `PUT` | `/A_PurchaseRequisitionItemAddress(...)` | Update/replace delivery address |
| `GET` | `/A_PurchaseRequisitionItemNote` | Read item notes |
| `POST` | `/A_PurchaseRequisitionItemNote` | Create item note |
| `PATCH` | `/A_PurchaseRequisitionItemNote(...)` | Update item note |
| `DELETE` | `/A_PurchaseRequisitionItemNote(...)` | Delete item note |

---

## A_PurchaseRequisition (Header)

**Key:** `PurchaseRequisition` (Edm.String)

| Property | Type | Description |
|---|---|---|
| `PurchaseRequisition` | String | Purchase Requisition Number |
| `PurchaseRequisitionType` | String | Document Type (e.g. NB) |
| `PurchasingOrganization` | String | Purchasing Organization |
| `PurchasingGroup` | String | Purchasing Group |
| `CompanyCode` | String | Company Code |
| `SourceDetermination` | Boolean | Source Determination Active |
| `PurReqnDoOnlyValidation` | Boolean | Simulation Mode Flag |
| `PurReqnDescription` | String | Short Description |
| `CreatedByUser` | String | Created By |
| `CreationDate` | DateTime | Created On |
| `LastChangeDateTime` | DateTime | Last Changed |
| `LastChangedByUser` | String | Last Changed By |
| `PurchasingProcessingStatus` | String | Processing Status |
| `ReleaseStatus` | String | Overall Release Status |
| `ReleaseCode` | String | Release Code |
| `CompleteRequisitionFinally` | Boolean | Complete Requisition Flag |
| `DeletionIndicator` | Boolean | Deletion Flag |
| `Supplier` | String | Preferred Vendor |
| `DocumentCurrency` | String | Currency |
| `ExchangeRate` | Decimal | Exchange Rate |
| `ValidityStartDate` | DateTime | Validity Start |
| `ValidityEndDate` | DateTime | Validity End |
| `Language` | String | Language Key |
| `ManualSourceDetermination` | Boolean | Manual Source Determination |
| `SourceDeterminationByUser` | String | Source Determination By |
| `ApprovalStatus` | String | Approval Status |
| `RejectionReason` | String | Rejection Reason |
| `RejectedByUser` | String | Rejected By |
| `RejectionDateTime` | DateTime | Rejection Time |

### Navigation Properties

| Navigation Property | Target Entity | Multiplicity |
|---|---|---|
| `to_PurchaseRequisitionItem` | `A_PurchaseRequisitionItem` | 0..* |

---

## A_PurchaseRequisitionItem

**Keys:** `PurchaseRequisition`, `PurchaseRequisitionItem`

| Property | Type | Description |
|---|---|---|
| `PurchaseRequisition` | String | PR Number (FK) |
| `PurchaseRequisitionItem` | String | Item Number |
| `PurchaseRequisitionItemText` | String | Short Text |
| `Material` | String | Material Number |
| `MaterialGroup` | String | Material Group |
| `Plant` | String | Plant |
| `StorageLocation` | String | Storage Location |
| `RequestedQuantity` | Decimal | Quantity Requested |
| `BaseUnit` | String | Base Unit of Measure |
| `PurchaseOrderQuantityUnit` | String | Order Unit |
| `RequestedDeliveryDate` | DateTime | Delivery Date Requested |
| `DeliveryDate` | DateTime | Delivery Date |
| `PurchaseRequisitionPrice` | Decimal | Estimated Price |
| `PriceUnit` | String | Price Unit |
| `DocumentCurrency` | String | Currency |
| `PurchasingGroup` | String | Purchasing Group |
| `PurchasingOrganization` | String | Purchasing Organization |
| `CompanyCode` | String | Company Code |
| `AccountAssignmentCategory` | String | Account Assignment Category (K=Cost Center, U=Unknown, etc.) |
| `PurchaseOrderItemCategory` | String | Item Category |
| `MaterialFixed` | Boolean | Material Fixed |
| `QuantityFixed` | Boolean | Quantity Fixed |
| `DeliveryDateFixed` | Boolean | Delivery Date Fixed |
| `SourceDetermination` | Boolean | Source Determination Active |
| `IsCancelled` | Boolean | Cancelled Indicator |
| `CancelledByUser` | String | Cancelled By |
| `CancellationDate` | DateTime | Cancellation Date |
| `IsFinallyDelivered` | Boolean | Finally Delivered |
| `IsCompletelyDelivered` | Boolean | Completely Delivered |
| `OverdelivToleranceLimit` | Decimal | Overdelivery Tolerance |
| `UnderdelivToleranceLimit` | Decimal | Underdelivery Tolerance |
| `UnlimitedOverdeliveryAllowed` | Boolean | Unlimited Overdelivery |
| `SourceOfSupply` | String | Source of Supply |
| `SourceOfSupplyType` | String | Source Type (e.g. Info Record, Contract) |
| `PurchasingInfoRecord` | String | Info Record |
| `PurchasingDocument` | String | Purchasing Document (PO/Contract) |
| `PurchasingDocumentItem` | String | Purchasing Document Item |
| `PricingDate` | DateTime | Pricing Date |
| `TaxCode` | String | Tax Code |
| `ConsumptionTaxCtrlCode` | String | Consumption Tax Control Code |
| `GoodsReceiptIsExpected` | Boolean | Goods Receipt Expected |
| `InvoiceIsExpected` | Boolean | Invoice Receipt Expected |
| `EstimatedPrice` | Decimal | Estimated Price |
| `EffectivePriceAmount` | Decimal | Effective Price |
| `ItemWeight` | Decimal | Item Weight |
| `WeightUnit` | String | Weight Unit |
| `ItemVolume` | Decimal | Item Volume |
| `VolumeUnit` | String | Volume Unit |
| `OrderQuantity` | Decimal | Quantity Ordered |
| `DeliveredQuantity` | Decimal | Quantity Delivered |
| `GoodsReceiptQuantity` | Decimal | GR Quantity |
| `RejectedQuantity` | Decimal | Rejected Quantity |
| `RejectionReason` | String | Rejection Reason |
| `RejectionCode` | String | Rejection Code |
| `IsDeleted` | Boolean | Deletion Indicator |
| `IsEvaluatedReceiptSettlement` | Boolean | ERS Indicator |
| `Supplier` | String | Supplier |
| `SupplyingPlant` | String | Supplying Plant |
| `RequirementSegment` | String | Requirement Segment |
| `RequirementTracking` | String | Requirement Tracking |
| `RequirementDate` | DateTime | Requirement Date |
| `Batch` | String | Batch Number |
| `ManufacturerPartNumber` | String | Mfr Part Number |
| `ManufacturerNumber` | String | Manufacturer |
| `StorageBin` | String | Storage Bin |
| `StorageType` | String | Storage Type |
| `SalesOrder` | String | Sales Order |
| `SalesOrderItem` | String | Sales Order Item |
| `SalesOrderScheduleLine` | String | Sales Order Schedule Line |
| `Project` | String | Project / WBS |
| `Network` | String | Network |
| `NetworkItem` | String | Network Item |
| `CostCenter` | String | Cost Center (direct) |
| `GLAccount` | String | G/L Account (direct) |
| `ProfitCenter` | String | Profit Center |
| `FunctionalArea` | String | Functional Area |
| `Segement` | String | Segment |
| `Fund` | String | Fund |
| `FundsCenter` | String | Funds Center |
| `GrantID` | String | Grant |
| `BusinessArea` | String | Business Area |
| `WBSElement` | String | WBS Element |
| `OrderID` | String | Internal Order |
| `CostObject` | String | Cost Object |
| `RealEstateObject` | String | Real Estate Object |
| `AssetNumber` | String | Asset Number |
| `AssetSubNumber` | String | Asset Sub-Number |
| `RecoveryIndicator` | String | Recovery Indicator |
| `JointVenture` | String | Joint Venture |
| `PartnerAccountNumber` | String | Partner Account |
| `CommitmentItem` | String | Commitment Item |

### Navigation Properties

| Navigation Property | Target Entity | Multiplicity |
|---|---|---|
| `to_PurchaseRequisitionItemAccount` | `A_PurchaseRequisitionItemAccount` | 0..* |
| `to_PurchaseRequisitionItemAddress` | `A_PurchaseRequisitionItemAddress` | 0..1 |
| `to_PurchaseRequisitionItemNote` | `A_PurchaseRequisitionItemNote` | 0..* |

---

## A_PurchaseRequisitionItemAccount

**Keys:** `PurchaseRequisition`, `PurchaseRequisitionItem`, `AccountAssignmentNumber`

| Property | Type | Description |
|---|---|---|
| `PurchaseRequisition` | String | PR Number (FK) |
| `PurchaseRequisitionItem` | String | Item Number (FK) |
| `AccountAssignmentNumber` | String | Serial Number |
| `CostCenter` | String | Cost Center |
| `GLAccount` | String | G/L Account |
| `Quantity` | Decimal | Quantity |
| `DocumentCurrency` | String | Currency |
| `NetAmount` | Decimal | Net Amount |
| `CommitmentItem` | String | Commitment Item |
| `FundsCenter` | String | Funds Center |
| `Fund` | String | Fund |
| `GrantID` | String | Grant |
| `BusinessArea` | String | Business Area |
| `ProfitCenter` | String | Profit Center |
| `WBSElement` | String | WBS Element |
| `OrderID` | String | Internal Order |
| `SalesOrder` | String | Sales Order |
| `SalesOrderItem` | String | Sales Order Item |
| `Segement` | String | Segment |
| `FunctionalArea` | String | Functional Area |
| `ControllingArea` | String | Controlling Area |
| `CostObject` | String | Cost Object |
| `ProjectNetwork` | String | Network |
| `JointVenture` | String | Joint Venture |
| `RecoveryIndicator` | String | Recovery Indicator |
| `RealEstateObject` | String | Real Estate Object |
| `PartnerAccountNumber` | String | Partner Account |
| `TaxCode` | String | Tax Code |
| `IsDeleted` | Boolean | Deletion Indicator |

---

## A_PurchaseRequisitionItemAddress (Delivery Address)

**Keys:** `PurchaseRequisition`, `PurchaseRequisitionItem`, `AddressNumber`

| Property | Type | Description |
|---|---|---|
| `PurchaseRequisition` | String | PR Number (FK) |
| `PurchaseRequisitionItem` | String | Item Number (FK) |
| `AddressNumber` | String | Address Number |
| `AddressUUID` | GUID | Address UUID |
| `City` | String | City |
| `PostalCode` | String | Postal Code |
| `Street` | String | Street |
| `StreetNumber` | String | House Number |
| `Country` | String | Country Key |
| `Region` | String | Region / State |
| `CompanyName` | String | Company Name |
| `Name1` | String | Name Line 1 |
| `Name2` | String | Name Line 2 |
| `Name3` | String | Name Line 3 |
| `Name4` | String | Name Line 4 |
| `Building` | String | Building Code |
| `Floor` | String | Floor |
| `RoomNumber` | String | Room |
| `POBox` | String | P.O. Box |
| `POBoxPostalCode` | String | PO Box Postal Code |
| `PhoneNumber` | String | Phone |
| `MobileNumber` | String | Mobile |
| `FaxNumber` | String | Fax |
| `EmailAddress` | String | Email |
| `CorrespondenceLanguage` | String | Language |
| `IsDefault` | Boolean | Default Address |
| `DeletionIndicator` | Boolean | Deletion Flag |

---

## A_PurchaseRequisitionItemNote (Item Text)

**Keys:** `PurchaseRequisition`, `PurchaseRequisitionItem`, `TextObjectType`, `DocumentText`, `Language`

| Property | Type | Description |
|---|---|---|
| `PurchaseRequisition` | String | PR Number (FK) |
| `PurchaseRequisitionItem` | String | Item Number (FK) |
| `TextObjectType` | String | Text Object Type (always `EBAN`) |
| `DocumentText` | String | Note Type (e.g. B01, B02) |
| `Language` | String | Language Key |
| `NoteDescription` | String | Note Content |
| `CreatedByUser` | String | Created By |
| `CreationDate` | DateTime | Created On |
| `LastChangeDateTime` | DateTime | Last Changed |

> **Note:** The key consists of `PurchaseRequisition` + `PurchaseRequisitionItem` + `TextObjectType` + `DocumentText` + `Language`.

---

## Entity Relationship Diagram (Simplified)

```
A_PurchaseRequisition (Header)
└── A_PurchaseRequisitionItem (Item)          (1..*)
    ├── A_PurchaseRequisitionItemAccount      (0..*)  [multi-account]
    ├── A_PurchaseRequisitionItemAddress      (0..1)  [single delivery address]
    └── A_PurchaseRequisitionItemNote         (0..*)  [multiple note types]
```

---

## Authentication & Authorization

- **Authentication:** Basic Auth (username/password) or OAuth 2.0
- **Authorization Objects (for PR):**
  - `M_BANF_BSA` ?Release strategy
  - `M_BANF_EKG` ?Purchasing Group
  - `M_BANF_EKO` ?Purchasing Organization
  - `M_BANF_WRK` ?Plant
- **CSRF Token:** Required for write operations; fetch via `GET /sap/opu/odata/sap/API_PURCHASEREQ_PROCESS_SRV/$csrf`

---

## Query Examples

### Read PR header with items expanded
```
GET /A_PurchaseRequisition('10000001')?$expand=to_PurchaseRequisitionItem
```

### Read items with account and delivery address
```
GET /A_PurchaseRequisitionItem?
  $filter=PurchaseRequisition eq '10000001'
  &$expand=to_PurchaseRequisitionItemAccount,
           to_PurchaseRequisitionItemAddress
```

### Read all notes for a specific item
```
GET /A_PurchaseRequisitionItemNote?
  $filter=PurchaseRequisition eq '10000001'
          and PurchaseRequisitionItem eq '00010'
```

### Filter by creation date
```
GET /A_PurchaseRequisition?
  $filter=CreationDate gt datetime'2024-06-01T00:00:00'
  &$orderby=CreationDate desc
  &$top=100
```

### Create PR in simulation mode (validation only)
```json
POST /A_PurchaseRequisition
{
  "PurchaseRequisitionType": "NB",
  "CompanyCode": "1010",
  "PurReqnDescription": "Test Simulation",
  "PurReqnDoOnlyValidation": true
}
```

### Create PR with one item and account assignment
```json
POST /A_PurchaseRequisition
{
  "PurchaseRequisitionType": "NB",
  "CompanyCode": "1010",
  "PurchasingOrganization": "1000",
  "PurchasingGroup": "001",
  "DocumentCurrency": "USD",
  "to_PurchaseRequisitionItem": [
    {
      "PurchaseRequisitionItemText": "Test Item",
      "MaterialGroup": "001",
      "Plant": "1000",
      "RequestedQuantity": "10",
      "BaseUnit": "EA",
      "RequestedDeliveryDate": "/Date(1767225600000)/",
      "AccountAssignmentCategory": "K",
      "to_PurchaseRequisitionItemAccount": [
        {
          "CostCenter": "CC-IT-001",
          "GLAccount": "400000",
          "Quantity": "10"
        }
      ]
    }
  ]
}
```

---

## Important Constraints

1. **Item notes only:** Only item-level notes are supported (no header notes).
2. **Account/delivery dependency:** Account assignment and delivery address cannot be created without an item.
3. **Batch changesets:** One changeset per PR; multiple PRs require separate changesets.
4. **Simulation mode:** Use `PurReqnDoOnlyValidation=true` to validate payload without posting.
5. **Language:** PR is created in logon language (must match system language).
6. **Paging:** Default page size = 1000, max = 5000 with `$top`.
7. **Source Determination:** Set `SourceDetermination=true` to let the system auto-suggest source of supply.
8. **Delete constraint:** A PR item can only be deleted if no subsequent document (PO, Contract) references it.

---

## SAP Cloud SDK (VDM) ?Java / JS

**Java (V2 VDM):**
```java
PurchaseRequisitionService service = new PurchaseRequisitionService();
PurchaseRequisitionHeader header = service
    .getPurchaseRequisitionByKey("10000001")
    .select(PurchaseRequisitionHeader.TO_PURCHASE_REQUISITION_ITEM)
    .executeRequest(destination);
```

**JavaScript (V2 Client):**
```js
const { purchaseRequisitionService } = require('./generated');
const { purchaseRequisitionApi } = purchaseRequisitionService();
const pr = await purchaseRequisitionApi.requestBuilder()
    .getAll()
    .filter(purchaseRequisitionApi.schema.PURCHASING_GROUP.equals('001'))
    .top(10)
    .execute({ destinationName: 'S4HANA' });
```

---

## References

- [SAP Help Portal ?Purchase Requisition OData V2](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/91af7f8d3acd47da90d33aaacfcd0d59/43c43f584eff2160e10000000a44147b.html)
- [SAP Business Accelerator Hub](https://api.sap.com/api/API_PURCHASEREQ_PROCESS_SRV)
- [SAP Community ?Purchase Requisition OData API Episode 1](https://community.sap.com/t5/enterprise-resource-planning-blog-posts-by-sap/purchase-requisition-odata-api-episode-1/ba-p/12839010)
- [SAP Community ?Purchase Requisition OData API Episode 4 (Notes)](https://community.sap.com/t5/enterprise-resource-planning-blog-posts-by-sap/purchase-requisition-odata-api-episode-4/ba-p/12835127)
- [SAP Cloud SDK ?Java PurchaseRequisitionService](https://javadoc.io/doc/com.sap.cloud.sdk.s4hana/s4hana-api-odata/latest/com/sap/cloud/sdk/s4hana/datamodel/odata/services/PurchaseRequisitionService.html)
- [Deprecation notice ?SAP S/4HANA Cloud 2402](https://help.sap.com/docs/SAP_S4HANA_CLOUD/bb9f1469daf04bd894ab2167f8132a1a/43c43f584eff2160e10000000a44147b.html)
- [latonaio/sap-api-integrations-purchase-requisition-reads (Go sample)](https://github.com/latonaio/sap-api-integrations-purchase-requisition-reads)