Skip to main content

SAP ABAP Development First Program Tutorial – Step-by-Step Guide to tcode SE38, WRITE Statements & Basic ABAP Concepts

SAP ABAP First Program – Complete Beginner

Welcome to Day 1 of your SAP ABAP learning journey.
This tutorial will guide you step-by-step to create your first ABAP program in SE38, understand basic ABAP syntax, and write simple output programs.

๐Ÿ—“️ Day 1: Introduction to SAP ABAP & SE38 Basics

๐ŸŽฏ Learning Objectives

  1. Understand what ABAP is
  2. Navigate and use SE38 (ABAP Editor)
  3. Create, activate, and execute a simple report
  4. Learn WRITE, comments, variables, constants
  5. Understand basic system fields (SY-fields)
  6. Work with simple arithmetic programs

๐Ÿ“˜ 1. What is ABAP?

ABAP (Advanced Business Application Programming) is SAP’s primary programming language used to build:

  1. Reports
  2. Interfaces
  3. Enhancements
  4. SmartForms
  5. Data conversion programs

๐Ÿ”ง 2. What is SE38?

T-CODE SE38 is the ABAP Program Editor used to:

  1. Create programs
  2. Edit code
  3. Activate and execute
  4. Debug
  5. View output.

SAP ABAP SE38 SCREEN

๐Ÿ–ฅ️ 3. How to Create Your First ABAP Program in SE38

Step-by-Step

  1. Go to transaction SE38

  2. Enter program name → Z_HELLO_ABAP

  3. Click Create

  4. Enter:

    • Title: My First ABAP Program

    • Type: Executable Program

  5. Choose package or use $TMP

  6. Write the program code

  7. Click Activate (Ctrl + F3)

  8. Click Execute (F8)

Example 1: Hello World Program

REPORT z_hello_abap. WRITE 'Hello World from ABAP!'.

Example 2: Multiple Lines with WRITE

REPORT z_write_example. WRITE: / 'Welcome to ABAP!', / 'Today is', sy-datum, / 'Current user:', sy-uname.

✔ Explanation

  1. / → new line
  2. sy-datum → current date
  3. sy-uname → current user


Example 3: Simple Arithmetic

REPORT z_add_numbers. DATA: num1 TYPE i VALUE 10, num2 TYPE i VALUE 20, result TYPE i.
result = num1 + num2.

WRITE: 'Result:', result.

๐Ÿ” 5. Important Basic Commands

ABAP Keyword / Command

Description / Meaning

REPORT
Declares an executable program
WRITE
Displays output on the screen
DATA
Declares variables
CONSTANTS
Declares fixed values
*
Comment line indicator
SY-UNAME
System field – current logged-in user


Day 2: Variables, Data Types & Parameters

๐ŸŽฏ Learning Objectives

Understand data types
Declare variables
Use constants
Take input using PARAMETERS
Perform operations


๐Ÿงพ 1. Common Data Types

TypeMeaningExample
IInteger100
CCharacters'ABAP'
NNumeric text'12345'
DDate'20250101'
TTime'101500'
FFloat15.23
STRINGVariable text'Hello'

๐Ÿ”ง 2. Variable Declaration

DATA: num1 TYPE i. DATA: name TYPE char25. DATA: city TYPE string VALUE 'Dubai'.

๐Ÿ”ง 3. Constant Declaration

CONSTANTS: n1 TYPE i VALUE 20. CONSTANTS: c_country TYPE c LENGTH 3 VALUE 'USA'.

๐Ÿ”ง 4. PARAMETERS – User Input

PARAMETERS: p_name TYPE string, p_age TYPE i.

Example 1: Display Variables

REPORT z_day2_variables_1. DATA: lv_name TYPE string VALUE 'LUCKY', lv_age TYPE i VALUE 32. WRITE: / 'Name:', lv_name, / 'Age :' , lv_age.

Example 2: Constants + Area Calculation

REPORT z_day2_constants. CONSTANTS: pi TYPE p DECIMALS 2 VALUE '3.14'. DATA: radius TYPE p DECIMALS 2 VALUE 5, area TYPE p DECIMALS 2. area = pi * radius * radius. WRITE: / 'Radius:', radius, / 'Area of Circle:', area.

