Application Development 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: 

Authorization object

Former Member
0 Kudos

may i know how to check authorization object,any body can help me to know how to incorporate the logic in your program for this authorization object

1. Cost Centre Planning (Reference Txn KP06)

Auth Object: K_CSKS_PLA (CO-CCA Cost Center Planning)

Fields:

· KOKRS Controlling Area

· KOSTL Cost Center

· ACTVT Activity

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Plz take the help of this code :

In PAI write this piece of code :

MODULE user_command_9000 INPUT.

  PERFORM f0801_validate_plan_area_cntry.

*Authority Check for Country

*AUTHORITY-CHECK OBJECT 'ZO9_CNTRY'
*      ID 'COUNTRY' FIELD g_soldto_country.
*    if sy-subrc ne 0.
*      clear g_ok_code.
*      message E001(ZOLSC_MESSAGE_AS) with G_soldto_country.
*    endif.
...............................................................
ENDMODULE.

In main program write this piece of code :

FORM f0801_validate_plan_area_cntry .

*Validate planning area
  SELECT  SINGLE pareaid
  FROM    /sapapo/tsareako
  INTO    g_pareaid
  WHERE   pareaid = g_parea.

  IF sy-subrc NE 0.
    CLEAR g_ok_code.
    MESSAGE i240 WITH g_parea.
  ENDIF.

*Validate Sold TO country
  SELECT SINGLE /bic/dcuscntry
  FROM   /bic/pdcuscntry
  INTO   g_con
  WHERE  /bic/dcuscntry = g_soldto_country
  AND    objvers = 'A' .

  IF sy-subrc NE 0.
    CLEAR g_ok_code.
    MESSAGE i241 WITH g_soldto_country.
  ENDIF.

ENDFORM.                    " f0801_validate_plan_area_cntry

thanx.

1 REPLY 1

Former Member
0 Kudos

Hi,

Plz take the help of this code :

In PAI write this piece of code :

MODULE user_command_9000 INPUT.

  PERFORM f0801_validate_plan_area_cntry.

*Authority Check for Country

*AUTHORITY-CHECK OBJECT 'ZO9_CNTRY'
*      ID 'COUNTRY' FIELD g_soldto_country.
*    if sy-subrc ne 0.
*      clear g_ok_code.
*      message E001(ZOLSC_MESSAGE_AS) with G_soldto_country.
*    endif.
...............................................................
ENDMODULE.

In main program write this piece of code :

FORM f0801_validate_plan_area_cntry .

*Validate planning area
  SELECT  SINGLE pareaid
  FROM    /sapapo/tsareako
  INTO    g_pareaid
  WHERE   pareaid = g_parea.

  IF sy-subrc NE 0.
    CLEAR g_ok_code.
    MESSAGE i240 WITH g_parea.
  ENDIF.

*Validate Sold TO country
  SELECT SINGLE /bic/dcuscntry
  FROM   /bic/pdcuscntry
  INTO   g_con
  WHERE  /bic/dcuscntry = g_soldto_country
  AND    objvers = 'A' .

  IF sy-subrc NE 0.
    CLEAR g_ok_code.
    MESSAGE i241 WITH g_soldto_country.
  ENDIF.

ENDFORM.                    " f0801_validate_plan_area_cntry

thanx.