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.
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.
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, 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.
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.
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.
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.
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.
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.
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.
0 Comments:
Post a Comment