Sub topic 11
Transporting and Maintaining Extensions
Key user extensions are created in one system, usually a development or test tenant. They must then reach quality and production systems in a controlled way. This chapter covers how that transport works, what travels with an extension, and how to maintain extensions over their lifetime.
This chapter assumes you can already create and publish a custom field in the Custom Fields and Logic app. It also assumes you know what a BAdI implementation is and why custom logic is restricted to released objects. Those topics come from earlier chapters.
Why extensions need a lifecycle
A custom field that exists only in a development system is of little use. Users in production need the field, the logic that fills it, and any reports or forms that show it. Without a controlled path, teams end up recreating fields by hand in each system. That causes naming differences, missed steps, and fields that behave differently between systems.
Key user extensibility solves this with two ideas:
- Extensions are collected into a transport request. The request is then imported into the next system.
- Extensions stay separate from standard code. Upgrades and imports do not overwrite them.
The second idea is the clean core principle from earlier in this tutorial. The first idea is the subject of this chapter.
The extension lifecycle at a glance
An extension moves through several states. A custom field, for example, is first created and then published. After that it can be changed within limits, transported, and eventually deleted if it is no longer needed.
Treat the source system as the only place where you change an extension. Target systems receive the result.
Where extensions are created and how they move
Which transport mechanism applies depends on your deployment. In SAP S/4HANA Cloud Public Edition, you work in a development tenant and use software packages and transport requests managed through the Manage Software Collections app. In SAP S/4HANA on premise and Private Cloud, key user extensions are tied to the standard ABAP transport system. You choose a transport request when you publish, and the request is released and imported with the usual transport tools.
In both cases the principle is the same. Creating or changing an extension records the change in a transport request. Releasing the request exports the change. Importing the request in the target system creates the extension there.
Check which edition you run before you plan the process. The app names and some steps differ, and this chapter describes the general pattern.
Transport requests in the key user context
When you publish a custom field, or activate custom logic, the system asks for a transport request if the system is configured to record changes. Keep these rules in mind:
- One request can contain several related extensions. Group a field, the logic that uses it, and the report that shows it in the same request. They then arrive together.
- Do not publish unrelated changes into the same request. A request is imported as a whole.
- Use a clear description. Include the business purpose and a ticket number, because reviewers rely on it.
What travels in a transport
An extension is made of several objects. Not all of them are always captured by the same request, so you must know what to check.
| Object | Travels with the field or logic? | Notes |
|---|---|---|
| Custom field definition | Yes | Includes data type, length, label, and business context |
| Field label translations | Yes, if maintained | Texts in other languages must exist in the source system |
| BAdI implementation | Yes | Includes the ABAP source and its activation state |
| Generated database fields | Created again in the target | Generated from the definition during import |
| UI adaptations such as layout or field position | Often separate | Key user UI adaptations may need their own request |
| Report and form usage | Often separate | Custom analytical queries and form templates have their own entries |
| Authorization role assignments | No | Assign roles in each target system |
| Field values in existing data | No | Transports carry definitions, not business data |
The last row matters most in practice. If a field is imported into production, existing documents do not receive values. Only new or changed documents can fill it, unless you run a data migration.
Dependencies between extensions
Custom logic often reads a custom field. If the logic reaches the target system before the field, activation fails. Keep dependent objects in one request, or import the field request first.
The following example shows logic that reads a custom field and depends on it. The field YY1_CostCenterNote_PRD must exist in the target system before this code can be activated.
" Reads a custom field on the product through a released CDS view.
" The field must already be published and transported.
DATA lv_product TYPE I_Product-Product VALUE 'TG11'.
DATA lv_note TYPE string.
SELECT SINGLE YY1_CostCenterNote_PRD
FROM I_Product
WHERE Product = @lv_product
INTO @lv_note.
IF sy-subrc <> 0.
" No product found, or the field is not available yet.
ENDIF.If the field is missing, the system reports a syntax error during activation. The error is a useful signal that the transport order was wrong.
A typical transport process
A reliable process has a few fixed steps. The sequence below works for most teams.
- Create and publish in development. Build the field and logic. Publish the field so that it is generated and usable.
- Test in development. Check the field in the UI, a report, and an API call. Run the logic with realistic data.
- Release the transport request. Make sure the request contains every related object.
- Import into the test system. Check that the field exists, has the correct label, and appears where expected.
- Run acceptance tests. Include negative cases, such as an empty field or an invalid value.
- Import into production. Do this after approval and during an agreed window.
- Assign authorizations and verify. Confirm that the right users can see and change the field.
Never fix a defect directly in production. Correct it in development, transport it again, and keep all systems in sync.
Maintaining a published field
After publication, a field is part of the data model and many other objects may depend on it. This limits what you can change.
| Change | Possible after publication? |
|---|---|
| Edit the label and its translations | Yes |
| Change the tooltip or description | Yes |
| Change the data type | No |
| Shorten the length | No |
| Increase the length | Limited, depending on the type |
| Change the business context | No |
| Change the field ID | No |
| Delete the field | Yes, with conditions |
Because the type and context are fixed, plan them before you publish. A wrong data type usually means creating a new field and moving the data across.
Changing labels safely
Label changes are the most common maintenance task. They are low risk, because they affect display only. Transport them like any other change, so all systems show the same text.
Replacing a field
If you must change something that is locked, follow a replacement pattern:
- Create a new field with the correct definition. Use a clear name, such as a version suffix.
- Add logic or a migration step to copy the values from the old field.
- Switch reports, forms, and APIs to the new field.
- Mark the old field as obsolete in your documentation.
- Delete the old field once nothing uses it.
Deleting extensions
Deleting a field is a two-step decision. First, confirm that nothing uses it. Then delete it in the source system and transport the deletion.
Check these before deleting:
- UI layouts that show the field.
- Custom analytical queries and CDS views that select it.
- Form templates and email templates that print it.
- Custom logic that reads or writes it.
- External systems that call APIs returning the field.
The Custom Fields and Logic app has a usage view for fields. It lists many dependent objects, but not every external consumer. Ask the owners of integrations before you delete.
Maintaining custom logic
Custom logic needs the same care as fields.
- Version thoughtfully. Keep the logic small. A short implementation that calls one released object is easier to test and to transport than a long one.
- Handle upgrade changes. SAP can change or deprecate a released object. The release state tells you whether a successor exists. Check release notes before each upgrade and test affected logic.
- Deactivate before deleting. Deactivating logic stops it from running without losing the source. If nothing breaks, delete it later.
- Document the purpose. Add a header comment that states the business reason, the owner, and the related ticket.
" Purpose: Validate that the product note is filled for finished goods.
" Owner: Sales operations
" Ticket: CHG-1042
" Uses: I_Product (released CDS view)Upgrade behaviour
Because extensions use only released objects, upgrades normally keep them working. Two risks remain:
- A released object is marked as deprecated. It still works, but you should plan to replace it.
- A released object is changed incompatibly. This is rare, and SAP announces it in advance.
Run your regression tests after each upgrade in the test system first. Use the same test set you used before the initial transport.
Governance and team practices
Technical steps are only part of the work. Teams that manage many extensions usually agree on the following:
- A naming convention for field labels and descriptions.
- A single owner for each extension.
- A register that lists every custom field, its purpose, and its users.
- A regular review that finds unused fields.
- A rule that only the development system is used for changes.
Common transport problems
| Symptom | Likely cause | Action |
|---|---|---|
| Logic fails to activate in the target | The custom field was not imported first | Import the field request, then the logic |
| Field exists but is not on the UI | UI adaptation was not transported | Transport the adaptation or repeat it in the target |
| Field shows no values in production | Transport carries no business data | Fill the field through new documents or a migration |
| Label missing in a language | Translation was not maintained in the source | Add the text in the source and transport again |
| Users cannot see the field | Role assignment is missing in the target | Assign the required roles |
| Import error about an existing field | A field with the same ID was created manually in the target | Remove the manual field and re-import |
The last row shows why manual changes in target systems are risky. They create conflicts that are hard to resolve.
Summary of practices
- Change extensions only in the source system.
- Group dependent objects in one transport request.
- Plan data type and business context before publishing, because they cannot be changed later.
- Transport definitions, but fill data and roles separately.
- Test after every import and after every upgrade.
- Check dependencies before deleting.
Exercise
Your team transports a request to production that contains a BAdI implementation reading the custom field YY1CostCenterNotePRD. The field was published in a different request that has not been imported yet. What happens, and how do you fix it?
Show answer
The activation of the BAdI implementation fails because the field does not exist in production yet. Import the request that contains the field first, then import the logic request. In future, put the field and the logic that depends on it into the same transport request.
Exercise
A key user published a custom field with the data type Text and length 10. Two weeks later, users need 40 characters. Which options exist?
Show answer
Changing the data type or shortening the length is not allowed after publication, and increasing the length is limited. Check whether the field type allows a larger length. If it does not, create a new field with length 40, copy the values with a migration step, switch reports, forms, and APIs to the new field, and delete the old one when nothing uses it.
Exercise
After importing a field into production, a report shows empty values for all existing sales orders. Is this an error?
Show answer
No. A transport carries the field definition, not business data. Existing documents have no value until they are changed or until you run a data migration that fills the field.