Example 3: User Input Using PARAMETERS

REPORT z_day2_parameters. PARAMETERS: p_name TYPE string, p_city TYPE c LENGTH 15. WRITE: / 'Welcome', p_name, 'from', p_city.

Example 4: Arithmetic Using PARAMETERS

REPORT z_day2_arithmetic. PARAMETERS: p_num1 TYPE i, p_num2 TYPE i. DATA: lv_sum TYPE i, lv_diff TYPE i, lv_mult TYPE i, lv_div TYPE f. lv_sum = p_num1 + p_num2. lv_diff = p_num1 - p_num2. lv_mult = p_num1 * p_num2. IF p_num2 <> 0. lv_div = p_num1 / p_num2. ENDIF. WRITE: / 'Sum:', lv_sum, / 'Difference:', lv_diff, / 'Product:', lv_mult, / 'Division:', lv_d.

NOTE : You want to learn about SAP ABAP control statement
please click the below.

Current date


Comments

Popular posts from this blog

SAP ABAP SE11 Data Dictionary Tutorial | Step-by-Step Explanation with Real-Time Examples

    SAP ABAP Data Dictionary (SE11) – Complete Guide to Tables, Views, Domains & Data Elements    What is the ABAP Data Dictionary? The SAP ABAP data dictionary serves as a primary and structured source of data for creating objects. It is an independent database DDL (Data Definition Language) that primarily deals with creating, editing, and dropping database tables. The data dictionary allows you to define and maintain database-related items. The ABAP data dictionary is readily connected with the ABAP workbench, allowing all of the workbench's components to simply access the definitions contained in the dictionary. Functions of Data Dictionary The important functions of data dictionary objects are as follows. 1. Database tables 2. Domains 3. Data elements 4. Views 5. Search helps 6. Lock Objects 1. Database Tables: –  Database tables are collections of fields that store physical data. It is an object that holds data in the form of rows and columns. So databa...

SAP ABAP ALV Report Using REUSE_ALV_GRID_DISPLAY – Complete Tutorial with Examples

  ๐Ÿ“˜ SAP ABAP ALV Report Using REUSE_ALV_GRID_DISPLAY – Complete Step-by-Step Guide (With Real Examples) SAP ABAP developers frequently use ALV (ABAP List Viewer) to present data in a clean and interactive format. One of the most commonly used ALV function modules in classical reporting is: This function module allows developers to create professional ALV reports with features such as sorting, filtering, totals, layout saving, and exporting to Excel. In this guide, I will explain: What REUSE_ALV_GRID_DISPLAY is How field catalogs work How to build an ALV report using MARC and KNA1 tables Real-time business examples Clean, fully working ABAP code This post is written from my personal learning and hands-on experience while working on SAP ABAP reports. ๐Ÿงฉ What is REUSE_ALV_GRID_DISPLAY? REUSE_ALV_GRID_DISPLAY is a function module-based ALV used in SAP ECC and compatible with S/4HANA systems. It displays internal table data in a grid-style output , which is more user...

SAP ABAP Control Break Statements – Complete Guide with AT FIRST, AT NEW & AT END OF Examples

๐Ÿ“˜ SAP ABAP Control Break Statements – Complete Guide with Example Learn about Control Break Statements in SAP ABAP including AT FIRST, AT NEW, AT END OF, AT LAST, and ON CHANGE OF. Includes a real-time example program with explanation and output. Perfect for SAP ABAP beginners and developers. SAP ABAP Control Break Statements AT NEW ABAP example AT END OF ABAP tutorial ABAP loop control SAP ABAP report programming AT FIRST, AT LAST in ABAP SAP ABAP internal table sorted ๐Ÿ“˜ Introduction In SAP ABAP , control break statements are used to trigger events inside a loop . They are essential for creating grouped or hierarchical reports , especially when working with sorted internal tables. There are 5 main control break statements in ABAP: AT FIRST – ENDAT AT NEW – ENDAT AT END OF – ENDAT AT LAST – ENDAT ON CHANGE OF FIELD. SAP ABAP Loop Control Tutorial:  How to Use AT NEW, AT END OF, AT FIRST, AT LAST, & ON CHANGE OF  FIELD. ๐Ÿง  Key Control Break Statements Explai...