10-22-2007 12:14 PM
How to create object in the ABAP?
I want to create object :
AUTHORITY-CHECK OBJECT 'Z_TABL_MNT'
ID 'ACTVT' FIELD '03'
ID 'TABLE' FIELD query_table.
Please let me know steps for creatting object.
Thanks in advance.
Best Regds,
zubera
10-22-2007 12:29 PM
Hi,
objects can only be creaed and addressed using reference variables.
create object <reference>
example:
airplane1 type ref to lcl_airplane.
create object airplane1.
note: lcl_airplane is the class name.
<b>reward points if useful.</b>
regards,
Vinod Samuel.
10-22-2007 12:35 PM
hi,
So Please let me know how i can go forward in the above mentioned object.
Thanks and regds,
zubera
10-22-2007 12:56 PM
Hi,
class lcl_airplane definition.
public section.
methods: get_name.
//declare other methods if wanted
endclass.
class lcl_airplane implementation.
method get_name.
//what is this method supposed to do.....
endmethod.
endclass.
start-of-selection.
data : airplane1 type ref to lcl_airplane.
call method airplane1->get_name.
....................
.......................
note: later on you can handle events, import and export parameters......
<b>reward points if useful.</b>
regards,
Vinod Samuel.
10-22-2007 4:08 PM
This is the Simple Program for O-ABAP
it has Class Definition , Class Implementation & how the class & its Methods are used in the Simple Program Using Creating a Object to that Class .
REPORT demo_class_counter .
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS: set IMPORTING value(set_value) TYPE i,
increment,
get EXPORTING value(get_value) TYPE i.
PRIVATE SECTION.
DATA count TYPE i.
ENDCLASS.
CLASS counter IMPLEMENTATION.
METHOD set.
count = set_value.
ENDMETHOD.
METHOD increment.
ADD 1 TO count.
ENDMETHOD.
METHOD get.
get_value = count.
ENDMETHOD.
ENDCLASS.
DATA number TYPE i VALUE 5.
DATA cnt TYPE REF TO counter.
START-OF-SELECTION.
CREATE OBJECT cnt.
CALL METHOD cnt->set EXPORTING set_value = number.
DO 3 TIMES.
CALL METHOD cnt->increment.
ENDDO.
CALL METHOD cnt->get IMPORTING get_value = number.
WRITE number.
Reward points if it is usefull ....
Girish
10-22-2007 8:42 PM
Hello Zubera
The relevant transactions for creating your own <b>AUTHORITY objects</b> are:
- SU20 (Create authorization fields)
- SU21 (Create object class & auth objects)
- SU24 (Assign AUTH objects to transactions)
Regards
Uwe
10-23-2007 3:33 AM
Hi Zubera,
This is not an ABAP object so you cannot use Object Oriented Approach.
This is a concept in ABAP for controlling authorization.
As rightly mentioned by Uwe, you should use these transactions. Typically BASIS is reponsible for creating these AUTHORIZATION OBJECTS.
Otherwise you can youself use transactions which Uwe mentioned.
Hope this clarifies your doubt.
Regards
Nishant
10-23-2007 8:47 AM