*&---------------------------------------------------------------------*
*& Report ZCHTYPOBJ *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT zchtypobj.
DATA customer_count TYPE i.
DATA tyre_price TYPE f.
DATA var1 TYPE i VALUE 786.
var1 = 890.
MOVE 900 TO var1.
WRITE 'ABAP/4 is easy.'.
WRITE / var1.
*& try text field literal vs string literal
DATA: str1(10) TYPE c VALUE 'abc',
str2(10) TYPE c VALUE 'abc '.
IF str1 = str2.
WRITE / 'str1 and str2 are same'.
ELSE.
WRITE / 'str1 and str2 are not same'.
ENDIF.
DATA: str3 TYPE string VALUE `abc`,
str4 TYPE string VALUE `abc `.
IF str3 = str4.
WRITE / 'str3 and str4 are same'.
ELSE.
WRITE / 'str3 and str4 are not same'.
ENDIF.
*CONSTANTS
CONSTANTS: c_nump TYPE p DECIMALS 3 VALUE '123.657',
c_city TYPE c LENGTH 10 VALUE 'manchester'.
*c_nump = 23. causes syntax error
*text symbols
WRITE / 'testign text symbols'.
WRITE: / text-001, / text-002, / text-0a0.
*****why is this not working??????
*write 'can i store during run time' (002).
DO 5 TIMES.
PERFORM dataobject_example.
WRITE: / 'sy-index: ', sy-index.
ENDDO.
*&--------------------------------------------------------------------*
*& Form dataobject_example
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM dataobject_example.
DATA ct1 TYPE i.
STATICS ct2 TYPE i.
ct1 = ct1 + 1.
ct2 = ct2 + 1.
WRITE: / 'ct1: ', ct1, 'ct2: ', ct2.
ENDFORM. "dataobject_example
*---------------------------------------------------------------------*
* CLASS C1 DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-DATA create_count TYPE i.
METHODS constructor.
ENDCLASS. "C1 DEFINITION
DATA: o1 TYPE REF TO c1,
o2 LIKE o1,
o3 LIKE o1.
CREATE OBJECT: o1,
o2,
o3.
WRITE: 'Number of created objects:', c1=>create_count.
*---------------------------------------------------------------------*
* CLASS C1 IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD constructor.
create_count = create_count + 1.
ENDMETHOD. "CONSTRUCTOR
ENDCLASS. "C1 IMPLEMENTATION
|