Showing posts with label OO. Show all posts
Showing posts with label OO. Show all posts

Thursday, September 7, 2017

How to Read Class or Object with Multiple Reference ??

 
 
 
 
 
  1. We need to read the ZCX_EXCEPTION reference in the code.
  2. zcx_exception TYPE REF TO lcx_exception.
  3. DATAexc    TYPE REF TO cx_root,
  4. CATCH lcx_exception INTO zcx_exception.
    exc ?=  zcx_exception" Take CX_ROOT INSTANCE
  5. Above is the way to read CX_ROOT value in the ZCX_EXCEPTION to EXC reference.
  6.  textid exc-textid.
  7. zcx_exception-text . Reading local class value.
 
 
 

Sunday, March 19, 2017

Assign anyr eference type of data to specific attributes



"To assign any data type reference  to specific val





DATA lt_tarikh TYPE zwdselopt.
DATA ls_tarikh TYPE selopt.
FIELD-SYMBOLS:    TYPE INDEX TABLE,
                    TYPE              any,
                  TYPE              char1,
               
                   TYPE              any,
                  TYPE              any.
DATA lt_datum TYPE REF TO data.
ASSIGN lt_datum->* TO .

IF IS ASSIGNED.
  LOOP AT ASSIGNING .
    ASSIGN COMPONENT 'SIGN' OF STRUCTURE TO .
    ASSIGN COMPONENT 'OPTION' OF STRUCTURE TO
    ASSIGN COMPONENT 'LOW' OF STRUCTURE TO .
    ASSIGN COMPONENT 'HIGH' OF STRUCTURE TO .
    ls_tarikh-sign = .
    ls_tarikh-option =
    ls_tarikh-low = .
    ls_tarikh-high = .
    APPEND ls_tarikh TO lt_tarikh.
  ENDLOOP.
ENDIF.

Thursday, January 17, 2013

ALV Grid Object Oriented Example SAP




Below is the list of project or example given by SAP to using ALV Grid mostly coded in OO style


1. Key in SALV* for Factory Method ALV in SE38

OR

2. Key in BC*ALV in SE38.


SALV*

BC*ALV


Friday, March 13, 2009

Introduction Object Oriented Programming in SAP ABAP

Object oriented programming tries to map the real world objects with their attributes and methods as realistically as possible in program constructs. The aim is to create the program flow in such a way as if it is taking place in the real world. This makes the interaction between the developer and the user easier. The user can formulate business requirements on a program in the language in which the user is familiar with and the developer can convert these directly instead of the classic programming model.

In the object oriented programming model a different approach is used. Attributes and methods which belong to a specific object are grouped together and made accessible to the user using a well defined interface behind which the actual implementation details are hidden. so, the attributes of the object are only changed by the methods of the object and not directly by the user of and object. This ensures that the status of the object is always consistent.

When do you call an object an object oriented programming? if it has these features.

Abstraction
Abstraction refers to the ability to reflect the real world  processes as realistically as possible through programming. These processes can be a business or a technical nature.

Encapsulation
Implementation details are hidden behind well-defined an documented interfaces. They ensure that the abstract representation of a object is used only in accordance with its spefication.

Inheritance
New abstractions i.e. classes are derived from existing ones. They inherit all the attributes and methods of the higher class and can expand and specialize them.

Polymorphism
Different objects can present the same interface to the outside. A user only needs to know the interface and need not know every minute details of the classes.