SAP ABAP Syntax for Parameters part Four

SAP ABAP Syntax for parameters were previously discussed in part one, two and three and the present post is in continuation with it.

Addition 13

... FOR TABLE dbtab

Effect

Assigns the database-specific parameter p to the table dbtab . This addition only makes sense in a logical database access program.

With database-specific parameters, you need this addition to ensure that the selection screen for a report contains only database-specific parameters which belong to a table from the currently active report.

Addition 14

... AS MATCHCODE STRUCTURE

Effect

Creates the database-specific parameter p as a field string according to the Dictionary structure MCPARAMS with the fields MCID (matchcode ID ) and STRING (search string ). Used for data selection through matchcode entry. On the selection screen, both sub-fields are displayed in a box with the text "Matchcode selection".

You can get a list of possible entries for the matchcode ID and the search string by pressing F4 . If you choose a matchcode ID and press F4 in the field "Search string", you see a dialog box where you can enter a search criterion for each field of the matchcode ID. The system interprets what you enter generically for each sub-field.

The addition AS MATCHCODE STRUCTURE only makes sense in a logical database access program and must therefore be used together with the addition FOR TABLE . It can also be combined with the addition MODIF ID , but not with any other additions. The matchcode object to which the matchcode ID and the search string refer is determined when you define the logical database.

Example

Input on the selection screen:

Matchcode ID: Customers Search string: Daniel

The effect of this is to select all customers whose names begin with "Daniel".

Performance

Matchcode selection can improve program performance considerably. This is because specifying a search string often describes the required set of data records more accurately than the key fields of the table. For example, it is easier to select by name ("Daniel") than by customer number ("000043010") and far fewer records are read from the database.

If a logical database (e.g. ldb ) contains a parameter p defined with AS MATCHCODE STRUCTURE , the system always creates an internal table ldb_MC which includes all the key fields of the selected records. The structure of ldb_MC is determined by the matchcode object and generated automatically. In the maintenance transaction for logical databases, the structure is displayed as a comment in the database program.

Example

Matchcode object for table T1 with key field T1-K1 . The table ldb_MC then has the following structure:

DATA: BEGIN OF ldb_MC OCCURS 100,
T1_K1 LIKE T1-K1,
END OF ldb_MC.

If the user has entered values in the matchcode parameter fields, the program reads the selected data from the matchcode table after START-OF-SELECTION and makes it available to the logical database program in the internal table ldb_MC . Then, the database program processes the records in the subroutine PUT_ldb_MATCHCODE and, with the help of PUT , triggers the appropriate GET events in the report. Subsequent processing is exactly the same as that for data selection direct from the database.


Example

FORM PUT_ldb_MATCHCODE.
SELECT * FROM T1
WHERE K1 = ldb_MC-T1_K1
FOR ALL ENTRIES IN ldb_MC.
PUT T1.
ENDSELECT.
ENDFORM.

In matchcode selection, the system flags all fields in the internal table MC_FIELDS which are filled with values by the matchcode (the field name is in MC_FIELDS-FIELDNAME and the flag is in MC_FIELDS-SUPPLIED ).

Example

A field F0 is supplied with a value by the matchcode if the following condition is satisfied:

IF MC_FIELDS-FIELDNAME EQ 'F0'
AND MC_FIELDS-SUPPLIED NE SPACE.

ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

OTHER PROGRAMMING COURSES:

Dot Net Complete Course Part one and two
ASP.NET part one and

No comments:

Post a Comment