Create Purchase Request Entities
Key Lesson: The purchase request model uses separate Entities for the request itself and the individual items it contains.
The purchase request data model begins with two Entities: PurchaseRequest and PurchaseRequestItem.
PurchaseRequest represents the request itself and holds information that applies to the request as a whole. PurchaseRequestItem represents an individual item being requested, such as a laptop. A PurchaseRequest can contain one or more PurchaseRequestItem objects.
The relationship between the two Entities is configured in the next tutorial step.
1. Create the PurchaseRequest Entity
Section titled “1. Create the PurchaseRequest Entity”Begin with the PurchaseRequest Entity. At this stage, it needs a cost center and a comment that can be used later when the request is reviewed.
- Go to Design.
- Under Object Types, select Entity.
- Select + to create a new Entity.
- Enter
PurchaseRequestin the Id field, then select OK. - In the GENERAL section, set Id type to
number. The selected Id type determines the type of the unique identifier used for the Entity in the database. - Add the following properties:
| NAME | TYPE | Notes |
|---|---|---|
| costCenter | | References the CostCenter Static Entity. Leave the default expression empty so the user must select a cost center. |
| comment | string | Stores the comment entered when the purchase request is reviewed. |
-
Leave all other properties at their default values.
-
Save and close the editor.
Tip
This, with a capital T, refers to the Module that the current business object belongs to. Typing This. in the Type or Default expression field displays suggestions for the Static Entities and Entities available in the current Module. Referring to the Module explicitly as Purchasing. is also possible, but is not encouraged.
2. Create the PurchaseRequestItem Entity
Section titled “2. Create the PurchaseRequestItem Entity”The PurchaseRequestItem Entity represents the individual items added to a purchase request. Each item records what is being requested, the quantity, the budget amount, and the currency.
- Go to Design.
- Under Object Types, select Entity.
- Select + to create a new Entity.
- Enter
PurchaseRequestItemin the Id field, then select OK. - In the GENERAL section, set Id type to
number. - Add the following properties:
| NAME | TYPE | DEFAULT EXPRESSION | Notes |
|---|---|---|---|
| description | string | (leave blank) | Describes the requested item. |
| quantity | number | 1 | Sets the requested quantity. New items default to 1. |
| budgetAmount | number | (leave blank) | Stores the budget amount for the requested item. |
| currency | | | References the Currency Static Entity and defaults to USD. |
-
Leave all other properties at their default values.
-
Save and close the editor.