Saturday, January 2, 2010

ABAP Objects

ABAP Objects is the exciting OO based SAP programming technique. We need to get used to its concepts and then we can find out that how it is easy for us to create a SAP program such as a SAP report based on its class, object, attributes, methods, and function modules.

The following is the example:

class demo definition.
public section.
interfaces: inf_data.
class-methods main.
methods: getdata, showdata, deletedata, updatedata.
private section.
class-datas: count type i, input type c length 25. "---classic ABAP codes
endclass.

class demo implementation.
method main.
data dataclass type ref to cl_bapi_cc.
create object dataclass.
dataclass->insertdata( ).
getdata( ).
call function showdatainalv importing id exporting result_tab.
endmethod.
endclass.

start-of-selection.
demo=>main().

We define a class type, implement this class type, and finally start this class type as an object to run the program.

We can discover from the code that classic ABAP codes only are the subset of ABAP object codes.

No comments: