Skip to content

Commit 8c8a04e

Browse files
oblomov-devclaude
andauthored
Fix abapGit import errors caused by source lines over 255 characters (#669)
ABAP limits source lines to 255 characters; longer lines break the import with "Literals across more than one line are not allowed". The merged reorganization contained such lines, and the failed import left z2ui5_cl_demo_app_038 and _378 as empty class stubs and reverted the sample_app_001 catalog to its old single-group state. - restore the aligned implementations of app 038 and 378 with their long literals split into short && chunks - generate-launchpad.js: wrap catalog rows whose sub would exceed the limit across multiple lines (sub split into && chunks) - regenerate sample_app_001, restoring the per-library groups and the full demo kit descriptions - enforce the limit via the abaplint line_length rule (255) and document it in AGENTS.md Claude-Session: https://claude.ai/code/session_016NuzrYKkzoSiM7jnMBKee4 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3f38ab1 commit 8c8a04e

6 files changed

Lines changed: 486 additions & 144 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ must conform to the abapGit file format:
284284
- **Line endings**: LF (`x0A`) only — never CRLF
285285
- **Final newline**: every file must end with a single newline character after the last line
286286
- **Indentation**: 2 spaces — never tabs
287+
- **Line length**: max **255 characters** per `.abap` source line (hard ABAP
288+
limit — longer lines break the abapGit import with "Literals across more
289+
than one line are not allowed"; enforced via the abaplint `line_length`
290+
rule). Split long string literals into `&&` chunks.
287291

288292
**Always verify consistency for all file types before committing**, not just
289293
`.abap` files. abaplint covers `.abap` files; for `.xml` and other files, check

abaplint.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"rules": {
2525
"exporting": true,
2626
"omit_parameter_name": true,
27+
"line_length": {
28+
"length": 255
29+
},
2730
"downport": true,
2831
"begin_end_names": true,
2932
"check_ddic": true,

scripts/generate-launchpad.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,26 @@ function rewrite(file, list) {
133133
// indentation of the tiles = indent of "result" line + 2 spaces
134134
const indent = ' '.repeat((text.slice(0, open).match(/\n( *)$/) || [, ''])[1].length + 2);
135135

136-
const rows = list.map(
137-
(t) => `${indent}( group = \`${t.group}\` header = \`${t.header}\` sub = \`${t.sub}\` app = \`${t.app}\` )`);
136+
// ABAP sources are limited to 255 characters per line — longer lines break
137+
// the abapGit import ("Literals across more than one line are not allowed")
138+
const MAX_LINE = 255;
139+
const rows = list.map((t) => {
140+
const one = `${indent}( group = \`${t.group}\` header = \`${t.header}\` sub = \`${t.sub}\` app = \`${t.app}\` )`;
141+
if (one.length <= MAX_LINE) return one;
142+
// split the sub literal into && chunks so no line exceeds the limit
143+
const subIndent = `${indent} `;
144+
const contIndent = `${subIndent} `; // aligns under the first chunk's opening backtick
145+
const chunkSize = MAX_LINE - contIndent.length - 6;
146+
const chunks = [];
147+
for (let s = t.sub; s.length; s = s.slice(chunkSize)) chunks.push(s.slice(0, chunkSize));
148+
const subLines = chunks.map((c, i) =>
149+
`${i === 0 ? `${subIndent}sub = ` : contIndent}\`${c}\`${i < chunks.length - 1 ? ' &&' : ''}`);
150+
return [
151+
`${indent}( group = \`${t.group}\` header = \`${t.header}\``,
152+
...subLines,
153+
`${subIndent}app = \`${t.app}\` )`,
154+
].join('\n');
155+
});
138156
// the last row additionally closes the constructor + statement
139157
rows[rows.length - 1] += ' ).';
140158

Lines changed: 230 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,236 @@
1-
class Z2UI5_CL_DEMO_APP_038 definition
2-
public
3-
create private .
1+
"! Rebuild of the UI5 demo kit sample: https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.MessageView/sample/sap.m.sample.MessageViewWithGrouping
2+
"! A sample with Message View and inside a Dialog and grouping of items
3+
CLASS z2ui5_cl_demo_app_038 DEFINITION PUBLIC.
44

5-
public section.
6-
protected section.
7-
private section.
5+
PUBLIC SECTION.
6+
INTERFACES z2ui5_if_app.
7+
8+
TYPES:
9+
BEGIN OF ty_s_msg,
10+
type TYPE string,
11+
title TYPE string,
12+
subtitle TYPE string,
13+
description TYPE string,
14+
group TYPE string,
15+
END OF ty_s_msg.
16+
DATA t_msg TYPE STANDARD TABLE OF ty_s_msg WITH EMPTY KEY.
17+
18+
PROTECTED SECTION.
19+
DATA client TYPE REF TO z2ui5_if_client.
20+
21+
METHODS on_init.
22+
METHODS on_event.
23+
METHODS view_display.
24+
METHODS popup_display.
25+
METHODS popover_display
26+
IMPORTING
27+
id TYPE string.
28+
29+
PRIVATE SECTION.
830
ENDCLASS.
931

1032

33+
CLASS z2ui5_cl_demo_app_038 IMPLEMENTATION.
34+
35+
METHOD z2ui5_if_app~main.
36+
37+
me->client = client.
38+
IF client->check_on_init( ).
39+
on_init( ).
40+
ELSEIF client->check_on_event( ).
41+
on_event( ).
42+
ENDIF.
43+
44+
ENDMETHOD.
45+
46+
47+
METHOD on_init.
48+
49+
" the original controller reuses the same long description text for every message
50+
DATA(description) = `First Error message description. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ` &&
51+
`Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ` &&
52+
`Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ` &&
53+
`Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`.
54+
55+
t_msg = VALUE #(
56+
( type = `Error`
57+
title = `Account 801 requires an assignment`
58+
subtitle = `Role is invalid`
59+
description = description
60+
group = `Purchase Order 450001` )
61+
( type = `Warning`
62+
title = `Account 821 requires a check`
63+
subtitle = `Undefined task`
64+
description = description
65+
group = `Purchase Order 450001` )
66+
( type = `Warning`
67+
title = `Enter a text with maximum 6 characters length`
68+
description = description
69+
group = `Purchase Order 450002` )
70+
( type = `Warning`
71+
title = `Enter a text with maximum 8 characters length`
72+
description = description
73+
group = `Purchase Order 450002` )
74+
( type = `Error`
75+
title = `Account 802 requires an assignment`
76+
subtitle = `Role is invalid`
77+
description = description
78+
group = `Purchase Order 450002` )
79+
( type = `Information`
80+
title = `Account 804 requires an assignment`
81+
subtitle = `Information type subtitle`
82+
description = description
83+
group = `Purchase Order 450002` )
84+
( type = `Error`
85+
title = `Technical message without object relation`
86+
description = description
87+
group = `General` )
88+
( type = `Warning`
89+
title = `Global System will be down on Sunday`
90+
description = description
91+
group = `General` )
92+
( type = `Error`
93+
title = `Global System will be down on Sunday`
94+
description = description
95+
group = `General` )
96+
( type = `Error`
97+
title = `An Error`
98+
subtitle = `Ungrouped message`
99+
description = description )
100+
( type = `Warning`
101+
title = `A Warning`
102+
subtitle = `Ungrouped message`
103+
description = description ) ).
104+
105+
view_display( ).
106+
107+
ENDMETHOD.
108+
109+
110+
METHOD on_event.
111+
112+
CASE client->get( )-event.
113+
WHEN `POPUP`.
114+
popup_display( ).
115+
WHEN `POPOVER`.
116+
popover_display( `messagePopoverBtn` ).
117+
WHEN `POPOVER_CLOSE`.
118+
client->popover_destroy( ).
119+
ENDCASE.
120+
121+
ENDMETHOD.
122+
123+
124+
METHOD view_display.
125+
126+
" the original derives the footer button icon and text from the highest message severity via formatters - here Error
127+
DATA(error_count) = 0.
128+
LOOP AT t_msg TRANSPORTING NO FIELDS WHERE type = `Error`.
129+
error_count = error_count + 1.
130+
ENDLOOP.
131+
132+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
133+
DATA(page) = view->shell(
134+
)->page(
135+
title = `abap2UI5 - Sample: Message View with Grouping`
136+
navbuttonpress = client->_event_nav_app_leave( )
137+
shownavbutton = client->check_app_prev_stack( ) ).
138+
139+
page->header_content(
140+
)->link(
141+
text = `UI5 Demo Kit`
142+
target = `_blank`
143+
href = `https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.MessageView/sample/sap.m.sample.MessageViewWithGrouping` ).
144+
145+
page->message_view(
146+
items = client->_bind( t_msg )
147+
groupitems = abap_true
148+
)->message_item(
149+
type = `{TYPE}`
150+
title = `{TITLE}`
151+
subtitle = `{SUBTITLE}`
152+
description = `{DESCRIPTION}`
153+
groupname = `{GROUP}`
154+
)->link(
155+
text = `Show more information`
156+
href = `http://sap.com`
157+
target = `_blank` ).
158+
159+
" the original renders the footer button with type 'Negative' - the type is only available since UI5 1.73, therefore omitted
160+
page->footer( )->overflow_toolbar(
161+
)->button(
162+
icon = `sap-icon://message-error`
163+
text = |{ error_count }|
164+
press = client->_event( `POPUP` )
165+
)->toolbar_spacer(
166+
)->button(
167+
id = `messagePopoverBtn`
168+
text = `Message Popover`
169+
press = client->_event( `POPOVER` ) ).
170+
171+
client->view_display( view->stringify( ) ).
172+
173+
ENDMETHOD.
174+
175+
176+
METHOD popup_display.
177+
178+
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ).
179+
180+
" the original hosts a back button for the message details in a custom header - here the dialog keeps the plain title
181+
DATA(dialog) = popup->dialog(
182+
title = `Publish order`
183+
contentheight = `50%`
184+
contentwidth = `50%`
185+
verticalscrolling = abap_false
186+
afterclose = client->_event_client( client->cs_event-popup_close ) ).
187+
188+
dialog->message_view(
189+
items = client->_bind( t_msg )
190+
groupitems = abap_true
191+
)->message_item(
192+
type = `{TYPE}`
193+
title = `{TITLE}`
194+
subtitle = `{SUBTITLE}`
195+
description = `{DESCRIPTION}`
196+
groupname = `{GROUP}`
197+
)->link(
198+
text = `Show more information`
199+
href = `http://sap.com`
200+
target = `_blank` ).
201+
202+
dialog->end_button( )->button(
203+
text = `Close`
204+
press = client->_event_client( client->cs_event-popup_close ) ).
205+
206+
client->popup_display( popup->stringify( ) ).
207+
208+
ENDMETHOD.
209+
210+
211+
METHOD popover_display.
212+
213+
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ).
214+
215+
popup->message_popover(
216+
items = client->_bind( t_msg )
217+
groupitems = abap_true
218+
placement = `Top`
219+
beforeclose = client->_event( `POPOVER_CLOSE` )
220+
)->message_item(
221+
type = `{TYPE}`
222+
title = `{TITLE}`
223+
subtitle = `{SUBTITLE}`
224+
description = `{DESCRIPTION}`
225+
groupname = `{GROUP}`
226+
)->link(
227+
text = `Show more information`
228+
href = `http://sap.com`
229+
target = `_blank` ).
230+
231+
client->popover_display( xml = popup->stringify( )
232+
by_id = id ).
233+
234+
ENDMETHOD.
11235

12-
CLASS Z2UI5_CL_DEMO_APP_038 IMPLEMENTATION.
13236
ENDCLASS.

0 commit comments

Comments
 (0)