Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / Security / Interview Questions

Interview Questions

Security · Technical Foundation ·

Open the interactive lesson →

All SAP security interview questions in one place, grouped by page. Read the page when an answer needs more depth.

How to practise: cover the answer, say yours out loud in 30–60 seconds, then compare.

01 · Authorization Concept – Users, Roles, Profiles & Objects

Q1. Explain the SAP authorization concept in one minute.

Fields are grouped in authorization objects (SU21). An object with values is an authorization. Authorizations sit in profiles, which PFCG generates from roles. Roles are assigned to users. At logon the user buffer is filled; S_TCODE is checked at transaction start and the program checks business objects with AUTHORITY-CHECK.

Q2. Role vs profile?

A role (PFCG) is the business view: menu plus authorization data. The profile is the technical container generated from it, which the kernel reads. Today you maintain roles, never profiles directly.

Q3. Single, composite and derived roles?

Single = own menu and authorizations. Composite = a bundle of single roles with no authorization data. Derived = child of a master role that inherits menu and authorizations and differs only in org levels.

Q4. What are organizational levels?

Fields like company code, plant or sales organization that PFCG maintains once per role for all objects. They are the only thing that differs between derived roles.

Q5. What is SU24 and why should a developer care?

SU24 tells PFCG which objects a transaction checks (check indicator) and which to propose with which values. For a custom transaction the developer maintains it, so role builders get the right objects automatically.

Q6. A user gets "not authorized". How do you analyse it?

SU53 right after the error shows the failed object and values. If that is not enough, STAUTHTRACE records all checks. Fix the role in PFCG, generate the profile, run the user comparison, user logs on again. SUIM shows who else is affected.

Q7. What is the activity field?

ACTVT in most objects says what may be done: 01 create, 02 change, 03 display, 06 delete, 16 execute. Allowed activities per object are defined in SU21.

Q8. Which user types exist?

Dialog (A), System (B), Communication (C), Service (S) and Reference (L). Background and RFC users should be system or communication users, never dialog users.

Q9. Why is S_TCODE alone not enough?

It only controls the start of a transaction. Inside, the program must check which data the user may see or change – otherwise anyone who can start the transaction sees all company codes.

Q10. S_TABU_DIS vs S_TABU_NAM?

S_TABU_DIS protects table maintenance by authorization group (SE54); S_TABU_NAM by individual table name – used when a group would grant too much.

Q11. A user has VKORG 1000 change in one role and VKORG 2000 display in another. Can they change orders in 2000?

No. A check passes only if one single authorization contains all checked values; values from different authorizations are not mixed.

Q12. What does user comparison (PFUD) do?

It writes the generated profiles of assigned roles into the user master and removes profiles whose role assignment has expired. Without it new role changes do not reach the user.

02 · Authorization Checks in ABAP – AUTHORITY-CHECK, CDS & RAP

Q1. What does AUTHORITY-CHECK return and what does it do on failure?

It only sets sy-subrc: 0 authorized, 4 values not covered, 12 no authorization for the object, 40 invalid user in FOR USER. It never stops the program – the code must react to sy-subrc.

Q2. What is DUMMY?

ID 'field' DUMMY tells the kernel not to check that field – any value is fine. Fields left out are not checked either, but DUMMY documents the intent.

Q3. What is FOR USER used for?

To check another user's authorizations, e.g. in a background or workflow step that acts for someone. It is a security risk if the user name comes from input.

Q4. How do you create and use a custom authorization object?

Field in SU20 (or reuse a standard one), object class and object in SU21 with permitted activities, SU24 proposal for the custom transaction, values in a PFCG role, assign the role, then AUTHORITY-CHECK in the program.

Q5. How do you check authorization for many values efficiently?

Either loop with AUTHORITY-CHECK and build a range, or use CL_AUTH_OBJECTS_TO_SQL: create_for_open_sql, add_authorization_object, get_sql_condition – it returns a dynamic WHERE built from the user's authorizations; CX_AUTH_NOT_AUTHORIZED if none. With CDS views (S/4HANA, and also on ECC systems from AS ABAP 7.40 SP10): CDS access control.

Q6. How does CDS access control work?

The view has @AccessControl.authorizationCheck: #CHECK; a DCL role with grant select and aspect pfcg_auth maps view elements to object fields. ABAP SQL adds the user's values to the WHERE clause automatically, so only allowed rows come back.

Q7. Can access control be bypassed?

Yes: selecting the underlying table directly, WITH PRIVILEGED ACCESS, or a view with #NOT_ALLOWED. That is why business reads should go through CDS entities with access control.

Q8. Global vs instance authorization in RAP?

Global answers "may the user do this at all" without data (create, update in general). Instance answers "may the user change this record" based on its data. Declared with authorization master ( global, instance ) and implemented in get_global_authorizations / get_instance_authorizations.

Q9. How do you make sure a called transaction is checked?

Use CALL TRANSACTION … WITH AUTHORITY-CHECK, or (older approach) AUTHORITY_CHECK_TCODE before calling. The SE93 authorization object of the transaction is checked too.

Q10. How are custom tables protected in SM30?

Assign an authorization group in SE54; SM30 checks S_TABU_DIS for the group or S_TABU_NAM for the table name.

Q11. Is S_RFC enough to secure an RFC function module?

No. S_RFC only allows calling the function group. Inside, the FM must check the business objects like any other program.

Q12. How are authorizations modelled in ABAP Cloud?

Authorization objects, IAM apps and business catalogs are created in ADT; administrators put catalogs into business roles with value restrictions and assign them to business users.

03 · Secure ABAP Coding & System Security

Q1. How can SQL injection happen in ABAP, and how do you prevent it?

Only through dynamic tokens (WHERE (lv_where), ORDER BY, FROM, field list) or native SQL when user input is concatenated into the statement. Prevent it with static ABAP SQL and host variables; if dynamic SQL is necessary, quote literals with cl_abap_dyn_prg=>quote and check names with check_allowlist (older releases: check_whitelist_*) / check_table_name_str.

Q2. What is CL_ABAP_DYN_PRG?

A standard class with methods to escape values (QUOTE, ESCAPE_QUOTES) and to validate dynamic names (CHECK_COLUMN_NAME, CHECK_TABLE_NAME_STR, CHECK_ALLOWLIST – older releases CHECK_WHITELIST_STR/TAB) before they are used in dynamic ABAP SQL or dynamic calls.

Q3. What is the Code Vulnerability Analyzer?

SAP's static security scanner for ABAP. It traces input through the code to dangerous statements and reports SQL injection, directory traversal, OS command injection, missing authorization checks, hard-coded user names and more. It runs in ATC (and SLIN) and is licensed separately for customer code.

Q4. Why is IF sy-uname = '…' a security finding?

It is a hidden backdoor: access is granted by a hard-coded name instead of an authorization object, it is invisible in role reports (SUIM), cannot be audited and breaks when users change.

Q5. How do you protect file access in ABAP?

Use logical file names and paths (transaction FILE, FILE_GET_NAME), validate externally supplied names with FILE_VALIDATE_NAME to stop ../ traversal, and rely on S_DATASET (check early with AUTHORITY_CHECK_DATASET).

Q6. How should ABAP run an operating-system command?

Only as an external command defined in SM69, called with SXPG_COMMAND_EXECUTE, which checks S_LOG_COM. Never CALL 'SYSTEM' with a command built from input.

Q7. What is S_RFC, and what is trusted RFC?

S_RFC authorizes calling RFC-enabled function modules (by function group or module, activity 16). Trusted RFC (SMT1) lets a user of a trusted system log on without a password; the called system checks S_RFCACL for that user.

Q8. What is UCON?

Unified Connectivity: an allowlist (Communication Assembly) of RFC function modules that may be called from outside. After a logging and evaluation phase, everything not in the assembly is blocked (UCONCOCKPIT).

Q9. What is the CSRF token in SAP Gateway?

A protection against cross-site request forgery: the client fetches a token with X-CSRF-Token: Fetch and must send it with every changing request; without a valid token the server answers 403.

Q10. How do you prevent XSS when ABAP generates HTML?

Encode every output value for its context with escape( val = … format = cl_abap_format=>e_xss_ml ) (or e_xss_js, e_xss_url, e_xss_css); in BSP use forceEncode; in UI5 rely on data binding.

Q11. Which tools log security-relevant activity?

Security Audit Log (RSAU_CONFIG / RSAU_READ_LOG), change documents (CDHDR / CDPOS), table logging (SCU3), Read Access Logging (SRALMANAGER) and the system log (SM21).

Q12. What is segregation of duties?

No single user may hold two conflicting functions, such as creating a vendor and paying it. SAP GRC Access Control (Access Risk Analysis) defines such risks and checks users and roles against them.