Posted By

qrist0ph on 11/13/09


Tagged

abap


Versions (?)

ABAP Klassen


 / Published in: Other
 

  1. REPORT ZCA_FIRST_PROGRAM.
  2.  
  3. CLASS demo DEFINITION.
  4. PUBLIC SECTION.
  5. CLASS-METHODS main.
  6. ENDCLASS.
  7.  
  8. CLASS vehicle DEFINITION.
  9. PUBLIC SECTION.
  10. DATA speed TYPE i VALUE 5.
  11. ENDCLASS.
  12.  
  13.  
  14. CLASS demo IMPLEMENTATION.
  15. METHOD main.
  16. DATA vehicle1 TYPE REF TO vehicle.
  17. DATA: zcatest_wa TYPE zcatest,
  18. zcatest_tab TYPE HASHED TABLE OF zcatest WITH UNIQUE KEY id.
  19. " Tempr�¤rers Objekt erstellen
  20. zcatest_wa-id = 0.
  21. zcatest_wa-bezeichnung = 'foo'.
  22. " und in tempor�¤re Tabelle einf�¼gen
  23. INSERT zcatest_wa INTO TABLE zcatest_tab.
  24.  
  25. "In transparente Tabelle einf�¼gen
  26. INSERT zcatest FROM TABLE zcatest_tab.
  27. MESSAGE zcatest_wa-bezeichnung TYPE 'I'.
  28. ENDMETHOD.
  29. ENDCLASS.
  30.  
  31. START-OF-SELECTION.
  32. demo=>main( ).
  33.  
  34.  
  35. ------
  36.  
  37. CLASS cylinder DEFINITION.
  38. PUBLIC SECTION.
  39. METHODS: constructur IMPORTING i_radius TYPE numeric
  40. i_heigt TYPE numeric.
  41. get_area RETURNING value(r_area) TYPE f.
  42.  
  43. START-OF-SELECATION.
  44. DATA oref TYPE REF TO cylinder.
  45. CREATE OBJECT oref EXPORTING i_radius=4 i_heigt=2.
  46. area = oref -> get_area( ).

Report this snippet  

You need to login to post a comment.