Pages

Sunday, December 18, 2011

Tcodes


DEVELOPERS' TRANSACTION CODE

OSS1
SAP Online Service System
OY19
Compare Tables
S001
ABAP Development Workbench
S002
System Administration.
SA38
Execute a program.
SCAT
Computer Aided Test Tool
SCU0
Compare Tables
SE01
Old Transport & Corrections screen
SE09
Workbench Organizer
SE10
Customizing Organizer
SE10
Customizing organizer - requests for user (To release for transport - enter user name, press Enter. Select changed object and select ReleaseSE10 New Transport & Correction screen)
SE11
ABAP/4 Dictionary Maintenance SE12 ABAP/4 Dictionary Display SE13 Maintain Technical Settings (Tables)
SE11
ABAP/4 Dictionary.
SE12
Dictionary: Initial Screen - enter object name
SE13
Access tables in ABAP/4 Dictionary.
SE14
ABAP/4 Dictionary: Database Utility.
SE14
Utilities for Dictionary Tables
SE15
ABAP/4 Repository Information System
SE15
ABAP/4 Repository Information System.
SE16
Data Browser
SE16
Data Browser: Initial Screen.
SE16
Display table contents
SE17
General Table Display
SE30
ABAP/4 Runtime Analysis
SE30
ABAP/4 Runtime Analysis: Initial Screen.
SE30
Run Time Analysis
SE32
ABAP/4 Text Element Maintenance
SE35
ABAP/4 Dialog Modules
SE36
ABAP/4: Logical Databases
SE37
ABAP/4 Function Library.
SE37
ABAP/4 Function Modules
SE38
ABAP Editor
SE38
ABAP/4 Editor.
SE38
ABAP/4 Program Development
SE39
Split-screen Editor: Program Compare
SE41
Menu Painter
SE43
Maintain Area Menu
SE51
Screen Painter
SE51
Screen Painter: Initial Screen.
SE54
Generate View Maintenance Module
SE61
R/3 Documentation
SE62
Industry utilities
SE63
Translate Short/Long Text.
SE63
Translation
SE64
Terminology
SE65
R/3 documents. Short text statistics SE66 R/3 Documentation Statistics (Test!)
SE68
Translation Administration
SE71
SAPscript layout set
SE71
SAPscript Layouts Create/Change
SE72
SAPscript styles
SE73
SAPscript font maintenance (revised)
SE74
SAPscript format conversion
SE75
SAPscript Settings
SE76
SAPscript Translation Layout Sets
SE77
SAPscript Translation Styles
SE80
ABAP/4 Development Workbench
SE80
Repository Browser: Initial Screen.
SE81
SAP Application Hierarchy
SE82
Customer Application Hierarchy
SE84
ABAP/4 Repository Information System
SE85
ABAP/4 Dictionary Information System
SE86
ABAP/4 Repository Information System
SE87
Data Modeler Information System
SE88
Development Coordination Info System
SE91
Maintain Messages
SE92
Maintain system log messages
SE93
Maintain Transaction Codes
SE93
Maintain Transaction
SEU
Object Browser

Legacy System Migration Workbench(LSMW)

  Steps to create a simple LSMW using batch input recording

Comment:

The LSM Workbench is an R/3-based tool that supports you when transferring data from non-SAP systems ("Legacy Systems") to R/3 once or periodically.

The tool supports conversion of data of the legacy system in a convenient way. The data can then be imported into the R/3 system via batch input, direct input, BAPIs or IDocs.
Furthermore, the LSM Workbench provides a recording function that allows to generate a "data migration object" in an entry or change transaction
To start working with the LSM Workbench, use transaction LSMW:


Click on the create button to create new project, subproject and the object. As shown below.


Project, Subproject and Object:
On the initial screen, you can create a new project, corresponding subprojects and objects via Edit -> Create new entry.
-          Project: An ID with a maximum of 10 characters to name your data transfer project. If you want to transfer data from several legacy systems, you may create a project e.g. for every legacy system.
-          Subproject: An ID with a maximum of 10 characters that is used as further structuring attribute.
-          Object: An ID with a maximum of 10 characters to name the business object.
In the initial screen, All objects provides a list of all projects created already. My objects displays a list of all objects you created personally. All objects of the project displays all objects of the selected project as tree structure. Project documentation displays any documentation written for the individual popups and processing steps. you can print the project documentation out, send it and save it in various file formats.

Click on the execute button once the project, subproject and the object are created.

Click Back.Now record usingBatch Input RecordingData Migration - Step by Stepvia Batch Input Recording
Step 1: Maintain Object attributes
In this example, you will be updating the Material master records with the help of recording a transaction (MM01). Choose radio buttonBatch Input Recordingand click on the recording overview icon to record the R/3 transaction. Enter theRecordingname asMM01_REC2, the description asMM01 Recording method, and the transaction code asMM01.

 
Click on create to record the transaction.




Click on Done.


Click on Done to actually start recording the transaction.
Enter the fields required for recoding a transaction successfully.


Note that the fields are populated with default values. The values you entered when you recorded the transaction are set by default.
*Double-click on the fieldRMMG1-MATNRand enter the name as MATNR and the description asMATERIAL NUMBERand remove the default as shown below:


Repeat this step for all fields.Similarly, double-click on all other fields with default values and make appropriate changes. Once you have made changes, the recording overview screen looks as shown below:


Click on SAVE to save the recording. The click on BACK icon to the main screen. Save the while going back to the main screen.
After completing the recoding the system will automatically take you to the second step as shown below:


 Step 2. Maintain Source Structures
Click on CREATE to create a source structure. Give a name and a description to the source structure as shown below:


Save the source structure and go to the main screen.
Step 3. Maintain Source Fields
In this step, you need to list what fields are present in the source structure. The easiest way is to click on 'Table Maintenance' icon to enter Fieldname, Type and Length for each field as shown:

Save while coming back to the main screen.

Step 4: Maintain Structure Relations
Execute a step to 'Maintain Structure Relations'. Since, there is only one Source and Target Structure, the relationship is defaulted automatically.


Save while coming back to the main screen.
Step 5: Maintain field mapping and conversion rules
Keep cursor on field 'MATNR' and click on 'Assign Source field' icon to choose source field MATERIAL from structure MM01V6 as shown


Similarly, assign 'Source Field' rules to the remaining fields.
Once all the fields are mapped, you should have an overview screen as shown

Save while coming back to the main screen.
Step 6: Maintain fixed values, translations, user-defined routines
You can also maintain re-usable translations and user-defined routines, which can be used across conversion tasks. In this case, that step is not required.

Step 7: Specify files
In this step, we define how the layout of the input file is. The input file is a [Tab] delimited with the first row as field names. It is present on my PC (local drive) as C:\MM3.txt.
Double Click on the legacy data.


Save while going to main screen.
Create an Excel with your data and save it as a Tab-delimited text file on your local drive (C and name it MM3.txt.


IMPORTANT
****The Structure of the flat file should be proper otherwise data will not be uploaded.. All the mandatory fields should be present in the flat file for the required transaction
Step 8: Assign files
Execute step 'Assign Files' and the system automatically defaults the filename to the source structure.

Save while going to main screen.

Step 9: Read data
In this step, LSMW reads the data from the source file (from your PC's local drive). You have the option to read only selected rows and convert data values to internal format.
Here 1 to 2 represents the number of rows to be read from the flat file. If you don't specify any number the system will read all the rows from the flat file. We have 2 rows in the flat file hence from 1 to 2.

 
After we execute the data read from the flat file is as shown below.

Step 10: Display read data
This step is optional. If required, you can review the field contents for the rows of data read.



Step 11: Convert data
This is the step that actually converts the source data (in source format) to a target format. Based on the conversion rules defined, source fields are mapped to target fields.



Click BACK to come back to main screen.

Step 12: Display Converted data
Again this is an optional step to view how the source data is converted to internal SAP format.


Step 13: Create batch input session
Once the source data is converted in an internal format, you can create a batch session to process updates.


Click EXECUTE button to execute a batch inout session.
Step 14: Run Batch Input Session
You can execute the BDC session by Run Batch input session. Executing a batch input session is a standard SM35 transaction for managing BDC sessions. Once you have successfully executed the batch input session, the Material master records are updated in the system. You can confirm this by viewing the Material master records (MM03).

Select the session and click on the PROCESS icon.


You can Process the session in foreground or background or can only display errors.
Select the Processing Mode and then click on the PROCESS tab to executive the session.
After the session is completely processed you can confirm this by viewing the Material master records (MM03) or in the table MARA.

Friday, December 16, 2011

ABAP System Fields


ABAP System Fields
The ABAP system fields are active in all ABAP programs. They are filled by the runtime environment, and you can query their values in a program to find out particular states of the system. Although they are variables, you should not assign your own values to them, since this may overwrite information that is important for the normal running of the program. However, there are some isolated cases in which you may need to overwrite a system variable. For example, by assigning a new value to the field SY-LSIND, you can control navigation within details lists.
The names and data types of the system fields are contained in the ABAP Dictionary structure SYST. To address them in an ABAP program, use the form SY-. Within screen flow logic, you can also use the form SYST-.


System Fields in Alphabetical Order
The following table contains an alphabetical list of the fields in the ABAP Dictionary structure SYST.
The first column indicates how you can use the field in an ABAP program:
The system field is set by the runtime environment. You can use its value in an ABAP program, but you must not change it.
The system field is set by the runtime environment. You can both use and change its value in the ABAP program to affect the runtime behavior of the program.
The system field must be set from the ABAP program. After that, it can be used by the runtime environment and within your program.
The system field is for internal use only, and must not be used in ABAP programs.
The system field is obsolete. No values are assigned to it, and it must not be used in ABAP programs.
"Name" stands for the component name. "Type" and "Length" are the ABAP Dictionary type and length of the field. The "Use" column indicates the contexts in which the system fields can be set, and the "Description" column contains a short description of the field's function.


Name Type Length Use Description
ABCDE CHAR 26 Constants Alphabet (A,B,C,...)
APPLI RAW 2 Obsolete

BATCH CHAR 1 Background processing Is program running in the background?
BATZD CHAR 1 Obsolete

BATZM CHAR 1 Obsolete

BATZO CHAR 1 Obsolete

BATZS CHAR 1 Obsolete

BATZW CHAR 1 Obsolete

BINPT CHAR 1 Batch input Is program running in the background?
BREP4 CHAR 4 Obsolete

BSPLD CHAR 1 Obsolete

CALLD CHAR 1 ABAP program Call mode of the ABAP program
CALLR CHAR 8 Printing lists ID for print dialog function
CCURS DEC 9 Obsolete

CCURT DEC 9 Obsolete

CDATE DATS 8 Obsolete

CFWAE CUKY 5 Internal

CHWAE CUKY 5 Internal

COLNO INT4 10 Creating lists Current list column
CPAGE INT4 10 Processing lists Current page number
CPROG CHAR 40 ABAP program Program that called the current external procedure
CTABL CHAR 4 Obsolete

CTYPE CHAR 1 Obsolete

CUCOL INT4 10 Screens Horizontal cursor position in PAI
CUROW INT4 10 Screens Vertical cursor position in PAI
DATAR CHAR 1 Screens Displays user input
DATLO DATS 8 Date and time User’s local date
DATUM DATS 8 Date and time Current application server date
DAYST CHAR 1 Date and time Flag for summer (daylight saving) time
DBCNT INT4 10 Database access Number of database rows processed
DBNAM CHAR 20 ABAP program Logical database linked to the program
DBSYS CHAR 10 R/3 System Name of the central database system
DCSYS CHAR 4 Obsolete

DEBUG CHAR 1 Internal

DSNAM CHAR 8 Internal

DYNGR CHAR 4 ABAP program Screen group of the current screen
DYNNR CHAR 4 ABAP program Number of the current screen
ENTRY CHAR 72 Internal

FDAYW INT1 3 Date and time Day in the factory calendar
FDPOS INT4 10 Strings Offset in a string
FFILE CHAR 8 Internal

FLENG INT4 10 Internal

FMKEY CHAR 3 Obsolete

FODEC INT4 10 Internal

FOLEN INT4 10 Internal

FTYPE CHAR 1 Internal

GROUP CHAR 1 Internal

HOST CHAR 8 R/3 System Name of application server
INDEX INT4 10 Loops Current loop pass
INPUT CHAR 1 Internal

LANGU LANG 1 R/3 System User’s logon language
LDBPG CHAR 40 ABAP program Logical database program
LILLI INT4 10 Processing lists List line selected
LINCT INT4 10 Creating lists Page length in a list
LINNO INT4 10 Creating lists Current line
LINSZ INT4 10 Creating lists Line width in a list
LISEL CHAR 255 Processing lists Contents of the chosen line
LISTI INT4 10 Processing lists Index of the chosen list
LOCDB CHAR 1 Obsolete

LOCOP CHAR 1 Obsolete

LOOPC INT4 10 Screens Number of lines visible in the table
LPASS CHAR 4 Internal

LSIND INT4 10 Processing lists Index of the detail list
LSTAT CHAR 16 Processing lists ID for list levels
MACDB CHAR 4 Obsolete

MACOL INT4 10 Printing lists Columns from the SET MARGIN statement
MANDT CLNT 3 R/3 System Current client
MARKY CHAR 1 Obsolete

MAROW INT4 10 Printing lists Rows from the SET MARGIN statement
MODNO CHAR 1 R/3 System Index of the external sessions
MSGID CHAR 20 Messages Message class
MSGLI CHAR 60 Messages Message line
MSGNO NUMC 3 Messages Message number
MSGTY CHAR 1 Messages Message type
MSGV1 CHAR 50 Messages Message variable
MSGV2 CHAR 50 Messages Message variable
MSGV3 CHAR 50 Messages Message variable
MSGV4 CHAR 50 Messages Message variable
NEWPA CHAR 1 Internal

NRPAG CHAR 1 Internal

ONCOM CHAR 1 Internal

OPSYS CHAR 10 R/3 System Operating system of application server
PAART CHAR 16 Printing lists Print formatting
PAGCT INT4 10 Obsolete

PAGNO INT4 10 Creating lists Current page
PAUTH NUMC 2 Internal

PDEST CHAR 4 Printing lists Output device
PEXPI NUMC 1 Printing lists Spool retention period
PFKEY CHAR 20 Screens Current GUI status
PLAYO CHAR 5 Internal

PLAYP CHAR 1 Internal

PLIST CHAR 12 Printing lists Name of spool request
PNWPA CHAR 1 Internal

PRABT CHAR 12 Printing lists Cover sheet: Department
PRBIG CHAR 1 Printing lists Selection cover sheet
PRCOP NUMC 3 Printing lists Number of copies
PRDSN CHAR 6 Printing lists Name of the spool dataset
PREFX CHAR 3 Obsolete

PRI40 CHAR 1 Internal

PRIMM CHAR 1 Printing lists Output immediately
PRINI NUMC 1 Internal

PRLOG CHAR 1 Internal

PRNEW CHAR 1 Printing lists New spool request
PRREC CHAR 12 Printing lists Recipient
PRREL CHAR 1 Printing lists Delete after output
PRTXT CHAR 68 Printing lists Text for cover sheet
REPI2 CHAR 40 Internal

REPID CHAR 40 ABAP program Current main program
RSTRT CHAR 1 Internal

RTITL CHAR 70 Printing lists Program from which you are printing
SAPRL CHAR 4 R/3 System R/3 Release in use
SCOLS INT4 10 Screens Number of columns
SFNAM CHAR 30 Obsolete

SFOFF INT4 10 Internal

SLSET CHAR 14 Selection screens Variant name
SPONO NUMC 10 Printing lists Spool number
SPONR NUMC 10 Obsolete

SROWS INT4 10 Screens Number of lines
STACO INT4 10 List processing First column displayed
STARO INT4 10 List processing Topmost line displayed
STEPL INT4 10 Screens Index of current table line
SUBCS CHAR 1 Internal

SUBRC INT4 10 Return code Return code following an ABAP statement
SUBTY RAW 1 Internal

SYSID CHAR 8 R/3 System Name of the R/3 System
TABID CHAR 8 Internal

TABIX INT4 10 Internal tables Current line index
TCODE CHAR 20 ABAP program Current transaction code
TFDSN CHAR 8 Obsolete

TFILL INT4 10 Internal tables Current number of lines
TIMLO TIMS 6 Date and time User’s local time
TITLE CHAR 70 Screens Text in the title bar
TLENG INT4 10 Internal tables Line size
TLOPC INT4 10 Internal

TMAXL INT4 10 Obsolete

TNAME CHAR 30 Obsolete

TOCCU INT4 10 Internal tables Initial memory requirement
TPAGI INT4 10 Obsolete

TSTIS INT4 10 Internal

TTABC INT4 10 Obsolete

TTABI INT4 10 Obsolete

TVAR0 CHAR 20 Creating lists Text variable for titles
TVAR1 CHAR 20 Creating lists Text variable for titles
TVAR2 CHAR 20 Creating lists Text variable for titles
TVAR3 CHAR 20 Creating lists Text variable for titles
TVAR4 CHAR 20 Creating lists Text variable for titles
TVAR5 CHAR 20 Creating lists Text variable for titles
TVAR6 CHAR 20 Creating lists Text variable for titles
TVAR7 CHAR 20 Creating lists Text variable for titles
TVAR8 CHAR 20 Creating lists Text variable for titles
TVAR9 CHAR 20 Creating lists Text variable for titles
TZONE INT4 10 Date and time Difference between local time and GMT
UCOMM CHAR 70 Screens Function code that triggered PAI
ULINE CHAR 255 Constants Horizontal line with length 255
UNAME CHAR 12 R/3 System Username of current user
UZEIT TIMS 6 Date and time Current application server time
VLINE CHAR 1 Constants Vertical line
WAERS CUKY 5 Obsolete

WILLI INT4 10 Obsolete

WINCO INT4 10 Obsolete

WINDI INT4 10 Obsolete

WINRO INT4 10 Obsolete

WINSL CHAR 79 Obsolete

WINX1 INT4 10 Obsolete

WINX2 INT4 10 Obsolete

WINY1 INT4 10 Obsolete

WINY2 INT4 10 Obsolete

WTITL CHAR 1 Creating lists Flag for standard page header
XCODE CHAR 70 Internal

XFORM CHAR 30 Internal

XPROG CHAR 40 Internal

ZONLO CHAR 6 Date and time User’s time zone

                                                                                                   
System Fields in Thematic Order
The system fields are grouped thematically below with notes on their use:

System Information
  •  
  •  
  •  
  •  
  •  
  •  
ABAP Programming
  •  
  •  
  •  
  •  
  •  
  •  
Screens
  •  
  •  
  •  
  •  
Internal System Fields
Obsolete System Fields

                                                                                                   
System Information
Information About the Current R/3 System
SY-DBSYS
Central database system (such as INFORMIX or ORACLE)
SY-HOST
Application server (such as HS0333, PAWDF087 …)
SY-OPSYS
Operating system of the application server (such as HP-UX, SINIX)
SY-SAPRL
R/3 Release in use (such as 30D, 46A, …)
SY-SYSID
R/3 System name (such as B20, I47, ...)
Information About the Current Terminal Session
SY-LANGU
One-character language key with the user’s logon language (such as D, E, F…)
SY-MANDT
Client in which the user is logged on (such as 000, 400…)
When you use Open SQL to access the database, SY-MANDT is used as the first key field in the WHERE clause.

SY-MODNO
Index of the external sessions. The first session has the index zero. The value is increased by one each time you choose System ® Create session or start a transaction by entering /o. If you have deleted sessions, the system fills free numbers before increasing the count further. Sessions started using CALL TRANSACTION … STARTING NEW TASK begin again at 0.
SY-UNAME
Username of the current user, such as KELLERH, BC400-01…
Information About Current Date and Time
The following system fields are always set automatically. The GET TIME statement synchronizes the time on the application server with the time on the database server and writes it to the field SY-UZEIT. SY-DATUM and the system fields for the local timezone (SY-TIMLO, SY-DATLO, and SY-ZONLO) are also reset.
SY-DATLO
User’s local date, for example 19981129, 19990628, …
SY-DATUM
Current application server date, for example 19981130, 19990627, …
SY-DAYST
X during summertime, otherwise space.
SY-FDAYW
Factory calendar day of the week: Monday = 1 … Friday = 5.
SY-TIMLO
User’s local time, for example 154353, 225312, …
SY-TZONE
Time difference in seconds between local time and Greenwich Mean Time (UTC), for example, 360, 10800.
SY-UZEIT
Current application server time. for example 164353, 215312, …
SY-ZONLO
User’s time zone, for example, EST, UTC, …
Information About the Current ABAP Program
SY-CALLD
X if the program was started using CALL TRANSACTION, CALL DIALOG, or SUBMIT … [AND RETURN]. Space if the program was started using LEAVE TO TRANSACTION or using a transaction code from a screen. SY-CALLD is always space when a batch input session is being processed.
SY-CPROG
The name of the calling program in an external routine, otherwise the name of the current program.
SY-DBNAM
The name of the logical database linked to an executable program.
SY-DYNGR
Screen group to which the current screen belongs. You can assign several screens to one screen group, for example, to allow you to modify them all identically.
SY-DYNNR
Number of the current screen. During selection screen processing, SY-DYNNR contains the screen number of the current selection screen. During list processing, it contains the number of the container screen. During subscreen processing, SY-DYNNR contains the number of the subscreen. This also applies to tabstrip controls.
SY-LDBPG
In executable programs, the database program of the associated logical database.
SY-REPID
Name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.
SY-TCODE
The current transaction code.
Background Processing
SY-BATCH
X if the ABAP program is running in the background, otherwise space
Batch Input
SY-BINPT
X while a batch input session is running and when an ABAP program is called using CALL TRANSACTION USING, otherwise space.
  • OPTIONS FROM in the CALL TRANSACTION USING statement can set SY-BINPT to space either for the entire duration of the program, or at the end of the BDC data.
  • SY-BINPT is always space during a CATT procedure.

                                                                                                   
ABAP Programming
Constants
SY-ABCDE
Contains the alphabet. You can use this field with offset to retrieve a letter of the alphabet regardless of codepage.
SY-ULINE
Contains a horizontal line with length 255 that you can use when creating lists.
SY-VLINE
Contains a vertical line (|) that you can use when creating lists.
Loops
SY-INDEX
In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.
Strings
SY-FDPOS
Location of hit in string operations.
  • When you use CO,CN, CA, NA, CS, NS, CP, and NP, offset values are assigned to SY-FDPOS depending on the search result.
  • SEARCH … FOR … sets SY-FDPOS to the offset of the search string.
Internal Tables
SY-TABIX
Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.
  • APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
  • COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
  • LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
  • READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
  • SEARCH FOR sets SY-TABIX to the index of the table line in which the search string is found.
SY-TFILL
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
SY-TLENG
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the length of the lines in the relevant internal table.
SY-TOCCU
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the initial amount of memory allocated to the relevant internal table.
Database Access
SY-DBCNT
SQL statements set SY-DBCNT to the number of table entries processed. In an Open SQL SELECT loop, SY-DBCNT is not set until after the ENDSELECT statement. In Native SQL, SY-DBCNT is not set until after the ENDEXEC statement.
  • DELETE sets SY-DBCNT to the number of deleted lines.
  • FETCH sets SY-DBCNT to the number of lines read by the corresponding cursor.
  • INSERT sets SY-DBCNT to the number of lines inserted.
  • MODIFY sets SY-DBCNT to the number of lines processed.
  • UPDATE sets SY-DBCNT to the number of lines changed.
Return Code
SY-SUBRC
Return code, set by the following ABAP statements. As a rule, if SY-SUBRC = 0, the statement was executed successfully.
  • ASSIGN sets SY-SUBRC to 0 if the field symbol assignment was possible, otherwise to 4.
  • AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the required authorization, otherwise to 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause of the authorization failure.
  • CALL DIALOG with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
  • CALL FUNCTION sets SY-SUBRC in accordance with the defined exception handling.
  • CALL METHOD sets SY-SUBRC in accordance with the defined exception handling.
  • CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chooses Enter or Execute, and 4 if the user chooses Cancel.
  • CALL TRANSACTION with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
  • CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC after the ENDCATCH statement if a system exception occurs. The value is set in the program.
  • COMMIT WORK sets SY-SUBRC to 0.
  • COMMIT WORK AND WAIT sets SY-SUBRC to 0 if the update is successful, otherwise to a value other than 0.
  • COMMUNICATION INIT DESTINATION … RETURNCODE sets SY-SUBRC as specified.
  • CONCATENATE sets SY-SUBRC to 0 if the result fits into the target variable, otherwise to 4.
  • CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled in the program.
  • CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object could be created, otherwise to 1, 2, or 3, depending on the cause.
  • DELETE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or another value other than 0, depending on the cause.
  • DEMAND … MESSAGES INTO sets SY-SUBRC to 0 if the message table is empty, otherwise to a value other than 0.
  • DESCRIBE LIST sets SY-SUBRC to 0 if the line or list exists, otherwise to 4 or 8.
  • EXEC SQL - ENDEXEC sets SY-SUBRC to 0 in nearly all cases. It does, however, set SY-SUBRC to 4 if no entry is read in a FETCH statement.
  • FETCH sets SY-SUBRC to 0 if at least one line was read, otherwise to 4.
  • GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if the generation was successful, otherwise to 8.
  • GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise to 4.
  • GET PARAMETER sets SY-SUBRC to 0 if a corresponding value exists in SAP memory, otherwise to 4.
  • IMPORT sets SY-SUBRC to 0 if the import is successful, otherwise to 4.
  • INSERT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  • LOAD REPORT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or 8 depending on the cause of the error.
  • LOOP sets SY-SUBRC to 0 if there is at least one pass through the extract. Otherwise, it is set to a value other than 0.
  • LOOP AT sets SY-SUBRC to 0 if there is at least one loop pass through the internal table, otherwise to 4.
  • MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  • MODIFY LINE sets SY-SUBRC to 0 if a line in the list was changed, otherwise it sets it to a value other than 0.
  • MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  • OLE2 Automation: Bundled commands set SY-SUBRC to 0 if all commands could be executed successfully, otherwise 1, 2, 3, or 4, depending on the cause of the error.
  • OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.
  • Open SQL statements set SY-SUBRC to 0 if the operation is successful, otherwise to a value other than 0.
  • OVERLAY sets SY-SUBRC to 0 if at least one character is overlaid, otherwise to 4.
  • READ DATASET sets SY-SUBRC to 0 if the read operation was successful, otherwise to 4 or 8, depending on the cause of the error.
  • READ LINE sets SY-SUBRC to 0 if a list line exists, otherwise to a value other than 0.
  • READ TABLE sets SY-SUBRC to 0 if table lines are found, otherwise to 2, 4, or 8, depending on the context and cause of the error.
  • REPLACE sets SY-SUBRC to 0 if the search string was replaced, otherwise to a value other than 0.
  • SCROLL sets SY-SUBRC to 0 if the scrolling within the list was successful, otherwise to 4 or 8, depending on the cause.
  • SEARCH sets SY-SUBRC to 0 if the search string was found, otherwise to 4.
  • SELECT sets SY-SUBRC to 0 if at least one line was read, otherwise to 4, or possibly 8 in SELECT SINGLE FOR UPDATE.
  • SET COUNTRY sets SY-SUBRC if the country code exists in table T005X, otherwise to 4.
  • SET BIT sets SY-SUBRC to 0 if the bit could be set, otherwise to a value other than 0.
  • SET TITLEBAR sets SY-SUBRC to 0 if the title exists, otherwise to 4.
  • SHIFT … UP TO sets SY-SUBRC to 0 if the position could be found within the string, otherwise to 4.
  • SPLIT sets SY-SUBRC to 0 if the sizes of the target fields are adequate, otherwise to 4.
  • UPDATE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  • WRITE … TO sets SY-SUBRC to 0 if the assignment is successful, otherwise to 4.

                                                                                                   
Screens
Screens
A group of system fields is set in the PAI event of each screen. With the exception of SY-DATAR, SY-LOOPC, and SY-STEPL, you can also use all of them in interactive list processing
SY-CUCOL
Horizontal cursor position. Counter begins at column 2.
SY-CUROW
Vertical cursor position. Counter begins at line 1.
SY-DATAR
X if at least one input field on the screen was changed by the user or other data transport, otherwise space.
SY-LOOPC
Number of lines currently displayed in a table control.
SY-PFKEY
GUI status of the current screen. This can be set in the PBO event using the SET PF-STATUS statement.
SY-SCOLS
Number of columns on the current screen.
SY-SROWS
Number of rows on the current screen.
SY-STEPL
Index of the current line in a table control. This is set in each loop pass. SY-STEPL does not have a meaningful value outside the loop (for example, during the POV event for a table line).
SY-TITLE
Text that appears in the title bar of the screen. This is the program name for selection screens and lists, and SAP R/3 otherwise. Can be set using the SET TITLEBAR statement.
SY-UCOMM
Function code that triggered the PAI event. There is a unique function code assigned to every function that triggers the PAI event with one exception: ENTER triggers the PAI, and various function codes can be passed to SY-UCOMM:
  • If the user has entered a command in the command field, this is passed to SY-UCOMM.
  • If there is no entry in the command field and a function code has been assigned to the ENTER key, this function code is passed to SY-UCOMM.
  • If there is no entry in the command field and there is no function key assigned to the ENTER key, the content of SY-UCOMM remains unchanged.
Selection Screens
SY-SLSET
Variant used to fill the selection screen.
Creating Lists
When you create a list, you can use the following system fields to control navigation. They help you to ensure that output statements do not overwrite existing output, or that data is not written outside the list. The system fields SY-COLNO and SY-LINNO always contain the current output position, and they are reset by each output statement. The other system fields contain other values used for creating lists.
SY-COLNO
Current column during list creation. The counter begins at 1. The field is set by the following output statements:
  • WRITE, ULINE, and SKIP set SY-COLNO to the next output position.
  • BACK sets SY-COLNO to 1.
  • POSITION sets SY-COLNO to . If is beyond the page border, any subsequent output statements are ignored.
  • NEW-LINE sets SY-COLNO to 1.
  • NEW-PAGE sets SY-COLNO to 1.
SY-LINCT
Page length of the list. For a default list of indefinite length, SY-LINCT is 0. If the page length is defined, SY-LINCT has that value.
  • LINE-COUNT in the REPORT, PROGRAM, or FUNCTION POOL statement sets SY-LINCT for the current program.
  • LINE-COUNT in the SUBMIT statement sets SY-LINCT for the program called in the statement.
SY-LINNO
Current line during list creation. The counter begins at 1, and includes the page header. SY-LINNO is set by the following output statements:
  • WRITE, ULINE, and SKIP increase SY-LINNO by one at each line break.
  • BACK sets SY-LINNO to the first line following the page header. If you use BACK with RESERVE, SY-LINNO is set to the first line of a block.
  • NEW-LINE increases SY-LINNO by one.
  • SKIP TO LINE sets SY-LINNO to . If is not between 1 and the length of the page, the statement is ignored.
SY-LINSZ
Line width in the list. The default value is the default window width. SY-LINSZ = SY-SCOLS, for SY-SCOLS >= 84, and 84 for SY-SCOLS < 84
You can change the line width of the list using the LINE-SIZE addition in the REPORT or NEW-PAGE statement.
  • LINE-SIZE in the REPORT, PROGRAM, or FUNCTION POOL statement sets SY-LINSZ for the current program.
  • LINE-SIZE in the SUBMIT statement sets SY-LINSZ for the program called in the statement.
SY-PAGNO
Current page during list creation.
  • WRITE, ULINE, and SKIP increase SY-PAGNO by one at each page break.
  • NEW-PAGE increases SY-PAGNO by one, but only if there is at least one output line on both the current page and the intended next page.
  • NEW-SECTION in the statement NEW-PAGE PRINT ON sets SY-PAGNO to 1.
SY-TVAR0 ... SY-TVAR9
You can assign values to these variables in your programs. Their contents replace the placeholders in the list and column headers of the program in the TOP-OF-PAGE event.
SY-WTITL
The REPORT, PROGRAM, and FUNCTION-POOL statements set this variable to N if you use the NO STANDARD PAGE HEADING addition. Otherwise, it has the value space. NEW-PAGE does not set SY-WTITL.
List Processing
The following system fields are filled at each interactive list event and at the READ LINE statement:
SY-CPAGE
Page number of the topmost page in the display of the list on which the event was triggered. The counter begins at 1.
SY-LILLI
Line at which the event was triggered. The counter begins at 1 and includes the page header.
SY-LISEL
Contents of the line in which the event was triggered (restricted to the first 255 characters).
SY-LISTI
Index of the list in which the event was triggered.
SY-LSIND
Index of the list currently being created. The basic list has SY-LSIND = 0, detail lists have SY-LSIND > 0. The field is automatically increased by one in each interactive list event. You may change the value of SY-LSIND yourself in the program to enable you to navigate between lists. Changes to SY-LSIND do not take effect until the end of a list event. It is therefore a good idea to place the relevant statement at the end of the corresponding processing block.
SY-LSTAT
Program-controlled name for list levels. You can assign values to SY-LSTAT during list creation. The value of SY-LSTAT when the list is finished is saved with the list. In an interactive list event, SY-LSTAT is set to the value assigned to it during creation of the list in which the event occurred. SY-LSTAT is no longer maintained, and you should not use it in your programs.
SY-STACO
Number of the first displayed column of the list from which the event was triggered. The counter begins at 1.
SY-STARO
Number of the topmost displayed line of the topmost displayed page of the list from which the event was triggered. The counter begins at 1, not including the page header.
Printing Lists
When you print lists, the spool and runtime systems require certain internal information that is set in the following system fields when you start printing.
SY-CALLR
Contains a value indicating where printing was started, for example, NEW-PAGE for program-controlled printing, or RSDBRUNT for printing from a selection screen.
SY-PRDSN
Contains the name of the spool file during printing.
SY-SPONO
Contains the spool number during printing.
SY-MAROW, SY-MACOL
The SET MARGIN statement fills the system fields SY-MAROW and SY-MACOL. These determine the number of lines in the top margin and the number of columns in the left-hand margin respectively.
Print Parameters
The print parameters are passed to the spool system by the runtime environment, using a structure with the ABAP Dictionary type PRI_PARAMS. Before this structure existed, system fields were used instead. When you start printing, some of the fields from PRI_PARAMS are still written into system fields with the same names. However, you should not use these system fields yourself.
Messages
When the MESSAGE statement occurs, the following system fields are set. When the MESSAGE … RAISING statement occurs in a function module or method, these fields are also set in the calling program if it is to handle the exception.
SY-MSGID
SY-MSGID contains the message class
SY-MSGNO
SY-MSGNO contains the message number
SY-MSGTY
SY-MSGTY contains the message type
SY-MSGV1,…,SY-MSGV4
SY-MSGV1 to SY-MSGV4 contain the fields used to replace the placeholders in the message.
Special Actions that Fill Message Fields
  • When you use an ENQUEUE function module to set a lock, and the FOREIGN_LOCK exception occurs, the field SY-MSGV1 contains the name of the owner of the lock.
  • When you use CALL TRANSACTION or CALL DIALOG with the USING addition, a message that occurs during the screen chain is returned in the fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 ... SY-MSGV4.
  • In Remote Function Call (RFC), error messages are retrieved from the remote system and placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO,SY-MSGV1, SY-MSGV2, SY-MSGV3, SY-MSGV4. The fields are also set when a short dump or a message with type X occurs.

                                                                                                   
Internal System Fields
Internal system fields are exclusively for internal use in the ABAP runtime environment and the system kernel. They must not be overwritten in any circumstances, and should also not be read in ABAP programs.
SY-CFWAE
Undocumented
SY-CHWAE
Undocumented
SY-DEBUG
Undocumented
SY-DSNAM
File name for spool output
SY-ENTRY
Undocumented
SY-FFILE
Flat file (USING/GENERATING DATASET).
SY-FLENG
Length of a field
SY-FODEC
Number of decimal places in a field
SY-FOLEN
Output length of a field
SY-FTYPE
Data type of a field
SY-GROUP
Bundling
SY-INPUT
Undocumented
SY-LPASS
Undocumented
SY-NEWPA
Undocumented
SY-NRPAG
Undocumented
SY-ONCOM
Undocumented
SY-PAUTH
Undocumented
SY-PLAYO
Undocumented
SY-PLAYP
Undocumented
SY-PNWPA
Undocumented
SY-PRI40
Undocumented
SY-PRINI
Undocumented
SY-PRLOG
Undocumented
SY-REPI2
Undocumented
SY-RSTRT
Undocumented
SY-SFOFF
Undocumented
SY-SUBCS
Call status of an executable program
SY-SUBTY
Call type of an executable program
SY-TABID
Undocumented
SY-TLOPC
Undocumented
SY-TSTIS
Undocumented
SY-XCODE
Extended function code, filled by user actions on a list (like SY-UCOMM). Before the length of SY-UCOMM was extended from 4 to 70 characters, SY-XCODE was used internally to accommodate long entries in the command field. You should always use SY-UCOMM in application programs.
SY-XFORM
SYSTEM-EXIT subroutine.
SY-XPROG
SYSTEM-EXIT program.

                                                                                                   
Obsolete System Fields
Some of the system fields in the R/3 System were originally adopted from R/2, but are no longer filled with values. They are obsolete, and must not (indeed cannot) be used.
SY-APPLI
R/2 - ID for the SAP applications installed. Not filled in R/3.
SY-BATZD
R/2 - flag for daily background scheduling. Not filled in R/3.
SY-BATZM
R/2 - flag for monthly background scheduling. Not filled in R/3.
SY-BATZO
R/2 - flag for one-time background scheduling. Not filled in R/3.
SY-BATZS
R/2 - flag for immediate background scheduling. Not filled in R/3.
SY-BATZW
R/2 - flag for weekly background scheduling. Not filled in R/3.
SY-BREP4
R/2 - root name of the report requesting background processing. Not filled in R/3.
SY-BSPLD
R/2 - flag for spool output from background processing. Not filled in R/3.
SY-CCURS
R/2 - exchange rate and result field for CURRENCY CONVERSION. Not filled in R/3.
SY-CCURT
R/2 - table exchange rate for CURRENCY CONVERSION. Not filled in R/3.
SY-CDATE
R/2 - exchange rate date for CURRENCY CONVERSION. Not filled in R/3.
SY-CTABL
R/2 - exchange rate table for CURRENCY CONVERSION. Not filled in R/3.
SY-CTYPE
R/2 - exchange rate type for CURRENCY CONVERSION. Not filled in R/3.
SY-DCSYS
Dialog system of the R/2 System. Not filled in R/3.
SY-FMKEY
Formerly the current function code menu. Not filled in R/3.
SY-LOCDB
Local database. Not implemented.
SY-LOCOP
Local database operation. Not implemented.
SY-MACDB
Formerly the file name for matchcode access. Not filled in R/3.
SY-MARKY
Current line letter for the MARK statement. The MARK statement will not be supported for much longer.
SY-TMAXL
Formerly the maximum number of entries in an internal table. Not filled in R/3.
SY-TFDSN
Formerly the name of an external storage file for extracts. Not filled in R/3.
SY-PAGCT
R/2 - the maximum number of pages per list. Not filled in R/3.
SY-PREFX
ABAP prefix for background jobs. Not filled in R/3.
SY-SFNAM
Undocumented
SY-SPONR
In R/2, you could process spool files with the TRANSFER statement, which also set SY-SPONR. Not filled in R/3.
SY-TNAME
Formerly the name of an internal table following access. Not filled in R/3.
SY-TTABC
Formerly the index of the last line of an internal table to be read. Not filled in R/3.
SY-TTABI
Formerly the offset of internal tables in the roll area. Not filled in R/3.
SY-TPAGI
Formerly flagged whether an internal table had been moved to the paging area. Not filled in R/3.
SY-WAERS
Formerly the company code currency after reading a posting segment. Not filled in R/3.
SY-WILLI
R/2 - the number of the list line selected from a detail list. Use SY-LILLI instead.
SY-WINCO
R/2 - cursor position on a detail list. Use SY-CUCOL instead.
SY-WINDI
R/2 - index of the list for a detail list. Use SY-LSIND instead.
SY-WINRO
R/2 - cursor position for a detail list. Use SY-CUROW instead.
SY-WINSL
R/2 - contents of the selected line for detail list in a window. Use SY-LISEL instead.
SY-WINX1
R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.
SY-WINX2
R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.
SY-WINY1
R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.
SY-WINY2
R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.