Book 11
Book 11
ABAP from the Basic ABAP Programming - S4D400 course. These notes are structured to
help you with interview preparation:
📘 1. Evolution of ABAP
🕰️Origins
🧱 Object-Oriented Extension
🚀 Modern Enhancements
🔄 Current Recommendation
⚠️Note: This course uses universal ABAP syntax applicable to all versions, with some
RAP-specific syntax in later units.
🔤 General Rules
Statements are the core of ABAP syntax and end with a period (.).
Case-insensitive: WRITE and write are treated the same.
Blanks are important. Many statements and expressions require at least one space
between keywords and operands.
🧱 Examples of Syntax
Declarative:
DATA text TYPE string.
Processing:
CONCATENATE first_name last_name INTO full_name.
Assignment (modern):
text = 'Hello World'.
💬 4. Comments in ABAP
💡 Quick Tips:
Would you like similar notes for the next lesson as well?
Here are detailed, interview-ready notes for Unit 2, Lesson 2: Working With Basic Data
Objects and Data Types from the Basic ABAP Programming - S4D400 course.
📌 b. Constants
🧱 c. Literals
📝 Best Practice: Use constants instead of literals for reusability and clarity.
Example:
🔁 4. Assigning Values
➕ Using = Operator
total = price + tax.
⚠️Risks:
Performance cost
Runtime errors (e.g., converting non-numeric strings to numbers)
Truncation (e.g., long string → short char field)
CLEAR age.
DATA(my_text) = `Hello`.
Example:
DATA(total) = price + tax. " total inferred from expression result type
✅ Inline Declaration
DATA(city) = `Berlin`.
You're absolutely right — thanks for pointing that out! Let's add a clear and complete
section on complete vs. incomplete data types to your notes from Unit 2, Lesson 2.
Type Description
I Integer (4 bytes)
D Date (YYYYMMDD)
T Time (HHMMSS)
Usage Example:
These require extra details, such as LENGTH or DECIMALS, for full definition.
Usage Examples:
🔹 If you forget to specify LENGTH or DECIMALS for incomplete types, it leads to syntax
errors or default behavior that might not suit your needs.
🧠 Interview Insight
If asked in an interview:
“What’s the difference between complete and incomplete data types in ABAP?”
“Complete types like I, D, and STRING are ready to use without extra specifications.
Incomplete types like C, N, and P require you to define their LENGTH or DECIMALS, making
them more flexible but also prone to errors if not properly specified.”
Would you like me to update your Lesson 2 notes into a single, final consolidated version
with this added?
Great — here's the complete, corrected, and consolidated version of Unit 2, Lesson 3:
Processing Data with every important detail covered, including a double-check against the
source to ensure no key point is missed.
✅ Unit 2, Lesson 3: Processing Data
🎯 Lesson Objectives
After completing this lesson, you will be able to:
🧮 1. Arithmetic Calculations
➕ Arithmetic Expressions
+ Addition total = a + b.
- Subtraction diff = a - b.
* Multiplication product = a * b.
⚙️Precedence Rules
result = ( 8 * 7 - 6 ) / ( 5 + 4 ).
🧠 Numeric Functions
Function Purpose
⚠️Syntax Rule: ABAP requires at least one space between operators and operands, and
inside brackets.
🧵 2. String Processing
🧱 a. String Templates
An ABAP expression of type string enclosed in | ... |. You can embed expressions with
{ ... }.
Must use { expression } with at least one space after { and before }
Can embed: variables, calculations, function calls
Example:
ABAP lets you format dates, numbers, and signs inside string templates.
🔗 c. String Concatenation
text = |{ a } + { b } = { a + b }|.
Best Practice Prefer expressions and templates for clarity and modern ABAP standards
Would you like this in a downloadable format (PDF or Word), or shall I continue with
Lesson 4?
Absolutely! Here's the full, detailed, and accurate notes for Unit 2, Lesson 4: Working
with Simple Internal Tables from the Basic ABAP Programming – S4D400 course. These
notes cover every key point, including concepts, syntax, best practices, examples, and
interview-useful explanations.
🎯 Lesson Objectives
By the end of this lesson, you will be able to:
Internal tables are variable-length structures used to store multiple rows of the
same type.
They reside in program memory and behave like dynamic arrays.
🔸 Characteristics:
Each row has the same row type (defined during declaration).
Number of rows is not fixed; grows as needed (limited by memory/system).
Initial value: an internal table starts empty (0 rows).
a. Built-in types
DATA my_table TYPE TABLE OF string.
Clears the entire content of the internal table and resets it to 0 rows.
CLEAR numbers.
Loops through all rows in order, placing each row in a work area.
✅ Advantages:
Cleaner code
Automatically infers correct type
🧪 Example: All Concepts in One
TYPES tt_texts TYPE TABLE OF string.
" Filling
APPEND 'Apple' TO texts.
APPEND 'Banana' TO texts.
" Looping
LOOP AT texts INTO DATA(item).
out->write( |Item: { item }| ).
ENDLOOP.
" Clearing
CLEAR texts.
Internal table Dynamic structure to hold multiple values of the same type
Sources of row type Built-in types, local TYPES, or global Dictionary types
Here are the complete, detailed, and interview-optimized notes for Unit 2, Lesson 5:
Using Control Structures in ABAP from the Basic ABAP Programming – S4D400 course.
These notes include every point covered in the lesson, clearly explained and structured to
help you both understand and explain the topic in interviews.
🎯 Lesson Objectives
By the end of this lesson, you should be able to:
🔀 1. Conditional Branching
ABAP supports the following decision-making structures:
✅ Syntax:
IF condition1.
" Code if condition1 is true
ELSEIF condition2.
" Code if condition2 is true
ELSE.
" Code if no condition is true
ENDIF.
Example:
✅ Syntax:
CASE variable.
WHEN value1.
" Code
WHEN value2.
" Code
WHEN OTHERS.
" Default code
ENDCASE.
Example:
CASE country.
WHEN 'US'.
out->write( 'United States' ).
WHEN 'IN'.
out->write( 'India' ).
WHEN OTHERS.
out->write( 'Other Country' ).
ENDCASE.
⚠️Use CASE instead of multiple IF statements when comparing the same variable.
✅ Syntax:
DO [n TIMES].
" Loop body
ENDDO.
Example:
DO 5 TIMES.
out->write( 'Repeat!' ).
ENDDO.
🔷 b. WHILE - ENDWHILE
✅ Syntax:
WHILE condition.
" Loop body
ENDWHILE.
Example:
🔷 c. LOOP AT - ENDLOOP
✅ Syntax:
Statement Purpose
✅ a. EXIT
Used to break out of the loop entirely.
DO.
IF condition.
EXIT.
ENDIF.
ENDDO.
✅ b. CONTINUE
Skips to the next iteration without executing the remaining code in the current loop.
✅ c. CHECK
🧠 CHECK vs. CONTINUE: Both skip iterations, but CHECK is more concise and
idiomatic.
This lesson mentions exception handling but defers full implementation to later units.
Would you like to continue with Lesson 6: Debugging an ABAP Program next?
Here are your full, detailed, and interview-ready notes for Unit 2, Lesson 6: Debugging
an ABAP Program from the Basic ABAP Programming – S4D400 course. This includes
every concept, tool, view, and step outlined in the material.
✅ Unit 2, Lesson 6: Debugging an ABAP Program
🎯 Lesson Objectives
By the end of this lesson, you should be able to:
Crashes
Unexpected output
No output at all
As a developer, you must analyze the code line-by-line to determine the cause of errors.
This is where the ABAP Debugger becomes essential.
Right-click the left margin of the ABAP editor and choose Toggle Breakpoint
Or double-click the margin
The program must be activated first
When the breakpoint is hit, the ABAP Debugger perspective opens in ADT
(Eclipse)
🔸 Breakpoint Behavior
💡 Depending on settings, ADT may ask for confirmation to open Debug Perspective
👓 3. Debug Perspective in ADT
Key Views in Debug Perspective:
View Purpose
Breakpoints View Lists all active breakpoints and lets you manage them
Hint: Editor tools are limited in Debug Perspective → switch back to ABAP afterward
Step Over F6 Executes line as a block (skips inside methods like out->write(...))
Jump to Line Shift+F12 Skips to or re-executes a specific line (careful: does not revert state)
Type Description
Statement Breakpoint Triggers on any CLEAR (or any statement) across the whole program
Exception Breakpoint Triggers when specific exception class is raised (e.g., CX_SY_ZERODIVIDE)
Type Description
Conditional Breakpoint Triggers only when condition is true (e.g., sy-index > 10)
👁️Watchpoints
✅ How to Set:
b. Variables View
c. Internal Tables
Internal Tables
Action Method
⚠️Don't press F5 on out->write(...) – it dives into reusable framework code. Use F6.
📌 Lesson Summary
By now, you should be able to:
Would you like a consolidated PDF of all Unit 2 lessons for easy review?