Clean ABAP
This skill provides comprehensive checking of ABAP code against Clean ABAP principles, based on the Clean ABAP style guide which adapts Robert C. Martin's Clean Code for ABAP.
How to Use This Skill
When checking ABAP code for Clean ABAP compliance:
- Read the code provided by the user
- Categorize issues by Clean ABAP sections (Names, Language, Constants, Variables, Tables, Strings, Booleans, Conditions, Ifs, Classes, Methods, Error Handling, Comments, Formatting, Testing)
- Identify violations with specific line references when available
- Provide actionable recommendations with code examples showing both the problem and the clean solution
- Prioritize issues by impact (critical, major, minor)
Check Categories
1. Names
Key Principles:
- Use descriptive names that convey content and meaning
- Prefer solution domain and problem domain terms
- Use pronounceable names
- Use snake_case consistently
- Avoid abbreviations unless necessary
- Use nouns for classes, verbs for methods
- Avoid noise words like "data", "info", "object"
- Pick one word per concept
- Avoid encodings (Hungarian notation, prefixes like iv_, rv_, lt_)
- Avoid obscuring built-in functions
Check for:
- Non-descriptive variable/method/class names (e.g.,
data1, temp, x)
- Inconsistent abbreviations across the code
- Mixed naming conventions (not snake_case)
- Noise words in names
- Hungarian notation or unnecessary prefixes (iv_, ev_, rv_, lt_, ls_)
- Method names that obscure ABAP built-in functions
2. Language
Key Principles:
- Prefer object orientation to procedural programming
- Prefer functional to procedural language constructs
- Avoid obsolete language elements
- Use design patterns wisely
Check for:
- Use of obsolete statements (unescaped host variables in SELECT, etc.)
- Procedural code that should be object-oriented
- Use of old-style MOVE instead of assignment
- TRANSLATE instead of to_upper()/to_lower()
- CREATE OBJECT instead of NEW
- Old-style READ TABLE instead of table expressions
3. Constants
Key Principles:
- Use constants instead of magic numbers
- Constants need descriptive names
- Prefer ENUM to constants interfaces
- Group related constants
Check for:
- Magic numbers or string literals in code
- Constants with non-descriptive names (c_01, c_x, etc.)
- Ungrouped constants that should be in BEGIN OF/END OF blocks
4. Variables
Key Principles:
- Prefer inline to up-front declarations
- Don't use variables outside their declaration block
- Don't chain up-front declarations
- Don't use field symbols for dynamic data access (modern ABAP)
- Choose the right loop targets (field symbols vs references vs values)
Check for:
- Up-front DATA declarations when inline would be clearer
- Variables used outside their declaration block scope
- Chained DATA declarations
- Unnecessary field symbols with ASSIGN
5. Tables
Key Principles:
- Use the right table type (STANDARD, SORTED, HASHED)
- Avoid DEFAULT KEY
- Prefer INSERT INTO TABLE to APPEND TO
- Prefer LINE_EXISTS to READ TABLE or LOOP AT
- Prefer READ TABLE to LOOP AT
- Prefer LOOP AT WHERE to nested IF
- Avoid unnecessary table reads
Check for:
- Tables with DEFAULT KEY
- APPEND TO when INSERT INTO TABLE is more appropriate
- READ TABLE ... TRANSPORTING NO FIELDS when LINE_EXISTS would be clearer
- LOOP AT ... EXIT when READ TABLE is intended
- Nested IF inside LOOP AT when WHERE clause would work
- Double reads (checking existence then reading again)
6. Strings
Key Principles:
- Use ` (backticks) to define string literals
- Use | (pipes) to assemble text
Check for:
- Single quotes for string literals
- String concatenation with && instead of string templates
7. Booleans
Key Principles:
- Use ABAP_BOOL for boolean types
- Use ABAP_TRUE and ABAP_FALSE for comparisons
- Use XSDBOOL to set boolean variables
- Consider if booleans are the right choice (vs enumerations)
Check for:
- Use of CHAR1 or other types instead of ABAP_BOOL
- Comparisons with 'X' and ' ' instead of ABAP_TRUE/ABAP_FALSE
- IF-THEN-ELSE to set boolean instead of XSDBOOL
- Boolean parameters that should be split methods
8. Conditions
Key Principles:
- Try to make conditions positive
- Prefer IS NOT to NOT IS
- Consider predicative method calls for boolean methods
- Consider decomposing/extracting complex conditions
Check for:
- Negative conditions that could be positive
- NOT IS instead of IS NOT
- Complex nested conditions that should be decomposed
- Long conditions that should be extracted to methods
9. Ifs
Key Principles:
- No empty IF branches
- Prefer CASE to ELSE IF for multiple alternatives
- Keep nesting depth low
Check for:
- Empty IF with logic only in ELSE
- Multiple ELSE IF that should be CASE
- Deeply nested IF statements (>3 levels)
10. Classes
Key Principles:
- Prefer objects to static classes
- Prefer composition to inheritance
- Don't mix stateful and stateless in same class
- Global by default, local only where appropriate
- FINAL if not designed for inheritance
- Members PRIVATE by default, PROTECTED only if needed
- Consider immutable instead of getter
Check for:
- Static classes that should be instance-based
- Deep inheritance hierarchies
- Mixed stateful/stateless methods
- Non-FINAL classes not designed for inheritance
- PUBLIC members that should be PRIVATE/PROTECTED
- Unnecessary getter methods for immutable data
11. Methods
Key Principles:
- Prefer instance to static methods
- Public instance methods should implement interfaces
- Aim for few IMPORTING parameters (<3)
- Split methods instead of OPTIONAL parameters
- RETURN, EXPORT, or CHANGE exactly one parameter
- Prefer RETURNING to EXPORTING
- Do one thing, do it well, do it only
- Keep methods small (3-5 statements ideal)
- Fail fast
- Omit RECEIVING, EXPORTING keywords when possible
- Omit self-reference ME when calling instance members
Check for:
- Static methods that should be instance methods
- Public methods not part of an interface
- Methods with >3 IMPORTING parameters
- Multiple OPTIONAL parameters (should be split methods)
- Multiple output parameters
- EXPORTING instead of RETURNING
- Long methods (>20 lines)
- Methods doing multiple things
- Unnecessary RECEIVING, EXPORTING keywords
- Explicit ME-> calls
12. Error Handling
Key Principles:
- Prefer exceptions to return codes
- Use class-based exceptions
- Throw CX_STATIC_CHECK for manageable exceptions
- Throw CX_NO_CHECK for unrecoverable situations
- Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE
- Wrap foreign exceptions
Check for:
- Return codes instead of exceptions
- Use of message classes for error handling
- Old-style RAISE EXCEPTION TYPE
- Unwrapped foreign exceptions
- Catching generic CX_ROOT
13. Comments
Key Principles:
- Express yourself in code, not comments
- Comments are no excuse for bad names
- Write comments to explain why, not what
- Comment with ", not *
- Delete code instead of commenting it
- Use FIXME, TODO, XXX with your ID
- ABAP Doc only for public APIs
Check for:
- Obvious comments explaining what code does
- Comments compensating for bad names
- Commented-out code
-
- Comments without TODO/FIXME tags
- Manual versioning in comments
- Duplicate message texts in comments
14. Formatting
Key Principles:
- Use ABAP Formatter before activating
- No more than one statement per line
- Reasonable line length (120 chars)
- Single blank lines to separate (not more)
- Close brackets at line end
- Keep single parameter calls on one line
- Indent and snap to tab
Check for:
- Multiple statements per line
- Lines exceeding 120 characters
- Multiple consecutive blank lines
- Inconsistent indentation
- Chained assignments
15. Testing
Key Principles:
- Write testable code
- Test publics, not private internals
- Use given-when-then structure
- Few, focused assertions
- Use the right assert type
Check for:
- Untestable code (tight coupling, no dependency injection)
- Tests without clear given-when-then structure
- Multiple unrelated assertions
- Missing test classes for public methods
Output Format
Structure your analysis as follows:
# Clean ABAP Check Results
## Summary
- Total Issues: [count]
- Critical: [count]
- Major: [count]
- Minor: [count]
## Critical Issues
### [Category] - [Issue Title]
**Location:** Line [X] / Method [name]
**Problem:** [Description of what violates Clean ABAP]
**Recommendation:** [How to fix it]
**Anti-pattern:**
```abap
[problematic code]
Clean code:
[improved code]
Major Issues
[Same format as Critical]
Minor Issues
[Same format as Critical]
Positive Observations
- [Things done well according to Clean ABAP]
Overall Assessment
[Brief summary of code quality and main areas for improvement]
## Priority Levels
**Critical:** Issues that significantly impact maintainability, testability, or could cause bugs
- Magic numbers without constants
- Deep nesting (>3 levels)
- Methods with >5 parameters
- Empty IF branches
- Static classes without interfaces
- Return codes instead of exceptions
**Major:** Issues that reduce code clarity and violate Clean ABAP principles
- Non-descriptive names
- Hungarian notation/prefixes
- Long methods (>20 lines)
- DEFAULT KEY usage
- Commented-out code
- Multiple output parameters
**Minor:** Issues that are stylistic improvements
- Missing inline declarations
- String quotes instead of backticks
- Unnecessary ME-> references
- Formatting inconsistencies
## References
When you need detailed explanations or examples for specific Clean ABAP rules, consult these reference files:
1. **Complete Guidelines**: Read `@skills/clean-abap/references/CleanABAP.md` - the full Clean ABAP style guide with in-depth explanations, rationale, and code examples for all principles
2. **Quick Patterns**: Read `@skills/clean-abap/references/quick-reference.md` - condensed good/bad code examples for common patterns
3. **Review Checklist**: Read `@skills/clean-abap/references/checklist.md` - a checklist format for systematic code reviews
**When to consult references:**
- To provide accurate citations when explaining violations
- To show users the official reasoning behind recommendations
- To find specific code examples to illustrate points
- To answer follow-up questions about Clean ABAP principles
- When encountering edge cases not covered in the summary above
## Examples
### Example 1: Checking a Simple Method
**Input:**
```abap
METHOD calculate.
DATA: lv_result TYPE i,
lv_temp TYPE i.
lv_temp = iv_value1 + iv_value2.
IF lv_temp > 100.
lv_result = lv_temp * 2.
ELSE.
lv_result = lv_temp.
ENDIF.
ev_result = lv_result.
ENDMETHOD.
Output:
# Clean ABAP Check Results
## Summary
- Total Issues: 4
- Critical: 0
- Major: 2
- Minor: 2
## Major Issues
### Names - Hungarian Notation Used
**Location:** Method calculate
**Problem:** Variables use Hungarian notation prefixes (lv_, iv_, ev_) which adds no value and violates Clean ABAP naming guidelines.
**Recommendation:** Remove prefixes and use descriptive names.
**Anti-pattern:**
```abap
DATA: lv_result TYPE i,
lv_temp TYPE i.
Clean code:
DATA(result) = value1 + value2.
IF result > 100.
result = result * 2.
ENDIF.
Methods - EXPORTING Instead of RETURNING
Location: Method signature
Problem: Method uses EXPORTING parameter instead of RETURNING, preventing functional call style.
Recommendation: Use RETURNING parameter for single output value.
Anti-pattern:
METHOD calculate
IMPORTING iv_value1 TYPE i
iv_value2 TYPE i
EXPORTING ev_result TYPE i.
Clean code:
METHOD calculate
IMPORTING value1 TYPE i
value2 TYPE i
RETURNING VALUE(result) TYPE i.
Minor Issues
Variables - Up-front Declarations
Location: Lines 2-3
Problem: Variables declared up-front instead of inline, increasing distance between declaration and usage.
Recommendation: Use inline declarations with DATA( ).
Language - Procedural Style
Location: Lines 5-9
Problem: Could use COND for conditional assignment instead of IF-ELSE.
Recommendation: Use functional constructs.
Clean code:
METHOD calculate
IMPORTING value1 TYPE i
value2 TYPE i
RETURNING VALUE(result) TYPE i.
DATA(sum) = value1 + value2.
result = COND #( WHEN sum > 100 THEN sum * 2 ELSE sum ).
ENDMETHOD.
Overall Assessment
The code is functional but uses outdated ABAP patterns. Main improvements needed: remove Hungarian notation, use RETURNING instead of EXPORTING, prefer inline declarations, and use functional language constructs. After these changes, the code will be significantly cleaner and more maintainable.
---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/likweitan) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->
1---2name: clean-abap3description: Check ABAP code for compliance with Clean ABAP principles. Use this skill when users ask to check, validate, review, or analyze ABAP code for clean code compliance, code quality, best practices, or adherence to Clean ABAP guidelines. Triggers include requests like "check this ABAP code", "is this clean ABAP", "review my ABAP for clean code", "validate ABAP against clean code principles", or "analyze ABAP code quality". Use when this capability is needed.4---56# Clean ABAP78This skill provides comprehensive checking of ABAP code against Clean ABAP principles, based on the Clean ABAP style guide which adapts Robert C. Martin's Clean Code for ABAP.910## How to Use This Skill1112When checking ABAP code for Clean ABAP compliance:13141. **Read the code** provided by the user152. **Categorize issues** by Clean ABAP sections (Names, Language, Constants, Variables, Tables, Strings, Booleans, Conditions, Ifs, Classes, Methods, Error Handling, Comments, Formatting, Testing)163. **Identify violations** with specific line references when available174. **Provide actionable recommendations** with code examples showing both the problem and the clean solution185. **Prioritize issues** by impact (critical, major, minor)1920## Check Categories2122### 1. Names2324**Key Principles:**25- Use descriptive names that convey content and meaning26- Prefer solution domain and problem domain terms27- Use pronounceable names28- Use snake_case consistently29- Avoid abbreviations unless necessary30- Use nouns for classes, verbs for methods31- Avoid noise words like "data", "info", "object"32- Pick one word per concept33- Avoid encodings (Hungarian notation, prefixes like iv_, rv_, lt_)34- Avoid obscuring built-in functions3536**Check for:**37- Non-descriptive variable/method/class names (e.g., `data1`, `temp`, `x`)38- Inconsistent abbreviations across the code39- Mixed naming conventions (not snake_case)40- Noise words in names41- Hungarian notation or unnecessary prefixes (iv_, ev_, rv_, lt_, ls_)42- Method names that obscure ABAP built-in functions4344### 2. Language4546**Key Principles:**47- Prefer object orientation to procedural programming48- Prefer functional to procedural language constructs49- Avoid obsolete language elements50- Use design patterns wisely5152**Check for:**53- Use of obsolete statements (unescaped host variables in SELECT, etc.)54- Procedural code that should be object-oriented55- Use of old-style MOVE instead of assignment56- TRANSLATE instead of to_upper()/to_lower()57- CREATE OBJECT instead of NEW58- Old-style READ TABLE instead of table expressions5960### 3. Constants6162**Key Principles:**63- Use constants instead of magic numbers64- Constants need descriptive names65- Prefer ENUM to constants interfaces66- Group related constants6768**Check for:**69- Magic numbers or string literals in code70- Constants with non-descriptive names (c_01, c_x, etc.)71- Ungrouped constants that should be in BEGIN OF/END OF blocks7273### 4. Variables7475**Key Principles:**76- Prefer inline to up-front declarations77- Don't use variables outside their declaration block78- Don't chain up-front declarations79- Don't use field symbols for dynamic data access (modern ABAP)80- Choose the right loop targets (field symbols vs references vs values)8182**Check for:**83- Up-front DATA declarations when inline would be clearer84- Variables used outside their declaration block scope85- Chained DATA declarations86- Unnecessary field symbols with ASSIGN8788### 5. Tables8990**Key Principles:**91- Use the right table type (STANDARD, SORTED, HASHED)92- Avoid DEFAULT KEY93- Prefer INSERT INTO TABLE to APPEND TO94- Prefer LINE_EXISTS to READ TABLE or LOOP AT95- Prefer READ TABLE to LOOP AT96- Prefer LOOP AT WHERE to nested IF97- Avoid unnecessary table reads9899**Check for:**100- Tables with DEFAULT KEY101- APPEND TO when INSERT INTO TABLE is more appropriate102- READ TABLE ... TRANSPORTING NO FIELDS when LINE_EXISTS would be clearer103- LOOP AT ... EXIT when READ TABLE is intended104- Nested IF inside LOOP AT when WHERE clause would work105- Double reads (checking existence then reading again)106107### 6. Strings108109**Key Principles:**110- Use ` (backticks) to define string literals111- Use | (pipes) to assemble text112113**Check for:**114- Single quotes for string literals115- String concatenation with && instead of string templates116117### 7. Booleans118119**Key Principles:**120- Use ABAP_BOOL for boolean types121- Use ABAP_TRUE and ABAP_FALSE for comparisons122- Use XSDBOOL to set boolean variables123- Consider if booleans are the right choice (vs enumerations)124125**Check for:**126- Use of CHAR1 or other types instead of ABAP_BOOL127- Comparisons with 'X' and ' ' instead of ABAP_TRUE/ABAP_FALSE128- IF-THEN-ELSE to set boolean instead of XSDBOOL129- Boolean parameters that should be split methods130131### 8. Conditions132133**Key Principles:**134- Try to make conditions positive135- Prefer IS NOT to NOT IS136- Consider predicative method calls for boolean methods137- Consider decomposing/extracting complex conditions138139**Check for:**140- Negative conditions that could be positive141- NOT IS instead of IS NOT142- Complex nested conditions that should be decomposed143- Long conditions that should be extracted to methods144145### 9. Ifs146147**Key Principles:**148- No empty IF branches149- Prefer CASE to ELSE IF for multiple alternatives150- Keep nesting depth low151152**Check for:**153- Empty IF with logic only in ELSE154- Multiple ELSE IF that should be CASE155- Deeply nested IF statements (>3 levels)156157### 10. Classes158159**Key Principles:**160- Prefer objects to static classes161- Prefer composition to inheritance162- Don't mix stateful and stateless in same class163- Global by default, local only where appropriate164- FINAL if not designed for inheritance165- Members PRIVATE by default, PROTECTED only if needed166- Consider immutable instead of getter167168**Check for:**169- Static classes that should be instance-based170- Deep inheritance hierarchies171- Mixed stateful/stateless methods172- Non-FINAL classes not designed for inheritance173- PUBLIC members that should be PRIVATE/PROTECTED174- Unnecessary getter methods for immutable data175176### 11. Methods177178**Key Principles:**179- Prefer instance to static methods180- Public instance methods should implement interfaces181- Aim for few IMPORTING parameters (<3)182- Split methods instead of OPTIONAL parameters183- RETURN, EXPORT, or CHANGE exactly one parameter184- Prefer RETURNING to EXPORTING185- Do one thing, do it well, do it only186- Keep methods small (3-5 statements ideal)187- Fail fast188- Omit RECEIVING, EXPORTING keywords when possible189- Omit self-reference ME when calling instance members190191**Check for:**192- Static methods that should be instance methods193- Public methods not part of an interface194- Methods with >3 IMPORTING parameters195- Multiple OPTIONAL parameters (should be split methods)196- Multiple output parameters197- EXPORTING instead of RETURNING198- Long methods (>20 lines)199- Methods doing multiple things200- Unnecessary RECEIVING, EXPORTING keywords201- Explicit ME-> calls202203### 12. Error Handling204205**Key Principles:**206- Prefer exceptions to return codes207- Use class-based exceptions208- Throw CX_STATIC_CHECK for manageable exceptions209- Throw CX_NO_CHECK for unrecoverable situations210- Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE211- Wrap foreign exceptions212213**Check for:**214- Return codes instead of exceptions215- Use of message classes for error handling216- Old-style RAISE EXCEPTION TYPE217- Unwrapped foreign exceptions218- Catching generic CX_ROOT219220### 13. Comments221222**Key Principles:**223- Express yourself in code, not comments224- Comments are no excuse for bad names225- Write comments to explain why, not what226- Comment with ", not *227- Delete code instead of commenting it228- Use FIXME, TODO, XXX with your ID229- ABAP Doc only for public APIs230231**Check for:**232- Obvious comments explaining what code does233- Comments compensating for bad names234- Commented-out code235- * comments instead of "236- Comments without TODO/FIXME tags237- Manual versioning in comments238- Duplicate message texts in comments239240### 14. Formatting241242**Key Principles:**243- Use ABAP Formatter before activating244- No more than one statement per line245- Reasonable line length (120 chars)246- Single blank lines to separate (not more)247- Close brackets at line end248- Keep single parameter calls on one line249- Indent and snap to tab250251**Check for:**252- Multiple statements per line253- Lines exceeding 120 characters254- Multiple consecutive blank lines255- Inconsistent indentation256- Chained assignments257258### 15. Testing259260**Key Principles:**261- Write testable code262- Test publics, not private internals263- Use given-when-then structure264- Few, focused assertions265- Use the right assert type266267**Check for:**268- Untestable code (tight coupling, no dependency injection)269- Tests without clear given-when-then structure270- Multiple unrelated assertions271- Missing test classes for public methods272273## Output Format274275Structure your analysis as follows:276277```278# Clean ABAP Check Results279280## Summary281- Total Issues: [count]282- Critical: [count]283- Major: [count]284- Minor: [count]285286## Critical Issues287288### [Category] - [Issue Title]289**Location:** Line [X] / Method [name]290**Problem:** [Description of what violates Clean ABAP]291**Recommendation:** [How to fix it]292293**Anti-pattern:**294```abap295[problematic code]296```297298**Clean code:**299```abap300[improved code]301```302303## Major Issues304[Same format as Critical]305306## Minor Issues307[Same format as Critical]308309## Positive Observations310- [Things done well according to Clean ABAP]311312## Overall Assessment313[Brief summary of code quality and main areas for improvement]314```315316## Priority Levels317318**Critical:** Issues that significantly impact maintainability, testability, or could cause bugs319- Magic numbers without constants320- Deep nesting (>3 levels)321- Methods with >5 parameters322- Empty IF branches323- Static classes without interfaces324- Return codes instead of exceptions325326**Major:** Issues that reduce code clarity and violate Clean ABAP principles327- Non-descriptive names328- Hungarian notation/prefixes329- Long methods (>20 lines)330- DEFAULT KEY usage331- Commented-out code332- Multiple output parameters333334**Minor:** Issues that are stylistic improvements335- Missing inline declarations336- String quotes instead of backticks337- Unnecessary ME-> references338- Formatting inconsistencies339340## References341342When you need detailed explanations or examples for specific Clean ABAP rules, consult these reference files:3433441. **Complete Guidelines**: Read `@skills/clean-abap/references/CleanABAP.md` - the full Clean ABAP style guide with in-depth explanations, rationale, and code examples for all principles3452. **Quick Patterns**: Read `@skills/clean-abap/references/quick-reference.md` - condensed good/bad code examples for common patterns3463. **Review Checklist**: Read `@skills/clean-abap/references/checklist.md` - a checklist format for systematic code reviews347348**When to consult references:**349- To provide accurate citations when explaining violations350- To show users the official reasoning behind recommendations351- To find specific code examples to illustrate points352- To answer follow-up questions about Clean ABAP principles353- When encountering edge cases not covered in the summary above354355## Examples356357### Example 1: Checking a Simple Method358359**Input:**360```abap361METHOD calculate.362 DATA: lv_result TYPE i,363 lv_temp TYPE i.364 365 lv_temp = iv_value1 + iv_value2.366 IF lv_temp > 100.367 lv_result = lv_temp * 2.368 ELSE.369 lv_result = lv_temp.370 ENDIF.371 372 ev_result = lv_result.373ENDMETHOD.374```375376**Output:**377```378# Clean ABAP Check Results379380## Summary381- Total Issues: 4382- Critical: 0383- Major: 2384- Minor: 2385386## Major Issues387388### Names - Hungarian Notation Used389**Location:** Method calculate390**Problem:** Variables use Hungarian notation prefixes (lv_, iv_, ev_) which adds no value and violates Clean ABAP naming guidelines.391**Recommendation:** Remove prefixes and use descriptive names.392393**Anti-pattern:**394```abap395DATA: lv_result TYPE i,396 lv_temp TYPE i.397```398399**Clean code:**400```abap401DATA(result) = value1 + value2.402IF result > 100.403 result = result * 2.404ENDIF.405```406407### Methods - EXPORTING Instead of RETURNING408**Location:** Method signature409**Problem:** Method uses EXPORTING parameter instead of RETURNING, preventing functional call style.410**Recommendation:** Use RETURNING parameter for single output value.411412**Anti-pattern:**413```abap414METHOD calculate415 IMPORTING iv_value1 TYPE i416 iv_value2 TYPE i417 EXPORTING ev_result TYPE i.418```419420**Clean code:**421```abap422METHOD calculate423 IMPORTING value1 TYPE i424 value2 TYPE i425 RETURNING VALUE(result) TYPE i.426```427428## Minor Issues429430### Variables - Up-front Declarations431**Location:** Lines 2-3432**Problem:** Variables declared up-front instead of inline, increasing distance between declaration and usage.433**Recommendation:** Use inline declarations with DATA( ).434435### Language - Procedural Style436**Location:** Lines 5-9437**Problem:** Could use COND for conditional assignment instead of IF-ELSE.438**Recommendation:** Use functional constructs.439440**Clean code:**441```abap442METHOD calculate443 IMPORTING value1 TYPE i444 value2 TYPE i445 RETURNING VALUE(result) TYPE i.446 447 DATA(sum) = value1 + value2.448 result = COND #( WHEN sum > 100 THEN sum * 2 ELSE sum ).449ENDMETHOD.450```451452## Overall Assessment453The code is functional but uses outdated ABAP patterns. Main improvements needed: remove Hungarian notation, use RETURNING instead of EXPORTING, prefer inline declarations, and use functional language constructs. After these changes, the code will be significantly cleaner and more maintainable.454```455456---457> Converted and distributed by [TomeVault](https://tomevault.io/claim/likweitan) — claim your Tome and manage your conversions.458<!-- tomevault:4.0:skill_md:2026-04-11 -->