‎2018 May 14 4:28 PM
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.
cl_demo_output=>new(
)->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:
cl_demo_output=>new(
)->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." ( https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenbuilt_in_types... )

Is this a bug or am I missing something?
‎2018 May 14 5: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.
‎2018 May 14 5: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.
‎2018 May 14 5:57 PM
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.
‎2018 May 15 10:32 AM
You can also use methods WRITE and DISPLAY. They are typed with ANY already.
‎2018 May 15 7:00 AM
Could you provide the code as text so that we can test on different releases? Thanks!
‎2018 May 15 8:02 AM
Sure, here's the full report: https://gist.github.com/flaiker/f59195d7e86b054b58be40778ca8b147
‎2018 May 16 10:45 AM