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: 

Authority Check for a selection condition/Range

Former Member
0 Kudos

I am relatively new to ABAP and still learning.

I am trying to create an authorisation check as part of a custom badi implementation.

i have amended the code, but i am just trying to figure out how to take the selection condition table to get the specific value to check.

i know the parameter - p_tplnr

this code is pulled back into the Badi..


* Import selection result
  IMPORT sel_tab = lt_nodes selcond = t_selcond           
    FROM MEMORY ID 'DIACL_SELECTION_NEW'.

the table is t_selcond . so i do a loop round table into structure based upon this parameter.

it could have single or multiple objects, and i am just unsure which object needs to be auth checked....

my code...


*--- Defect # 96 - Add Authorisation Check to filter out all Functional Locations.
  DATA: s_selcond TYPE rsparams.
  DATA: tplnr     TYPE diacl_lbk_sel_ds-tplnr.

*--- Read table where selection name is Functional Location
  LOOP AT t_selcond INTO s_selcond
  WHERE   selname = 'P_TPLNR'.

    IF sy-subrc = 0.

*--- Check the authorisation object for functional location
      AUTHORITY-CHECK OBJECT 'P_TPLNR'
      ID 'TPLNR' FIELD tplnr
      ID 'ACTVT' FIELD '03'.

    ENDIF.
  ENDLOOP.

My question is how do i Authority Check the values within s_selcond when it could have single or multiple entries and could have conditions to include/exclude and have selection options?

4 REPLIES 4

Former Member
0 Kudos

One Option could be that

1)Find the master table which has the value for your select option s_selcond

2)Use a select query to get all data from master data for your select option


    SELECT xxxx
      FROM Master_Table
      INTO TABLE t_selcond
     WHERE xxxx IN s_selcond.

3) Loop the internal table and then apply Authority Check


  LOOP AT t_selcond INTO <fs_selcond>
   
*--- Check the authorisation object for functional location
      AUTHORITY-CHECK OBJECT 'AUTHORIZATION OBJECT''
      ID 'XXXX' FIELD <fs_selcond>-xxxx
      ID 'ACTVT' FIELD '03'.
 
   ENDLOOP.

0 Kudos

well i have sort of done that, but loop round the whole table where the condition meets my parameter.

my query is that i have a table that is based upon RSPARAMS

so i have a low and high entry with between, exclude, equals etc....

for example... one scenario i am running returns these details:


SELNAME KIND    SIGN    OPTION  LOW             HIGH
P_TPLNR	S	I	EQ	1033
P_TPLNR	S	I	EQ	1111
P_TPLNR	S	I	BT	1033.27.10.11	1033.27.10.19
P_TPLNR	S	E	EQ	1033.27.10.16

so there are includes, excludes, ranges and multliple items

Former Member
0 Kudos

Hi ,



LOOP AT t_selcond INTO s_selcond
  WHERE   selname = 'P_TPLNR'.

endloop.

-----------------This code can be replaced by

READ TABLE T_SELCOND INTO S_SELCOND WITH KEY SELNAME = 'P_TPLNR'. "binary search after sort ..
CHECK SY-SUBRC EQ 0 

auth-check  object...

-


some basic code to get an idea ...


tables /BIC/SPLANTGRP.
select-options: so_basin for /bic/splantgrp-/bic/plantgrp no-display.

so_basin-low = '1'. append so_basin.
so_basin-low = '2'. append so_basin.
so_basin-low = '3'. append so_basin.
so_basin-low = '4'. append so_basin.


loop at so_basin.
  write:/ so_basin-low.
endloop.

read table so_basin with key low = '4'.
if sy-subrc eq 0 .
  write:/ 'found hit', so_basin-low.
else.
  write:/ 'found NO hit'.
endif.


read table so_basin with key low = '5'.
if sy-subrc eq 0 .
  write:/ 'found hit', so_basin-low.
else.
  write:/ 'found NO hit'.
endif.


-


vijay

Former Member
0 Kudos

I was looking at this the wrong way....

instead of authorisation on the selection, i am now authorisation checking the return data... much simpler and working! 🐵