cancel
Showing results for 
Search instead for 
Did you mean: 

How to post ABAP code snippets

former_member192854
Active Participant
0 Kudos

Hi SCN members,

I'm wondering, when I copy paste a code snippet in order to response on someone how to do something within ABAP, I've got several options in this WYSIWYG editor. When I press the '>>' Insert button, I can choose too put my snippet into:

Syntax highlighting > Plain / XML / SQL / c++ / c# / css/ javascript / php / python / ruby.

Then I get this lovely box:

CLASS lcl DEFINITION.

  PUBLIC SECTION.

     METHOD: START.

ENDCLASS.

But the key words CLASS, DEFINITION or PUBLIC SECTION are not 'BLUE'. Even not when I copy paste them from an editor directly.

And the font is also a True type, instead of the monospaced (space outlined) font. I can not change the font type there.

It's also possible to use the '>>' Insert button and hit the 'Quote' option.

CLASS lcl IMPLEMENTATION.

  METHOD start.

      WRITE : / 'This looks more like ABAP, but still no syntax highlighting'.

   ENDMETHOD.

ENDCLASS.

And in there I can choose another font. So that's good. But I really would like syntax highlights,

Of course the last resort is to add the highlights manually...

CLASS lcl IMPLEMENTATION.

  METHOD start.

      WRITE : / 'This looks more like ABAP, but still no syntax highlighting'.

   ENDMETHOD.

ENDCLASS.

But this is far to time consuming.

So now I'm wondering, what's best? Or is there something new coming up?

Best,

Sander

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Here is another way of pasting highlighted text.

Answers (2)

Answers (2)

cientistaflavio
Explorer
0 Kudos

Hello, Sander!

Inspired by your question, I've written a document on posting code snippets with ABAP syntax highlighting here on SCN.

Posting Good-looking ABAP Code Snippets on SCN

I hope this tutorial helps you as you help other SCN members with your ABAP skills!

Finally, please feel free to mark this post as liked, helpful or correct! Share your opinion with other SCN members!

Best regards,

Flávio.

former_member192854
Active Participant
0 Kudos

Hi Flavio,

thanks for creating such a swell document. Code snippets look much prettier using this method.

Unfortunately I will not always remember this highlight website ( http://highlight.hohli.com/ ) Next to this, the font colors doesn’t match the ABAP Editor defaults.

So I’m still hoping someday such functionality will be embedded directly into the SCN editor.

Best,

Sander

JasonLax
Product and Topic Expert
Product and Topic Expert
0 Kudos

What really too bad is that there were at least two ideas to ad ABAP highlighting to SCN's text editor and both were archived:

former_member183424
Active Contributor
0 Kudos

Hi,

As per my suggestion, you should for for last one.

You can find the syntax and call function in just a look.

Last one is better.

Thanks

DEV