Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error in authorization control

Hi, Expert.

Kindly need your help regarding to authorization control;

The program always return error message eventhough the sales organization (VKORG) is authorize

Below is my code:

DATA:

   BEGIN OF it_output OCCURS 0,

     KUNNR    TYPE kunnr,

     NAME1    TYPE name1_gp,

     STRAS    TYPE stras,

     ZTERM    TYPE KNVV-ZTERM,

     VKORG    TYPE KNVV-VKORG,

     VTWEG    TYPE KNVV-VTWEG,

     SPART    TYPE KNVV-SPART,

     VTEXT    TYPE TVTWT-VTEXT,

     VTEXTP   TYPE TVZBT-VTEXT,

     VTEXTS   TYPE TVKOT-VTEXT,

   END OF it_output.

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.

*sales organization for authorization

SELECT-OPTIONS: s_vkorg FOR knvv-vkorg OBLIGATORY.

* 1. Customer No

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK a1.

IF s_vkorg IS NOT INITIAL.

AUTHORITY-CHECK OBJECT 'Z_VKORG'

          ID 'ACTVT' FIELD '03'           " read access

          ID 'ZVKORG' FIELD s_vkorg.      " actual value

   IF sy-subrc EQ 0.                        " check authorization

     SELECT  KNA1~KUNNR

             KNA1~NAME1

             KNA1~STRAS

             KNVV~ZTERM

             KNVV~VKORG

             KNVV~VTWEG

             KNVV~SPART

             TVTWT~VTEXT

             TVZBT~VTEXT

             TVKOT~VTEXT

     INTO TABLE it_output

     FROM KNA1

     INNER JOIN KNVV

     ON KNVV~KUNNR = KNA1~KUNNR

     INNER JOIN TVTWT

     ON TVTWT~VTWEG = KNVV~VTWEG

     INNER JOIN TVZBT

     ON TVZBT~ZTERM = KNVV~ZTERM

     INNER JOIN TVKOT

     ON TVKOT~VKORG = KNVV~VKORG

     WHERE KNA1~KUNNR IN s_kunnr.

     WRITE:/ 'SUCCESSFUL RETRIEVE THE DATA'.

   ELSE.

     MESSAGE E014(ZMSG) WITH 'Not Authorize !!'.

   ENDIF.

   ENDIF.



Thanks and Regards,

Liyana

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question