Вы находитесь на странице: 1из 19

SAP Procedure

Reference: SERVER1\SYS1:\COMMON\SAPPROJE\SETUP\PROC037.DOC (Word 7.0a)


Title: ABAP/4 Programming Standard
Author: Richard Harper
Date: June 98
Version: 1.0
SAP Version: 3E

Table Of Contents.

1. INTRODUCTION............................................................................................................................2
1.1. PURPOSE.....................................................................................................................................2
1.2. SCOPE.........................................................................................................................................2
1.3. AUDIENCE...................................................................................................................................2
1.4. RELATED DOCUMENTS...............................................................................................................2
2. DOCUMENT STRUCTURE..........................................................................................................3
2.1. HEADER SECTION.......................................................................................................................3
2.2. DATA SECTION............................................................................................................................3
2.2.1. Variable Names..................................................................................................................4
2.3. LOGIC SECTION..........................................................................................................................5
2.3.1. Statement Layout...............................................................................................................5
2.3.2. Comments..........................................................................................................................6
2.3.3. Forms And Functions........................................................................................................7
3. REVISIONS......................................................................................................................................9
3.1. IN-HOUSE PROGRAMS...............................................................................................................13
3.2. SAP STANDARD PROGRAMS.....................................................................................................13
3.2.1. Chnge...............................................................................................................................13
3.2.2. Date..................................................................................................................................14
3.2.3. Who..................................................................................................................................14
3.2.4. Reason..............................................................................................................................14
3.2.5. Access Key.......................................................................................................................14
3.2.6. Tracking Changes............................................................................................................14
4. MODULARISATION....................................................................................................................15
4.1. INCLUDE PROGRAMS................................................................................................................15
4.2. FORMS (PROCEDURES).............................................................................................................15
4.3. FUNCTIONS...............................................................................................................................15
4.4. MACROS...................................................................................................................................15

List Of Figures.
Figure 1 - SAP Revision History................................................................................................................9
Figure 2 - SAP Change Report.................................................................................................................13

List Of Tables.
Table 1 - Variable Prefixes.........................................................................................................................4
Table 2 - SAP System Variables By Name...............................................................................................19

Page 1
SAP Procedure

1. Introduction.
1.1. Purpose.
The purpose of this document is to define a standard for programming in ABAP/4. It provides
the standard to which code inspections if implemented should take place. These standards are
designed to ensure:

Consistency in Coding.
Maintainability of Code.
Legibility of Code.

1.2. Scope.
This document addresses programming in ABAP/4 for R/3 3.0e.

1.3. Audience.
This document is intended for all programmers working on Interim Technology UKs SAP
system whether permanent or contract staff, It assumes an understanding of the SAP
environment.

1.4. Related Documents.


PROC032 - Common Programming Procedures.

2.

Page 2
SAP Procedure

3. Document Structure.
The structure of an ABAP program shall be as follows:

Header Section
Data Section
Logic Section
Forms Section.

3.1. Header Section.


The Header Section of the program shall contain the Report statement and a comment block
describing the function of the program. The report statement will be defined in full rather than
allowing SAP to supply the default for the page size and so forth:

***********************************************************************
*
* Program: ZSO0630
* Title: Order Intake Analysis By Profit Centres
* Analyst: Cecilia Chan
* Programmer: Richard Harper
* Date: 12/05/98
* Doc. Id: 31-10010013-06
*
***********************************************************************
*
* Change History
* Date Reason Who
*
REPORT ZSO0630 Message-Id 38
Line-Count 64(1)
Line-Size 132
No Standard Page Heading.

3.2. Data Section.


The Data Section contains the data definitions that will be used at a global level by the
program. Any definitions not required by the program shall be omitted. In order to aid
documentation, Tables statements that are used only inside particular forms shall be defined
with in the form as though they are local to the form. Where they are used in more than one
form then they should be defined in the main program.

The definitions should be defined in the following order:

Constants
Tables
Data
Select-Options and parameters
Field Groups
Field Symbols

Definitions not defined in the SAP data dictionary should be commented as to their use. Eg:

Data: Begin Of t_repdata Occurs 0,


*
* Data common across all reports
*
vkorg like vbak-vkorg, " Sales org
vtweg like vbak-vtweg, " Distribution Chnl
spart like vbak-spart, " Division
vkbur like vbak-vkbur, " Sales Office
vkgrp like vbak-vkgrp, " Sales Group

Page 3
SAP Procedure

