Wednesday, 8 June 2022

Get started with ABAP Programming from Scratch

In this blog post you will learn how to create package and how to write your first program.

How to Create Package

Once you login to the system, below screen will be open. On the left side of the screen there is command field. You can enter transaction code to go to any task of SAP application.

SE80 and SE38 are transaction code for ABAP editor.

Follow the below steps to create package.

Step 1: Enter SE80 transaction code in command field and press Enter.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 2: Select package from the drop-down list

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 3: Enter package name and press Enter.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 4: It will prompt you to create the package if the package with the same name is not present. Click on Yes.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 5: Give short description and press enter and package is created.

How to write program

 
Step 1: Once the package is created, right click on the package name. You will get the below options.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 2: Click on Create option. Once you click on it you will get options. Select Program option.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 3: Give the program name. Program name should start with Z or Y.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Step 4: Save it in your package. Once you save it you will get below screen. Here you can write your code.

Program to print Text


There is a keyword WRITE to print a text on output screen.

Syntax: Write ‘This is my first program’.

Write: It is a keyword to print text on output screen.

Whatever the text that we want to print on output screen must be inside the single quotation mark.

The statement is closed with period(.).

Note: Each statement must be closed with period(.).

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Once you write your code, you can check your code whether it is syntactically correct or not.

To check click on check button which is shown in below image.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Once you click on it will show you the error if it is present. If not, you will get the message like No syntax errors found in report.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Then you have to activate your program. To activate this, click on activate button.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Once your program is activated you can execute your program. Click on execute to run the program.

Note: Any changes if you done in your program then first you have to activate the program then run it. If the program is inactive then you will not be able to run your program. You can see that status just besides the report name.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Once you execute it, you will get the output.

SAP ABAP Programming, SAP ABAP, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Skills, SAP ABAP Development, SAP ABAP News

Here you have completed the first step into your learning SAP ABAP programming journey.

Source: sap.com

No comments:

Post a Comment