Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP OO arrow Object references
Object references PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Sunday, 27 May 2007
REPORT demo_objects_references.

CLASS counter DEFINITION.
  PUBLIC SECTION.
    METHODS: set IMPORTING value(set_value) TYPE i,
             increment,
             get EXPORTING value(get_value) TYPE i.
  PRIVATE SECTION.
    DATA count TYPE i.
ENDCLASS.

CLASS counter IMPLEMENTATION.
  METHOD set.
    count = set_value.
  ENDMETHOD.
  METHOD increment.
    ADD 1 TO count.
  ENDMETHOD.
  METHOD get.
    get_value = count.
  ENDMETHOD.
ENDCLASS.

DATA: cnt_1 TYPE REF TO counter,
      cnt_2 TYPE REF TO counter,
      cnt_3 TYPE REF TO counter,
      cnt_tab TYPE TABLE OF REF TO counter.

DATA number TYPE i.

START-OF-SELECTION.

  CREATE OBJECT: cnt_1,
                 cnt_2.

  MOVE cnt_2 TO cnt_3.

  CLEAR cnt_2.

  cnt_3 = cnt_1.

  CLEAR cnt_3.

  APPEND cnt_1 TO cnt_tab.

  CREATE OBJECT: cnt_2,
                 cnt_3.

  APPEND: cnt_2 TO cnt_tab,
          cnt_3 TO cnt_tab.

  CALL METHOD cnt_1->set EXPORTING set_value = 1.

  CALL METHOD cnt_2->set EXPORTING set_value = 10.

  CALL METHOD cnt_3->set EXPORTING set_value = 100.

  DO 3 TIMES.
    CALL METHOD: cnt_1->increment,
                 cnt_2->increment,
                 cnt_3->increment.
  ENDDO.

  LOOP AT cnt_tab INTO cnt_1.
    CALL METHOD cnt_1->get IMPORTING get_value = number.
    WRITE / number.
  ENDLOOP.

Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 333
Sample Code: 164
Total Contributions: 550

Member Activity
Members: 6182 since 2/1/2007!
New: 9 since yesterday!
Visitors: 1010429
We have 1 guest online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor