SAP Function Modules

CP_CHK_AUTHORITY SAP Function module - Task lists: Authorization check







CP_CHK_AUTHORITY is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CP_CHK_AUTHORITY into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: CPAU
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM CP_CHK_AUTHORITY - CP CHK AUTHORITY





CALL FUNCTION 'CP_CHK_AUTHORITY' "Task lists: Authorization check
  EXPORTING
    plnaw_imp =                 " tca01-plnaw   Task list usage
    plkod_imp =                 " plkod         Header E/A structure
*   message_type_imp = 'I'      " sy-msgty      Message type --> see long text
*   tcode_imp = SY-TCODE        " sy-tcode
*   trtyp_imp = SPACE           " tca05-trtyp
  IMPORTING
    no_authority =              "               Flag: No authorization
    no_authority =              "               No authorization
    .  "  CP_CHK_AUTHORITY

ABAP code example for Function Module CP_CHK_AUTHORITY





The ABAP code below is a full code listing to execute function module CP_CHK_AUTHORITY including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_no_authority  TYPE STRING ,
ld_no_authority  TYPE STRING .


SELECT single PLNAW
FROM TCA01
INTO @DATA(ld_plnaw_imp).

DATA(ld_plkod_imp) = 'Check type of data required'.
DATA(ld_message_type_imp) = 'some text here'.
DATA(ld_tcode_imp) = 'some text here'.

SELECT single TRTYP
FROM TCA05
INTO @DATA(ld_trtyp_imp).
. CALL FUNCTION 'CP_CHK_AUTHORITY' EXPORTING plnaw_imp = ld_plnaw_imp plkod_imp = ld_plkod_imp * message_type_imp = ld_message_type_imp * tcode_imp = ld_tcode_imp * trtyp_imp = ld_trtyp_imp IMPORTING no_authority = ld_no_authority no_authority = ld_no_authority . " CP_CHK_AUTHORITY
IF SY-SUBRC EQ 0. "All OK ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_no_authority  TYPE STRING ,
ld_no_authority  TYPE STRING ,
ld_plnaw_imp  TYPE TCA01-PLNAW ,
ld_plkod_imp  TYPE PLKOD ,
ld_message_type_imp  TYPE SY-MSGTY ,
ld_tcode_imp  TYPE SY-TCODE ,
ld_trtyp_imp  TYPE TCA05-TRTYP .


SELECT single PLNAW
FROM TCA01
INTO ld_plnaw_imp.

ld_plkod_imp = 'some text here'.
ld_message_type_imp = 'some text here'.
ld_tcode_imp = 'some text here'.

SELECT single TRTYP
FROM TCA05
INTO ld_trtyp_imp.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CP_CHK_AUTHORITY or its description.