Application Development and Automation 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: 
Read only

authorization control

Former Member
0 Likes
620

Hi! expert,

just now i write a program using ALV and i have to add authorization control so that only user that have access to the sales organization

could view the customer info.

thanks, regards,

Liyana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
571

Hi,

You can capture the AUTHORITY-CHECK control for this

for e.g.

  AUTHORITY-CHECK OBJECT 'ZCHECK'

           ID 'UNAME' FIELD SY-UNAME

           ID 'VKORG' FIELD WA-VKORG.

  IF SY-SUBRC <> 0.

    MESSAGE 'AUTHORIZTION FAILED' TYPE 'E'.

  ELSE.

    "Display the alv code.

  ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
572

Hi,

You can capture the AUTHORITY-CHECK control for this

for e.g.

  AUTHORITY-CHECK OBJECT 'ZCHECK'

           ID 'UNAME' FIELD SY-UNAME

           ID 'VKORG' FIELD WA-VKORG.

  IF SY-SUBRC <> 0.

    MESSAGE 'AUTHORIZTION FAILED' TYPE 'E'.

  ELSE.

    "Display the alv code.

  ENDIF.

Read only

rosenberg_eitan
Active Contributor
0 Likes
569

Hi,

Ask your module consaltant what authorization object you need to use .

For example:

SELECT-OPTIONS: s_vkorg FOR tvko-vkorg OBLIGATORY .

Then:

AT SELECTION-SCREEN .
  PERFORM at_selection_screen_input .
 
*----------------------------------------------------------------------*
FORM at_selection_screen_input .

  SELECT * FROM tvko
    WHERE vkorg IN s_vkorg .

    AUTHORITY-CHECK OBJECT 'J_REPO_VKO'
             ID 'VKORG' FIELD tvko-vkorg .

    IF sy-subrc NE 0 .
      MESSAGE e051(j0) WITH tvko-vkorg .
    ENDIF .

  ENDSELECT .

  IF sy-subrc NE 0 .
    MESSAGE e668(vl).
  ENDIF .

ENDFORM .                    "at_selection_screen_input
*----------------------------------------------------------------------*

Regards.