Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create objects

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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.

Former Member
0 Kudos

hi,

So Please let me know how i can go forward in the above mentioned object.

Thanks and regds,

zubera

0 Kudos

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.

Former Member
0 Kudos

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

uwe_schieferstein
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

Thanks,

ya it is cleared for me....

Thanks and regds,

zubera