erdat like vbak-erdat, " Order Date


*
**********************************************************************
*
* ZSO0600 - For Management
*
vbeln like vbak-vbeln, " P/O No.
kunnr like vbak-kunnr, " Customer Number
matkl like vbap-matkl, " Model
kwmeng like vbap-kwmeng, " Order Qty
waerk like vbak-waerk, " Currency
kzwi6 like vbap-kzwi6, " Order Discount
kzwi6c like vbap-kzwi6, " Converted value
chnge like vbak-netwr, " Net Change
chngec like vbak-netwr, " Converted value
netwr like vbak-netwr, " Total order value
netwrc like vbak-netwr, " Converted value.
bezei like tvaut-bezei, " Change Indicator

3.2.1. Variable Names.


Variable names should conform as much as possible to the following conventions:

The variables should be prefixed with a single character and an under score (_). The
single character defines the type of variable:

Variable Type Prefix


Constants c_
Internal Tables t_
Select Option Tables s_
Parameters p_
Form Parameters Using Pu_
Form Parameters Changing Pc_
Form Parameters - Tables Pt_
Field Groups g_
Field Symbols f_
Ranges r_
Working storage w_
Table 1 - Variable Prefixes

The second part of the variable name should identify the variable. If the variable is a
copy of a SAP defined variable and has an identical use then this portion of the name
should be the same as the definition. For example a working storage version of
mara-matnr could be defined as w_matnr.

Where possible always declare a variable using the like keyword which associates a
variable definition with a data dictionary item.

Within data definitions (and code blocks), system variables will be used where
required and not the literal value. (eg. Sy-langu instead of E). A list of system
variables is provided in appendix A.

Do not use two underscores within a variable name such as w__count as this is the
convention used in the programs documented in PROC032 'Common Programming
Procedures' to prevent conflict with any user programs.

Apart from that variable names should be clear, meaningful abbreviations of what
they actually represent. Over long variable names (such as w_vatonsales) should be
avoided where the abbreviation (w_vat) is just as easily understood.

Page 4
SAP Procedure

3.3. Logic Section.


The Logic Section contains the executable statements grouped under their respective section
headings. Any sections not required by the program shall be omitted. The section headings
will appear in the following order:

Initialisation
At Selection-Screen
Start-Of-Selection
Get Tables
Get Tables Late
End-Of-Selection
Top-Of-Page
End-Of-Page
At Line-Selection
At Pf-keys
At User-Command
Top-Of-Page During Line Selection

3.3.1. Statement Layout.


The way a program is written is largely a matter of personal preference, but to
enable different programmers to pick up programs written by others, a style
convention is required.

3.3.1.1. Layout of Statements.


Each statement should be on an individual line and lined up vertically. Eg:

Move Field123 to Field2.


Move Field3 to Field4.

Do not concatenate statements as this obscures the logic of the program:

Perform Procedure Using: A, B, C, D.

Instead separate these into separate statements:


Perform Procedure Using A.
Perform Procedure Using B.
Perform Procedure Using C.
Perform Procedure Using D.

Do not use multiple assignments:

w_result=w_var1=w_var2. (How would you interpret this ?)

This should be coded as:


Move w_var2 to w_var1.
Move w_var2 to w_result.

3.3.1.2. Indentation.
Program code should be indented to allow the structure and flow of the
program logic to be easily observed.

Indents should begin at the column of the next word on the line causing the
indentation:

Data: w_var1 type i,


w_var2 type i.

Page 5
SAP Procedure

Loop At Vbak.
Perform Routine1.
EndLoop.

If w_material <> .
Perform ProcessMaterial.
Case w_material.
When 1.
.
.
When 2.
.
.
.
EndCase.
EndIf.

The Select clause should be indented as follows:

Select * from table up to 1 rows


Where condition1 and
condition2 and
condition3 and
.... and
.... or
....
Group by group condition
Order by order condition.

Data declarations should make sure that the type or like reserved words
all line up on the same column as can be seen in section 2.2 above.

3.3.2. Comments.
Code should be commented in useful, meaningful ways. Comments should always
highlight a block of codes functionality. In order to take advantage of ABAPs print
functionality where comments can be highlighted, all comments should begin with
an asterisk in column one, with the actual text starting at the indent level of the code.

To highlight comments even further, a blank comment should be at the top and
bottom of the comment block:

*
* Any Model here ?
*
if w_modelfound = True.
*
* Report Dependant Selection.
*
Clear t_Repdata.
Move-Corresponding vbak to t_repdata.
Case w_repid.
When c_zso0600.
Perform GetOrderDiscount
using vbak-vbeln
Changing w_kzwi6.
*
* Get the change reason.
*

3.3.3. Forms And Functions.


A Form (SAPs word for a Procedure) is a program module that performs an action.
A function is a program module that has a value. ABAP blurs the distinction between
Forms and Procedures somewhat as there is a changing keyword that allows the
variable passed to be changed rather that retaining its previous value.

Page 6
SAP Procedure

Forms and Functions should be used to modularise programs and to improve


readability and maintainability.

Wherever possible Forms should be self contained. Any communication with the
outside world should be carried out using formal parameters. Any variables used in
the routine should be declared inside the routine.

Further modularisation is possible using the Local and Static keywords.

3.3.3.1. Local.
The local keyword is used in association with a previously defined global
variable name. The current value of the variable is pushed on the stack at
the start of the routine and pulled from the stack at the end, thus allowing
changes to be made to the variable whilst keeping the changes within the
currently running procedure.

This should be used in preference to assigning the value of a global


variable to a copy and using that as it preserves the readability of the
program.

3.3.3.2. Static.
This keyword preserves the value of the declared variable across procedure
calls. This should be used where a value has to be carried across two or
more calls to the procedure. Without using this keyword, the variable
would have to be declared at a higher level. If the use of the variable is
restricted to the current or lower procedures and the value has to be
preserved then this keyword should be used. Again, to preserve
readability of the program.

Below is a full Form declaration

Forms should be prefixed with the following comment block, also available in
ZBLANK:

*eject
**********************************************************************
*
* Procedure:
*
* Purpose:
*
* Entry:
*
* Exit:
*
* Called By:
*
* Calls:
*
* Modification History:
*
* Date Reason Version Who
*
Form ProcedureName
Tables TableList
...
...
Using ParameterList
...
...
Changing ChangeList.

Page 7
SAP Procedure

Forms should be prefixed with the comment block above, also available in
ZBLANK:

All entries should start in the column after Modification History and can extend for
as many lines as required.

The entries are:

3.3.3.3. Procedure.
This is the name of the form.

3.3.3.4. Purpose.
This entry should details the function of the procedure. The action that it
carries out.

3.3.3.5. Entry.
This entry should list any tables passed to the routine and any Using
variables with their name and function.

It should document any assumptions made by the routine and any reliance
(!!!) on global variables. (See Local/Static above)

3.3.3.6. Exit.
This entry details any variables and their function that are changed by the
routine.

3.3.3.7. Called By.


This is an optional entry. If the routine is used within a program then this
entry should contain a list of dependant routines. Unfortunately, this
cannot be defined if the routine is a general routine such as the ones in
ZBOSSINC.

3.3.3.8. Calls.
This entry details the procedures that are called by this routine.

3.3.3.9. Modification History.


Any changes to the routine after the initial write, entered under the
appropriate headings.

4. Revisions.
Programs tend to be subject to a never ending request for revisions. SAP contains a version
management system that is activated at each transport of the program. Therefore it makes sense to use
this system to track changes to our in-house programs.

Taking the Common SAP Procedures include program ZBOSSINC, the Version manager has this to
report on the Include program:

Page 8
SAP Procedure

Figure 1 - SAP Revision History

This shows that there have been nine transports of the program to the live environment. Previous
versions can be recalled, and differences compared between versions:

Compare report sources

Left-hand column:
Report source: ZBOSSINC Version 00008
Request: M01K902911 22.05.1998 RHARPER
Text: ZSO Report series changes.

Right-hand column:
Report source: ZBOSSINC active version
Request: M01K903193 01.06.1998 RHARPER
Text: ZBOSSINC modification/upgrade.

Contents unchanged:
000010 000010 ***INCLUDE ZBOSSINC.
000020 000020 ***********************************************************************
000030 000030 *
... ... ...
000460 000460 Data: w__grouphdr type i, " In group header routine
000470 000470 w__lineprinted type i, " Line printed flag
000480 000480 w__runtotal type i. " Run total rec needed

The following lines were changed:


000490 *
000490 *eject

Page 9
SAP Procedure

Contents unchanged:
000500 000500 ***********************************************************************
000510 000510 *
000520 000520 * macro: Psub.
... ... ...
000740 000740 &1-low &1-high.
000750 000750 EndLoop.
000760 000760 End-Of-Definition.

The following lines were changed:


000770 *
000770 *eject

Contents unchanged:
000780 000780 ***********************************************************************
000790 000790 *
000800 000800 * Procedure: Repheader.
... ... ...
001490 001490 Move False to w__grouphdr.
001500 001500 Move False to w__lineprinted.
001510 001510 ENDFORM.

The following lines were added:


001520 *eject

Contents unchanged:
001520 001530 ***********************************************************************
001530 001540 *
001540 001550 * Procedure: WLine.
... ... ...
002230 002240 write ' ' no-gap.
002240 002250 enddo.
002250 002260 ENDFORM.

The following lines were added:


002270 *eject

Contents unchanged:
002260 002280 ***********************************************************************
002270 002290 *
002280 002300 * Procedure: GroupHdr.
... ... ...
002810 002830 Move false to w__lineprinted.
002820 002840 Endif.
002830 002850 ENDFORM. " Group Header.

The following lines were added:


002860 *eject

Contents unchanged:
002840 002870 ***********************************************************************
002850 002880 *
002860 002890 * Procedure: PrintTitles.
... ... ...
003750 003780 EndWhile.
003760 003790 Endif.
003770 003800 ENDFORM. " PrintTitles

The following lines were added:


003810 *eject

Contents unchanged:
003780 003820 ***********************************************************************
003790 003830 *
003800 003840 * Procedure: Underline.
... ... ...
004020 004060 Move sy-uline to w__repline+w__offset(p_width).
004030 004070 Write / w__repline.
004040 004080 ENDFORM. "UNDERLINE

The following lines were added:


004090 *eject

Page 10
SAP Procedure

Contents unchanged:
004050 004100 ***********************************************************************
004060 004110 *
004070 004120 * Procedure: Tableline.
... ... ...
004290 004340 Perform UnderLine
004300 004350 using ReportTable-StartPos w__maxwidth.
004310 004360 ENDFORM.

The following lines were added:


004370 *eject

Contents unchanged:
004320 004380 ***********************************************************************
004330 004390 *
004340 004400 * Procedure: BuildReport.
... ... ...
005220 005280 endloop.
005230 005290 Append ReportTable.
005240 005300 ENDFORM. "BUILDREPORT.

The following lines were added:


005310 *eject

Contents unchanged:
005250 005320 ***********************************************************************
005260 005330 *
005270 005340 * Procedure: FormatReport.
... ... ...
005940 006010 Modify ReportTable.
005950 006020 Endloop.
005960 006030 ENDFORM. "FORMATREPORT

The following lines were added:


006040 *eject

Contents unchanged:
005970 006050 ***********************************************************************
005980 006060 *
005990 006070 * Procedure: WriteLine
... ... ...
006720 006800 Write sy-vline no-gap.
006730 006810 Move True to w__lineprinted.
006740 006820 EndForm.

The following lines were added:


006830 *eject

Contents unchanged:
006750 006840 ***********************************************************************
006760 006850 *
006770 006860 * Procedure: SetColour
... ... ...
007070 007160 When Col_Group. Format Color Col_Group.
007080 007170 Endcase.
007090 007180 EndForm.

The following lines were added:


007190 *eject

Contents unchanged:
007100 007200 ***********************************************************************
007110 007210 *
007120 007220 * Procedure: WriteCentre.
... ... ...
007340 007440 Move p_text to w__repline+w__offset.
007350 007450 Write /001 w__repline.
007360 007460 ENDFORM.

The following lines were added:


007470 *eject

Page 11
SAP Procedure

Contents unchanged:
007370 007480 ***********************************************************************
007380 007490 *
007390 007500 * Procedure: FindSupplier.
... ... ...
008410 008520 endif.
008420 008530 endif.
008430 008540 ENDFORM. " FINDSUPPLIER

The following lines were added:


008550 *eject

Contents unchanged:
008440 008560 ***********************************************************************
008450 008570 *
008460 008580 * Procedure: GiveLine.
... ... ...
009090 009210 move space to p_text.
009100 009220 endif.
009110 009230 ENDFORM.

The following lines were added:


009240 *eject

Contents unchanged:
009120 009250 ***********************************************************************
009130 009260 *
009140 009270 * Procedure: StripString.
... ... ...
009570 009700 EndWhile.
009580 009710 EndDo.
009590 009720 EndForm.

The following lines were changed:


009600 *
009730 *eject

