Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to color or Highlight with CL_GUI_SOURCEEDIT ?

Rodrigo-Giner
Active Contributor
0 Kudos

Hi, I want to show a source code highlighted, something like transaction SCOV does to show coverage code.

The transaction uses class CL_SCOV_GUI_SOURCEEDIT_STMNT (inherit from CL_GUI_SOURCEEDIT) but this class is highly integrated with SCOV data.

So I want to use CL_GUI_SOURCEEDIT but I don't see any method to do this...debugging I found the method ( that it suppose to do that but inside it uses rare functions

  METHOD lexer_send_color_info.
    DATA: lt_data TYPE cvt_stmnt_cov_meta_data.

* Get highlighting info
    lt_data = mo_stmnt_data_container->get_stmnt_cov_meta_data( ).

* Create dataprovider object
    CALL FUNCTION 'DP_CREATE'
      CHANGING
        h_dp = m_h_dp.

    CALL FUNCTION 'DP_SEND_TABLE'
      EXPORTING
        h_dp = m_h_dp
      TABLES
        data = lt_data.

* Get info in dataprovider object
    call_method( method  = 'SendLexerCommand'
                 p_count = 4
                 p1      = 1 "nCommand: SEND_COLOR_INFO
                 p2      = 0
                 p3      = 0
                 p4      = m_h_dp ).

* Destroy dataprovider object again
    CALL FUNCTION 'DP_DESTROY'
      CHANGING
        h_dp = m_h_dp.

  ENDMETHOD.                    "LEXER_SEND_COLOR_INFO

Does anyone nows how to accomplish this ??? I tried to do the same but without success

Thanks

4 REPLIES 4

Sandra_Rossi
Active Contributor

Bravo! You have the code, why don't you do it yourself by creating your own subclass, and so you may create your own method with same code except the part concerning the code coverage.

Rodrigo-Giner
Active Contributor
0 Kudos

I created my own subclass from CL_GUI_SOURCEEDIT but my problem it that I don't know how to color it and I can't use CL_SCOV_GUI_SOURCEEDIT_STMNT as my parent because the constructor already needs info related to SCOV transaction that I won't be using.

I tried to emulate only the "coloring" method of CL_SCOV_GUI_SOURCEEDIT_STMNT but without luck.I have no clue how DP_CREATE ...and DP_SEND_TABLE from what I can see is related to "Data Provider".

Sandra_Rossi
Active Contributor
0 Kudos

What I would do:

  • First: by debug, get the contents of the variable LT_DATA, reproduce the exact same contents in your class, and display the exact same ABAP code than the screenshot, and you should reproduce the same colors.
  • Second: understand the relationship between contents of LT_DATA and what gets colored in the source code, and you should be able to do whatever you want.

Or do you mean that the instance m_h_dp is complex to obtain? Or something else?

Rodrigo-Giner
Active Contributor
0 Kudos

yeah it's what I have done. lt_data olds wich rows and col from to, that'ss the info that has to be highlighted.

I copy the extact same things.

Yeah the attribute m_h_dp it's assigned in that DP_CREATE and it hold very weird info

SCOV

My Class, it seams pretty similar.

Then it CALL FUNCTION 'DP_SEND_TABLE' is the same no error, but no highlight. I have no clue.