Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ATC cannot check REDUCE inline command

brazel_pilipp
Explorer
2,869

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:

  1. There is no symbol available
  2. Invalid name LV_SUM for DATA/RANGES (local)

Does anyone have a solution to this problem / the same problem?

I'm looking forward to your comments.

Best regards,

Philipp

1 ACCEPTED SOLUTION
Read only

BjoernJueliger
Product and Topic Expert
Product and Topic Expert
2,286

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.

6 REPLIES 6
Read only

BjoernJueliger
Product and Topic Expert
Product and Topic Expert
0 Likes
2,286

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

Read only

matt
Active Contributor
2,286

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/

Read only

2,286

I'm with you on this. But today this is not yet part of our Group guideline for ABAP.

Best regards,

Philipp

Read only

brazel_pilipp
Explorer
0 Likes
2,286

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

Read only

BjoernJueliger
Product and Topic Expert
Product and Topic Expert
2,287

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.

Read only

0 Likes
2,286

Thanks for the answer.

We are running our ATC system on 753 kernel with patch level 16 - this should be the correct hint.