Update
This commit is contained in:
@@ -2367,7 +2367,7 @@ ENDCLASS.
|
||||
```
|
||||
|
||||
3)
|
||||
- The following example class represents an exectuable example that displays output in the ADT console.
|
||||
- The following example class represents an executable example that displays output in the ADT console.
|
||||
- Apart from simple demo implementations, it includes alias names specified for interface components.
|
||||
- The interface methods declared with `DEFAULT IGNORE` and `DEFAULT FAIL` are intentionally not implemented, but the methods are nevertheless called.
|
||||
- Interface method declared with `DEFAULT IGNORE`: No implementation available, and no value is assigned for the returning parameter. Therefore, the value is initial.
|
||||
|
||||
@@ -223,6 +223,9 @@ FINAL(final_string) = `zyx`.
|
||||
|
||||
"Since char2 is of type c length 4 (the length is also derived),
|
||||
"characters are truncated in the following example assignment
|
||||
"Note: In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the literal (intentionally specified
|
||||
"here like this) is not an admissable value for the target type.
|
||||
char2 = 'ijklmnopq'. "ijkl
|
||||
|
||||
"Trailing blanks after assigning fixed length to variable length string
|
||||
|
||||
@@ -216,7 +216,7 @@ AND 4 - 3 + 1 = num
|
||||
AND `ha` && `llo` = <fs>
|
||||
|
||||
"Constructor expression
|
||||
AND CONV i( '2.03' ) = num
|
||||
AND VALUE i( ) = 0
|
||||
AND VALUE string_table( ( `a` ) ( `b` ) ( `c` ) ) = str_table
|
||||
|
||||
"Table expression
|
||||
|
||||
@@ -1286,7 +1286,12 @@ DATA do_i_str TYPE string.
|
||||
|
||||
"Assignments
|
||||
do_h_c3 = 'abc'.
|
||||
do_h_c3 = 'defghi'. "only 'def' assigned -> length and memory use do not change
|
||||
|
||||
"only 'def' assigned -> length and memory use do not change
|
||||
"Note: In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the literal (intentionally specified
|
||||
"here like this) is not an admissable value for the target type.
|
||||
do_h_c3 = 'defghi'.
|
||||
|
||||
"Memory consumption changes for dynamic data objects
|
||||
do_i_str = `abc`.
|
||||
|
||||
@@ -205,6 +205,9 @@ TRY.
|
||||
ENDTRY.
|
||||
|
||||
"Assignment of an invalid date of type d to type i; the initial value is produced
|
||||
"Note: In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the literal (intentionally specified
|
||||
"here like this) does not match type d.
|
||||
DATA(inv_date3) = CONV i( CONV d( '20240231' ) ).
|
||||
ASSERT inv_date3 = 0.
|
||||
```
|
||||
@@ -841,6 +844,10 @@ DO 6 TIMES.
|
||||
dls_test = abap_false.
|
||||
tz_test = `EST`.
|
||||
|
||||
"Note: In newer ABAP releases, some of the following statements
|
||||
"show a syntax warning. The values of some literals (intentionally
|
||||
"specified here like this) are not admissable values for the target
|
||||
"types.
|
||||
CASE sy-index.
|
||||
WHEN 1.
|
||||
"No data object change. The statement below should return a valid time stamp.
|
||||
|
||||
@@ -187,7 +187,18 @@ CLASS zcl_demo_abap_date_time IMPLEMENTATION.
|
||||
|
||||
"Assignment of an invalid date of type d to type i; the initial value
|
||||
"is produced
|
||||
DATA(inv_date3) = CONV i( CONV d( '20240231' ) ).
|
||||
"In newer ABAP releases, the following statement shows a
|
||||
"syntax warning that the date (intentionally specified as
|
||||
"invalid date here) does not match the type. Therefore,
|
||||
"the example is provided differently to circumvent the
|
||||
"syntax warning.
|
||||
|
||||
"DATA(inv_date3) = CONV i( CONV d( '20240231' ) ).
|
||||
|
||||
TYPES c8 TYPE c LENGTH 8.
|
||||
DATA false_date TYPE c8 VALUE '20240231'.
|
||||
DATA(inv_date3) = CONV i( CONV d( false_date ) ).
|
||||
|
||||
IF inv_date3 = 0.
|
||||
out->write( `inv_date3 = 0` ).
|
||||
ENDIF.
|
||||
@@ -913,10 +924,27 @@ CLASS zcl_demo_abap_date_time IMPLEMENTATION.
|
||||
"No data object change. The statement below should return a valid time stamp.
|
||||
WHEN 2.
|
||||
"Invalid date
|
||||
date_test = '20249999'.
|
||||
"In newer ABAP releases, the following statement shows a
|
||||
"syntax warning that the date (intentionally specified as
|
||||
"invalid date here) does not match the type. Therefore,
|
||||
"the example is provided differently to circumvent the
|
||||
"syntax warning.
|
||||
|
||||
"date_test = '20249999'.
|
||||
|
||||
TYPES c_l8 TYPE c LENGTH 8.
|
||||
DATA falsedate TYPE c_l8 VALUE '20240231'.
|
||||
date_test = falsedate.
|
||||
WHEN 3.
|
||||
"Invalid time
|
||||
time_test = '992458'.
|
||||
"The following statement is commented out for the reasons
|
||||
"mentioned above.
|
||||
|
||||
"time_test = '992458'.
|
||||
|
||||
TYPES c_l6 TYPE c LENGTH 6.
|
||||
DATA falsetime TYPE c_l6 VALUE '992458'.
|
||||
time_test = falsetime.
|
||||
WHEN 4.
|
||||
"Invalid fractions of seconds
|
||||
frac_sec_test = '1'.
|
||||
@@ -925,7 +953,14 @@ CLASS zcl_demo_abap_date_time IMPLEMENTATION.
|
||||
dls_test = 'X'.
|
||||
WHEN 6.
|
||||
"Invalid time zone
|
||||
dls_test = `NOPE`.
|
||||
"The following statement is commented out for the reasons
|
||||
"mentioned above.
|
||||
|
||||
"dls_test = `NOPE`.
|
||||
|
||||
TYPES c_l4 TYPE c LENGTH 4.
|
||||
DATA falsetimezone TYPE c_l4 VALUE 'NOPE'.
|
||||
dls_test = falsetimezone.
|
||||
ENDCASE.
|
||||
|
||||
TRY.
|
||||
|
||||
@@ -1273,7 +1273,15 @@ CLASS zcl_demo_abap_dtype_dobj IMPLEMENTATION.
|
||||
out->write( data = date name = `date` ).
|
||||
out->write( |\n| ).
|
||||
|
||||
date = 20240101.
|
||||
"In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the the data object (intentionally
|
||||
"specified here like this) is not an admissable value for the
|
||||
"target type. Therefore, the example is provided differently to
|
||||
"circumvent the syntax warning.
|
||||
|
||||
"date = 20240101.
|
||||
DATA falsedate TYPE i VALUE 20240101.
|
||||
date = falsedate.
|
||||
out->write( data = date name = `date` ).
|
||||
|
||||
**********************************************************************
|
||||
@@ -1670,7 +1678,21 @@ CLASS zcl_demo_abap_dtype_dobj IMPLEMENTATION.
|
||||
|
||||
"Assignments
|
||||
do_h_c5 = 'abc'.
|
||||
do_h_c5 = 'defghi'. "only 'def' assigned -> length and memory use do not change
|
||||
|
||||
"In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the literal (intentionally specified
|
||||
"here like this) is not an admissable value for the target type.
|
||||
"Therefore, the example is provided differently to circumvent the
|
||||
"syntax warning.
|
||||
|
||||
"do_h_c5 = 'defghi'.
|
||||
|
||||
TYPES c_l6 TYPE c LENGTH 6.
|
||||
DATA some_char TYPE c_l6 VALUE 'defghi'.
|
||||
"only 'def' assigned -> length and memory use do not change
|
||||
do_h_c5 = some_char.
|
||||
|
||||
|
||||
|
||||
"Memory consumption changes for dynamic data objects
|
||||
do_i_str = `abc`.
|
||||
|
||||
@@ -415,7 +415,7 @@ CLASS zcl_demo_abap_prog_flow_logic IMPLEMENTATION.
|
||||
AND `ha` && `llo` = <fs>
|
||||
|
||||
"Constructor expression
|
||||
AND CONV i( '2.03' ) = num
|
||||
AND VALUE i( ) = 0
|
||||
AND VALUE string_table( ( `a` ) ( `b` ) ( `c` ) ) = str_table
|
||||
|
||||
"Table expression
|
||||
|
||||
@@ -99,7 +99,17 @@ CLASS zcl_demo_abap_string_proc IMPLEMENTATION.
|
||||
DATA(str_a6) = `efgh`. "Type string
|
||||
|
||||
"Note: Variable is of type c length 4. Characters are truncated.
|
||||
char_a2 = 'ijklmnopq'.
|
||||
"In newer ABAP releases, the following statement shows a syntax
|
||||
"warning that the value of the literal (intentionally specified
|
||||
"here like this) is not an admissable value for the target type.
|
||||
"Therefore, the example is provided differently to circumvent the
|
||||
"syntax warning.
|
||||
|
||||
"char_a2 = 'ijklmnopq'.
|
||||
|
||||
TYPES c_l9 TYPE c LENGTH 9.
|
||||
DATA some_char TYPE c_l9 VALUE 'ijklmnopq'.
|
||||
char_a2 = some_char.
|
||||
|
||||
"Treating trailing blanks
|
||||
DATA(char_a3) = 'ab '.
|
||||
|
||||
Reference in New Issue
Block a user