Contents unchanged:
009610 009740 ***********************************************************************
009620 009750 *
009630 009760 * Procedure: SortRep
... ... ...
010030 010160 EndCase.
010040 010170 Endif.
010050 010180 EndForm.

The following lines were changed:


010060 *
010190 *eject

Contents unchanged:
010070 010200 ***********************************************************************
010080 010210 *
010090 010220 * Procedure: SubTitle
... ... ...
010730 010860 Endif.
010740 010870 Perform WriteCentre using w__subtitle.
010750 010880 EndForm.

The following lines were added:


010890 *eject

Contents unchanged:
010760 010900 ***********************************************************************
010770 010910 *
010780 010920 * Procedure: InitBreak
... ... ...
011190 011330 Move t__cols[] to ReportBreaks-Totals[].
011200 011340 Append ReportBreaks.
011210 011350 EndForm.

The following lines were added:


011360 *eject

Page 12
SAP Procedure

Contents unchanged:
011220 011370 ***********************************************************************
011230 011380 *
011240 011390 * Procedure: Checkbreaks
... ... ...
012240 012390 EndWhile.
012250 012400 EndIf.
012260 012410 EndForm.

The following lines were changed:


012270 *
012420 *eject

Contents unchanged:
012280 012430 ***********************************************************************
012290 012440 *
012300 012450 * Procedure: PrintTotals
... ... ...
013000 013150 Position w__pos.
013010 013160 Write: sy-vline.
013020 013170 EndForm.

The following lines were added:


013180 *eject

Contents unchanged:
013030 013190 ***********************************************************************
013040 013200 *
013050 013210 * Procedure: RunTotals
... ... ...
013500 013660 EndLoop.
013510 013670 Perform TableLine.
013520 013680 EndForm.

Figure 2 - SAP Change Report

Revisions can be retrieved at will with the proviso that they will over write the current version unless it
is copied somewhere else.

4.1. In-House programs.


In view of the fact that SAP possesses full version control, changes to in-house programs
should be documented in the revision history block at the head of the program, or within the
relevant procedure.

In order to maintain readability, lines that should be deleted should be and not commented
out. Lines that are changed should be changed and not copied and commented out. This
maintains readability throughout the code and in any case, the previous version can always be
retrieved if required.

4.2. SAP Standard Programs.


Where a SAP standard program is to be changed, the change details should be documented in
a comment at the head of the program.

The comments should form a history of the changes made in the program and should contain
the following details:

* Chnge Date Who Reason Access Key

4.2.1. Chnge
This column should contain a consecutive change number (1 2 3.... etc)

Page 13
SAP Procedure

4.2.2. Date
The date the change commenced

4.2.3. Who
Who is responsible for the change.

4.2.4. Reason
The reason for the change.

4.2.5. Access Key


The Access Key obtained from OSS.

4.2.6. Tracking Changes.


Any lines changed should have the comment Interim change No appended to them.

To delete a line, place an asterisk in the first column, changing that line into a
comment, again marking that line with Interim change No.

To change a line, copy the line to the clipboard, mark the current line with an
asterisk and Interim change No. Paste the original line back in below the old line
and make the necessary changes. Again, mark the line with Interim change No.

Whilst this is not the way to maintain programs and keep them readable and tidy, this is
apparently the way that Origin maintain programs...... However.

5.

Page 14
SAP Procedure

6. Modularisation.
Programs should be modularised so that effects of changes and damage limitation can be contained.

Modularisation Units available within ABAP are:

6.1. Include Programs.


Where a Form or function is shared between two or more programs it may be called using the
statement:

Perform Procedure In programName If Found


Tables TableList
Using Using List
Changing ChangeList.

However, a better way of doing this is to group all the common procedures for an application
into an Include file which is Included in the main program using the Include statement

6.2. Forms (Procedures).


A subroutine with formal parameters which should be used to isolate the different functional
routines used within the program.

6.3. Functions.
A Procedure with a value.

6.4. Macros.
These are defined once at the head of the program and are then used as though they are
intrinsic commands within the ABAP language. An example of a macro can be found in
PROC032, PSUB.

Page 15
SAP Procedure

Appendix A
SAP System Variables.

Variable Name Type Length Contents


SY-ABCDE CHAR C 26 CONSTANT: ALPHABET (A,B,C)
SY-APPLI RAW X 2 SAP APPLICATIONS
SY-BATCH CHAR C 1 BACKGROUND ACTIVE (X)
SY-BATZD CHAR C 1 BACKGROUND SUBMIT: DAILY
SY-BATZM CHAR C 1 BACKGROUND SUBMIT: MONTHL
SY-BATZO CHAR C 1 BACKGROUND SUBMIT: ONCE
SY-BATZS CHAR C 1 BACKGROUND SUBMIT: IMMEDI
SY-BATZW CHAR C 1 BACKGROUND SUBMIT: WEEKLY
SY-BINPT CHAR C 1 BATCH INPUT ACTIVE (X)
SY-BREP4 CHAR C 4 BACKGROUND SUBMIT: ROOT N
SY-BSPLD CHAR C 1 BACKGROUND SUBMIT: LIST O
SY-CALLD CHAR C 1 CALL MODE ACTIVE (X)
SY-CALLR CHAR C 8 PRINT: ID FOR PRINT DIALO
SY-CCURS DEC P 5 RATE SPECIFICATION/RESULT
SY-CCURT DEC P 5 TABLE RATE FROM CURRENCY
SY-CDATE DATS D 8 DATE OF RATE FROM CURRENC
SY-CFWAE CUKY C 5 INTERNAL USE
SY-CHWAE CUKY C 5 INTERNAL USE
SY-COLNO INT4 X 4 CURRENT COLUMN DURING LIS
SY-CPAGE INT4 X 4 CURRENT PAGE NUMBER
SY-CPROG CHAR C 8 RUNTIME: MAIN PROGRAM
SY-CTABL CHAR C 4 EXCHANGE RATE TABLE FROM
SY-CTYPE CHAR C 1 EXCHANGE RATE TYPE 'M'
SY-CUCOL INT4 X 4 CURSOR POSITION (COLUMN)
SY-CUROW INT4 X 4 CURSOR POSITION (LINE)
SY-DATAR CHAR C 1 FLAG: DATA RECEIVED
SY-DATLO DATS D 8 LOCAL DATE FOR USER
SY-DATUM DATS D 8 SYSTEM: DATE
SY-DATUT DATS D 8 GLOBAL DATE RELATED TO UT
SY-DAYST CHAR C 1 SUMMERTIME ACTIVE ? ('day
SY-DBCNT INT4 X 4 NUMBER OF ELEMENTS IN EDI
SY-DBNAM CHAR C 2 LOGICAL DATABASE FOR ABAP
SY-DBSYS CHAR C 10 SYSTEM: DATABASE SYSTEM
SY-DCSYS CHAR C 4 SYSTEM: DIALOG SYSTEM
SY-DEBUG CHAR C 1 INTERNAL USE
SY-DSNAM CHAR C 8 RUNTIME: NAME OF DATASET
SY-DYNGR CHAR C 4 SCREEN GROUP OF CURRENT S
SY-DYNNR CHAR C 4 NUMBER OF CURRENT SCREEN
SY-ENTRY CHAR C 72 INTERNAL USE
SY-FDAYW INT1 X 1 FACTORY CALENDAR WEEKDAY
SY-FDPOS INT4 X 4 LOCATION OF A STRING
SY-FFILE CHAR C 8 INTERNAL: FLAT FILE (USIN
SY-FLENG INT4 X 4 INTERNAL USE (FIELD LENGT
SY-FMKEY CHAR C 3 CURRENT FUNCTION CODE MEN
SY-FODEC INT4 X 4 INTERNAL USE (FIELD DECIM
SY-FOLEN INT4 X 4 INTERNAL USE (FIELD OUTPU
SY-FTYPE CHAR C 1 INTERNAL USE (FIELD TYPE)
SY-GROUP CHAR C 1 INTERNAL: BUNDLING
SY-HOST CHAR C 8 HOST

Page 16
SAP Procedure

SY-INDEX INT4 X 4 NUMBER OF LOOP PASSES


SY-INPUT CHAR C 1 INTERNAL USE
SY-LANGU LANG C 1 SAP LOGON LANGUAGE KEY
SY-LDBPG CHAR C 8 PROGRAM: ABAP/4 DATABASE
SY-LILLI INT4 X 4 NUMBER OF CURRENT LIST LI
SY-LINCT INT4 X 4 NUMBER OF LIST LINES
SY-LINNO INT4 X 4 CURRENT LINE FOR LIST CRE
SY-LINSZ INT4 X 4 LINE SIZE OF LIST
SY-LISEL CHAR C 255 INTERACT.: SELECTED LINE
SY-LISTI INT4 X 4 NUMBER OF CURRENT LIST LI
SY-LOCDB CHAR C 1 LOCAL DATABASE EXISTS
SY-LOCOP CHAR C 1 LOCAL DATABASE OPERATION
SY-LOOPC INT4 X 4 NUMBER OF LOOP LINES AT S
SY-LPASS CHAR C 4 INTERNAL USE
SY-LSIND INT4 X 4 NUMBER OF SECONDARY LIST
SY-LSTAT CHAR C 16 INTERACT.: STATUS INFORMA
SY-MACDB CHAR C 4 PROGRAM: NAME OF FILE FOR
SY-MACOL INT4 X 4 NUMBER OF COLUMNS FROM SE
SY-MANDT CLNT C 3 CLIENT NUMBER FROM SAP LO
SY-MARKY CHAR C 1 CURRENT LINE CHARACTER FO
SY-MAROW INT4 X 4 NO. OF LINES FROM SET MAR
SY-MODNO CHAR C 1 NUMBER OF ALTERNATIVE MOD
SY-MSGID CHAR C 2 MESSAGE ID
SY-MSGLI CHAR C 60 INTERACT.: MESSAGE LINE (
SY-MSGNO NUMC N 3 MESSAGE NUMBER
SY-MSGTY CHAR C 1 MESSAGE TYPE (E,I,W)
SY-MSGV1 CHAR C 50 MESSAGE VARIABLE
SY-MSGV2 CHAR C 50 MESSAGE VARIABLE
SY-MSGV3 CHAR C 50 MESSAGE VARIABLE
SY-MSGV4 CHAR C 50 MESSAGE VARIABLE
SY-NEWPA CHAR C 1 INTERNAL USE
SY-NRPAG CHAR C 1 INTERNAL USE
SY-ONCOM CHAR C 1 INTERNAL: ON COMMIT FLAG
SY-OPSYS CHAR C 10 SYSTEM: OPERATING SYSTEM
SY-PAART CHAR C 16 PRINT: FORMAT
SY-PAGCT INT4 X 4 PAGE SIZE OF LIST FROM RE
SY-PAGNO INT4 X 4 RUNTIME: CURRENT PAGE IN
SY-PAUTH NUMC N 2 INTERNAL USE
SY-PDEST CHAR C 4 PRINT: OUTPUT DEVICE
SY-PEXPI NUMC N 1 PRINT: SPOOL RETENTION PE
SY-PFKEY CHAR C 8 RUNTIME: CURRENT F KEY ST
SY-PLAYO CHAR C 5 INTERNAL USE
SY-PLAYP CHAR C 1 INTERNAL USE
SY-PLIST CHAR C 12 PRINT: NAME OF SPOOL REQU
SY-PNWPA CHAR C 1 INTERNAL USE
SY-PRABT CHAR C 12 PRINT: DEPARTMENT ON COVE
SY-PRBIG CHAR C 1 PRINT: SELECTION COVER SH
SY-PRCOP NUMC N 3 PRINT: NUMBER OF COPIES
SY-PRDSN CHAR C 6 PRINT: NAME OF SPOOL DATA
SY-PREFX CHAR C 3 ABAP/4 PREFIX FOR BACKGRO
SY-PRI40 CHAR C 1 INTERNAL USE
SY-PRIMM CHAR C 1 PRINT: PRINT IMMEDIATELY
SY-PRINI NUMC N 1 INTERNAL USE

Page 17
SAP Procedure

SY-PRLOG CHAR C 1 INTERNAL USE


SY-PRNEW CHAR C 1 PRINT: NEW SPOOL REQUEST
SY-PRREC CHAR C 12 PRINT: RECIPIENT
SY-PRREL CHAR C 1 PRINT: DELETE AFTER PRINT
SY-PRTXT CHAR C 68 PRINT: TEXT FOR COVER SHE
SY-REPI2 CHAR C 8 INTERNAL USE
SY-REPID CHAR C 8 PROGRAM: NAME OF ABAP/4 P
SY-RSTRT CHAR C 1 INTERNAL USE
SY-RTITL CHAR C 70 PRINT: REPORT TITLE OF PR
SY-SAPRL CHAR C 4 SYSTEM: SAP RELEASE
SY-SCOLS INT4 X 4 COLUMNS ON SCREEN
SY-SFNAM CHAR C 30 NO LONGER USED
SY-SFOFF INT4 X 4 INTERNAL USE
SY-SLSET CHAR C 14 NAME OF SELECTION SET
SY-SPONO NUMC N 5 RUNTIME: SPOOL NUMBER FOR
SY-SPONR NUMC N 5 RUNTIME: SPOOL NUMBER FRO
SY-SROWS INT4 X 4 LINES ON SCREEN
SY-STACO INT4 X 4 INTERACT.: LIST DISPLAYED
SY-STARO INT4 X 4 INTERACT.: PAGE DISPLAYD
SY-STEPL INT4 X 4 NUMBER OF LOOP LINE AT SC
SY-SUBCS CHAR C 1 INTERNAL: CALL STATUS OF
SY-SUBRC INT4 X 4 RETURN VALUE AFTER SPECIF
SY-SUBTY RAW X 1 ABAP/4: CALL TYPE FOR SUB
SY-SYSID CHAR C 8 SYSTEM: SAP SYSTEM ID
SY-TABID CHAR C 8 INTERNAL USE
SY-TABIX INT4 X 4 RUNTIME: CURRENT LINE OF
SY-TCODE CHAR C 4 SESSION: CURRENT TRANSACT
SY-TFDSN CHAR C 8 RUNTIME: DATASET FOR DATA
SY-TFILL INT4 X 4 CURRENT NUMBER OF ENTRIES
SY-TIMLO TIMS T 6 LOCAL TIME FOR USER
SY-TIMUT TIMS T 6 GLOBAL TIME RELATED TO UT
SY-TITLE CHAR C 70 TITLE OF ABAP/4 PROGRAM
SY-TLENG INT4 X 4 LINE WIDTH OF AN INTERNAL
SY-TLOPC INT4 X 4 INTERNAL USE
SY-TMAXL INT4 X 4 MAXIMUM NUMBER OF ENTRIES
SY-TNAME CHAR C 30 NAME OF INTERNAL TABLE AF
SY-TOCCU INT4 X 4 OCCURS PARAMETER WITH INT
SY-TPAGI INT4 X 4 FLAG INDICATING ROLL-OUT
SY-TSTIS INT4 X 4 INTERNAL USE
SY-TSTLO NUMC N 14 TIMESTAMP (DATE AND TIME)
SY-TSTUT NUMC N 14 TIMESTAMP (DATE AND TIME)
SY-TTABC INT4 X 4 NUMBER OF LINE LAST READ
SY-TTABI INT4 X 4 OFFSET OF INTERNAL TABLE
SY-TVAR0 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR1 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR2 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR3 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR4 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR5 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR6 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR7 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR8 CHAR C 20 RUNTIME: TEXT VARIABLE FO
SY-TVAR9 CHAR C 20 RUNTIME: TEXT VARIABLE FO

Page 18
SAP Procedure

SY-TZONE INT4 X 4 TIME DIFFERENCE FROM 'Gre


SY-UCOMM CHAR C 70 INTERACT.: COMMAND FIELD
SY-ULINE CHAR C 255 CONSTANT: UNDERLINE (4444
SY-UNAME CHAR C 12 SESSION: SAP USER FROM SA
SY-UZEIT TIMS T 6 SYSTEM: TIME
SY-VLINE CHAR C 1 CONSTANT: VERTICAL BAR
SY-WAERS CUKY C 5 T001: COMPANY CODE CURREN
SY-WILLI INT4 X 4 NUMBER OF CURRENT WINDOW
SY-WINCO INT4 X 4 CURSOR POSITION IN WINDOW
SY-WINDI INT4 X 4 INDEX OF CURRENT WINDOW L
SY-WINRO INT4 X 4 CURSOR POSITION IN WINDOW
SY-WINSL CHAR C 79 INTERACT.: SELECTED WINDO
SY-WINX1 INT4 X 4 WINDOW COORDINATE (COLUMN
SY-WINX2 INT4 X 4 WINDOW COORDINATE (COLUMN
SY-WINY1 INT4 X 4 WINDOW COORDINATE (LINE L
SY-WINY2 INT4 X 4 WINDOW COORDINATE (LINE R
SY-WTITL CHAR C 1 STANDARD PAGE HEADER INDI
SY-XCODE CHAR C 70 EXTENDED COMMAND FIELD
SY-XFORM CHAR C 30 INTERNAL USE (SYSTEM-EXIT
SY-XPROG CHAR C 8 INTERNAL USE (SYSTEM-EXIT
SY-ZONLO CHAR C 6 TIME ZONE OF USER

Table 2 - SAP System Variables By Name

Page 19

Вам также может понравиться