Created
September 24, 2016 17:54
-
-
Save furlan/fdf5e19e63c2587744ca1647acf60cc6 to your computer and use it in GitHub Desktop.
Revisions
-
furlan created this gist
Sep 24, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ REPORT z_rich_model. CLASS order_item DEFINITION DEFERRED. TYPES: order_item_table TYPE TABLE OF REF TO order_item WITH NON-UNIQUE DEFAULT KEY. CLASS order_item DEFINITION. PUBLIC SECTION. METHODS get_price RETURNING VALUE(item_price) TYPE i. METHODS set_price IMPORTING item_price TYPE i. METHODS get_quantity RETURNING VALUE(item_quantity) TYPE i. METHODS set_quantity IMPORTING item_quantity TYPE i. METHODS get_total RETURNING VALUE(item_total) TYPE i. PRIVATE SECTION. DATA price TYPE i. DATA quantity TYPE i. ENDCLASS. CLASS order_item IMPLEMENTATION. METHOD get_price. item_price = me->price. ENDMETHOD. METHOD set_price. me->price = item_price. ENDMETHOD. METHOD get_quantity. item_quantity = me->quantity. ENDMETHOD. METHOD set_quantity. me->quantity = item_quantity. ENDMETHOD. METHOD get_total. item_total = me->price * me->quantity. ENDMETHOD. ENDCLASS. CLASS order DEFINITION. PUBLIC SECTION. METHODS get_total RETURNING VALUE(order_total) TYPE i. METHODS add_item IMPORTING order_item TYPE REF TO order_item. PRIVATE SECTION. DATA items TYPE order_item_table. ENDCLASS. CLASS order IMPLEMENTATION. METHOD add_item. APPEND order_item TO me->items. ENDMETHOD. METHOD get_total. DATA item TYPE REF TO order_item. LOOP AT me->items INTO item. order_total = item->get_total( ). ENDLOOP. ENDMETHOD. ENDCLASS.