Information

Please visit our international page to see all the numbers matching your region.

First Steps in SAP ABAP - 2nd Edition

First Steps in SAP ABAP - 2nd Edition

Langue

English

Pages

139

Édition

2

Niveau

Débutant

ISBN

9783960121923

ISBN Imprimer

9783960121947

Livres numériques

ou accéder à l'ensemble du contenu

Taux forfaitaire

19 € par mois

  • Licence unique
  • Plus de 1000 livres électroniques et tutoriels vidéo
  • Accès instantané
  • 12 mois(228 €par an)
  • renouvellement automatique

Plus de détails

If you’re looking to master SAP ABAP (Advanced Business Application Pro- gramming), this book is your perfect starting point. Written in a clear and concise style, this guide takes you through the basics of SAP ABAP program- ming, helping you build a strong foundation. Many SAP professionals start their careers as programmers and focus on turning functional specifications into technical specifications and writing code. Learn how to write your own ABAP code step by step and progressively build your own ABAP application. This updated 2nd edition provides you with the tools you need to get started with a job as an SAP ABAP programmer, including new information on ABAP Development Tools (ADT).

  • Step-by-step instructions for beginners
  • Comprehensive descriptions and code examples
  • A guide to creating your first ABAP application
  • Tutorials that provide answers to the most commonly asked programming questions

Exemple de lecture

2.1 Using parameters as input variables

The statement PARAMETERS (always plural) is a simple way to allow users to provide input to a report that is stored in a variable. Specify the name of the parameter, its type, and if you would like, a default value:

PARAMETERS pa_name type c length 12 DEFAULT 'HUGO'. 

(In this example, we already used the type c for character which will be explained shortly, but yes: it is the type you expect it to be).

When you start the report, the system will display a simple input field with the given default value that you can overwrite, see Figure 2.1.

ABAP

Figure 2.1: A parameter as an input variable

The parameter serves as an input field and as a variable.

Now let’s use the input variable to make our welcome greeting a bit more personal, introducing chain statements as well:

 WRITE: 'Hello', pa_name. 

Chain statements

A chain statement combines several statements that use the same keyword into one statement that will be applied to several data objects. It requires a colon after the keyword (here: WRITE), and a comma between the data objects that the keyword applies to.

Did you try your own name with some lower-case letters and find that they were displayed as upper-case letters? You can use the keyword addition lower-case for the PARAMETERS keyword to account for lower-case letters. Note that this is not a conversion to lower case, but the permission for lower-case letters (omit the conversion to upper case).

The user interface (UI) in Figure 2.1 shows the name of the input variable, which is not always understandable to the user. If you consider that the length of a parameter name is restricted to eight characters, you may want to include more meaningful text.

You can provide additional text for this variable by using the menu Goto • Text Elements • Selection Texts. Enter Your name for the selection text of PA_NAME, as shown in Figure 2.2.

ABAP

Figure 2.2: Maintenance of text for a parameter variable

It is important to note that you have to activate the selection text in this view before returning to the coding of your report (by using F3).

If you chose to activate an object and you have more than one object in an inactive state, the system will display these objects in a list. This allows you to selectively activate some of the objects or all of them. In the following example, the report is inactive. When you activate the selection text, both objects are part of the list displayed: object REPS (S for source), and object REPT (T for text), see Figure 2.3.

ABAP

Figure 2.3: List of inactive objects

List of inactive objects

At a later stage of your ABAP development practice, you may come across a situation where the list of inactive objects is also shown, although it looks as if you have just one inactive object. Check the tab Transportable Objects to look for additional inactive objects. The transport of development objects is introduced and explained in Section 3.2.

The advantage of a selection text is that this text can be translated into other languages. If you choose a different language during logon, your report will show the text for the parameter in that language (assuming that the text has been translated into that language).

Selection texts and selection screen

The parameter text is called selection text because it specifies the data selection. An advanced report that reads data from the database will have the following sequence: first the selection criteria have to be specified by the user (PARAMETERS statement), then the database access uses the selection criteria, and then the selected data is displayed to the user.

The display of the selection texts is called the selection screen. The selection screen is assigned to the internal screen number 1000 and is covered in more detail in Section 7.3.

To summarize:

  • A PARAMETERS statement declares a local variable.
  • At the beginning of the report, the selection screen displays an input field, so that the user can specify the value of the variable.
  • The input field on the selection screen has a text label associated with it that can be translated.

Notations

  • K. Ieu

    25.50.2023

Support-Team

  • Pour plus d'aide, consultez notre documentation ou cliquez sur Chat.