1. How do public, protected, and private sections work in an ABAP class?
Ans:
PUBLIC components can be accessed from outside the class, PROTECTED components are available within the class and its subclasses, and PRIVATE components are restricted to the defining class.
2. What is method overloading in object-oriented programming?
Ans:
Method overloading refers to defining methods with the same name but different parameter signatures. In ABAP Objects, method redefinition is commonly used to provide specialized behavior in subclasses.
3. How does polymorphism work in ABAP Objects?
Ans:
Polymorphism allows a reference to a superclass or interface to work with different implementing objects. The actual object's method implementation is executed when the method is called.
4. Why are constructor expressions useful in modern ABAP?
Ans:
Constructor expressions such as VALUE, NEW, and CONV simplify object creation, data initialization, and type conversion. They help reduce lengthy assignments and improve code readability.
5. What is the purpose of the SWITCH and COND expressions?
Ans:
SWITCH evaluates a value against multiple alternatives, while COND selects a result based on logical conditions. Both expressions help write compact conditional assignments in ABAP.
6. How can an ABAP program consume an external OData service?
Ans:
I configure the required communication setup, establish the service connection, send suitable HTTP requests, and process the returned data. I also validate responses and manage communication errors.
7. What are the advantages of using CDS views in SAP applications?
Ans:
CDS views provide reusable data models with features such as associations, annotations, and calculated fields. They support structured data access and can move suitable processing to the database layer.
8. How would you identify an incorrect value in an ABAP calculation?
Ans:
I trace the calculation statements, inspect input values, verify field types and decimal places, and review the execution sequence. I then test the corrected logic with different data samples.
9. How can unit tests improve the reliability of ABAP classes?
Ans:
Unit tests check individual methods against expected results. They help identify logic errors early, verify important conditions, and reduce the risk of introducing defects during future modifications.
10. What approach do you follow when modifying an existing SAP application?
Ans:
I understand the business requirement, review the existing implementation, assess dependencies, and make the necessary changes. I then complete testing, document the updates, and follow the transport process.