Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

*&———————————————————————* *& Report  ZCLASS_TEST_DP_1 *& *&———————————————————————* *& *& *&———————————————————————* REPORT zclass_test_dp_1. *pillars of oop ” abstraction  –> hiding the data. ” encapsulation –> variable + methods.  –> capsule ->  1 + 1 == ” inheritance –> parent child relation. ” –> child calss will inherit the property of parent class ” polymorphism ” multiple forms –> 1 method — same name and differe param parent ==> child class but with different paremeters. –> method overriding. ” method overloading is not there –> same 2 same name and different parameters. PARAMETERS: p_num TYPE i. DATA: lv_tot TYPE i. CLASS lcl_main DEFINITION. PUBLIC SECTION. METHODS: get_data EXPORTING iv_num TYPE i. METHODS: set_data IMPORTING ev_num TYPE i. PROTECTED SECTION. PRIVATE SECTION. DATA : lv_num1 TYPE i. ENDCLASS. CLASS lcl_main IMPLEMENTATION. METHOD set_data. lv_num1 = ev_num. ENDMETHOD. METHOD get_data. iv_num = lv_num1. ENDMETHOD. ENDCLASS. ” inheritance class lcl_child DEFINITION INHERITING FROM lcl_main. PUBLIC SECTION. METHODS: get_data REDEFINITION. METHODS: set_data REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. data lv_child type i value 4. ENDCLASS. class lcl_child IMPLEMENTATION. method get_Data. ” method overriding *    ev_tot = iv_num + iv_num2. ” child will gor the child methods first then to parent method. super->get_data( IMPORTING iv_num = iv_num ). ” way to calling the parent method ENDMETHOD. method set_Data. *    ev_tot = iv_num + iv_num2. ” child will gor the child methods first then to parent method. super->set_data( EXPORTING ev_num = ev_num  ). ” way to calling the parent method ENDMETHOD. ENDCLASS. START-OF-SELECTION. DATA(lo_obj) = NEW lcl_main( ). DATA(lo_obj_child) = NEW lcl_child( ). lo_obj_child->set_data( EXPORTING ev_num = p_num ).

  • 1
DPM125
Beginner

Abstract Class Defined with CLASS ... DEFINITION ABSTRACT. Can have: Attributes (data) Concrete methods (implemented) Abstract methods (declared but not implemented — must be redefined in subclass) Cannot be instantiated directly — only subclasses can be created. Supports inheritance (a subclass inherits implementation + attributes). Can implement interfaces ...

  • 0
DPM125
Beginner

While ABAP classes can’t inherit from multiple classes, they can implement multiple interfaces, achieving interface-based multiple inheritance. INTERFACE if1.   METHODS: method1. ENDINTERFACE. INTERFACE if2.   METHODS: method2. ENDINTERFACE. CLASS my_class DEFINITION.   PUBLIC SECTION.     INTERFACES: if1, if2. ENDCLASS. CLASS my_class IMPLEMENTATION.   METHOD if1~method1.     WRITE: 'Method1 from IF1'.   ENDMETHOD.   METHOD if2~method2.     WRITE: 'Method2 from IF2'.   ENDMETHOD. ENDCLASS.

  • 0
DPM125
Beginner

1. Single Inheritance (Supported in ABAP) Definition: One subclass inherits from one superclass. Use: Most common form of inheritance. CLASS parent_class DEFINITION.  PUBLIC SECTION.    METHODS: display.ENDCLASS.CLASS parent_class IMPLEMENTATION.  METHOD display.    WRITE: 'Parent class method'.  ENDMETHOD.ENDCLASS.CLASS child_class DEFINITION INHERITING FROM parent_class.ENDCLASS.CLASS child_class IMPLEMENTATION.ENDCLASS.

  • 0
DPM125
Beginner

An interface in ABAP defines a contract that any implementing class must follow. It contains only declarations of: Methods (without implementation) Constants Types Attributes Interfaces do not contain implementation. Any class that implements an interface must provide the logic for all its methods. Feature Description No implementation Only method ...