Sie sind auf Seite 1von 5

SAP ABAP

• RANGES Tables
You can use the RANGES statement to create internal tables of the same type as selection tables.
RANGES <rangetab> FOR <f>.
This statement is simply a shortened form of the following statements:
DATA: BEGIN OF <rangetab> OCCURS 0,
SIGN(1),
OPTION(2)
LOW LIKE <f>,
HIGH LIKE <f>,
END OF <rangetab>.

Internal tables created with RANGES have the same structure as selection tables, but they do not
have the same functionality.
Selection tables created with RANGES are not components of the selection screen. As a result, no
relevant input fields are generated. Also, you cannot use a RANGES table as a data interface in
program <prog> called by the following statement:
SUBMIT <prog> WITH <rangetab> IN <table>.

• Function Groups and Function Modules


Function groups are containers for function modules. You cannot execute a function group. When
you call an function module, the system loads the whole of its function group into the internal
session of the calling program (if it has not already been loaded).

SAPL<fgrp> contains nothing but the INCLUDE statements for the following include programs:

L<fgrp>TOP. This contains the FUNCTION-POOL statement (equivalent for a function group of the
REPORT or PROGRAM statement) and global data declarations for the entire function group.

L<fgrp>UXX. This contains further INCLUDE statements for the include programs L<fgrp>U01,
L<fgrp>U02, ... These includes contain the actual function modules.

The include programs L<fgrp>F01, L<fgrp>F02, ... can contain the coding of subroutines that can be
called with internal subroutine calls from all function modules of the group.

All of the function modules in a function group can access the global data of the group. For this
reason, you should place all function modules that use the same data in a single function group. For
example, if you have a set of function modules that all use the same internal table, you could place
them in a function group containing the table definition in its global data.

Like executable programs (type 1) and module pools (type M), function groups can contain screens,
selection screens, and lists. User input is processed either in dialog modules or in the corresponding
event blocks in the main program of the function group. There are special include programs in which
you can write this code. In this way, you can use function groups to encapsulate single screens or
screen sequences.

• New Fields for Lists of Sales and Distribution Documents


VA05 transaction
VBMTV (Lists of Sales Documents) Structure
VBMTVZ (Customer enhancements for lists of sales documents) Structure
V05TZZMO (further document fields for lists of sales documents) Include Program

• DELETE ADJACENT DUPLICATES FROM itab.


Additions:
1. ... COMPARING f1 f2 ...
2. ... COMPARING ALL FIELDS
Deletes neighboring, duplicate entries from the internal table itab. If there are n duplicate entries,
the first entry is
retained and the other n - 1 entries are deleted.

Two lines are considered to be duplicated if their keys match.

The return code is set as follows:


SY-SUBRC = 0: At least one duplicate exists, at least one entry deleted.
SY-SUBRC = 4: No duplicates exist, no entry deleted.

... COMPARING f1 f2 ...


Two lines of the internal table itab are considered to be
duplicates if the specified fields f1, f2, .... match.

delete adjacent duplicates from lekpo comparing ebeln ebelp.

... COMPARING ALL FIELDS


Two lines are considered to be duplicates if all fields of the
table entries match.

• OKC9 : Define Substitution


VIEWNAME : V_TKAZES Call up Points for Substitutions
Substitution object: Constant, table field, or exit
There are three methods for changing (substituting) the value in a table field if the Boolean condition
has been fulfilled (or is empty). The selected method is displayed next to this field.
Substitution with a constant value.
Substitution with the value from a different table field.
Substitution within a user exit.

User Exits
Syntax: Uzzzz (zzzz = up to 4 characters)
The name of the form pool contained by your user exit must be stored in table T80D.
Validation exits. These are used in requirements and checks. They have either the value "T" for
true or "F" for false and are interpreted as a part of the logical expression, such as a comparison of
constants or of fields. This type of user exit requires you to enter a parameter with the result of your
check ("T" for true; "F" for false).
Substitution exits are used to change one or more fields. However, you can only change fields for
which substitution is permitted in the Boo lese class. When maintaining substitutes, you can display
these fields by choosing the menu path "Extras -> Fields for substitution".

It is important that you tell your code generation programs the number and type of parameters that
you use for the user exit. You do this by making your newly defined user exit known in the FORM
routine GET_EXIT_TITLES (with the exception of the parameter for the result of a validation exit).
You do not need to declare this parameter because it is automatically generated by the system. For
information on the types of parameter that exist and how they are used, refer to the online
documentation. When you create a user exit, you can also use the example form pools supplied by
SAP (RGGBNR000 for validation; RGGBS000 for substitution). You are recommended to copy the
example form pools when creating your user exits. These example form pools already contain entries
in the FORM routine GET_EXIT_TITLES for the examples supplied. Note that routine GET_EXIT_TITLES
must always exist in your form pool.

SAP Exits
SAP exits are FORM routines programmed by SAP. The name of the form pool is SAPFGBEB.
Syntax: Szzzz (zzzz = up to four characters)
FORM Szzzz using B_result. "'T' oder 'F'

Program : ZGGBS0TR
form get_exit_titles tables etab.
...
exits-name = 'U104'.
exits-param = c_exit_param_field.
exits-title = text-104. "Cost center from MARA
append exits.
...
endform.

form u104 using cost_center.


data prodh like mvke-prodh.
select prodh into prodh
from mvke
where matnr = cobl-matnr.
exit.
endselect.
clear cost_center.
select single kostl into cost_center
from zbdfcoc0001
where prodh = prodh(4).
endform.

• V50Q0001 Enhancement SD
LE-SHP-DL Delivery Processing
VL06: Designing your own display variants
VL06O Transaction
WS_MONITOR_OUTB_DEL_PICK Program
LIPOV Structure
Function Module : EXIT_SAPLV50Q_001
include zxv50qu01.

• RS_SEND_MAIL_FOR_SPOOLLIST
SAP OSS Note 321624 says "RS_SEND_MAIL_FOR_SPOOLLIST was developed by SAP for internal
use and a very special task. The module is not released for customers and should therefore not be
used.
Use released interfaces of SAPoffice for sending messages.
Replace the module with the function SO_NEW_DOCUMENT_SEND_API1."
I used RS_SEND_MAIL_FOR_SPOOLLIST function module in Release 4.6C, but
RS_SEND_MAIL_FOR_SPOOLLIST is inactive in Release 4.0B. Therefore, I used
SO_NEW_DOCUMENT_SEND_API1 insted of it.

• Using Values Greater than 255 for the LINE-SIZE of a List


If you use a column with greater than 255 as the LINE-SIZE in the REPORT or NEW-PAGE statement,
the following notes apply:
- Type definitions: The type group SLIST defines the valid maximum value for the list width
(SLIST_MAX_LINESIZE), and contains a type for list lines with maximum type (SLIST_MAX_LISTLINE).
- Printing: You cannot print the list using standard printing functions. To print it, you must create a
special print routine that arranges the data in shorter lines (for example, using the ... PRINT ON
addition in the NEW-PAGE) statement.
- Accessing the entire contents of a line: To read or modify the entire contents of a wide line,
you can use the ... LINE VALUE addition in the READ LINE or MODIFY LINE statements. This is an
alternative to using SY-LISEL that is independent of the attributes of the system field (since the
length of SY-LISEL is 255 characters).
- Horizontal lines: With extra-wide lists, the "ULINE." statement corresponds to "WRITE / SY-
ULINE.". So, for example, "ULINE AT 5(300)." corresponds to "WRITE AT 5(300) SY-ULINE.".
- Output length: You can use the length specification in WRITE (or ULINE) to extend the output
length of an extra-wide list up to the value of LINE-SIZE. If you want to output a whole field that is
longer than 255 characters, you must use this, even if the field itself is defined as longer than 255
characters.
Example
NEW-PAGE LINE-SIZE 1000.
DATA: F1(500) VALUE 'F1'.
WRITE: / F1 COLOR COL_NORMAL. " Output with length 255
WRITE: /(500) F1 COLOR COL_NORMAL. " Output with length 500

• SORT_TOO_MANY_FIELDS
Cause and prerequisites
A SELECT with FOR ALL ENTRIES is carried out for a table with more than 250 fields. You select with a
field list with more than 250 fields or SELECT * . .. INTO CORRESPONDING.
SELECT ... FOR ALL ENTRIES is (almost) always linked internally to a sorting of the resulting quantity.
However, the sorting algorithm allows only 250 sort fields. That is normally no restriction since
transparent database tables may only have a maximum of 249 fields. However, this problem can
occur with cluster tables (such as table BSEG).
Solution
1. Use less than 250 fields in the SELECT condition or
a) avoid the additions FOR ALL ENTRIES or INTO/APPENDING CORRESPONDING.
• Program Attributes - Fixed Point Arithmetic
If you mark this checkbox, all calculations in the program will use fixed point arithmetic.
If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated
as integers when they are used in assignments, comparisons and calculations, irrespective of the
number of decimal places defined. Intermediate results in arithmetic calculations will also be
rounded to the next whole number. The number of decimal places defined is only taken into account
when you output the answer using the WRITE statement.

• RESERVE n LINES.
If there is not enough space left on the current page for at least n lines, this statement starts a new
page. n can be a constant (1,2,3,...) or a variable.
Before starting a new page, the END-OF-PAGE processing is executed. This differs from NEW-
PAGE.
If the RESERVE statement does not trigger a new page, output is continued on the current page.
Use BACK to return to the first line output after RESERVE.

• Select .... for all entries in i_tab


In case you are using
Select .... from t1
for all entries in i_tab
where .......
you must check internal table i_ctab is not empty. Without this check you will lead to full table scan
of Table 't1'.
• CONCATENATE f1 ... fn INTO g.
Combines the fields f1 to fn (n >= 2) and places them in g.
Note that trailing spaces in source fields with type C are ignored (since they cannot be
distinguished from "padding" characters). In C strings, on the other hand, they are considered. All
fields fi (1 <= i <= n) are used in the length STRLEN(fi).

• NEW-PAGE.
NEW-PAGE does not generate blank pages, it ignores pages containing no output.
NEW-PAGE increments the page counter (the system field SY-PAGNO).
The event END-OF-PAGE is not processed.
To start a new page depending on the number of unused lines remaining on the current page, use
the RESERVE statement.

• Which SQL statement bypasses the table buffer?


Following are the SQL statements which bypass table buffer; avoid these statements when working
with buffered tables.
SELECT ... BYPASSING BUFFER.
SELECT from the database views
SELECT ... DISTINCT ... .
SELECT COUNT, SUM, AVG, MIN, MAX.
SELECT ... ORDER BY (other than the primary key)
SELECT ... FOR UPDATE. (EXEC ... ENDEXEC)
Native SQL statements.

• BSEG Access
Index tables to provide quicker access to BSEG (Accounting Documents) Choose the index table that
best matches the data that you want to retrieve.
BSAD Accounting: Secondary index for customers (cleared items)
BSAK Accounting: Secondary index for vendors (cleared items)
BSAS Accounting: Secondary index for G/L accounts (cleared items)
BSID Accounting: Secondary index for customers
BSIK Accounting: Secondary index for vendors
BSIM Secondary Index, Documents for Material
BSIS Accounting: Secondary index for G/L accounts

• Does the SELECT command carry out any authorization check?


No
• What does the system variable SY-DBCNT contain?
SY-DBCNT contains the number of entries read using a SELECT statement.

• What is the function of the environment variable SY-LISEL in interactive reporting?


SY-LISEL stores the contents of the line selected. The contents of the variable are available in
secondary screen.

Das könnte Ihnen auch gefallen