Skip to Content
0
Jan 09, 2008 at 02:20 AM

Authorization and roles in CRM BSP Application

118 Views

Dear Friends.

I need to restrict my BSP look to role base authorization. say for example if my user is sold to party then i need to assign him edit and display right of my BSP application where if my user is bil to party then i need to allow only display in BSP, and none from the above.. then I need to say No authority.

To achieve this task i have implemented one Badi.. and successfully received the No authority message but I dont know how to ristrict the rights... please tell me i have 2 flags if first one is set then it will be sold to party and if seconf one is set then it will a bill to party.if none of them the third flag will be set and no authority will trigger,,

Now please help me to know how i can restric them

Any help will be appreciated..

I am attaching my code for your reference,

Thanking you

Regards.

Naeem

MOVE iv_header_guid TO wa_order_guid.

APPEND wa_order_guid TO order_guid.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_header_guid = order_guid

iv_no_auth_check = auth_check_flag

IMPORTING

et_orgman = org

et_partner = partner_order

CHANGING

cv_log_handle = y_lv_log_handle

EXCEPTIONS

document_not_found = 1

error_occurred = 2

document_locked = 3

no_change_authority = 4

no_display_authority = 5

no_change_allowed = 6

others = 7.

Read table partner_order into wa_partner_order INDEX 1.

if sy-subrc = 0.

lv_partner = wa_partner_order-partner_no.

endif.

CALL FUNCTION 'BUPA_ROLES_GET'

EXPORTING

IV_PARTNER = lv_partner

TABLES

ET_PARTNERROLES = partner_role.

  • ET_RETURN = ls_message.

if partner_role is not initial.

Loop at partner_role into wa_partner_role.

if wa_partner_role-partnerrole = 'CRM000'.

flag = 'X'.

elseif wa_partner_role-partnerrole = 'CRM004'.

flag1 = 'X'.

endif.

Endloop.

If sy-subrc NE 0.

flag2 = 'X'.

Endif.

Endif.

if flag EQ 'X'.

<something should be to allow edit and display here i dont know>.

endif.

if flag1 EQ 'X'.

<something should be to allow display here i dont know>.

endif.

IF flag2 EQ 'X'..

RAISE no_authority .

ENDIF.