Skip to Content
0
Jan 09, 2015 at 07:44 AM

Error in authorization control

43 Views

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