Application Development and Automation Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
joachimrees1
Active Contributor
1,876
Sometimes, "little chunks of knowledge" can be as little as a few lines of code.
And most of them are commented out.

With this blog post, I'll give you an example for it, explain why keeping them somewhere is useful for me, and invite you to let me know if you have similar cases.

My example is this:
* data lo_report TYPE REF TO lcl_report.
* CREATE OBJECT lo_report.
DATA(lo_report) = NEW lcl_report( ).

Explanation:
Defining a reference variable to a class,
and creating an instance of that class (that is: creating an object of that class),
and assigning that object to the reference variable
used to be 2 lines of code.
But it now can be done just as well in one line of code.

I try to use the new version, but I'm not always sure on first try.
Like, all those don't work, and I remember failing with a least a few of them:
*FALSE examples:
lo_report = new lcl_report( )
DATA(lo_report) = NEW lcl_report.
DATA(lo_report) = NEW lcl_report().
DATA(lo_report) = NEW lcl_report( )

So I think it's clear, that we benefit from having those "3lines of code, 2 commented out" examples.

But I don't want them in my coding!
1. I don't want useless comments. I'll delete them!
2. How would I find such an example again? (I know I did that somewhere, but where?)

So, this all leads to my plan: I'll use a SAP Community blog post for those things:

1. It's the right place
2. I don't need screenshots, my sources can be #textOnly!
3. it still looks nice, just like in the editor, as I can put it in a code block.
4. I can add new things by editing or as a comment.
5. Maybe most important: publicly shared knowledge is good knowledge: I have a convenient place to look things up again and others can also benefit.

What do you think about that?
Best
Joachim
10 Comments
Labels in this area