Sub topic 6
Creating a custom field step by step
This chapter walks through creating a custom field in the Custom Fields and Logic app. It assumes you can navigate the SAP Fiori launchpad. It also assumes you know the business objects you want to extend, such as sales orders or products. You need the key user authorizations from the earlier chapter on roles. You should also have chosen a business context, which the previous chapter covered.
What you are building
A custom field is a new data field added to a standard business object. The system adds it without changing standard code. That is why the extension survives upgrades.
The example here adds a free-text note to the product master. Planners will use it to record a cost center remark.
The creation flow
The creation flow has a fixed order. The field exists only as a draft until you publish it.
Step by step
- Open the Custom Fields app from the launchpad. If the tile is missing, your user lacks the key user role.
- Choose New to start a field.
- Select the business context. For the example, pick the context for products. The context decides which business objects, UIs and APIs receive the field. It cannot be changed later, so check it first.
- Enter a label. This is the text users see on screens. Use a clear business term, such as "Cost Center Note".
- Enter a field identifier. The system adds a prefix and suffix around what you type. You cannot rename it after publishing.
- Select the type. Common choices are listed below.
- Set the length and, for numbers, the decimal places.
- Select Save. The field is saved as a draft and does not yet affect users.
- Select Publish when the definition is final.
Choosing a type
The type controls how data is stored and checked. Pick it carefully, because you cannot change it after publishing.
| Type | Use it for | Notes |
|---|---|---|
| Text | Notes, codes, short descriptions | You set a maximum length |
| Number | Counts and quantities | You set digits and decimals |
| Date | Deadlines, review dates | Stored as a calendar date |
| Amount | Money values | Needs a currency |
| Checkbox | Yes or no flags | Stored as a boolean-style indicator |
| Code list | A fixed set of allowed values | Users choose from a dropdown |
For the example, choose Text with length 100.
How the field is named
Fields you create get the YY1_ prefix. You can use it to tell your fields from standard ones in field lists, reports and API responses.
Custom field ID pattern: YY1_<FieldName>_<suffix>
Example: YY1_CostCenterNote_PRDThe system generates the suffix from the business context. In the example, PRD comes from the product context. You will see this ID again when you read the field through an API or a CDS view.
Check the result
After publishing, the app shows the field with a status. Wait until it shows as published before you test it. The system generates the field's technical parts in the background, so this can take a short time.
Then open a product in the product maintenance app. The new field is available, but you may need to add it to the screen through UI adaptation. The next chapter covers that, along with reports, forms and APIs.
Common errors
- The business context you need is not in the list. The object may not support key user extensions. Check the extensibility information for that object.
- The field is published but not visible. Creating a field does not place it on a screen. Add it to the UI layout.
- Publishing fails. Check for a duplicate identifier or a length outside the allowed range. Fix the definition and publish again.
- The tile is missing. Ask an administrator to assign the key user business role.
Exercise
A colleague created a custom text field in the product context. After publishing, they notice the label has a typo, and they also want to switch the type to Number. Which of these changes can they make to the published field, and what must they do for the other?
Show answer
They can correct the label, because labels stay editable after publishing. They cannot change the type of a published field. To get a Number field, they must create a new field with that type, and then stop using the old one.
Exercise
You see the field ID YY1CostCenterNotePRD in an API response. What does the YY1_ prefix tell you, and where does the PRD part come from?
Show answer
The YY1_ prefix marks the field as a key user extension rather than a standard field. The PRD suffix is generated by the system from the business context, which here is the product context.