Video Lesson 7.5: ABAP Include Programs

Learn ABAP

Video Lesson 7.5: ABAP Include Programs

This lesson will show you how to create INCLUDES in your ABAP programs so you can reference other subroutines and organize your programs in a more efficient way.

  • Include programs are global R/3 Repository objects.
  • They are solely for modularizing source code, and have no parameter interface.
  • They have the following functions:
  • Library: Include programs allow you to use the same source code in different programs.
  • Order: Include programs allow you to manage complex programs in an orderly way.
  • Function groups and module pools use include programs to store parts of the program that belong together.
  • A special include is the TOP include of a program.

Creating Your Own Include Programs

  • If you create an include program yourself, you must assign it the type I in its program attributes.
  • You can also create or change an include program by double-clicking on the name of the program after the INCLUDE statement in your ABAP program.
  • If the program exists, the ABAP Workbench navigates to it.
  • If it does not exist, the system creates it for you.
  • An include program cannot run independently, but must be built into other programs.
    Include programs can contain other includes.




Video Lesson 7.4: SAP Implementing A Subroutine Call

Learn ABAP

Video Lesson 7.4: SAP Implementing A Subroutine Call

This lesson will show you how to implement a subroutine call in your ABAP program.

  • You can have the PERFORM statement for calling a subroutine generated into your source code.
  • First, define the subroutine and then save your main program.
  • The newly-defined subroutine appears in the navigation area.
  • Move it to the required call point in your program by means of drag & drop.
  • Alternatively, the call generation can also be implemented using the “Pattern” pushbutton in the ABAP editor.

 




Video Lesson 7.3: ABAP Table Types

Learn ABAP

Video Lesson 7.3: ABAP Table Types

You will learn how to create a table type object in the ABAP dictionary, this can be re-used in different programs to declare table type variables.

Table Types

  • Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary.
  • When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key.
  • The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table
  • In an ABAP program, you can use the TYPE addition to refer directly to a table type. ->

Visibility of Global and Local Data Objects

  • Variables defined in the main program are global data objects.
  • They are visible (can be addressed) in the entire main program in every subroutine called.
  • Variables defined within a subroutine are called local, as they only exist in the relevant subroutine - just like the formal parameters.
  • The formal parameters and local data objects of a subroutine can not have the same names.




Video Lesson 7.2: Parameter Passing – Structures And Internal Tables

In this lesson you will learn how the interface of a subroutine is used to pass parameters and how the different transfer types are used.

  • You can address all (global) variables defined in the main program from a subroutine.
  • But, in order to call up a subroutine for a specific situation with different data objects for each situation, you do not use global variables in the subroutine but placeholders.
  • These placeholders are called formal parameters.
  • They form the interface of the subroutine, which has to be declared when the subroutine is defined.
  • When the subroutine is called, formal parameters must be specialized by means of corresponding global variables (actual parameters)
  • This assignment of actual parameters to formal parameters when calling a subroutine is called parameter passing.

The way these variables of the main program are passed to the formal parameters of the subroutine is called passing type and is specified for each parameter in the interface of the subroutine.

There are three passing types:

  • Call by Value
  • Call by value and result
  • Call by reference

Video Lesson 7.1: ABAP Subroutines and procedures

Learn ABAP

Video Lesson 7.1: ABAP Subroutines and procedures

In this lesson you will learn why subroutines make sense and how you can use them in your ABAP programs. Furthermore, you will learn how the interface of a subroutine is used to pass parameters and how the different transfer types are used. This is only a brief introduction to the tools.

Using Subroutines

  • A subroutine is a modularization unit within the program where a function is encapsulated in the form of source code.
  • You page out a part of a program to a subroutine to get a better overview of the main program and to use the corresponding sequence of statements several times.
  • Using subroutines makes your program more function-oriented: it splits the program's task into subfunctions, so that each subroutine is responsible for one subfunction.
  • Using subroutines also means that your program becomes easier to maintain as changes to functions often only have to be implemented in the subroutine.->