Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

addition missing

$
0
0

Dear Experts,

 

which syntax is the correct one. According to Abap OOP Tutorials is Example 1 the common kind of syntax, isn' it?

 

Because I am getting this error massage with example1: PUBLIC addition of the CLASS statement is missing

-----------------------------------------------------------------------------------------------

Example 1

 

CLASS ZCL_EMPLOYEE definition.

 

* compare this section with below example 2


   public section.
    TYPES:
       BEGIN OF t_employee,
         no  TYPE i,
         name TYPE string,
      END OF t_employee.

   METHODS:
       constructor
         IMPORTING im_employee_no TYPE i
                   im_employee_name TYPE string,

      display_employee.
   protected section.
       CLASS-DATA: g_no_of_employees TYPE i.
   private section.
       DATA: g_employee TYPE t_employee.
ENDCLASS.

-----------------------------------------------------------------------------------------------

This works well with the part after DEFINITION.

 

Example 2

 

CLASS ZCL_EMPLOYEE definition

   public

   final

   create public .

 

 

   public section.

      TYPES:

       BEGIN OF t_employee,

         no  TYPE i,

         name TYPE string,

      END OF t_employee.

   METHODS:
       constructor
         IMPORTING im_employee_no TYPE i
                   im_employee_name TYPE string,

      display_employee.
   protected section.
       CLASS-DATA: g_no_of_employees TYPE i.
   private section.
       DATA: g_employee TYPE t_employee.
ENDCLASS.

 

-----------------------------------------------------------------------------------------------

 

Best Regards

Hakan


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>