Exporting, Importing and Changing values in ABAP Objects with example

Go down

Exporting, Importing and Changing values in ABAP Objects with example Empty Exporting, Importing and Changing values in ABAP Objects with example

Post  Admin on Sun Apr 08, 2012 9:42 pm

*&---------------------------------------------------------------------*
*& Report Z_08
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZKRISH_OOPS_08.

DATA W_TAX TYPE P DECIMALS 2.
DATA W_SAL TYPE P DECIMALS 2.

*----------------------------------------------------------------------*
* CLASS c1 DEFINITION
*----------------------------------------------------------------------*
CLASS TAX DEFINITION.
PUBLIC SECTION.
METHODS: TAX_CALC IMPORTING GRADE TYPE C
EXPORTING ITAX TYPE P
CHANGING SAL TYPE P.
ENDCLASS. "c1 DEFINITION
.
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS TAX IMPLEMENTATION.
METHOD: TAX_CALC.
CASE GRADE.
WHEN 'A'.
ITAX = SAL * '0.3'.
WHEN 'B'.
ITAX = SAL * '0.2'.
WHEN 'C'.
ITAX = SAL * '0.1'.
ENDCASE.
SAL = SAL - ITAX.
ENDMETHOD. "tax_calc
ENDCLASS. "tax IMPLEMENTATION

START-OF-SELECTION.
DATA: O1 TYPE REF TO TAX.
CREATE OBJECT O1.


W_SAL = 30000.
WRITE: / W_SAL, W_TAX.

CALL METHOD O1->TAX_CALC
EXPORTING
GRADE = 'B'
IMPORTING
ITAX = W_TAX
CHANGING
SAL = W_SAL.
WRITE: / W_SAL, W_TAX.

Admin
Admin

Posts : 92
Join date : 2012-01-26

http://mysaplab.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum