How To Create 'Hello World' program in ABAP/4



Here's an example how to create your 'Hello World' program in ABAP/4.
  1. Select the menu path Tools->ABAP/4 Workbench From the R/3 main menu. A screen with the title ABAP/4 Development Workbench is displayed.
  2. Press the ABAP/4 Editor button on the application toolbar. The ABAP/4 Editor: Initial Screen is displayed.
  3. In the Program field, type the program name 0201.
  4. Press the Create button. The ABAP/4: Program Attributes screen is displayed. The fields containing question marks are required.
  5. Type My First ABAP/4 Program in the Title field. By default, the contents of this field will appear at the top of the list.
  6. Type 1 in the Type field. A 1 indicates the program is a report.
  7. Type an asterisk (*) in the Application field. The value in the Application field indicates to which application area this program belongs. The complete list of values can be obtained by positioning your cursor on this field and then clicking on the down-arrow to the right of it. For example, if this program belongs to Inventory management, you would put an L in the Application field. Since this is a simple test program, I have used an asterisk to indicate that this program does not belong to any particular application area.
  8. Tickmark the Editor Lock check box. Enabling Editor lock will prevent changes to the program by anyone other than the creator. For your exercises, tickmark this box to safeguard your programs from accidental modification by others. However, you should not use this to lock actual development programs. It will prevent other programmers from maintaining them later.
  9. To save the program attributes, press the Save button on the Standard toolbar. The Create Object Catalog Entry screen is displayed.
  10. Press the Local Object button. The program attributes screen is redisplayed. In the status bar at the bottom of the screen, the message "Attributes for program saved" appears. (Note: the message you see will contain the program name too, but since this name will vary for each user, it is left out of the text in the book. This convention of leaving the development object name out of the message will be carried throughout the book.)
  11. Press the Source Code button on the application toolbar. The ABAP/4 Editor: Edit Program screen is displayed.
  12. Choose the menu path Settings->Editor Mode. The Editor: Settings screen is displayed.
  13. Choose the radio button PC Mode With Line Numbering.
  14. Choose the radio button Lower Case.
  15. Press the Copy button (the green check mark). You have now saved your editor settings. (Editor settings only need to be set once.)
  16. Look at line 1. If it does not contain the statement report 0201., type it now, as shown in Listing 2.1.
  17. On line 2, type write 'Hello SAP world'. Use single quotes and put a period at the end of the line.
  18. Press the Save button on the Standard toolbar.
  19. To execute your program, choose the menu path Program->Execute. A screen with the title My First ABAP/4 Program is displayed, and the words Hello SAP world are written below it. This is the output of the report, also known as the list.

Ranking: 5