DAY-10: PARAMETERS, SELECT-OPTIONS & DATATYPES in SAP ABAP

On a journey of continuous learning π I share the concepts I learn daily through blogs. Learn concepts with me β one topic at a time.
#LearningInPublic #ContinuousLearning
Today we move into core ABAP programming fundamentals.
If you understand Day-10 clearly, you can write basic SAP reports confidently.
We will cover:
β Datatypes
β Variables
β TYPES (Structure creation)
β Internal Tables
β PARAMETERS
β SELECT-OPTIONS
β LOOP
β IF Conditions
β BREAK-POINT
β Input & Output
β Selection Screen Frames
Everything explained in simple language π
1οΈβ£ What is a Datatype in ABAP?
A datatype defines what kind of data a variable can store.
Think like this:
iβ Whole numbers (10, 20, 100)stringβ Textpβ Decimal numbers (money)abap_boolβ True / False
Basic Datatypes Example
DATA: gv_text TYPE string, "Stores text
gv_count TYPE i, "Stores integer numbers
gv_price TYPE p DECIMALS 2, "Stores decimal values
gv_flag TYPE abap_bool. "True or False
Explanation:
| Variable | Datatype | Purpose |
| gv_text | string | Stores text |
| gv_count | i | Stores numbers |
| gv_price | p | Stores currency |
| gv_flag | abap_bool | Boolean value |
2οΈβ£ Creating a File Name Variable
DATA: gv_filename TYPE string.
gv_filename = '/usr/sap/tmp/flight_data.txt'.
This stores a file path.
Used in:
File upload
File download
Application server file handling
3οΈβ£ TYPES β Creating Custom Structure
In ABAP, TYPES is used to create a structure.
Structure = Group of fields.
Example:
TYPES: BEGIN OF ty_flight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
price TYPE sflight-price,
END OF ty_flight.
Explanation:
sflightβ Standard SAP flight tableWe are copying its field definitions
Ensures datatype consistency
4οΈβ£ Internal Table & Work Area
Internal Table = Stores multiple rows
Work Area = Stores one row
DATA: it_flight TYPE STANDARD TABLE OF ty_flight,
wa_flight TYPE ty_flight.
| Object | Meaning |
| it_flight | Internal table |
| wa_flight | Work area |
5οΈβ£ PARAMETERS & SELECT-OPTIONS
These create input fields on selection screen.
PARAMETERS
Used for single input.
PARAMETERS: p_carr TYPE sflight-carrid.
User enters one airline.
Example input:
LH
SELECT-OPTIONS
Used for range input.
SELECT-OPTIONS: s_price FOR sflight-price.
User can enter:
Single value
Multiple values
Range (100 to 500)
Exclude values
Example:
100 β 800
6οΈβ£ Selection Screen Frame
To group fields:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_max TYPE i DEFAULT 5.
SELECTION-SCREEN END OF BLOCK b1.
Creates a box around selection fields.
7οΈβ£ BREAK-POINT (Debugging)
BREAK-POINT.
Stops program execution for debugging.
Used in:
Testing
Error checking
8οΈβ£ SELECT Statement (Database Fetch)
SELECT carrid
connid
price
FROM sflight
INTO TABLE it_flight
UP TO p_max ROWS
WHERE carrid = p_carr
AND price IN s_price.
What happens here?
Fetch data from SFLIGHT
Apply filter
Store in internal table
| Clause | Meaning |
| INTO TABLE | Store data |
| UP TO p_max ROWS | Limit records |
| WHERE | Apply condition |
9οΈβ£ LOOP Processing
LOOP AT it_flight INTO wa_flight.
Reads internal table row by row.
π IF Condition
IF wa_flight-price > 500.
gv_flag = abap_true.
ELSE.
gv_flag = abap_false.
ENDIF.
Simple logic:
If price > 500 β True
Else β False
1οΈβ£1οΈβ£ WRITE (Output)
WRITE: / wa_flight-carrid,
wa_flight-connid,
wa_flight-price,
gv_flag.
/ β New line
Displays output in classic list format.
1οΈβ£2οΈβ£ System Function Example
WRITE: / 'Total Records:', lines( it_flight ).
lines( ) returns number of rows.
π§ Complete Beginner Version of Code
Here is the full clean program:
REPORT z_abap_all_basics_demo.
* Variables
DATA: gv_flag TYPE abap_bool.
* Structure
TYPES: BEGIN OF ty_flight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
price TYPE sflight-price,
END OF ty_flight.
* Internal table
DATA: it_flight TYPE STANDARD TABLE OF ty_flight,
wa_flight TYPE ty_flight.
* Selection screen
PARAMETERS: p_carr TYPE sflight-carrid.
SELECT-OPTIONS: s_price FOR sflight-price.
* Fetch data
SELECT carrid connid price
INTO TABLE it_flight
FROM sflight
WHERE carrid = p_carr
AND price IN s_price.
* Loop
LOOP AT it_flight INTO wa_flight.
IF wa_flight-price > 500.
gv_flag = abap_true.
ELSE.
gv_flag = abap_false.
ENDIF.
WRITE: / wa_flight-carrid,
wa_flight-connid,
wa_flight-price,
gv_flag.
ENDLOOP.
WRITE: / 'Total Records:', lines( it_flight ).
π― Final Understanding
| Concept | Simple Meaning |
| Datatype | Type of data |
| TYPES | Create structure |
| Internal Table | Multiple rows |
| Work Area | Single row |
| PARAMETERS | Single input |
| SELECT-OPTIONS | Range input |
| LOOP | Read table |
| IF | Condition |
| WRITE | Display |
| BREAK-POINT | Debug |
π Real-World Usage
Used in:
Reports
ALV
Data filtering
Custom SAP programs
Business reporting



