In this tutorials, you will learn what are the important pre requisites to create an ABAP program in SAP and how to create SAP ABAP program step by step.

Pre-requisites to create SAP ABAP Program

  1. Name: The program name of SAP Abap should start with a letter Z or Y because, A to X letters are reserved for SAP programs.
  2. Title: Under title, you need to update the description of an ABAP program.
  3. Type: Type of program – Executable program, Include Program, Module Pool Program, etc.
  4. Package: It refers to folder, where the SAP Abap program can be stored and created.

In real time scenarios, the packages are maintained as per modules and sub modules and not for individual programs.

How to Create an ABAP Program in SAP

Step 1: Enter the transaction code “SE38” in the SAP command field.

ADVERTISEMENT
ABAP program in sap transaction code

Step 2: ABAP Editor – Initial Screen appears on the screen. Now enter the following details

  • Program: Enter the name of program name in the given box.
  • Sub Objects: Choose the source code in the sub-objects.
  • Now click on create button to create a new SAP ABAP program.
SAP ABAP Editor initial screen

Step 3: A screen  “ABAP Program Attributes ZDEMO_ABAP_Program change” opens. Enter the following details.

  • Title: Update the title of ABAP program
  • Type: Update the type of program as “Executable Program” which can be tested independently.
  • After entering all the details for ABAP program, click on save icon
Create a abap program in SAP

Step 4: A pop up screen displays “create object directory entry ” click on the local object option.

In Real time, we never select as local object to save the ABAP program ( it is not transportable from development to quality and quality to production).

SAP ABAP program - local object

Now the ABAP Editor for the current program ZDEMO_ABAP_PROGRAM open as follows.

SAP ABAP Program Editor

Write the simple program as follows.

SAP ABAP Demo Program

After program source code is done, click on save icon or ctrl+s to save the ABAP program.

To check the ABAP source code syntax errors, press ctrl+ f2 or choose icon check

To activate the ABAP program, click on activate icon or ctrl+f3.

check ABAP program errors

After activating the program, you get the following screen. Now press enter to continue

Save ZDEMO ABAP Program in SAP

To run the ABAP program, press the function key F8 or click on the icon direct processing.

The output of an ABAP program displays as follows

Run ABAP Program in SAP

Successfully we have created new abap program in SAP and executed.