Code Samples in New SCN
Hello Colleagues!
My own 2 cents
First of all I’d like to say Thank You for all SCN team for their Great Job! You are doing really amazing things all over here! And I like it very much! 😎
Many folks may blame new SCN. But much much more will appreciate it, I believe!!! So keep going please!!
Good Old Code Button
Actually I’d like to write this blog (as soon as it’s easier now) because I’ve already met some discussions where people provide their suggestions in a way of coding samples. And this is great. But they are doing this in simple way: copy and paste the code. Simple, but not readable. In old SCN it used to be a button to surround the code with some tags which make the code readable.
Where is it now?
ℹ When you’re writing a blog post (as I’m doing right now) or starting a discussion it’s here:
ℹ And when you post or reply in discussions it’s in Advanced Editor:
➖ Here is an example without using Syntax Higlighting.
DATA: current TYPE REF TO cl_crm_bol_entity,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_textset_col TYPE REF TO if_bol_bo_col,
lr_iterator TYPE REF TO if_bol_bo_col_iterator.
value = ”.
if iterator is bound.
current ?= iterator->get_current( ).
else.
current ?= collection_wrapper->get_current( ).
endif.
CHECK current IS BOUND.
lr_entity ?= current->get_related_entity( ‘BTADVSOpp’ ).
CHECK lr_entity IS BOUND.
lr_entity = lr_entity->get_related_entity( ‘BTOrderHeader’ ).
➕ And here is an example with it.
DATA: current TYPE REF TO cl_crm_bol_entity,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_textset_col TYPE REF TO if_bol_bo_col,
lr_iterator TYPE REF TO if_bol_bo_col_iterator.
value = ''.
if iterator is bound.
current ?= iterator->get_current( ).
else.
current ?= collection_wrapper->get_current( ).
endif.
CHECK current IS BOUND.
lr_entity ?= current->get_related_entity( 'BTADVSOpp' ).
CHECK lr_entity IS BOUND.
lr_entity = lr_entity->get_related_entity( 'BTOrderHeader' ).
Fill the difference please. I personally remember the times when there were ‘code samples’ on SDN forums looked like insertion of the code even without line breaks not to say formatting. Really painful. Always keep in mind that many people are around you and actually they read what you contribute. So please do not be lazy and make your posts pretty. My opinion.
Hi Andrei,
have you faced the problem that I've described at http://scn.sap.com/thread/3142933?
Also it would be great to have an ABAP specific syntax highlighting.
Best regards
Gregor
Hi, Gregor.
Unfortunately, yes. Same experience. But I think it's just the matter of time. And hope it will be fixed soon.
And ABAP highlighting is a must 🙂
Excellent Andrei! Great! Thank you very much!
You're welcome 🙂
Just what I was looking for!
Maybe 2 cents but very useful 😉
Thank you for sharing!
Good one... I always use to copy and paste the code (sometimes taking the screenshot). Syntax highlighting is really useful. Thanks for sharing.
Good One ...Very helpful for me...Thanks for sharing... 🙂
Nice article!
Since this is the way to post code in the new SCN; is it possible that the article posted below will be updated?
http://scn.sap.com/thread/1170968
Discussion is locked, and new reply can't be posted by normal users.
Moderators can possibly do it, but I don't know why this link has come up.
Document by Andrei is newer than linked discussion. I do not see any FAQ article that links to the discussion. How did you find it?
Post code in SCN (first hit), that's why I used the same "post code" in my message 🙂
Hi Sander,
the post you've mentioned is outdated. I'll be no help here.
And also I've found out that both ideas:
Add new style for Code Sample
and
ABAP syntax highlighting
were archived 🙁
Perhaps they thought:
What good is an ABAPer who can't find his way around to show colorful code on a web platform that supports rich text..