Uploaded by dallelm

SAP ABAP basic programming class 2

advertisement
Types of messages
Types of messages

1.
2.
3.
4.
5.
There are 5 types of messages.
Information message.
Status message.
Warning message.
Error message.
Abort Message.
Source Code
PARAMETERS :
CASE
MESS TYPE
C.
MESS.
WHEN 'E'.
MESSAGE 'THIS IS ERROR MESSAGE' TYPE 'E'.
WHEN 'W' .
MESSAGE 'THIS IS WARNING MESSAGE' TYPE 'W'.
WHEN
'I'.
MESSAGE 'THIS IS INFORMATION MESSAGE' TYPE 'I'.
WHEN 'S'.
MESSAGE 'THIS IS
STATUS MESSAGE' TYPE 'S'.
WHEN 'A'.
MESSAGE 'THIS IS ABORT MESSAGE' TYPE 'A'.
ENDCASE.
or
PARAMETERS : MESS TYPE C.
CASE MESS.
WHEN 'I'.
MESSAGE I000(ZMESSTAB).
WHEN 'W'.
MESSAGE W001(ZMESSTAB).
WHEN 'S'.
MESSAGE S002(ZMESSTAB).
WHEN 'A'.
MESSAGE A003(ZMESSTAB).
WHEN 'E'.
MESSAGE E004(ZMESSTAB).
ENDCASE.
1. Information message ( I ).
1.
2.
Message will be displayed in pop-up box.
Allows to re-enter the input.
Input
Enter input as 'I'.
Output
2.Status message ( S ).
Input
1.
Status message are used to display successful operation of previous statements.
2.
Status message shows successful in green - color at status bar.
Output
3.Error Message ( E )
Input
1.
Used to display error messages.
2.
3.
4.
It shows error messages in red-color at status bar.
It doesn't allow you re-enter the input value.
Further Execution of program will stop.
Output
4.Warning message ( W ).
Input
1.
It is used to display warning messages.
2.
3.
It shows warning-message in yellow-color at status bar.
Further execution of program will continue .
5.Abort message ( A )
1.
It shows abort message in pop-up dialog box with Exit button option.
2.
Once you clicked on Exit button , it closes the current transaction.
3.
Operation will be terminated.
Input
Output
Parameters
Parameters

Used to provide the single input.

Keyword: Parameters .
1.
2.
3.
Go to transaction code : SE38 (ABAP Editor ).
Enter the program name Z or Y<program name>.
Select the type executable program.
Ex :
Steps :
Source code
PARAMETERS : NAME(20) TYPE C.
WRITE : / NAME.
Input
Output
Structures
Structures

The structure is a combination of different variables or data types.

Structures do not hold memory. But it holds memory only at runtime.
Syntax :
types : Begin of <structure name>,
----------End of <structure name>.
Ex :
Steps :
1.
2.
3.
4.
Go to transaction code SE38.
Enter program name Z or Y<program name>.
Select Attributes type as an Executable program.
Click on save.
Source Code
Types: BEGIN OF TY_STR,
NAME(12) TYPE C,
AGE TYPE I,
PLACE(20) TYPE C,
END OF TY_STR.
Work Area
Work Area

Area.
A variable which has been declared with reference of the structure is Know as Work
DATA : <Work Area name > type <structure name or table structure name>.
Ex :
Source Code
Types : BEGIN OF TY_STR,
NAME(12) TYPE C,
AGE TYPE I,
PLACE(20) TYPE C,
END OF TY_STR.
DATA : WA_STR TYPE TY_STR.
WA_STR-NAME = 'APPLEX'.
WA_STR-AGE = 12.
WA_STR-PLACE = 'MANGALORE'.
WRITE : / WA_STR-NAME ,WA_STR-AGE , WA_STR-PLACE.
Save->Check->Activate ->Execute.
Download