cancel
Showing results for 
Search instead for 
Did you mean: 

Authority check on ABAP on cloud

nishantbansal91
Active Contributor
0 Kudos

Hello Team,

I am implementing custom Authorization object for particular field on table in ABAP on cloud service. I did all the below steps but still getting sy-subrc = 12 after executing the Authority_Check statement.

Example table name is ZUNIT

Field Name UNIT_CODE .

a. Created the Authorization object ZOBJ_UNIT and authorization Field ZFIELD_UNT along with ACTVT field.

b. Created Restriction type based on the authorization object and Restriction field based on Authorization field.

c. Created new Business catalog and assign the authorization object in the Restriction Type column.

Nothing is maintained in Apps TAB.

d. Created the business Role template based on the catalog.

e. Created new Business role and assign the unrestricted value to business role.

f. Assigned the Business role to Developer user.

Created new test class.

METHOD if_oo_adt_classrun~main.

select * from T001 into table data(lt_table) .

loop at lt_table assigning <fs_table>.

AUTHORITY-CHECK OBJECT 'ZOBJ_UNIT'

ID 'ZFIELD_UNT' FIELD <fs_unit>-unit_code

ID 'ACTVT' FIELD '03'.

after executing this statement sy-subrc value is 12.

endif.

Endmethod.

I have executed the trace also in the Authorization application. It shows the same Business Role

which is already assigned to my user.

xiswanto
Active Participant
0 Kudos

do you perhaps given the wrong code? or it is only part of the code?

in your code, you are checking <fs_unit>-unit_code, but the loop are assigning into <fs_table>.

nishantbansal91
Active Contributor
0 Kudos

Hello xiswanto

No it's kind of dummy code. Below is the actual code.

DATA lt_unit1 TYPE TABLE OF zunit_t.

SELECT * FROM zunit_t INTO TABLE @DATA(lt_unit).

LOOP AT lt_unit ASSIGNING FIELD-SYMBOL(<fs_unit>).

AUTHORITY-CHECK OBJECT 'ZOBJ_UNIT'

ID 'ZFIELD_UNT' FIELD <fs_unit>-unit_code

ID 'ACTVT' FIELD '03'.

IF sy-subrc <> 0.

DATA(lv_test) = 'Not authorized'.

ENDIF.

ENDLOOP.

View Entire Topic
nishantbansal91
Active Contributor
0 Kudos

I am trying to create the IAM application for the same authorization object but facing below error while adding the object to IAM application. This is happening for all the Authorization object

@

nishantbansal91
Active Contributor
0 Kudos

frankjentsch