short class declaration

 CLASS car  DEFINITION.

  PUBLIC SECTION.
    DATAname      TYPE char20,
          color     TYPE char10,
          fuel_type TYPE char10.
    METHODSdisplay.
    METHODSconstructor IMPORTING im_name TYPE char20  im_color TYPE char10 im_fuel_type TYPE char20 .
ENDCLASS.

CLASS car IMPLEMENTATION.
  METHOD constructor.
    name im_name.
    color im_color.
    fuel_type im_fuel_type.
  ENDMETHOD.

  METHOD display.
    WRITE'name = ' name 'color = ' color ' fuel_type = ' fuel_type.
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
  DATA(car1NEW carim_name 'Name car1'  im_color 'RED'  im_fuel_type 'DIESEL'  ).
  car1->display).

"""""""""""""""""""""""
"""""""""""""""""""""""


""" OR

REPORT yprog_ooabap1.

CLASS car  DEFINITION.
  PUBLIC SECTION.
    DATAname      TYPE char20,
          color     TYPE char10,
          fuel_type TYPE char10.
    METHODSdisplay.
    METHODSconstructor IMPORTING name TYPE char20  color TYPE char10 fuel_type TYPE char20 .
ENDCLASS.

CLASS car IMPLEMENTATION.
  METHOD constructor.
    me->name name.
    me->color color.
    me->fuel_type fuel_type.
  ENDMETHOD.

  METHOD display.
    WRITE'name = ' name 'color = ' color ' fuel_type = ' fuel_type.
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
  DATA(car1NEW carname 'Name car1'  color 'RED'  fuel_type 'DIESEL'  ).
  car1->display).

Comments

Popular posts from this blog

sap abap import from excell to table (transparent table)

sap abap Import from excell to internal table that works 100%