Skip to content

Translate 69 abap2UI5 samples with cap2ui5 abap2js, texts 1:1 - #2

Merged
oblomov-dev merged 1 commit into
mainfrom
claude/absp2ui5-cap2ui5-transfer-7pg6dg
Sep 28, 2026
Merged

oblomov-dev merged 1 commit into
mainfrom
claude/absp2ui5-cap2ui5-transfer-7pg6dg

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

Why

The samples were ported by hand, nine so far. cap2ui5's new abap2js (cap2UI5/cap2UI5#89) translates an abap2UI5 app class line for line, so the samples are now translated, not ported. Every sample keeps the original's lines, comments and texts, all of them, the page title "abap2UI5 - …" included.

What changes

  • scripts/generate.mjs reads each class that scripts/samples.json lists under generated from abap2UI5/samples at the commit in ABAP2UI5_SAMPLES_PIN (cdd5c8b), and writes it to srv/apps/<class>.js. These files are never edited by hand: a change goes into the ABAP sample, the pin moves, and the script runs again. npm run check:generated fails when a file is not what the translation writes.
  • 69 samples are generated. The two that abap2js still refuses are ported by hand the way it writes, texts and comments 1:1 as well: 011 (LOOP AT … REFERENCE INTO, DELETE … WHERE) and 488 (ASSIGN … ->* TO FIELD-SYMBOL( )).
  • The differential test holds every sample to its ABAP original. scripts/originals.mjs transpiles the originals with the transpiler the runtime was built with (@abaplint/transpiler 2.13.91, against the runtime's downport/), renamed ZABAP_SMP_APP_nnn. test/differential.mjs serves both in one cap2UI5 server, fires every event the original's first view wires on a fresh start of each, and compares the views, the model the original sends, the other actions and the app that has the screen.
  • CI runs the generation check and the differential test against the pinned abap2UI5/samples checkout, besides npm test. It packs cap2ui5 from cap2UI5's branch claude/absp2ui5-cap2ui5-transfer-7pg6dg until npx cap2ui5 abap2js: an abap2UI5 app class, translated into a cap2UI5 app line for line cap2UI5#89 is on its main; then that ref: line goes.
  • test/samples.test.mjs expects the original's page title, and expects 186 to show no view on its first roundtrip, as its original does.
  • The README explains how a sample gets here and what the differential test compares, and lists all 71 samples.

Tests

  • npm test: 9/9.
  • node scripts/generate.mjs --check: 69 samples, 0 to regenerate, 0 refused.
  • npm run differential: 71 samples in 239 roundtrips, no difference. One difference is known and left on purpose: in 122, CONV string( ) of a number keeps ABAP's trailing sign position ("0 "), and JavaScript's String( ) does not.
  • All 71 modules pass ESLint with no-undef, no-unused-vars and no-case-declarations.

Depends on cap2UI5/cap2UI5#89 (abap2js, and t.numc( ) for 067). The other 58 samples follow as abap2js learns their constructs.

🤖 Generated with Claude Code

https://claude.ai/code/session_012kUq3QqNUmt3WugBL5rLc7


Generated by Claude Code

The samples are no longer ported by hand: scripts/generate.mjs reads each
class from abap2UI5/samples at the commit in ABAP2UI5_SAMPLES_PIN and
writes what cap2ui5's abap2js makes of it into srv/apps/<class>.js - the
same class name, the original's lines, comments and texts, all of them,
the page title "abap2UI5 - ..." included. scripts/samples.json lists the
69 generated samples and the two abap2js still refuses, ported by hand
the way it writes the rest, comments and texts 1:1 as well: 011 (LOOP AT
... REFERENCE INTO writes through the row, DELETE ... WHERE) and 488
(ASSIGN ... ->* TO FIELD-SYMBOL( )). Generated files are never edited by
hand; `npm run check:generated` fails when one is not what the
translation writes.

test/differential.mjs holds every sample to its ABAP original:
scripts/originals.mjs transpiles the originals with the transpiler the
runtime was built with, renamed ZABAP_SMP_APP_nnn, and both are served in
one cap2UI5 server; every event the original's first view wires is fired
on a fresh start of each and the views, the model the original sends, the
other actions and the target app are compared. 71 samples, 239
roundtrips, no difference; one known on purpose (122: CONV string( ) of a
number keeps ABAP's sign position).

CI runs both against the pinned samples checkout and packs cap2ui5 from
the cap2UI5 branch that adds abap2js until it is on main. The samples
test now expects the original's page title, and 186 showing no view on
its first roundtrip, as its original does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012kUq3QqNUmt3WugBL5rLc7
@oblomov-dev
oblomov-dev merged commit 9ea2a75 into main Sep 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants