0% found this document useful (0 votes)
12 views25 pages

Book 11

The document provides detailed notes for Unit 2, Lessons 1 to 4 of the Basic ABAP Programming course, covering key concepts such as the evolution of ABAP, basic syntax, data objects, data types, arithmetic calculations, string processing, and internal tables. Each lesson includes objectives, definitions, examples, and best practices to aid in understanding and interview preparation. Key takeaways emphasize the importance of modern syntax, the distinction between complete and incomplete data types, and effective use of internal tables.

Uploaded by

lokeshkumaar3421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views25 pages

Book 11

The document provides detailed notes for Unit 2, Lessons 1 to 4 of the Basic ABAP Programming course, covering key concepts such as the evolution of ABAP, basic syntax, data objects, data types, arithmetic calculations, string processing, and internal tables. Each lesson includes objectives, definitions, examples, and best practices to aid in understanding and interview preparation. Key takeaways emphasize the importance of modern syntax, the distinction between complete and incomplete data types, and effective use of internal tables.

Uploaded by

lokeshkumaar3421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Here's a detailed and clear set of notes for Unit 2, Lesson 1: Understanding the Basics of

ABAP from the Basic ABAP Programming - S4D400 course. These notes are structured to
help you with interview preparation:

Unit 2, Lesson 1: Understanding the Basics of ABAP


✅ Lesson Objectives

By the end of this lesson, you should be able to:

 Describe the evolution of ABAP


 Explain the basics of ABAP syntax

📘 1. Evolution of ABAP

🕰️Origins

 ABAP (Advanced Business Application Programming) is SAP’s proprietary


programming language.
 Developed in 1983 as a procedural language.
 Initially influenced by languages like COBOL and Pascal.

🧱 Object-Oriented Extension

 In the late 1990s, ABAP was extended to support object-oriented programming


(OOP).
 Named ABAP Objects post this evolution.
 Combined both procedural and object-oriented paradigms.

🚀 Modern Enhancements

 ABAP evolved to include expression-based syntax to reduce verbosity.


 Example: Moving from statements (ADD A TO B) to expressions (C = A + B).
 Supports OO, procedural, and expression-based styles in one language.

🔄 Current Recommendation

 Use object-oriented and expression-based syntax wherever possible in modern


ABAP development.

🧾 2. ABAP Language Versions

 Each ABAP program has an attribute called "ABAP language version".


 This attribute controls:
o Allowed syntax rules
o Allowed repository objects
 Types of language versions (not named specifically in the document but typically
include):
o Standard ABAP
o ABAP for Cloud Development
o ABAP for Key Users (restricted version)

⚠️Note: This course uses universal ABAP syntax applicable to all versions, with some
RAP-specific syntax in later units.

📝 3. Basics of ABAP Syntax

🔤 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'.

💡 Expression-based Assignment Examples

 Using literals, variables, and functions:


 text = 'Hello'. " Literal assignment
 text = first_name. " Variable assignment
 text = replace( val = text sub = 'H' with = 'J' ). " Function call
 text = COND string( WHEN x > 0 THEN 'Positive' ELSE 'Non-Positive' ).
" Conditional assignment

💬 4. Comments in ABAP

🟨 Two types of comments:

1. Full line comment with asterisk * in first column:


2. * This is a full-line comment
3. Inline comment using double quotes ":
4. DATA text TYPE string. " This is an inline comment
❗ Incorrect placement of * (not in first column) will result in a syntax error.

💡 Quick Tips:

 Add comment: Select lines → Press Ctrl + <


 Remove comment: Select lines → Press Ctrl + >

🎯 Summary – Key Takeaways

 ABAP has evolved from a procedural language to a multi-paradigm language with


OOP and expressions.
 Use modern, readable syntax when possible.
 ABAP supports expression-based operations, which are concise and efficient.
 Comments help clarify code and support collaboration, with clear syntax rules.

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.

Unit 2, Lesson 2: Working With Basic Data Objects and


Data Types
✅ Lesson Objectives

After completing this lesson, you should be able to:

 Declare data objects


 Assign values to variables

📦 1. Understanding Data Objects in ABAP


A data object is a reserved memory section used during program execution. There are 3
types:
🔁 a. Variables

 Value can change at runtime.


 Must be declared with a name.
 Always initialized with a type-specific default value.

📌 b. Constants

 Value is fixed and hard-coded.


 Declared using CONSTANTS.
 Cannot be changed during execution.
Example:
 CONSTANTS: pi TYPE p DECIMALS 2 VALUE '3.14'.

🧱 c. Literals

 Anonymous, hard-coded values used directly in code.


 No name = not reusable.
 Examples:
o Number literal: 1234
o Text literal: 'Hello' (type C)
o String literal: `Hello` (type STRING)

📝 Best Practice: Use constants instead of literals for reusability and clarity.

🏷️2. ABAP Data Types


ABAP data objects must be typed. Types are sourced from:

1️⃣ Built-in ABAP Types

 Simple numeric, char-like, and binary types.


 Examples:
o I → Integer (4 bytes, ±2,147,483,648)
o P → Packed decimal (used for decimals)
o C → Fixed-length character
o N → Digits only (used for non-calculable numbers)
o D → Date (YYYYMMDD)
o T → Time (HHMMSS)
o STRING → Variable-length string

Types like C, N, P require additional LENGTH/DECIMALS—called incomplete types.

2️⃣ Local Types (via TYPES statement)

 Custom types declared inside the program.


 TYPES my_type TYPE i.
 DATA my_var TYPE my_type.

3️⃣ Global Types (ABAP Dictionary)

 Stored in the ABAP Repository.


 Add semantic metadata (labels, descriptions). Example:
 DATA airport TYPE /DMO/AIRPORT_ID.

✍️3. Declaring Variables


Use the DATA keyword:

DATA var_name TYPE type [VALUE initial_value].

Example:

DATA age TYPE i VALUE 25.

🔁 4. Assigning Values
➕ Using = Operator
total = price + tax.

 The left-hand side gets the value.


 Right-hand side can be:
o Literal (5)
o Variable (price)
o Expression (price + tax)
o Function call (replace(...))
o Conditional (COND)

🔄 5. Implicit Type Conversions


ABAP automatically converts types when compatible, but:

⚠️Risks:

 Performance cost
 Runtime errors (e.g., converting non-numeric strings to numbers)
 Truncation (e.g., long string → short char field)

Avoid implicit conversions when possible.


🧽 6. Resetting Variables
Use CLEAR to reset a variable to its type-specific initial value:

CLEAR age.

Note: This ignores any initial value defined via VALUE.

✍️7. Inline Declarations


Declare a variable where it's first used using DATA(...):

DATA(my_text) = `Hello`.

ABAP infers the type from the context.

Example:

DATA(total) = price + tax. " total inferred from expression result type

