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

How to check authorization for company code for a selet-option variable

Former Member
0 Likes
2,833

How to check authorization for company code for a selet-option variable

Thank you

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
1,024

You need to take all the valid compnay codes into one internal table than call the AUTHORITY CHECK for every company code in that internal table.

Like:

SELECT BUKRS
INTO IT_BUKRS
FROM T001
WHERE BUKRS IN S_BUKRS
LOOP AT IT_BUKRS.
  AUTHORITY-CHECK 'F_BUK' " <<  I am not sure about the object
   FIELD IT_BUKRS-BUKRS       
   ACTIVITY '03'  " << 
ENDLOOP.

Regards,

Naimesh Patel

Read only

harimanjesh_an
Active Participant
0 Likes
1,024

Hi pradeep,

Use authorization object <b>F_BKPF_BUK</b>.

Fetch all company codes into internal from select-options.

SELECT bukrs

INTO it_bukrs

FROM t001

WHERE bukrs IN s_bukrs.

Loop through ur internal table and check for authorization.

LOOP AT it_bukrs.

AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'

ID 'BUKRS' FIELD it_bukrs-bukrs " passing internal table value

ID 'ACTVT' FIELD '03'. " u can pass required value

ENDLOOP.

check this link for more information:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaccb35c111d1829f0000e829fbfe/frameset.htm

I have considered <b>F_BKPF_BUK Accounting Document</b>: <b>Authorization for Company Codes</b>. This is an object in class Financial Accounting.

To refer other objects use TCODES SU20 for fields and SU21 for objects.

Reward me if useful,

Harimanjesh AN