Sunday, July 3, 2016

Authorization check into SAP query

Here we will see how we can write custom code for authorization check into SAP query.

Let's have a authorization check for company code.
Define the company code field in INFOSET ( SQ02) , go to Selection tab and create a New selection with below details. Here selection name is BUKRS.

Suppose we have a custom table which has a field called BUKRS for company code.




















Now for creating rest of the selection screen, go to SQ01 and don’t select company code there. If you select here then in the selection screen 2 times company code will come.




















Now again go to SQ02>GOTO>CODE>START-OF-SELCTION














Place your authorization code here : , save and generate the 
infoset.


Now RUN query from SQ01


















Check in debugging the value of BUKRS, you will find the selection screen value of there in BUKRS .
















Output :





No comments: