Google Search - Blog...........

Working With Matchcode Objects In Sap ABAP.

A Matchcode is an aggregated object and it gives list of possible values for the user. A matchcode is a collection of search terms on which you retrieve a data from the database table.

All matchcode are associated with either selection criteria or parameters. When an input field has a little triangle in the right-hand corner, it indicates that it has an associated matchcode. When you click on drop-down arrow or press F4 button, it gives a list of all possible values. For example Matnr field i.e. material number from MARA table, user might not know all the material number, but they might know other details like material description, type or any other details. You can create matchcode, which has all these search terms i.e. you can create matchcode with description as search term or matchcode with type as search term.

R/3 system includes many predefined matchcode but developers can create new matchcode as is created in following case. Usually, system displays list of possible values for all the primary keys with particular search term. Usually you create matchcode in following cases:

When you use non-primary key of input.
You need different search term for the primary key.

Creating Matchcode object:

Entire Matchcode object is created in two steps:

Defining of Matchcode object.
Defining one or more search ids for the object.

Defining Matchcode Object:

It includes all the tables and fields, which make up the Matchcode, which are used for Matchcode Ids.
Steps for defining Matchcode object are as follows:

From dictionary, enter name (four character).
Select Matchcode radiobutton and click on CREATE.
Define attributes for the object i.e. description.

Select primary table.
Select the fields for the table by clicking on the fields.
Activate the object.

If at all you are selecting secondary table then it is done after selecting primary table.
And steps are as follows:
Tables  Choose secondary table. A dialog box appears, which displays list of possible secondary tales. Select the table by Choose  copy.

To activate the object, Matchcode object - activate

Creating Matchcode ID's:

Once the object is created, you need to define search term for the object and steps are as follows:

Click on the Matchcode ID from maintenance screen.
Enter attributes for the Matchcode Id.
Short text.
Update type - Default is 1 for logical updating. It means that at the moment when you access the Matchcode object, the table is created like view. Unlike logical updating, physical updates are: A,S,P.
System Matchcode: If you click this particular field, it indicates a system matchcode, which is used by SAP software and cannot be changed by the end user.
Autho.checks: If it is checked, the system performs authorization checks for this matchcode Id.

Selecting Secondary Tables:

Position the cursor on the base table of the ID.
Edit  Choose secondary tables
A dialog box appears listing the tables linked to the table by foreign keys
Select table.
Selecting fields for Matchcode ID

Select fields.
Choose fields.
Once all the fields are selected, click on copy fields.
Fields are transferred to the matchcode ID.

Activation of ID:

A corresponding database view is created in the database during activation for the Ids of update type I. During activation, a check is made to see whether the corresponding index to support view selection exists in the database. If it doesn’t, a warning is displayed.

Testing the Matchcode ID.

To test the matchcode Id:

Maintain matchcode object.
Utilities  display matchcode data.

Using Matchcode:

When the user do not know which matchcodes are available for a field, user can find the matchcode by:

Positioning the cursor on a field and clicking on drop arrow or pressing the F4 key.
A dialog box appears with a list of available matchcode.
User can select another matchcode by clicking on the NEW selection button.
Double click on a matchcode to use it. If you want to use this as default matchcode, click on standard button. If user does this once, the selected matchcode is proposed automatically the next time.
You can enter the search term and press ENTER. If search term is not specified, the system displays all the records for the specific matchcode.

1 comment: