abap-form-translator
A runtime translation layer for Smartform and Adobe form labels, matching structure fields against a table maintained in a RAP Fiori app, so a label changes without SE63 or a transport.
Changing a label on a Smartform or an Adobe form normally means the SE63 translation workflow and a transport. This keeps the text out of the form: the components of a flat interface structure are matched by field name against the rows of a database table, ZABAP_FORM_TRANS, through RTTI, and the labels are maintained in a Fiori elements application built with RAP rather than in SE63, which puts a changed label into production without a transport request. Only flat structures are translated, not nested structures or internal tables, and the table is buffered, so a changed text reaches other application servers once the buffer synchronises rather than at once.
Facts
Where it sits
Who is behind it
In the atlas: maintains 4, contributes to 7@greltelmaintainerLars HvamContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1@larshpMarc BernardContributes to this
In the atlas: contributes to 26@mbtools2 contributors
What it declares
Every artifact
- Type
- Package
- Origin
- Independently maintained
As a package
- Where it runs
- Inside its host
- Distributed through
- abapGit
Connections
Serving labels, messages and content per user locale
Git client written in ABAP that runs inside the system
Download
README
quoted from greltel/abap-form-translator under MIT, readABAP Form Translator
✅ Status: Release (2.0.0)
Open Source Contribution: This project is community-driven and Open Source! 🚀 If you spot a bug or have an idea for an enhancement, open an Issue or submit a Pull Request — see CONTRIBUTING.md.
A lightweight, dynamic runtime translation tool for SAP forms, written in ABAP for Cloud Development. It decouples text management from form development: functional consultants maintain labels in a Fiori Elements app, and the print program picks them up at runtime — no SE63, no transport for a changed label.
Table of contents
- Key benefits
- What's new in 2.0.0
- Requirements
- Installation
- Usage
- The maintenance app
- Architecture
- Design decisions
- Tests
- License
- Contributors
Key benefits
- No more SE63: forget the standard translation workflow for forms.
- Zero hardcoding: keep the form logic clean — no
IF sy-langu = 'D'. text = 'Kunde'. ENDIF. - Hot-swap texts: change a label in production without a transport request.
The table is buffered, so a change becomes visible on other application servers
after the buffer synchronisation interval (typically ~60 s). Inside a long-running
session (mass print, batch job) call
ZCL_FORM_TRANSLATION=>clear_buffer( )to pick it up immediately. - Generic: works with any flat ABAP structure or form interface, matched by component name through RTTI.
- Performance: table buffering plus a per-session translation buffer — zero impact on print times.
- Fiori Elements app built with the ABAP RESTful Application Programming Model (RAP), draft-enabled, with a Copy Language action that duplicates a translation into another language straight from the list.
- Authorization: read and maintenance access is governed by one authorization
object,
ZFORMTRA, checked in CDS access control and in the behavior implementation. - Tested: 66 ABAP Unit tests, 43 of which also run outside SAP on every push.
What's new in 2.0.0
2.0.0 is the first release built as ABAP for Cloud Development, with authorization checks and a hardened behavior implementation. It is a breaking release for installations: see CHANGELOG.md for the details and the upgrade notes.
Requirements
- SAP S/4HANA 2023 (ABAP 7.58) or later — on premise or private cloud.
- A package with ABAP language version ABAP for Cloud Development. All objects carry that language version; the repository sets it for abapGit as well.
- abapGit for the installation.
The runtime class can be called from any ABAP code — classic print programs and Smart Forms / Adobe Forms drivers included. Only the objects of this package need the cloud language version, not their callers.
Older systems or standard packages: the code itself is compatible with Standard ABAP. Set the abapGit repository option ABAP Language Version to Undefined before pulling, and expect no support for releases before 7.58 — the logon language is read through
xco_cp=>sy->language( ), which is not available on every 7.57 system.
Installation
- Create a package (for example
ZABAP_FORM_TRANSLATION) with ABAP language version ABAP for Cloud Development. - In abapGit, create an online repository for
https://github.com/greltel/abap-form-translatoron that package and pull. Activate the objects if abapGit did not do it for you. - Roles: add authorization object
ZFORMTRAto a role. Activity03displays translations in the app,01/02/06create, change and delete them. The Copy Language action needs01. The service bindingZUI_FORM_TRANS_BINships with SU22 default values, so PFCG proposes the object when the binding is added to a role. - Fiori app: publish the OData V4 service binding
ZUI_FORM_TRANS_BINand either use the ADT preview or generate a List Report with SAP Fiori tools from the published service and deploy it to your launchpad. The repository ships the service, not a UI5 project.
Print-time reads of the table are not guarded by the access control on purpose: the user who prints a form needs no maintenance role. Only the app is checked.
Usage
In your Adobe / Smart Forms driver program
- Define a structure for your labels in the form's global definitions or in the driver program.
- Populate it with defaults (optional).
- Call the translator before the form function module.
TYPES: BEGIN OF form_labels,
title TYPE string,
footer_note TYPE string,
customer_lbl TYPE string,
END OF form_labels.
DATA(labels) = VALUE form_labels( title = 'Invoice' ).
DATA(translator) = CAST zif_form_translation( NEW zcl_form_translation( ) ).
" Texts in the logon language of the user, English filling the gaps.
translator->translate_form( EXPORTING formname = 'ZINVOICE_FORM'
CHANGING form_elements = labels ).
" labels now carries the texts maintained in the app - pass it to the form.
Pass langu to translate into a specific language, for example the language of
the business partner the document is addressed to.
API reference
translate_form maps the rows of ZABAP_FORM_TRANS onto the components of your
structure by field name (via RTTI).
| Parameter | Direction | Type | Default | Meaning |
|---|---|---|---|---|
formname | importing | zabap_form_trans_name | – | Key in ZABAP_FORM_TRANS. An empty value returns without changes. Matched case-insensitively. |
langu | importing | zabap_form_trans_langu | logon language | Target language. When empty, the logon language of the user is used; when that cannot be resolved, the default language E. |
enable_fallback | importing | abap_boolean | abap_true | When on, fields without a text in the target language fall back to the default language E. |
form_elements | changing | any | – | Flat structure whose components are filled with the translated texts. Components that cannot hold text keep their value. |
clear_buffer (static) invalidates the in-memory translation buffer.
The constructor accepts an optional zif_form_trans_user_context — the source
of the logon language. You will only ever pass it in a unit test.
Only flat structures are supported. Nested structures and internal tables are not translated. A translation with an empty text leaves the component untouched.
Database table ZABAP_FORM_TRANS
| Field | Type | Key | Description |
|---|---|---|---|
FORM | ZABAP_FORM_TRANS_NAME (CHAR 30) | ✔ | Form key passed as formname. |
FIELDNAME | ZABAP_FORM_TRANS_FIELD (CHAR 30) | ✔ | Component name in your structure. |
LANGU | ZABAP_FORM_TRANS_LANGU (LANG) | ✔ | Language of the text. |
DESCR | ZABAP_FORM_TRANS_DESCR (CHAR 50) | Translated text. | |
LENGTH | ZABAP_FORM_TRANS_MAXLEN (INT2, 0–9999) | Max length; a longer text is truncated at print time. 0 means no limit. |
Form and field names are stored in upper case; the app rejects anything else, because HANA compares case-sensitively and the text could never be found at print time.
The maintenance app
The list report on ZC_FORM_TRANS is draft-enabled: create, edit and delete rows,
search by form, field or language, and use the value helps for form and field names.
Copying a translation into another language
Select one or more rows, press Copy Language and pick the target language. Each selected row is duplicated into that language as a draft, keeping its description and max length. Rejected with a message:
- the target language is empty, or is the language of the row itself
- a translation already exists under the target key, active or draft
- two selected rows of the same form and field aim at the same target language — there is no way to tell which text should win, so the whole selection is rejected rather than letting the first row silently decide
Validations
| Rule | Trigger | Message |
|---|---|---|
| Description must not be empty | create, update, Prepare | 002 |
| Max length between 0 and 9999 | create, update, Prepare | 001 |
| Text longer than max length | create, update, Prepare | 006 (warning, does not block) |
| Key must not exist yet | create | 003 |
| Form and field name upper case | create | 007 |
Authorization
| Operation | ZFORMTRA activity |
|---|---|
| Display (list, value helps) | 03 |
| Create, Copy Language | 01 |
| Edit / Update | 02 |
| Delete | 06 |
Denied operations report messages 008 (create) and 009 (change / delete).
Architecture
Three layers, each testable on its own:
| Layer | Objects | Role |
|---|---|---|
| Print time | ZIF_FORM_TRANSLATION, ZCL_FORM_TRANSLATION, ZIF_FORM_TRANS_USER_CONTEXT, ZCL_FORM_TRANS_USER_CONTEXT | Reads the table, resolves the language, maps texts onto the caller structure. The user context adapter is the only platform dependency. |
| Rules | ZCL_FORM_TRANS_RULES | Pure functions: validation and copy rules, free of RAP and persistence. |
| Maintenance | ZI_FORM_TRANS (root, draft), ZC_FORM_TRANS (projection), ZBP_I_FORM_TRANS, ZDD_COPY_LANG_POPUP, value helps, ZIF_FORM_TRANS_AUTHORITY, ZCL_FORM_TRANS_AUTHORITY, DCLs, ZFORMTRA, ZUI_FORM_TRANS_O4, ZUI_FORM_TRANS_BIN | RAP business object, authorization, OData V4 service. |
Inside the behavior pool, lcl_form_trans_factory resolves the authority check;
tests inject a double through it. Handler methods are called directly by the test
classes (friends of the handler), EML is reserved for two smoke tests.
Design decisions
ZCL_FORM_TRANSLATIONis not FINAL and reads the database in a protected method. An injected reader interface would cost two more objects for one SELECT; tests substitute the read by subclassing. The logon language, in contrast, is injected, because without that seam the "no language given" path could not be tested.ZCL_FORM_TRANS_RULESis a static class. The rules are pure functions with no collaborators; there is nothing to double, so nothing to inject.- Authorization is global, not per instance.
ZFORMTRAcarries onlyACTVT; a per-form authorization would add a field and an instance check — easy to add later, not needed now. - The logon language comes from XCO (
xco_cp=>sy->language( )), the one place in the package that reads the session, behindZIF_FORM_TRANS_USER_CONTEXT. - The table has delivery class C. Translations are transportable customizing by default; production maintenance through the app is still possible.
- Object names are frozen. Renaming shipped tables and views would force a data migration on every installation; new objects follow the naming of the existing ones.
Tests
66 ABAP Unit tests run in ADT:
| Class | Tests | Covers |
|---|---|---|
ZCL_FORM_TRANSLATION | 17 | RTTI mapping, truncation, language resolution, fallback, buffer |
ZCL_FORM_TRANS_RULES | 25 | every validation and copy rule, including ambiguity |
ZCL_FORM_TRANS_USER_CONTEXT | 1 | forwards the logon language |
ZBP_I_FORM_TRANS | 23 | global authorization, validations, feature control, Copy Language, save sequence |
Running the tests off-stack
The classes without RAP dependency also run outside the ABAP system, transpiled to JavaScript with abaplint, so every push is verified without an SAP system:
npm ci
npm run check
check runs abaplint (Clean ABAP rules plus a syntax check against the released
ABAP Cloud API) and all 43 transpiled tests of ZCL_FORM_TRANSLATION,
ZCL_FORM_TRANS_RULES and ZCL_FORM_TRANS_USER_CONTEXT, backed by an in-memory
SQLite database so SELECT and CL_OSQL_TEST_ENVIRONMENT behave as in the system.
Nothing is skipped off-stack. The behavior pool tests need the RAP runtime and
run in ADT only.
License
This project is licensed under the MIT License.
Contributors
Created by George Drakos.
History
Removed 2, Features 5, Changed 7, Other 4
Notes
First release built as ABAP for Cloud Development. Breaking for existing installations — read the upgrade notes.
Added
- Authorization object
ZFORMTRA(activity only) with CDS access control on every view and a global authorization check in the behavior implementation. Denied operations report messages 008 and 009. ZIF_FORM_TRANS_AUTHORITY/ZCL_FORM_TRANS_AUTHORITY: the authority check behind an interface, injected into the handler through a local factory.ZIF_FORM_TRANS_USER_CONTEXT/ZCL_FORM_TRANS_USER_CONTEXT: the logon language behind an interface;ZCL_FORM_TRANSLATIONtakes it as an optional constructor parameter, so the "no language given" path is testable.- Direct handler tests for the global authorization, every validation, the feature control and the Copy Language action (23 tests on the behavior pool).
- Off-stack gate hardened: abaplint syntax check against the released ABAP Cloud
API (2305 snapshot), Clean ABAP rules, a CI guard for the
#CHANGE_SETgrouping of the Copy Language button, Dependabot.
Changed
- All objects carry ABAP language version ABAP for Cloud Development; the
abapGit repository sets
cloudDevelopment. - Minimum release is SAP S/4HANA 2023 (ABAP 7.58).
- Validation
validateUniqueKeyreads the persisted keys with one SELECT per request instead of one per instance. - Copy Language messages show the ISO 639 code of the language (
EL,DE) instead of the internal key. ZCL_FORM_TRANS_RULES=>check_copy_requesttakes acopy_requeststructure instead of six scalar parameters.- The behavior implementation of the Copy Language action is split into
queue_copies,report_rejectionandcreate_drafts. - Message texts in the tests use string literals in backticks; internal tables
are filled with
INSERT … INTO TABLEthroughout.
Removed
- Dead exception handling around the logon language and the XCO language formatting.
- Four EML-driven tests of the save sequence that the direct handler tests cover; two smoke tests remain.
Upgrade notes
- Move the objects into a package with ABAP language version ABAP for Cloud Development (or set the abapGit option ABAP Language Version to Undefined to keep a standard package).
- Every user of the app needs
ZFORMTRA:03to display,01/02/06to maintain. Without a role the list is empty and create is denied. - Callers of
ZCL_FORM_TRANS_RULES=>check_copy_request(unlikely outside this package) have to pass acopy_requeststructure. - The protected type
ZCL_FORM_TRANSLATION=>translationsbecame a sorted table with a unique key on the field name.
Notes
Standard ABAP releases; see the GitHub releases.
Others providing
Compare all 15 on the Localization page →- abap_btocs_deeplabap_btocs_deeplA plugin for the B-Tocs ABAP SDK that lets an SAP ABAP server translate with DeepL through an SM59 RFC destination, using a DeepL API key, with a demo program for the first call.independent, abapDeepL translation plugin for the B-Tocs ABAP SDKfrom ABAP
- abap_btocs_libtrlabap_btocs_libtrlA plugin for the B-Tocs ABAP SDK that lets an SAP ABAP server translate with LibreTranslate through an SM59 RFC destination, against an instance hosted on-premise, on a hyperscaler, on SAP BTP or as SaaS.independent, abapLibreTranslate plugin for the B-Tocs ABAP SDKfrom ABAP
- SAP Translation HubSAP Translation HubSAP's translation service for software texts and documents, drawing on repositories of verified and company translations and on machine translation by SAP's neural MT or large language models.sap official, btpTranslation service for software texts and documentsfrom BTP/BAIP
- com.sap.cds:cds-services-bomcom.sap.cds:cds-services-bomThe Maven bill of materials for CAP Java, pinning every com.sap.cds module in a release, from the API and core runtime to the Spring Boot starters and the CQN engine, to the same version.sap official, capMaven bill of materials pinning CAP Java module versionsfrom CAP
- ABAP_DeepL_clientABAP_DeepL_clientAn ABAP client for the DeepL translation service, so text can be sent for translation from inside the system rather than through a tool outside it.independent, abapABAP client for the DeepL translation servicefrom ABAP
- LISALISAAn MCP server that lets an AI client read and write the translations of ABAP repository objects through three tools, backed by an ABAP HTTP service on SAP's XCO i18n APIs.independent, abapMCP server for reading and writing ABAP object translationsfrom ABAP
- @concircle/i18n-ai-translator@concircle/i18n-ai-translatorA CLI that translates a UI5 app's i18n.properties with OpenAI and writes the language files back, masking placeholders, applying a glossary and caching what has been translated.independent, ui5CLI translating UI5 i18n.properties files with OpenAIfrom UI5
- ABAP_TRANSLATION_HUBABAP_TRANSLATION_HUBA report that pushes an ABAP object list to SAP Translation Hub and pulls the finished translations back, meant to run as a job after the evaluation job has finished.independent, abapReport pushing ABAP objects to SAP Translation Hub and backfrom ABAP
- ui5-i18n-excel-converterui5-i18n-excel-converterA command-line tool that exports a UI5 app's i18n properties files to an Excel sheet of keys and languages for translators and imports the translated sheet back into the files.independent, ui5CLI converting UI5 i18n properties files to Excel and backfrom UI5
- ZOTR_UTILITYZOTR_UTILITYA small ABAP framework that reads language-dependent texts from SAP's online text repository through inheritance and named constants rather than a direct API call with a string alias.independent, abapABAP framework reading texts from SAP's online text repositoryfrom ABAP
- ZABAP_TRANSLATIONSZABAP_TRANSLATIONSAn ABAP tool that exports the texts of a package or program to an Excel file and imports them back in bulk once translated, covering eight object types from programs and classes to domain values.independent, abapExcel export and import of ABAP package or program textsfrom ABAP
- @sap/cds@sap/cdsThe CAP Node.js runtime, which compiles the CDS model, serves the services declared in it, answers generic requests before any handler runs, and loads every cds-plugin.sap official, capCAP Node.js runtimefrom CAP
- @sap-ux/i18n@sap-ux/i18nA library that reads and writes the i18n bundles of a UI5 or CAP project from Node code, the i18n.properties file of a UI5 app and the i18n folder of a CAP project alike.sap official, ui5Reader and writer for i18n bundles of UI5 or CAP projectsfrom UI5
- XLF TranslatorXLF TranslatorTakes an uploaded XLIFF file and makes every entry that carries a translation element editable in the page, aimed mainly at the ABAP Cloud content the Maintain Translation app generates.independent, abapEditor for the translations in an uploaded XLIFF filefrom ABAP
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
abaplint
Flavors
“ABAP Cloud/Clean Core compatibility.Passed SCI check variant S4HANA_READINESS_2023 and ABAP_CLOUD_READINESS” — greltel/abap-form-translator — README, Design Goals-Features
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:greltel-abap-form-translator- JSON
- /artifacts/greltel-abap-form-translator.json
- MCP
- Connecting an agent