🔸 No space allowed between DATA and (

🧪 8. Practical Examples for Interviews


✅ Variable Declaration & Output
DATA name TYPE string VALUE 'John'.
out->write( name ).

✅ Constants & Literals


CONSTANTS max_age TYPE i VALUE 100.
out->write( max_age ). " Output: 100

out->write( '100' ). " Text literal, type C


out->write( 100 ). " Number literal, type I

✅ Inline Declaration
DATA(city) = `Berlin`.

📌 Summary – Key Interview Points


Concept Details
Variable Mutable memory with name and type
Constant Immutable, must have VALUE defined
Literal Anonymous, one-time-use value
Built-in Types I, P, C, N, D, T, STRING, etc.
Local Types Declared using TYPES
Global Types Declared in ABAP Dictionary
Assignment Operator = (right → left)
CLEAR Statement Resets variable to initial value
Inline Declaration DATA(var) = expression – type inferred automatically
Type Conversions Possible, but may cause errors or data loss – use carefully

Would you like notes for Lesson 3: Processing Data as well?

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.

🔍 Complete vs. Incomplete ABAP Data Types


ABAP’s built-in types are categorized into two types based on whether they require
additional parameters (like LENGTH or DECIMALS) when declared:

✅ Complete Data Types

These do not require any additional specification.

Type Description

I Integer (4 bytes)

D Date (YYYYMMDD)

T Time (HHMMSS)

STRING Variable-length character string

XSTRING Variable-length hexadecimal string

Usage Example:

DATA age TYPE i.


DATA birth_date TYPE d.
DATA comment TYPE string.
⚠️Incomplete Data Types

These require extra details, such as LENGTH or DECIMALS, for full definition.

Type Requires Description

C LENGTH Fixed-length character string (e.g., LENGTH 10)

N LENGTH Digit-only string, used for IDs (e.g., personnel number)

P LENGTH + DECIMALS Packed number for financial data

X LENGTH Fixed-length hexadecimal data

Usage Examples:

DATA code TYPE c LENGTH 5.


DATA emp_id TYPE n LENGTH 8.
DATA amount TYPE p LENGTH 8 DECIMALS 2.

🔹 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?”

You can say:

“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:

 Perform arithmetic calculations


 Apply string processing

🧮 1. Arithmetic Calculations
➕ Arithmetic Expressions

Used in reading positions (e.g., right-hand side of assignments). Combine operands,


operators, and functions.

🔹 Operators and Their Meaning:

Operator Function Example

+ Addition total = a + b.

- Subtraction diff = a - b.

* Multiplication product = a * b.

/ Division (decimal) quotient = a / b.

DIV Integer division 7 DIV 3 = 2

MOD Modulo (remainder) 7 MOD 3 = 1

⚙️Precedence Rules

 *, /, DIV, MOD have higher precedence than +, -


 Parentheses () can be used to control evaluation order

result = ( 8 * 7 - 6 ) / ( 5 + 4 ).

🧠 Numeric Functions

Function Purpose

sqrt(x) Square root of x

ipow( base = x exp = y ) x to the power of y (integer exponent)


result = sqrt( 16 ). " 4
result = ipow( base = 2 exp = 3 ). " 8

⚠️Syntax Rule: ABAP requires at least one space between operators and operands, and
inside brackets.

🧵 2. String Processing
🧱 a. String Templates

🔹 What is a string template?

An ABAP expression of type string enclosed in | ... |. You can embed expressions with
{ ... }.

DATA text TYPE string.


text = |Hello { user_name }!|.

🔸 Embedded Expression Rules:

 Must use { expression } with at least one space after { and before }
 Can embed: variables, calculations, function calls

Example:

DATA total TYPE p DECIMALS 2.


text = |Total amount: { total } EUR|.

🎨 b. Format Options in Templates

ABAP lets you format dates, numbers, and signs inside string templates.

📅 Date Formatting Options

Option Output Format

DATE = ISO ISO format (YYYY-MM-DD)

DATE = USER User's locale (e.g., DD.MM.YYYY)

Default Internal format (YYYYMMDD)


|Date: { today DATE = ISO }|

🔢 Number Formatting Options


Option Purpose

NUMBER = USER Localized number format

SIGN = LEFT Displays sign at left (e.g., -12)

SIGN = RIGHT Displays sign at right (e.g., 12-)

STYLE = SCIENTIFIC Displays number in scientific notation

|Temp: { temp STYLE = SCIENTIFIC }|

🔗 c. String Concatenation

Use && to concatenate strings or expressions.

DATA first TYPE string VALUE 'Hello'.


DATA second TYPE string VALUE 'World'.

DATA greeting TYPE string.


greeting = first && ' ' && second. " Hello World

Also works with expressions:

text = |{ a } + { b } = { a + b }|.

🧪 Example Exercise Recap


DATA amount1 TYPE p DECIMALS 2 VALUE '1.20'.
DATA amount2 TYPE p DECIMALS 2 VALUE '2.10'.
DATA total TYPE p DECIMALS 2.

total = amount1 + amount2.

DATA(output) = |{ amount1 } + { amount2 } = { total } EUR|.


out->write( output ).

📌 Key Interview-Ready Summary


Topic Key Points

Arithmetic Operators +, -, *, /, DIV, MOD

Function Calls Use sqrt() and ipow() for math operations

String Templates Enclosed in `

Format Options Use DATE=, NUMBER=, SIGN=, STYLE= inside templates

Concatenation Use && to combine strings and expressions


Topic Key Points

Syntax Rules Spaces required around operators and inside {}

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.

✅ Unit 2, Lesson 4: Working with Simple Internal Tables

🎯 Lesson Objectives
By the end of this lesson, you will be able to:

 Define simple internal tables


 Process data using simple internal tables

📦 1. What Are Internal Tables?


🔹 Definition:

 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).

🛠️2. Declaring Internal Tables


➤ Syntax:
DATA itab_name TYPE TABLE OF <row_type>.

✅ Example (of integers):


DATA numbers TYPE TABLE OF i.

🧱 3. Sources of Row Types


You can base the row type on:

a. Built-in types
DATA my_table TYPE TABLE OF string.

b. Local types (TYPES):


TYPES tt_strings TYPE TABLE OF string.
DATA texts TYPE tt_strings.

c. Global table types (from ABAP Dictionary):


DATA bookings TYPE string_table.

string_table is a standard global type defined in SAP.

➕ 4. Filling Internal Tables


📌 APPEND Statement

Adds a new row at the end of the table.

DATA numbers TYPE TABLE OF i.


APPEND 1234 TO numbers.
APPEND 5678 TO numbers.

You can also use expressions:

DATA number TYPE i VALUE 1000.


APPEND number TO numbers.
APPEND number * 2 TO numbers.

🧽 5. Emptying Internal Tables


🔄 CLEAR Statement

Clears the entire content of the internal table and resets it to 0 rows.

CLEAR numbers.

🔍 6. Reading from Internal Tables


📥 a. Reading by Index (Internal Table Expression)
DATA num TYPE i.
num = numbers[ 1 ].

💡 Syntax Rule: Must include a space after [ and before ].

🔁 b. Reading All Entries: LOOP AT

Loops through all rows in order, placing each row in a work area.

DATA number TYPE i.


LOOP AT numbers INTO number.
out->write( number ).
ENDLOOP.

🧑‍💻 Work Area Requirements

 Must be of same or compatible type as internal table row type.

✏️7. Inline Declaration in Loops


Instead of declaring the work area separately, you can use inline declaration:

LOOP AT numbers INTO DATA(num).


out->write( num ).
ENDLOOP.

✅ Advantages:

 Cleaner code
 Automatically infers correct type
🧪 Example: All Concepts in One
TYPES tt_texts TYPE TABLE OF string.

DATA texts TYPE tt_texts.


DATA single_text TYPE string.

" Filling
APPEND 'Apple' TO texts.
APPEND 'Banana' TO texts.

" Reading by index


single_text = texts[ 1 ].
out->write( |First: { single_text }| ).

" Looping
LOOP AT texts INTO DATA(item).
out->write( |Item: { item }| ).
ENDLOOP.

" Clearing
CLEAR texts.

📌 Summary – Interview Essentials


Topic Explanation

Internal table Dynamic structure to hold multiple values of the same type

Declaration DATA itab TYPE TABLE OF type

Sources of row type Built-in types, local TYPES, or global Dictionary types

APPEND Adds a row at the end

CLEAR Removes all rows

Reading by index var = itab[ index ] with spacing required

LOOP AT INTO Iterates over each row; uses a work area

Inline work area declaration INTO DATA(var) — type inferred automatically

🧠 Best Practices / Interview Tips


 Always initialize internal tables properly before using them.
 Prefer inline declarations (DATA(...)) for cleaner, safer loops.
 Remember: tables start empty, so avoid assumptions without checks.
 Use standard table types (e.g., string_table) where applicable.
 In loops, always ensure work area type matches row type.
Would you like me to continue with Lesson 5: Using Control Structures in ABAP next?

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.

✅ Unit 2, Lesson 5: Using Control Structures in ABAP

🎯 Lesson Objectives
By the end of this lesson, you should be able to:

 Implement conditional branching


 Implement iterations (loops)
 Handle exceptions

🔀 1. Conditional Branching
ABAP supports the following decision-making structures:

🟦 a. IF - ELSEIF - ELSE - ENDIF

Standard branching structure.

✅ Syntax:

IF condition1.
" Code if condition1 is true
ELSEIF condition2.
" Code if condition2 is true
ELSE.
" Code if no condition is true
ENDIF.

Example:

IF score >= 90.


out->write( 'Grade: A' ).
ELSEIF score >= 75.
out->write( 'Grade: B' ).
ELSE.
out->write( 'Grade: C or below' ).
ENDIF.
🟪 b. CASE - WHEN - ENDCASE

Used when evaluating a single variable against multiple values.

✅ 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.

🔁 2. Loops (Iteration Structures)


🔷 a. DO - ENDDO

Used to repeat a block of code a fixed number of times or indefinitely.

✅ Syntax:

DO [n TIMES].
" Loop body
ENDDO.

 If n is omitted, it's an infinite loop.


 Use EXIT to stop execution inside infinite loops.

Example:

DO 5 TIMES.
out->write( 'Repeat!' ).
ENDDO.
🔷 b. WHILE - ENDWHILE

Repeats as long as a condition is true.

✅ Syntax:

WHILE condition.
" Loop body
ENDWHILE.

Example:

DATA count TYPE i VALUE 1.


WHILE count <= 3.
out->write( count ).
count = count + 1.
ENDWHILE.

🔷 c. LOOP AT - ENDLOOP

Used to iterate over internal tables.

✅ Syntax:

LOOP AT itab INTO wa.


" Use wa
ENDLOOP.

You can also use inline declaration:

LOOP AT itab INTO DATA(row).


out->write( row ).
ENDLOOP.

⛔ 3. Loop Control Statements


These help control flow inside loops:

Statement Purpose

EXIT Terminates loop immediately

CONTINUE Skips the remaining code in the current loop

CHECK Skips iteration if condition is false

✅ 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.

LOOP AT numbers INTO DATA(n).


IF n < 0.
CONTINUE. " skip negative numbers
ENDIF.
out->write( n ).
ENDLOOP.

✅ c. CHECK

If condition is false, skips the current iteration.

LOOP AT numbers INTO DATA(n).


CHECK n > 0. " skip non-positive
out->write( n ).
ENDLOOP.

🧠 CHECK vs. CONTINUE: Both skip iterations, but CHECK is more concise and
idiomatic.

🚨 4. Exception Handling (Brief Overview)


While detailed error handling comes later, you should know that ABAP uses:

 RAISE EXCEPTION: to throw an exception


 TRY - CATCH - ENDTRY: to catch and handle exceptions

This lesson mentions exception handling but defers full implementation to later units.

🧪 Example: All Control Structures Together


DATA numbers TYPE TABLE OF i.
APPEND 5 TO numbers.
APPEND -1 TO numbers.
APPEND 10 TO numbers.
LOOP AT numbers INTO DATA(n).
CHECK n > 0.
IF n = 10.
EXIT.
ENDIF.
out->write( |Valid number: { n }| ).
ENDLOOP.

📌 Summary – Interview Takeaways


Feature Description

IF - ELSE General purpose conditional branching

CASE Efficient when checking one variable against multiple values

DO Fixed or infinite loops

WHILE Loop while condition is true

LOOP AT Iterate over internal tables

EXIT Exit loop entirely

CONTINUE Skip rest of current iteration

CHECK Skip iteration if condition is false

INTO DATA(...) Inline declaration for loop work areas

TRY - CATCH Used for exception handling (covered in detail later)

💡 Best Practices & Tips


 Use CHECK for concise loop filters.
 Use CASE instead of long chains of IF when comparing one variable.
 Always ensure DO or WHILE loops have a clear exit condition to prevent infinite loops.
 Use inline declaration (INTO DATA(...)) for cleaner code.
 Learn exception handling in combination with business logic in later lessons.

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:

 Enter debugging mode


 Control program execution
 Analyze data object contents using the debugger

🧩 1. Why Debugging Is Needed


Errors in ABAP programs may cause:

 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.

🛠️2. Entering Debugging Mode


🔹 Set a Breakpoint

 Right-click the left margin of the ABAP editor and choose Toggle Breakpoint
 Or double-click the margin
 The program must be activated first

🔸 Run the Program

 When the breakpoint is hit, the ABAP Debugger perspective opens in ADT
(Eclipse)

🔸 Breakpoint Behavior

 Breakpoints are user-specific and persistent (survive logoff)


 Can be:
o Deleted via Toggle
o Deactivated via right-click context menu

💡 Depending on settings, ADT may ask for confirmation to open Debug Perspective
👓 3. Debug Perspective in ADT
Key Views in Debug Perspective:

View Purpose

Source Code View Displays code, highlights current execution line

Variables View Shows current values of all variables

Breakpoints View Lists all active breakpoints and lets you manage them

Debug View Displays call hierarchy and active debug sessions

Perspective Selector Use to switch back to ABAP perspective after debugging

Hint: Editor tools are limited in Debug Perspective → switch back to ABAP afterward

4. Controlling Code Execution


🔁 Navigation Functions:

Function Shortcut Purpose

Step Into F5 Executes line-by-line, enters method calls

Step Over F6 Executes line as a block (skips inside methods like out->write(...))

Resume F8 Runs until next breakpoint or end of program

Run to Line Shift+F8 Executes up to the selected line

Jump to Line Shift+F12 Skips to or re-executes a specific line (careful: does not revert state)

Terminate Stops execution immediately

🎯 5. Breakpoints and Watchpoints


📍 Special Breakpoints

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

 Triggers when the value of a variable changes


 You can add a condition to trigger selectively

✅ How to Set:

 Right-click a variable → Set Watchpoint


 Edit condition in Breakpoints View

🔎 6. Analyzing Data Objects


a. Hover Technique

 Hover over variable in code during debug → shows current value

b. Variables View

 Expand Locals to see all in-scope variables


 Add to top-level manually:
o Double-click a variable in editor
o Use <Enter variable> field
o Right-click → Show as Top-Level Variable

c. Internal Tables

 Open in ABAP Internal Table View


 Double-click table name to analyze contents
 Use filters to find data quickly

✏️7. Modifying Data at Runtime


Simple Variables

 Right-click → Change Value

Internal Tables
Action Method

Change Value Right-click row → Change Value

Insert Row Right-click table → Insert Row...

Delete Rows Right-click → Delete Selected or Delete Range

🧪 8. Debugging Example Program – Loan Repayment


In the exercise, you debug a program that calculates a loan repayment plan with interest and
special payments.

Key Debug Tasks:

✅ Task 1: Analyze Starting Values

 Set breakpoint on loan_remaining = loan_total


 Run program → debugger stops at breakpoint
 Observe values of loan_total, loan_remaining

✅ Task 2: Analyze Branching

 Step into CASE block


 Observe which WHEN branch executes based on spec_repay_mode

✅ Task 3: Use Watchpoints

 Set watchpoint on loan_remaining


 Resume program → execution halts when value changes

✅ Task 4: Analyze Internal Table repayment_plan

 Step into APPEND statement


 Watch how string template populates each new row

✅ Task 5: Use Statement Breakpoint

 Set breakpoint on EXIT to stop when loan is fully paid

✅ Task 6: Final Execution

 Use F6 (Step Over) to skip out->write(...)


 Open Console view to see formatted output

⚠️Don't press F5 on out->write(...) – it dives into reusable framework code. Use F6.
📌 Lesson Summary
By now, you should be able to:

 Enter and navigate in debugging mode


 Use breakpoints, watchpoints, and conditional logic to control execution
 Inspect and modify variables, internal tables, and flow control
 Leverage the ADT Debug Perspective to isolate and fix program errors

Would you like a consolidated PDF of all Unit 2 lessons for easy review?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy