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: 

ADT Eclipse with SAP BTP Cockpit - use of Class CL_SALV_TABLE is not permitted.

jgaia
Explorer

Hello

Could you please guided me to solve this issue?

I am using SAP BTP Cockpit Trial to learn CD view (got a course at Udemy).

The issue is that I am receiving this message error when developing a report:

"The use of Class CL_SALV_TABLE is not permitted"

I do not have SAP GUI and access to SAP environment. Just SAP BTP Cockipt Trial and Eclipse version:

Eclipse IDE for Java Developers (includes Incubating components)

Version: 2022-03 (4.23.0)

Build id: 20220310-1457

CLASS zclas_teste01 DEFINITION
PUBLIC
* final
  CREATE PUBLIC .
  PUBLIC SECTION.
*     DATA: salv        TYPE REF TO cl_salv_table.
    DATA: p_coin type string,
          l_count type i.
*    INTERFACES if_oo_adt_classrun.
  METHODS run.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zclas_teste01 IMPLEMENTATION.

method run.
    p_coin  = 'BRL'.
    select    *  
    from      /dmo/a_booking_d
    into      TABLE @data(lt_tab).
    
    TRY.
 
     cl_salv_table=>factory(
        IMPORTING
           r_salv_table   = data(lo_alv)
       CHANGING
         t_table        = lt_tab 
     ).
   
       CATCH cx_salv_msg.
    ENDTRY.
lo_alv->display( ).
 ENDMETHOD.
ENDCLASS.
1 ACCEPTED SOLUTION

matt
Active Contributor

CL_SALV_TABLE is a SAPGui only class. It won't produce output with BTP Cockpit.

If you need output in ADT, you use WRITE, CL_OUTPUT_DEMO or set this blog. https://blogs.sap.com/2021/02/01/printing-to-abap-console/

3 REPLIES 3

matt
Active Contributor

CL_SALV_TABLE is a SAPGui only class. It won't produce output with BTP Cockpit.

If you need output in ADT, you use WRITE, CL_OUTPUT_DEMO or set this blog. https://blogs.sap.com/2021/02/01/printing-to-abap-console/

0 Kudos

I would like to thank you matthew.billingham and frdric.girod. thank you very much for your help. Attached the new code that solve my problem.

CLASS zclas_teste01 DEFINITION
 PUBLIC
  final
   CREATE PUBLIC .
  PUBLIC SECTION.
 CLASS-DATA:
      out TYPE REF TO if_oo_adt_classrun_out.

    INTERFACES if_oo_adt_classrun.

    CLASS-METHODS:
      hello_world.

  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zclas_teste01 IMPLEMENTATION.

METHOD if_oo_adt_classrun~main.
    me->out = out.

    hello_world(  ).
ENDMETHOD.

METHOD hello_world.

    select      booking_id
                booking_date
                customer_id
                carrier_id
                connection_id
                flight_date
    from      /dmo/a_booking_d
    where booking_id = '0004'
    into      TABLE @data(lt_tab).
    out->write( lt_tab ).
 ENDMETHOD.
 ENDCLASS.