ERPClimb logoERPClimb
Login
All topics
ABAPBeginner

Modularization

Learn how to structure ABAP code using FORM routines, function modules, methods, includes, classes and reusable service design.

Overview

Learn how to structure ABAP code using FORM routines, function modules, methods, includes, classes and reusable service design.

Lessons in this topic

Interview questions covered

  • Report crashes because a FORM reads an uninitialised global variable. How do you prevent it?
  • How do you design a service layer for a large ABAP application?
  • Difference between FORM and METHOD in ABAP.
  • When would you use INCLUDE programs?
  • What is the cost of many small function-module calls in a loop?
  • How do you evolve a legacy function group into a service class without breaking callers?
  • What is a Function Module and when is it required?
  • Customer validation exists separately in three reports and one OData service. How do you move it into a class-based design?
  • A customer validation rule was written as a local class in one report. Now two other programs need it. What do you do?
  • The same delivery-block rule is coded separately in a report, a user exit and an OData service, and they now give different results. How do you fix this?
  • Users get a success message after saving a sales-related custom document, but the record is sometimes missing in the database. What could be wrong with the update logic?
  • A pricing routine uses several global variables and CHANGING parameters, and nobody knows which values it changes. How do you clean up its interface?
  • A delivery user exit in MV50AFZ1 contains several FORM routines sharing global variables, and a change caused wrong values in another FORM. How do you work safely here?
  • You need logic that a report uses, that an external system calls via RFC, and that runs in the update task. Would you use a FORM, a method or a function module?
  • A 6,000-line SD report with everything in START-OF-SELECTION is hard to change. How do you restructure it into maintainable modules?
  • A custom RFC-enabled function module is called by several external systems. What must you consider when changing it?
  • A pricing rule was copied into five reports. A defect was fixed in one of them, and the others still produce wrong prices. How do you prevent this happening again?
  • Where would you put business logic that must be reused by a report, a Fiori app and a BAPI?
  • When should you use a subroutine (FORM), a function module, and a method?

How to study Modularization

Modularization has 10 lessons (4 beginner, 3 intermediate, 3 advanced) with about 85 minutes of reading in total. Start with the lesson that matches your level, then read the real project scenario and common mistakes in each one before moving on. After the lessons, say the 19 interview questions out loud in your own words, then check yourself against the model answer in each question (shown once you open it). Use the 30 mock questions to check recall. Finish with the 1 code lab scenario: read the buggy code first, say what is wrong, and only then open the optimized version.

Mock test questions covered

Try answering each one before you open the mock test; the answer options and scoring are in the Mock Questions tab.

  • In MV50AFZ1, a custom global variable set in one FORM exit caused wrong values in another delivery. Best practice?
  • A method calculates exactly one value (a price). Which parameter kind makes it usable in expressions like IF calc( ) > 100?
  • A 6,000-line report is split into TOP, SEL and F01 includes. What has this achieved?
  • A custom RFC FM is used by several external systems. Which change is safe?
  • Which ABAP Unit class definition is correct for a test that does not change persistent data?
  • Which is the main benefit of modularizing an ABAP program into units with parameters?
  • In a classic report, which event block should mainly call the modules that read and process data?
  • How is a parameter passed with PERFORM calc USING lv_a CHANGING lv_b and FORM calc USING p_a CHANGING p_b handled by default?
  • What is the status of FORM routines for new ABAP development?
  • Which requirement still needs a function module rather than a class method?
  • What is the difference between a static method and an instance method?
  • Where is a local class visible?
  • What is the effect of IMPORTING VALUE(iv_qty) instead of IMPORTING iv_qty in a method?
  • When should you use a CHANGING parameter?
  • Why does ZCL_FLIGHT_BOOKING_SERVICE depend on the interface ZIF_FLIGHT_DAO rather than on ZCL_FLIGHT_DAO directly?

Code lab scenarios

  • Refactor legacy FORM to a testable methodOrder confirmation lives in a 300-line FORM that reads global variables and calls BAPIs. Rewriting it must not break callers.

Related topics

Interview questions on this topic