Skip to Content

Pass calculated value with build in function to TYPE data importing parameter syntax error

May 14 at 03:28 PM


avatar image

I wanted to display some debug values using CL_DEMO_OUTPUT. One was the number of lines an internal table has. I wrote something like this:

DATA: gt_tab TYPE stringtab.

  )->write_data( lines( gt_tab )
  )->display( ).

I was very surprised to find out that is syntactically not correct and does not compile (751SP02).

As my go-to alternative for when type determination fails or just does not have enough information I adjusted the line to give it some assistance:

  )->write_data( CONV i( lines( gt_tab ) )
  )->display( ).

That now results in a syntax warning though:

Which seems weird to me because if it would be redundant then I should be able to just leave it out.

I looked at the parameter interface of write_data and tried to find out if it makes a difference whether a generic importing parameter is passed by value or by reference but that doesn't seem to make any difference. What does make a difference though is using TYPE ANY instead of TYPE data (?!). I was under the impression that they act the same and nowadays data would be the one to use (if you have to use generic parameters). In the documentation I also couldn't find any hint as to them acting differently:

"The generic type any can, like all generic types listed here except data and object, only be specified directly after TYPE and has exactly the same effect there as the generic type data." ( )

Is this a bug or am I missing something?

1.png (1.9 kB)
2.png (1.7 kB)
3.png (56.5 kB)
10 |10000 characters needed characters left characters exceeded

Could you provide the code as text so that we can test on different releases? Thanks!

Thanks. Exactly the same issue with 7.31 and 7.52.

* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Horst Keller
May 14 at 04:01 PM

I'd say bug. TYPE data and TYPE any should behave the same way. As the author of CL_DEMO_OUTPUT I would never have expected that syntax error. I will report it to kernel development and hope for a correction. If there is none, the difference between data and any must be documented and I will change the parameter typing in CL_DEMO_OUTPUT to any.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Ok thanks!

I'll use the CONV approach for now and hide the warning with ##OPERATOR[I] until there is a fix in one way or another.


You can also use methods WRITE and DISPLAY. They are typed with ANY already.