‎2019 Apr 30 10:37 AM
Hello everybody!
We use ATC (among other things) to check the ABAP naming conventions in the ERP development system. We have the case that the REDUCE command with inline DATA declaration cannot be resolved correctly in the ATC. The naming conventions themselves are correct. If the DATA declaration is removed from the command, the check works.
Short test report:
REPORT z_test_reduce_atc.
TYPES: BEGIN OF gtys_int,
value TYPE int3,
END OF gtys_int,
gtyt_int TYPE STANDARD TABLE OF gtys_int WITH DEFAULT KEY.
PERFORM test.
FORM test.
DATA(lt_values) = VALUE gtyt_int( ( value = 1 ) ( value = 2 ) ( value = 3 ) ).
DATA(lv_sum) = REDUCE #( INIT lv_x = 0
FOR ls_values IN lt_values
NEXT lv_x = lv_x + ls_values ).
WRITE lv_sum.
ENDFORM.
Both errors are in the same line where the DATA( ..) = REDUCE command is located and lead to naming convention checks:
Does anyone have a solution to this problem / the same problem?
I'm looking forward to your comments.
Best regards,
Philipp
‎2019 Jul 11 8:34 AM
This was a bug in the interface between the kernel and the check that did not correctly treat the inline declaration as a declaration.
It should no longer occur on 749 kernels with patch level >= 715 or 753 kernels with patch level >= 422.
‎2019 May 07 11:12 AM
Hi Philipp,
your test report does not pass the syntax check. There is no INT3 data type in standard ABAP, and the two summands in your NEXT clause have incompatible types regardless (LV_X has elementary type I but LS_VALUES is a structured type GTYS_INT) and cannot be added together. Could you provide a syntactically correct example that demonstrates the problem? What AS ABAP release are you working on?
Kind regards,
Björn
‎2019 May 07 8:00 PM
Change your standards? Hungarian notation is now unrecommended not only by SAP but by DSUG. Also by the Clean ABAP project. https://blogs.sap.com/2019/05/03/clean-abap/
‎2019 May 08 11:04 AM
I'm with you on this. But today this is not yet part of our Group guideline for ABAP.
Best regards,
Philipp
‎2019 May 08 11:11 AM
Hi Björn,
thanks for your answer. You are right, here is an updated version:
REPORT z_test_reduce_atc.
TYPES: BEGIN OF gtys_int,
value TYPE int2,
END OF gtys_int,
gtyt_int TYPE STANDARD TABLE OF gtys_int WITH DEFAULT KEY.
PERFORM test.
FORM test.
DATA(lt_values) = VALUE gtyt_int( ( value = 1 ) ( value = 2 ) ( value = 3 ) ).
DATA(lv_sum) = REDUCE gtys_int-value( INIT lv_x = 0
FOR ls_values IN lt_values
NEXT lv_x = lv_x + ls_values-value ).
DATA(lt_int) = VALUE gtyt_int( FOR lv_x = 1 WHILE lv_x <= 10 ( value = lv_x ) ).
WRITE lv_sum.
ENDFORM.
We are on 750 SP7.
Best regards,
Philipp
‎2019 Jul 11 8:34 AM
This was a bug in the interface between the kernel and the check that did not correctly treat the inline declaration as a declaration.
It should no longer occur on 749 kernels with patch level >= 715 or 753 kernels with patch level >= 422.
‎2019 Jul 11 9:51 AM
Thanks for the answer.
We are running our ATC system on 753 kernel with patch level 16 - this should be the correct hint.