First Program using Object oriented programming in SAP ABAP
Object-oriented programming is often the most natural and pragmatic approach, once you get the hang of it. OOP languages allows you to break down your software into bite-sized problems that you then can solve — one object at a time.
Simple Example of OOP in SAP.
"""""""""""""""""""""""" Definition of class
CLASS LC_MIRO DEFINITION.
PUBLIC SECTION.
METHODS:GET_DATA.
ENDCLASS.
START-OF-SELECTION.
""""""""""""""""""" Object Declaraion using main class
data:local_obj TYPE REF TO LC_MIRO.
create OBJECT local_obj.
local_obj->get_data( ).
""""""""""""""""""""logic declaration using method in class
CLASS LC_MIRO IMPLEMENTATION. "
METHOD get_data.
MESSAGE 'First Program Using OOP' TYPE 'I'.
ENDMETHOD.
ENDCLASS.
No comments:
Post a Comment