Basic Syntax and Screen Navigation in SAP ABAP
Basic Syntax and Screen Navigation in SAP ABAP
To understand SAP ABAP screen navigation and basic syntax , we should have basic knowledge of how to log into sap system, ABAP Editor and how to Logout and from SAP system. I hope this post helpful for new ABAP learners to understand sreen navigation and the standard toolbar functionality and basic systax of ABAP programming.
How to log in into SAP system
First of all, we log on to SAP server, then SAP login screen will ask for client,User ID , Password and language details. We have to provide a valid client, user ID and Password and language and press Enter .
ABAP Screen Navigation
Menu Bar: Menu bar is the top line of dialog window.
Standard Toolbar: Most standard functions such as Top of Page, End of Page, Page Up, Page Down and Save are available in this toolbar.
Title Bar: Title Bar displays the name of the application/business process you are currently in.
Application Toolbar: Application specific menu options are available here.
Command Field: We can start an application without navigating through the menu transactions and some logical codes are assigned to business processes. Transaction codes are entered in the command field to directly start the application.
Standard Keys and Icons Exit keys are used to exit the program/module or to log off. They are also used to go back to the last accessed screen.
Following are the options for checking, activating and processing the reports.
Log Off It’s always a good practice to Exit from your ABAP Editor or/and logoff from the SAP system after finishing your work.
Statements in ABAP
ABAP source program consists of comments and ABAP statements. Every statement in ABAP begins with a keyword and ends with a period, and ABAP is a not case sensitive.
The first uncomment line in a program begins with the word REPORT. The Report will always be the first line of any executable program created. The statement is followed by the program name which was created previously. The line is then terminated with a full stop.
The syntax is:
REPORT programme name.
Statements..
...............
This allows the statement to take up as many lines in the editor as it needs.Statements consist of a command and any variables and options, ending with a period. As long as the period appears at the end of the statement, no problems will arise. It is this period that marks where the statement finishes.
Let’s write the code.
On the line below the REPORT statement, just type this statement: Write ‘ABAP Tutorial’.
REPORT Z_learn_01.
Write 'New ABAP learner'.
Four things to consider while writing statements:
The write statement writes whatever is in quotes to the output .
The ABAP editor converts all text to uppercase except text strings, which are surrounded by single quotation marks.
Unlike some older programming languages, ABAP does not care where a statement begins on a line. You may take advantage of this and improve the readability of your program by using indentation to indicate blocks of code.
ABAP – Basic Syntax
ABAP has no restrictions on the layout of statements. That is, multiple statements can be placed on a single line, or a single statement may stretch across multiple lines.
Colon Notation Consecutive statements can be chained together if the beginning of each statement is identical. This is done with the colon (:) operator and commas, which are used to terminate the individual statements, much as periods end normal statements.
WRITE 'Hello'.
WRITE 'ABAP'.
WRITE 'World'.
Using the colon notation, it could be rewritten this way:
WRITE: 'Hello',
'ABAP',
'World'.
Like any other ABAP statement, the layout doesn’t matter. This is an equally correct statement:
WRITE: 'Hello', 'ABAP', 'World'.
Comments
Inline comments may be declared anywhere in a program by one of the two methods:
Full line comments are indicated by placing an asterisk (*) in the first position of the line, in which case the entire line is considered by the system to be a comment. Comments don’t need to be terminated by a period because they may not extend across more than one line:
* This is the comment line
Partial line comments are indicated by entering a double quote (") after a statement. All text following the double quote is considered by the system to be a comment. You need not terminate partial line comments by a period because they may not extend across more than one line:
WRITE 'Hello'. "Here is the partial comment
Note: Commented code is not capitalized by the ABAP editor.
Suppressing Blanks
The NO-ZERO command follows the DATA statement. It suppresses all leading zeros of a number field containing blanks. The output is usually easier for the users to read.
Example
REPORT Z_learn.
DATA: number(10) TYPE N. MOVE 20 TO number. WRITE number to NO-ZERO.
The above code produces the following output:
20
Note: Without ZERO command, the output is: 0000000020
Blank Lines
The SKIP command helps in inserting blank lines on the page.
Example The message command is as follows:
WRITE 'it is the one line'.
SKIP.
WRITE 'it is the two line'.
The above message command produces the following output:
This is the one line
This is the two line
We may use the SKIP command to insert multiple blank lines.
SKIP number_of_lines.
The output would be several blank lines defined by the number of lines. The SKIP command can also position the cursor on a desired line on the page.
SKIP TO LINE line_number.
This command is used to dynamically move the cursor up and down the page. Usually, a WRITE statement occurs after this command to put output on that desired line.
Inserting Lines in ABAP syntax
The ULINE command automatically inserts a horizontal line across the output. It’s also possible to control the position and length of the line. The syntax is pretty simple:
ULINE.
Example
The message command is as follows:
WRITE 'it is Underlined'.
ULINE.
The above code produces the following output:
It is Underlined .
Messages
The MESSAGE command displays messages defined by a message ID specified in the REPORT statement at the beginning of the program. The message ID is a 2 character code that defines which set of 1,000 messages the program will access when the MESSAGE command is used.
The messages are numbered from 000 to 999. Associated with each number is a message text up to a maximum of 80 characters. When message number is called, the corresponding text is displayed.
Following are the characters for use with the Message command:
Message Type Consequences
E Error The message appears and the application stops at its current point.
W Warning the message appears and the user must press Enter for the application run
I Information A pop-up window opens with the message text and the user Enter to run.
A Abend This message class cancels the transaction that the user is currently using.
ReplyDeleteLooking for the best SAP SCM Training in Bangalore, then don't delay join IntelliMindz SAP SCM Training in Bangalore. Join our SAP SCM training to get hands-on training and practice in SAP SCM Software. Any Queries call @ 9655877677. IntelliMindz is the best IT Training Institute in Bangalore with placement, offering 200 and more software courses with 100% Placement Assistance.
SAP SCM in Bangalore
SAP SCM in Chennai
SAP SCM Online Course
Looking for the best SAP ARIBA Training in Bangalore, then don't delay join IntelliMindz SAP ARIBA Training in Bangalore. Join our SAP ARIBA training to get hands-on training and practice in SAP ARIBA Software. Any Queries call @ 9655877677. IntelliMindz is the best IT Training Institute in Bangalore with placement, offering 200 and more software courses with 100% Placement Assistance.
ReplyDeleteSAP ARIBA Course in Bangalore
SAP ARIBA Course in Chennai
SAP ARIBA Online Course