SAP S/4
ABAP Programming
for non-Technical Users
Create ABAP Program with
Simple Selection Screen
a look at ABAP syntax
PARAMETERS, NEW-LINE,
and WRITE
Write an ABAP program to request INPUT from User and upon F8 (execute) to return the results below
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
The sequence of
is important
whenever
Enter Program name and
click Create
(note, Program name should start with character
Y or Z)
new Package can be defined in SE80 (Object Navigator)
An ABAP package is a transportable ABAP repository object that groups development objects (reports, transactions, and function modules etc) of an ABAP system.
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
the Program is set with “Inactive” status at the beginning
2 defaulted sections:
This is the Documentation Area (not executable) and starts with *&
2 defaulted sections:
Program Name behind the word REPORT
Syntax
PARAMETERS variable_name TYPE [variable type].
Definition
Full-stop is required at the END of a Statement.
Syntax
WRITE: ‘text string’, variable_name.
Definition
Syntax
NEW-LINE.
Definition
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
Perform
Syntax Check. (any code errors will show as RED in the bottom segment of the screen).
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
SAVE. (or Activate & SAVE).
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
ACTIVATE is necessary for any changes in the Source Code and Text Elements.
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
DIRECT PROCESSING is to Execute the Program
user input
Execute
click BACK twice to return to the Editor
Results as expected
at end of Line 3, press Enter to add a line
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
at the new line 4, enter ‘*&’
meaning comment line (which is not evaluated for syntax correctness)
Type whatever documentation text
with cursor on end of line 11,
press ENTER
5 times to insert
5 empty lines
note 5 lines inserted,
this is just for more documentation
enter the Comment lines as needed (starts with *&)
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
Before next segment, these 3 steps were done
new
T-code
with input/selection screen
T-code
Text
the new Program name
SAVE
SAP GUI for the HTML, Java, and Windows Environment where this Program can be executed.
Add the new t-code to the Favorite via Right click and select “Insert Transaction”.
Perform some settings in the ABAP Editor for coding assistance …
click this to made changes in the Settings
just click on line 1 (note the color of the current line cursor on is white)
In the “Fonts and Colors” Options, note in the Display Items “Current line” “Item Background” is now WHITE as check in the previous screen. (note this is not the text but the SPACE of the line).
change it
to GREEN
change the FONT size from 10 to 12
preview of the Background Color of “Current line” and Size is 12
example of Non-Keywords are like the field z_age
Switch on “Suggest Non-Keywords (example are like variables) from the Text”,
eg: when entering new code like example the character “z_”; the system will suggest “z_age” and any other words in the program that contain “z_”....
when entering up to 2 characteristics, system will show hints eg: keywords entered
system will hide the Key word after 3000 msec
When type keywords of 5 or less character, the system will show HINT of a possible keyword in the dictionary but remain 9000 msec before it is hidden
note the cursor is now on Line 26, the Background color of the “Current line” is now GREEN
Font size is now 12 instead of 10
when typing 5 or below characters, the system will suggest ABAP syntax keyword (note yellow above ‘para’ shows the PARAMETERS syntax suggestion) and remain for 9000 ms until it is hidden… user can press TAB and system will append the entire keyword
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
note yellow above ‘para’ as the word ‘para’ is typed, user can just TAB to fill up the suggested keyword automatically.
current version S/4 2022, field character max size is 8 for PARAMETER syntax
z_country is 9 characters
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
SYNTAX check
change
z_from to
z_city
change
z_country to z_from
change
z_from to
z_city
Close
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
note as z_ is typed (current line GREEN), system suggest z_from (which is a non-keyword), user can click TAB to auto fill the variable z_from
also amended some documentation)
system will OUTPUT
the z_from value entered
and follow up with a dot.
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
Syntax
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
Save
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
Activate
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation
You can test run in SE38 as well
Write ABAP code
Syntax Check
Save
Activate
Test
Change ABAP code
Write Documentation