Creating A Program: Tcode: Se38
Creating A Program: Tcode: Se38
Creating A Program: Tcode: Se38
TCode: se38
After clicking the save button a popup screen will appear, from that select the „Local object‟
option to assign the program to the temporary development class. Once this is achieved, the
coding screen is reached.
Write Statements
Output Individual Fields
Declaring Variables
There are some rules to be followed when dealing with variables:
They must begin with a letter.
Can be a maximum size of 30 characters,
Cannot include + , : or ( ) in the name,
Cannot use a reserved word.
Constants
A constant is a variable whose associated value cannot be altered by the program during its
execution, hence the name
Arithmetic – Addition
Arithmetic – Subtraction
Arithmetic – Division
Arithmetic – Multiplication
Additionally to these methods, the statements ADD, SUBTRACT, DIVIDE and MULTIPLY can
be used. The syntax for these is slightly different. Beneath the first calculation (where integer01
and packed_decimal01 where added), write a new line of code “ADD 8 to result.” (Ignore the
comment line in the image):
While this is a legitimate method for calculations, it must be added that this is very rarely used,
as the initial method is much simpler.
Data type C variables are used for holding alphanumeric characters, with a minimum of 1
character and a maximum of 65,535 characters. By default, these are aligned to the left.
The other common generic character string data type is N. data type NUMC, with a length
of 8.
This data type, then, is ideal when the field is only to be used for numbers with no intention of
carrying out cal-culations.
String Manipulation
Concatenate
Condense
NO-GAPS
Replace
Search
Shift
Split
Case Statement
Select Loops
Do Loops
Nested Do Loops
While Loops
LOOP AT SCREEN.
IF SCREEN-name = 'P_FIELd1'.
SCREEN-INTENSIFIED = '1'.
MODIFY SCREEN.
CONTINUE.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
This event is triggered when the user presses enter on the report selection screen and is mainly used to add
processing related to screen validation. Within the AT SELECTION SCREEN event you have not left the
selection screen, which allows you to manipulate the values contained within sel screen parameters or stop the
program and return the user to the selection screen by displaying an error message.
AT SELECTION-SCREEN ON
This allows you to add processing to a selection screen field for when it is chnaged, user presses F1 or F4 etc
using the following parameters
<parameter1>
AT SELECTION-SCREEN ON Block <block1>
AT SELECTION-SCREEN ON HELP-REQUEST for <parameter1> (i.e. When press F1)
AT SELECTION-SCREEN ON VALUE-REQUEST for <parameter1> (i.e. When press F4)
AT SELECTION-SCREEN ON RADIOBUTTON for <parameter1> (i.e. When press F4)
AT SELECTION-SCREEN ON P_FIELD1.
AT SELECTION-SCREEN ON help-request for P_FIELD1.
START-OF-SELECTION
This event is called when . If the user executes the program either by pressing the execute button or F8 this is
the first event triggered after all screen selection processing has been completed (AT Selection...). So pressing
execute triggers both AT SELECTION and then START-OF-SELECTION
If no other events are declared then there is no need to manually code this event as all processing statements
will be automatically assigned to an implicit START-OF-SELECTION block. It is a good ideal to put it in though
as it separates the code and makes it easier to read. Generally you would put all you data selection ABAP code
within this event.
END-OF-SELECTION
If your report is linked to a logical database this event is called after the logical database has completely
finished its work. Otherwise this event is trigged after the START-OF-SELECTION event so you would
generally use it to processes the data retrieved in that event.