Sub topic 4
Working in the Custom Fields and Logic app
This chapter covers the Custom Fields and Logic app: what it contains, how you move around in it, and where its limits are. It assumes you can navigate the SAP Fiori launchpad and know the business objects you extend, such as sales orders, business partners and products. Reading knowledge of SQL or ABAP helps in the logic section. Later chapters cover business contexts, field creation and publication in detail. This chapter gives you the working model of the app itself.
What the app is
Custom Fields and Logic is the central Fiori app for key user extensibility in SAP S/4HANA. A key user is a business user with extension authorizations, not a developer. In this app, a key user can:
- Create and edit custom fields.
- Publish those fields so that UIs, reports, forms and APIs can use them.
- Write custom logic for BAdIs (Business Add-Ins), which are predefined hooks in standard processes.
- Review which extensions exist and what state they are in.
The app changes the system through supported extension points only. It does not modify SAP standard code, which is why the extensions survive upgrades. The previous chapters on clean core and key user roles explain the reasoning. Here, the focus is how the app works.
Starting the app
You open the app from the launchpad tile named Custom Fields and Logic. If the tile is missing, the cause is almost always authorization. The user needs a business role that contains the key user extensibility catalog. Your administrator assigns it, as covered in the roles chapter.
On first start the app may ask you to choose or confirm a development package or transport context, depending on the system type. In a system where extensions are transported, you also need a transport request. Chapter 11 covers this.
Layout of the app
The app opens on an overview with a list of items and a set of tabs. The exact labels vary slightly by release, but the structure is stable.
| Area | Purpose |
|---|---|
| Custom Fields tab | Lists all custom fields with their business context, type, and status |
| Custom Logic tab | Lists BAdI implementations created by key users |
| Filter and search bar | Narrows the list by business context, field name, or status |
| Create button | Starts a new field or a new logic implementation |
| Publish action | Makes unpublished changes active in the system |
| Detail page | Shows and edits one field or one implementation |
Learn to read the status column first. It tells you whether an item is only a draft or is already live. Most confusion in this app comes from editing an item and then forgetting that the change is not yet active.
The two working areas
Custom fields
The Custom Fields tab shows every field that key users have created. Each row has a field ID, a label, a data type and a business context. Field IDs carry the YY1_ prefix, so you can tell them apart from standard fields in field lists, reports and API responses.
Custom field ID pattern: YY1_<FieldName>_<suffix>
Example: YY1_CostCenterNote_PRD
The YY1_ prefix marks key user extensions. The suffix is generated by the system from the business context.You do not choose the prefix or the suffix. You choose the field name, and the system builds the rest. Once a field is published, its ID cannot change, because other objects may already refer to it.
Custom logic
The Custom Logic tab lists implementations for BAdIs. A BAdI implementation is a piece of ABAP code that the standard process calls at a defined point. For example, a BAdI may run just before a document is saved, so your code can check a value and reject the save with a message.
Key user logic runs under restrictions. It is written in a limited ABAP dialect called ABAP for key users. That language version allows only released objects, which are objects SAP has marked as stable for customer use. The next chapters on released objects and BAdIs cover this fully. A short example shows the style:
" Read data through a released CDS view, as allowed in key user custom logic.
DATA lv_product TYPE matnr VALUE 'TG11'.
DATA lv_product_type TYPE I_Product-ProductType.
SELECT SINGLE ProductType
FROM I_Product
WHERE Product = @lv_product
INTO @lv_product_type.
IF sy-subrc <> 0.
" No product found: handle the case here, for example by raising a message.
ENDIF.I_Product is a released CDS view. The @ characters mark host variables, which is the required syntax in modern ABAP SQL. If you try to read a table such as MARA directly, the syntax check fails, because the table is not released.
Draft, published and the lifecycle of one item
Every field and every logic implementation moves through states. Understanding them prevents most mistakes.
The states work like this:
- Draft. The item exists only in the app. No other object can use it.
- Published. The system has generated the required technical objects. The field now appears in the places you enabled.
- Modified. You changed a published item. The old version stays active until you publish again.
Publishing runs a background job in the system. For a field, it adds the field to the underlying database structures and to the related CDS views and service definitions. This can take a short time, and the app shows a progress or status message. Do not assume the field is usable the instant you click Publish. Check the status first.
A typical working session
A realistic session in the app looks like this.
- Open Custom Fields and Logic from the launchpad.
- Filter the list by business context so that you see only the objects that matter, for example sales orders.
- Check whether a suitable field already exists. Duplicate fields with slightly different names are a common maintenance problem.
- Select Create and define the field, as the creation chapter describes in detail.
- Save the draft and review the usage options.
- Publish and wait until the status shows the field as active.
- Open the target application, for example a sales order, and confirm that the field appears. You may need to adapt the page layout, which is a separate step.
- If the field must be checked or defaulted, switch to the Custom Logic tab and add a BAdI implementation.
Step 7 matters. Publishing a field does not always place it on every screen. Whether it shows in a given UI depends on the usage options you chose and on the page adaptation that a key user does in the UI itself.
Working across several users
Several key users can work in the same system. The app does not lock the whole list, but it protects each item.
- If two users edit the same item, the second one may see a message that the item is being processed.
- A transport request collects changes in systems that use transports, so that all related changes move together.
- A field created by one user can be edited by another with the right authorization. The app does not tie ownership to one person.
Agree on naming conventions within your team. Field labels are visible to end users, so a clear label is more important than a clever one. Names such as Note1 and Note2 become a burden within months.
Common mistakes
- Forgetting to publish. The field is in the list, but nothing in the UI shows it. Check the status column.
- Wrong business context. The field exists, but it belongs to the wrong object, so it does not appear where you need it. The business context cannot be changed after publication in most cases. The next chapter covers choosing it.
- Expecting a tile that is not assigned. Missing tile, missing catalog. Ask for the role, not for a workaround.
- Writing logic with unreleased objects. The syntax check fails. Look for a released CDS view or API that offers the same data.
- Testing in the wrong client or system. Extensions created in a development system do not exist in the quality system until they are transported.
Limits to keep in mind
The app is built for bounded, low-risk extensions. It is not a replacement for developer extensibility. Remember these limits.
- Custom logic can use only released objects and the restricted ABAP language version.
- Not every business object offers an extension point. If a business context is not in the list, you cannot add a field there with this app.
- Complex process changes belong to developer extensibility or side-by-side extensibility, which the overview chapter compares.
- The number of custom fields per object is limited by the underlying database structure, so do not use fields as a substitute for a proper data model.
Summary of what to remember
The Custom Fields and Logic app is one place for fields and BAdI logic. Items move from draft to published, and changes become active only after publishing. Fields carry the YY1_ prefix. Logic uses released objects only. Work with a clear naming approach and check status after every action.
Exercise
A key user creates a custom field for sales orders and saves it. The next day, colleagues report that the field does not appear in the sales order UI. Name two checks you would do in the Custom Fields and Logic app and one check outside it.
Show answer
In the app, check the status column to see whether the field was published or is still a draft, and check that the usage options for the UI were enabled and that the business context matches the sales order object. Outside the app, check in the sales order application whether the page layout was adapted to show the new field, because publishing alone does not always place it on the screen.
Exercise
Why does a SELECT on the table MARA fail the syntax check in key user custom logic, while a SELECT on I_Product succeeds?
Show answer
Key user logic uses the restricted ABAP language version, which allows only released objects. I_Product is a released CDS view and MARA is not, so the syntax check rejects direct access to the table.