Regarding matchcode

hi to all experts,
                          my question is what are match code and matchcode id . what are the differences between search help and match codes.help me  very urgent.

Hi
Match codes and search helps both are same which are used as a search tool for getting the fields values from a table
Here is complete Overview of Match code with each and everypoint covered
Match Code
Matchcodes are an SAP technique to help users find information, normally in
connection with the F4 key on an input field. Information from one or more
tables can be combined and queried on using various search criteria: for
example, all companies whose name starts with "LEVI" and whose location is
"San Francisco."
<b>How are matchcodes implemented?</b>
Traditionally, matchcodes were implemented as redundant collections of data
in pool tables, as illustrated in the following:
Company header table     Company detail table       Matchcode pool table
     (TAB1)               (TAB2)               (M_POOL)
The advantage of the old pool matchcodes was a quick and easy search, as
long as the significant fields were entered by the end user (in this case,
company name and location). The disadvantage was that for every change in
the master tables, the system had to make redundant updates in the matchcode
tables. In addition, it was impossible to search in a pool matchcode for any
but the significant fields, i.e., it would have been very CPU intensive to
search for all companies in San Francisco.
This limitation led to the creation of matchcodes (more precisely, in SAP
terms, "matchcode IDs") for every possible query you could expect from end
users (one with company name as the significant field, one with location,
yet another with customer number, and so on). Customers with a very high
number of debitors, for example, soon found that their pool matchcode tables 
grew to unmanageable sizes.
As of release 2.1, it is now possible to define so-called transparent or
view matchcodes. Transparent matchcodes are implemented by defining a
database view for the information that should be queried. Database views are
not redundant containers of data, but are merely definitions of paths to
obtaining that data. In the example:
Company header table      Company detail table          Database view:
     (TAB1)               (TAB2)               (M_VIEW)
The advantage of this new technique is that it is no longer necessary to
maintain redundant matchcode data: a view takes only a small amount of
database dictionary space. Using this technique, the query is converted by
the database to a query against the original tables, so it becomes very
important that access be supported by the proper indexes.
Matchcode Customizing
When a transparent matchcode ID is activated, the system checks if an
appropriate index exists for the ID. Normally, such an index is necessary to
support the matchcode query. If such an index does not exist, there can be
major performance problems during matchcode selection. The system assumes
that the first field in the matchcode definition (for client-dependent match
codes the first field after the client field) is the relevant search field,
i.e., that the user will narrow down the search by entering a selection
criterion in this field.
An index is considered appropriate for the matchcode if it contains this
relevant matchcode field (or the client field followed by this field).
If no such index exists, a warning is given during the activation of the
matchcode ID. At this point, there are two possible courses of action:
1) If the matchcode view in the database covers less than 1,000 data
records, it is not necessary to create an index.
2) If the matchcode view will search more than 1,000 records, you should
create an index.
The first fields of an index to support matchcode selection should be
those that will be searched with equality (client, language or general
fields for which the get/set indicator has been set, i.e., the flag GP is
set for the field in the screen Update Matchcode ID Fields).
The index should have the following structure:
Client field - Fields for which the Get Parameter flag is set
Search fields - This index structure does not guarantee that the index will
be used by the underlying database system. Which index is used depends on
the database system's optimizer. You must verify that the index you have
created actually is used by the database.
Use the following method to determine whether the proper index is being used
to support the matchcode query:
Open a second session and choose System / Utilities / SQL Trace.
Select Trace on.
In your first session, do a search on your matchcode ID.
In your second session, choose Trace off and then List trace.
Search in your list for the first statement in which the matchcode view
occurs. Use the function Explain SQL to obtain information about how the
optimizer services the query. In particular, you can see which index is used.
Surplus matchcodes:
Before Release 3.0, surplus matchcode IDs should be deleted.
As of Release 3.0, surplus matchcodes IDs should be deactivated.
Deleting matchcode IDs (before Release 3.0)
Before you can delete a matchcode ID, you must check if it is a "system
matchcode." You can tell this by looking at the field System matchcode on
the screen Update Matchcode ID (Attributes). If this field is set, SAP uses
this matchcode ID. You should never delete a system matchcode ID!
Unfortunately, the dictionary transactions will allow you to delete system
matchcodes, so you should be extremely careful to check this flag and don't
delete a matchcode ID for which the flag is set.
If the flag System matchcode is not set, you must check which programs
use the matchcode. Use the general table display function (se16) and enter
the matchcode object and matchcode ID as the table name.
Deactivating matchcode IDs (as of Release 3.0)
The function Deactivate in the menu MC-Id of the screen Update Matchcode ID
(Attributes) allows you to reduce the load of unnecessary matchcode IDs.
Rather than deleting the ID, the dictionary definition remains available in
the ABAP/4 dictionary. If at some point the ID is needed again, it can
simply be reactivated.
The function Deactivate can only be used for active matchcode IDs. Before a
matchcode ID can be deactivated, the corresponding objects in the database
must be deleted (e.g., the view and possibly the index for IDs of update
type I).
Note that when you deactivate a matchcode ID of update type S, the matchcode
records will no longer be updated to keep up with application data. If you
reactivate a matchcode ID, you must re-create the matchcode records with the
matchcode utilities.
Note also that the deactivated matchcode IDs will not appear in F4 help.
Warning: Deactivation is a pure customizing function, i.e., not a
transportable characteristic.
If a deactivated matchcode ID is delivered again by SAP, it will be active
again after the upgrade.
Conversion to transparent matchcodes
Prerequisites for conversion
To convert a "physically stored" (pool) matchcode ID to transparent (view),
the following condition must be met:
All underlying tables of the ID must be transparent; no partial fields can
be used.
Note that when converting a program-controlled ID, you may need to adapt
the application programs.
Conversion procedure
To convert a physically stored matchcode ID (update type A, S or P) to
transparent (update type I), proceed as follows: Copy the ID you wish to
convert to the customer name range (IDs 0 to 9). Change the update type to
I and activate the ID.
If the original ID has the update type S, change the original to update type
A. This prevents unnecessary updates of the old ID. In Release 3.0, you
should simply deactivate the original ID.
Changes after the conversion
Searches are case sensitive
Queries on transparent matchcode IDs are case sensitive, i.e., when entering
a search argument in the text field, there is a distinction between upper
and lower case. The search string "hugo" would not match with the value
"Hugo" in the database. In some applications, there have been text fields
added to the original tables in which information is held redundantly in
upper case. If you use these fields in the matchcode ID, you can avoid this
problem of case sensitivity.
Sort order in output changes
For releases 2.1G to 2.1J, the output list is sorted by the index that the
optimizer chose for accessing the ID. As of 2.2E, the sort order depends on
the field order in the ID, i.e., the sort order will correspond to that of
the physical matchcode IDs. Transparent IDs that were not delivered with
2.2E must be activated again to have this new sort order.
Result set of a query can be smaller
The result set of a query on a transparent ID can be a real subset of the
results of an equivalent query on a physical matchcode ID. This is because
of the fact that transparent IDs are implemented with an inner join, whereas
the physical matchcodes are realized with an implicit outer join.
When searching with a transparent ID, records of a primary table that have
no corresponding entries in the foreign key fields of a secondary table will
not be found.
<b>Example:</b> An ID provides the search for an employee's personnel number using
name and department. The primary table contains the personnel number and
name. The secondary table contains departments and their employees.
Employees who have not been assigned to a department have no entry in the
secondary table. THose employees will not be found in a search with a
transparent matchcode with fields number, name and department. In a physical
matchcode ID with the same fields, those employees will be found.
Adapting partial fields
Partial fields in matchcodes are fields that you have defined so only a
portion of the original field is displayed and maintained in the matchcode.
You might want to show, for example, only the last six positions of SAP's
standard 16-character material number. If you defined partial fields for
the matchcode ID, their definitions must be removed to convert to a
transparent matchcode.
Further information
Issues especially for programmed matchcodes (update type P)
Programmed matchcodes are implemented physically, i.e., the matchcode data
is held redundantly in a separate table. The data is updated directly by
application programs, so that these application programs and other programs
always have access to the latest matchcode data. A function module is
generated during activation of the matchcode. The matchcode data is updated
when this function module is called. Conversion of programmed matchcodes to
transparent requires changes to the application programs that use the
function module. It is possible to just comment out the call to the function
module.
Adding tables to a matchcode object that contains a programmed matchcode ID
can lead to difficulties. Only one function module exists for all programmed
IDs in the object. This function module gets its information directly from
the matchcode object. For this reason, the function module interface should
be modified whenever the basis table of the object is changed, even if this
modification does not directly concern the programmed matchcode IDs.
Common problems with matchcode tables
Excessively large matchcode pool tables<Development Class [Save[Choose Sec. Tab. "presents candidate list
(&Tablename [Choose)... [Copy
[Fields
[Yes "Save before terminating Editing?
[Enter
(&Tablename [Choose Fields #Choosefields)..
[Save [Back [Activate
"Match Code Object is now created and activated.
<b>Or simply follow this</b>
SE11à Search Help àZmatchcode(Give ur name with starting Z) à F5(Create)
àShort Descriptionà Selection Method(Select your table or press F4 and select)
àDialog Type(Display Values Immediately,Dialog Depends on Set of Values, Dialog with restriction.)
*For present you can select Display Values Immediately*
Next goto Search Help Parameter declare your fields from table which already you had declared above. Then select both Import & Export Paramaters Give Lpos & Spos 1. Then check(Ctrl+F2) Then activate it.
Search Help
A search help is an object of the ABAP Dictionary with which input helps (F4 helps) can be defined.
There are the following types of search helps:
· Elementary search helps implement a search path for determining the possible entries.
· Collective search helps contain several elementary search helps. A collective search help therefore provides several alternative search paths for possible entries.
· Append search helps can be used to enhance collective search helps delivered by SAP with customer-specific search paths without requiring a modification.
The three components of the input help process described by a search help are the outer interface, the online behavior and the method of data collection.
The outer interface is defined by specifying the interface parameters They define the context information to be used in the input help process and the attributes to be sent to the screen by the input help.
The search help attachment defines the field contents for parametrizing an import parameter and the fields of the input template in which the contents of the export parameters should be returned.
The dialog behavior and data collection are defined differently for elementary search helps and collective search helps.
The behavior of a search help can be made more flexible than usual with search help exits
Elementary Search
An elementary search help is a search help that describes an input help process in which it is not possible to select one of a number of search paths.
The online behavior of an elementary search help is controlled by defining the dialog type and by specifying the fields to be displayed in the dialog box for restricting values or in the dialog box for displaying the hit list (including the order in these dialog boxes). These fields must be defined as parameters of the search help.
For data collection, a database table or a view is normally defined and the possible values are selected here. This table/view is called the selection method of the search help. If the selection method is a table, a text table can also be used for collecting data if one exists. In the selection, those fields of the selection method (and possibly of the text table) which have parameters with the same names in the search help are used.
If the standard options for describing the online behavior or data collection for the search help are not sufficient, you can define its behavior more flexibly by using a search help exit
Collective Search
A collective search help describes an input help process in which the user can choose one of several alternative search paths. Each alternative search path corresponds to an elementary search help i.e. a collective search help contains several elementary search helps.
Both elementary search helps and other collective search helps can be included in a collective search help. if a collective search help contains other collective search helps, they are resolved down to the level of the elementary search helps when the input help is called.
Like an elementary search help, a collective search help has an interface of import and export parametersThe data is exchanged between the screen template and the parameters of the elementary search helps contained in it using this interface. The parameters of the search helps included in a collective search help must be assigned to the parameters of the collective search help.
During the input help process, the collective search help only controls the user's selection of the required search path. The rest of the dialog and data collection is controlled by the selected elementary search help. If selection of the required elementary search help should be made flexible (e.g. with context-specific definition of the set of available search paths), the collective search help must be assigned a search help exit
Append Search
An append search help is used for modification-free enhancement of a collective search help (that is not the original in the current system) with further search help inclusions. This technique can be used for example in special developments and country versions, and by SAP partners and customers to add further search paths to a collective search help of the standard system.
An append search help has a fixed assignment to a collective search help (its appending object). This appending object is enhanced with the append search help.
The structure of an append search help corresponds to that of a collective search help, but the append search help takes on the parameters of its appending object so that it cannot be maintained separately any longer. Furthermore, an append search help cannot be assigned a search help exit.
An append search help is automatically included in its appending object. The parameters of the two search helps having the same name are assigned to each other.
Note: You can also hide modification-free search helps from a collective search help with an append search help. You have to insert the search help to be hidden in the append search help and then hide the inclusion there. The search path(s) defined by this search help are no longer offered in the appending search help. To cancel this, remove the hidden inclusion again from the append search help.
Note: Append search helps can also be used themselves to describe an input help. They are treated like collective search helps.
Note: If the parameters of the appending object change, this change is not automatically made in the append search help. Instead, you are informed that the parameters of the append search help should be adjusted. In this case you should check if you want to change the assignments between the parameters of the append search help and the search helps included in them.
Procedure: Proceed as follows to enhance a collective search help of the standard system with your own search paths:
1. For each search path, create an elementary search help in your namespace and activate these search helps.
2. In display mode, go to the maintenance screen for the collective search help and choose Goto -> Append search helps. Create the append search help in your namespace.
3. Include the elementary search help defined in the first step in the append search help. Maintain the parameter assignments between the parameters of the append search help and the parameters of the included search helps.
4. Activate the append search help. The append search help is automatically added to your appending object. The search paths inserted in the append search help are now available in the collective search help. They appear at the end of the list of available elementary search helps.
Search Help Exit
A search help exit is a function module for making the input help process described by the search help more flexible than possible with the standard version.
This function module must have the same interface as function module F4IF_SHLP_EXIT_EXAMPLE. The search help exit may also have further optional parameters (in particular any EXPORTING parameters).
A search help exit is called at certain timepoints in the input help process.
Note: The source text and long documentation of the above-specified function module (including the long documentation about the parameters) contain information about using search help exits.
Function modules are provided in the function library for operations that are frequently executed in search help exits. The names of these function modules begin with the prefix F4UT_. These function modules can either be used directly as search help exits or used within other search help exits. You can find precise instructions for use in the long documentation for the corresponding function module.
This module has been created as an example for the interface and design of Search help exits in Search help
All the interface parameters defined here are mandatory for a function module to be used as a search help exit, because the calling program does not know which parameters are actually used internally.
A search help exit is called repeatedly in connection with several
Events during the F4 process. The relevant step of the process is passed on in the CALLCONTROL step. If the module is intended to perform only a few modifications before the step, CALLCONTROL-STEP should remain unchanged.
However, if the step is performed completely by the module, the following step must be returned in CALLCONTROL-STEP.
For more detailed information please refer to the documentation describing the concept of the search help exit.
The module must react with an immediate EXIT to all steps that it does not know or does not want to handle.
During the input help process, a number of timepoints are defined that each define the beginning of an important operation of the input help process.
If the input help process is defined with a search help having a search help exit, this search help exit is called at each of these timepoints. If required, the search help exit can also influence the process and even determine that the process should be continued at a different timepoint.
The following timepoints are defined:</b></u>
1. <b>SELONE</b>
Call before selecting an elementary search help. The possible elementary search helps are already in SHLP_TAB. This timepoint can be used in a search help exit of a collective search help to restrict the selection possibilities for the elementary search helps.
Entries that are deleted from SHLP_TAB in this step are not offered in the elementary search help selection. If there is only one entry remaining in SHLP_TAB, the dialog box for selecting elementary search helps is skipped. You may not change the next timepoint.
The timepoint is not accessed again if another elementary search help is to be selected during the dialog.
2. <b>PRESEL1</b>
After selecting an elementary search help. Table INTERFACE has not yet been copied to table SELOPT at this timepoint in the definition of the search help (type SHLP_DESCR_T). This means that you can still influence the attachment of the search help to the screen here. (Table INTERFACE contains the information about how the search help parameters are related to the screen fields).
3.<b> PRESEL</b>
Before sending the dialog box for restricting values. This timepoint is suitable for predefining the value restriction or for completely suppressing or copying the dialog.
4. <b>SELECT</b>
Before selecting the values. If you do not want the default selection, you should copy this timepoint with a search help exit. DISP should be set as the next timepoint.
5. <b>DISP</b>
Before displaying the hit list. This timepoint is suitable for restricting the values to be displayed, e.g. depending on authorizations.
6.<b> RETURN</b> (usually as return value for the next timepoint)
The RETURN timepoint should be returned as the next step if a single hit was selected in a search help exit.
It can make sense to change the F4 flow at this timepoint if control of the process sequence of the Transaction should depend on the selected value (typical example: setting SET/GET parameters). However, you should note that the process will then depend on whether a value was entered manually or with an input help.
7.<b> RETTOP</b>
You only go to this timepoint if the input help is controlled by a collective search help. It directly follows the timepoint RETURN. The search help exit of the collective search help, however, is called at timepoint RETTOP.
8. <b>EXIT</b> (only for return as next timepoint)
The EXIT timepoint should be returned as the next step if the user had the opportunity to terminate the dialog within the search help exit.
9. <b>CREATE</b>
The CREATE timepoint is only accessed if the user selects the function "Create new values". This function is only available if field CUSTTAB of the control string CALLCONTROL was given a value not equal to SPACE earlier on.
The name of the (customizing) table to be maintained is normally entered there. The next step returned after CREATE should be SELECT so that the newly entered value can be selected and then displayed.
10. APP1, APP2, APP3
If further pushbuttons are introduced in the hit list with function module F4UT_LIST_EXIT, these timepoints are introduced. They are accessed when the user presses the corresponding pushbutton.
Note: If the F4 help is controlled by a collective search help, the search help exit of the collective search help is called at timepoints SELONE and RETTOP. (RETTOP only if the user selects a value.) At all other timepoints the search help exit of the selected elementary search help is called.
If the F4 help is controlled by an elementary search help, timepoint RETTOP is not executed. The search help exit of the elementary search help is called at timepoint SELONE (at the moment). This search help exit should not do anything at this timepoint. Any preparatory work should be carried out at timepoint PRESEL1.
<b>Standard Search Help Exit for Changing Hit List</b>
Functionality of F4UT_LIST_EXIT
With this module you can create another pushbutton in the hit list of an input help in addition to the standard pushbuttons. You can freely define the functionality behind this pushbutton .
To use this option, you must describe the input help process with a search help. You must write a search help exit for this search help and call this module in the search help exit at timepoint 'DISP'. Define the attributes of the pushbutton with IMPORT parameters NAME, ICON_TEXT, QUICKINFO and TEXT (see also the long documentation for these parameters).
Then assign a function code to the pushbutton in IMPORT parameter FCODE. It must have one of the following values: APP1, APP2, or APP3.
If the user presses the pushbutton defined in this way, the search help exit is called again. The function code defined previously in FCODE is passed as the timepoint.
Example
You can find an example of using this function module in the search help exit SAPBC_GLOBAL_F4_SFLIGHT_DISEDI of search help SFLIGHT_WITH_DISPLAY_AND_EDIT.
Notes· You can create up to three additional pushbuttons with the three possible function codes in the hit list by calling this module repeatedly.
· When handling the additional functions, you can use function module F4UT_LIST_EXIT_GET_INFO to get information about the status of the hit list.
· If the IMPORT parameter is set to REMOVE, the pushbutton is removed from the hit list with the function code defined by FCODE. Parameters NAME, ICON_TEXT, QUICKINFO and TEXT are meaningless in this case.
· The other parameters of this module must be defined as the parameters of the search help exit having the same name.
Functionality of F4UT_LIST_EXIT_GET_INFO
With this module you can obtain information about the status of the hit list when handling a self-defined supplementary function (see function module F4UT_LIST_EXIT) within a search help exit.
EXPORT parameter LINE contains the number of the line of the hit list where the cursor was when the function was triggered. This value is 0 if the cursor was in the column title or in the area of the constant columns removed from the list at this time.
EXPORT parameter PARAMETER contains the name of the search help parameter where the cursor was positioned when the function was triggered. Normally this means that the cursor was positioned in the corresponding column of the hit list. If the contents of the parameter, however, were removed from the list as constant value, the cursor was positioned in the corresponding line over the hit list.
EXPORT parameter MARK_TAB is only filled if the input help was called with multiple choice. In this case this parameter contains the list of line numbers that were marked in the hit list when the function was triggered.
Notes
· This module only works at timepoints APP1, APP2, APP3.
· The TABLES and CHANGING parameters of this module must be parametrized with the parameters of the search help exit having the same name.
Search Help Inclusion
The search help inclusion is the mechanism with which the alternative search paths defining the behavior can be assigned to a collective search help
In a search help inclusion, any other search help can be assigned to the including collective search help. Normally the included search help will be an elementary search help In this case the search path implemented by this search help will become one of the alternative search paths of the including search help. If the included search help is also a collective search help itself, all the elementary search helps contained in this collective search help will become alternative search paths of the including collective search help. In such a multi-level inclusion, however, you must note the following special features
Passing on the context information and returning the selected attributes on the screen is described by the assignment made between the parameters of the including search help and the interface parameters of the included search help.
The search help inclusion is a part of the definition of the including search help. A search help can be included in any number of search helps.
Note: An append search help is automatically included in its appending object. You may not include an append search help in other collective search helps.
When you include a collective search help I in a collective search help S, you should note the following features:
· When you display the search paths available in S, all the search helps contained in S are resolved to the level of the elementary search helps.
· If an elementary search help is contained more than once in a collective search help, e.g. because it is contained in more than one of the included search helps, it is offered only once in the dialog box for selecting the search path ( shadowing mechanism).
· If I has a search help exit, it is not taken into consideration in an input help process defined by S.
· Context information is transported to the input help process and from field contents from the input help process with the assignment for the parameters of I and S made during the inclusion.
· If parameter PAR of I is not an IMPORT parameter or if it was not assigned to a parameter of S in the inclusion, any existing default value of PAR is passed to all IMPORT parameters of included search helps that are linked with PAR.
· I may not contain S (or be the same as S).
Shadowing mechanism
If a collective search help S contains two search helps I and J which in turn contain a fourth search help U, a shadowing mechanism takes effect. If U is contained in I or J, it is shadowed (depending on which inclusion in S comes last). If J = U, however, J must precede I as otherwise the inclusion of J in S would be meaningless.
Default Value
A default value of the right type can be assigned to a parameter of a search help. The parameter is assigned this default value in the following cases when the input help is called:
1. If the parameter is not an IMPORT parameter.
2. If nothing is assigned to the parameter in the search help attachment with which the search help is attached to the screen field.
3. If in the search help attachment a field was assigned to the parameter that does not exist on the screen or in the flow logic (module pool) in the input help process.
4. If a search help is included in a collective search help and the parameter is not linked with any parameter of this collective search help.
There are the following options for the default values:
a) Constants enclosed in apostrophes ('). The constant must be specified in internal representation for parameters whose data type has an editing mask (e.g. date and time). For example the date 01.03.1998 must be defined as '19980301'.
b) System fields. These are fields of the DDIC structure SYST where the prefix SY- can be used instead of the prefix SYST-.
c) The ID of a GET parameter.
Set/Get parameter ID
A field can be filled with proposed values from SAP memory using a parameter ID.
Example
A user only has authorization for company code 0001. This company code is stored in memory at the beginning of a transaction under the corresponding parameter ID. Fields that refer to the data element are automatically filled with the value 001 in all subsequent screen templates.
Dependencies
A field in the screen template is only filled automatically with the value stored under the parameter ID of the data element if this was explicitly permitted in the Screen Painter.
Position in the hit list of an elementary search help
Position of the parameterin the hit list.
If the parameter should not appear in the hit list, leave this field empty. No position number may occur more than once in this column, but gaps are allowed. They do not affect the design of the hit list.
Example: An elementary search help contains parameters PAR1, PAR2, PAR3 and PAR4. Field LPos is defined as follows:
Parameter LPos
PAR1 3
PAR2 0 or ' '
PAR3 1
PAR4 7
Parameters PAR3, PAR1 und PAR4 appear in this order in the hit list.
Note: In an elementary search help, at least one parameter should appear in the hit list. The only exception to this rule is the elementary search help, in which the display of the hit list is entirely copied from a search help exit
Text table
Table A is the text table of table B if the key of A comprises the key of B and an additional language key field (field with data type LANG). Table A can therefore contain explanatory text in several languages for each key entry of B.
To link the key entries with the text, text table A must be linked with table B using a foreign key. Key fields of a text table must be selected for the type of foreign key fields.
Only one text table can be created for a table. When it is activated, the system checks whether another table already has a text foreign key for the specified table.
If a text table exists, it is used at different places in the system to show the text for the key entries in the logon language of the user automatically.
If for example table B is the check table of a field, the existing key entries of table B are displayed as possible input values when F4 is pressed. The explanatory text is also shown in the logon language of the user for each key value.
Selection method of an elementary search help
The possible entries for a field displayed in the hit list are determined at runtime by selection from the database. The selection method describes the database object from which the data is read. A database table or view can be defined as selection method.
To use a field of the selection method in the input help (as field in the dialog box for restricting values, as column in the hit list or as value returned to the screen), a parameter with the same name must be inserted in the search help.
Process On Value request
PROCESS ON VALUE-REQUEST.
Event in user-programmed help that occurs when the user presses F4 with the cursor positioned on a screen field. The modules specified in the subsequent FIELD statements are called instead of the SAP help system.
<b>Example</b>
FIELD XY MODULE XYZ
Module XYZ determines the value of field XY and places it in the input field on the screen.
VALUES
Definition of the valid input values:
FIELD field_name VALUES (list of values)
The list of values can define single values and/or intervals for input values that are allowed or not allowed. The values must be enclosed in apostrophes and separated with a comma.
('value') valid single value
(NOT 'value') invalid single value
(BETWEEN 'value' AND 'value') valid values in the interval
(NOT BETWEEN 'value' AND 'value') invalid values in the interval
SELECT
SQL interface  
SELECT * FROM  table name
         WHERE table-keyfield = inputfield
         and   ....
         INTO  fieldname
         WHENEVER  NOT FOUND          (or FOUND)
                   SEND ERRORMESSAGE  (or WARNING)
                        messagenumber
                        WITH  fieldname ...
You do not have to specify a message number and var. texts (WITH). If there is an error (FOUND or NOT FOUND), a standard message is output.
If the INTO ... statement is not defined, the table entry is not read in.
Check table
Table whose key fields are used to check the foreign key fields (see Foreign Keys). Only entries that are contained in the key fields of the check table can be contained in the foreign key fields.
The check table is used to check whether the input values are valid and for the input help (F4 help).
Foreign key
A foreign key creates a link between two tables T1 and T2. Every primary key field from T1 (check table) is assigned a field from table T2 (foreign key field). The fields from T2 assigned to primary key fields are marked as foreign key fields.
The most important function of the foreign key is the support of data integrity. The foreign key fields can only accept values which appear in the primary key of the check table. During input the values of the foreign key fields can thus be checked against the entries of the assigned key fields of the check table.
Foreign keys are also the foundation for defining lock objects, maintenance views and help views. These objects contain fields from several tables. All the tables used in such an object must be linked with foreign keys.
Dialog type
The dialog type defines the dialog steps executed for an input help.
There are the following dialog types:
· Immediate value display: The hit list is displayed immediately after the input help has been called. This option is advisable if the hit list usually contains only a few entries.
· Dialog with value restriction: The dialog box for restricting values is displayed immediately. Select this option if the list of possible entries is normally very large. Restricting the set of data to be processed increases the clarity of the hit list and reduces the system load during value selection.
· Dialog depends on value set: If the hit list contains less than 100 entries, it is displayed immediately. If the hit list contains more than 100 entries, the dialog box for restricting values is displayed.
Search Help Parameter
A search help parameter is a field for controlling the behavior of a search help.
There are the following roles for search help parameters, where a parameter can have more than one role:
1.
Import parameters: These are parameters with which context information can be copied to the input help process from the input template or from the module pool of the processed screen.
2. Export parameters: These are parameters with which values can be returned to the input template from the input help process.
3. Internal parameters: These are parameters used for the input help process. Further data can be applied in the input help process using parameters that appear in the dialog box for restricting values or that have a default value. Furthermore, all the fields displayed in the hit list are internal parameters of the search help.
Import and export parameters of the search help are also called their interface parameters.
The corresponding assignment of the search help attachment or search help inclusion control the field contents with which an import parameter is parametrized and the fields of the input template in which the contents of the export parameters should be returned. However, you should note that the values are not returned beyond the limits of a subscreen or a line of a step loop or table control
The fields of the selection method are assigned to the parameters of an elementary search help by equality of name. The non-key fields of a text table may also be specified.
Types must be defined for the parameters of a search help. The parameters of elementasry search helps normally take on the attributes of the fields of the selection method having the same name. The types are defined by assigning a data element to the parameter. This field or data element also defines the behavior of the parameter at the interface for parameters that also appear in one of the dialog boxes of the input help process.
Default Value
A default value of the right type can be assigned to a parameter of a search help. The parameter is assigned this default value in the following cases when the input help is called:
1. If the parameter is not an IMPORT parameter.
2. If nothing is assigned to the parameter in the search help attachment with which the search help is attached to the screen field.
3. If in the search help attachment a field was assigned to the parameter that does not exist on the screen or in the flow logic (module pool) in the input help process.
4. If a search help is included in a collective search help and the parameter is not linked with any parameter of this collective search help.
There are the following options for the default values:
a) Constants enclosed in apostrophes ('). The constant must be specified in internal representation for parameters whose data type has an editing mask (e.g. date and time). For example the date 01.03.1998 must be defined as '19980301'.
b) System fields. These are fields of the DDIC structure SYST where the prefix SY- can be used instead of the prefix SYST-.
c) The ID of a GET parameter.
Search Help Attachments
A search help attachment is an assignment of a search help to a table, structure or data element, causing the corresponding search help to be automatically used to describe the input help process at this field when an ABAP Dictionary field is used in a screen.
You can attach a search help as follows:
1. Attach a search help to a structure or table field: The attached search help is available for all screen fields that refer to the table or structure field. There must be an assignment between the interface parameters of the search help and the fields of the table or structure for this type of attachment. In the input help process, this assignment results in a value transport between the corresponding fields (if they are known at least to the module pool of the screen) and the search help parameters. As for the foreign key definition, you can assign nothing, a constant or any other field (which is then sought in the module pool) to indivdiual search help parameters.
2. Attach a search help to a table: The assigned search help is available for all screen fields for which the table is a check table There must also be an assignment between the search help parameters and the key fields of the table for this type of assignment.
3. Attach a search help to a data element: The attached search help is available for all screen fields that refer to the data element. If the search help is attached to a data element, an export parameter of the search help must be assigned to the data element. If the user chooses a row of the hit list in the input help, the contents of this parameter are returned in the corresponding screen field. More than one value is not returned when a search help is attached to a data element.
The described attachments only take effect if the field was not yet assigned an input help in the screen definition. Such an assignment can be made with the mechanism PROCESS ON VALUE-REQUEST in the flow logic or by attaching a search help to the screen field in the attribute maintenance screen. A F4 help can also be assigned to the field in the flow logic by using VALUES or SELECT In the latter case, the input help here behaves as if the table specified under SELECT were assigned to the field as check table.
If more than one of the described mechanisms compete in defining the input help method of a screen field, the first one named will take effect. If none of the described mechanisms is available, the domain fixed values of the field will be used for the input help if necessary. If the domain of the field has no fixed values but has data type DATS or TIMS, the input helps that are assigned to these types are used for the input help. Otherwise there will be no input help available for the field.
A search help attachment always belongs to the definition of the object to which the attachment is made (structure, table or data element). It is also maintained in the maintenance transaction for this object and transported with this object.
See the links:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=2176485
https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=3601619
pls go through this for search help creation
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Search Help Exits: 
++

Similar Messages

  • Regarding Matchcode object in ABAP programs

    hi experts,
    we have Addon abap programs using Matchcode objects in R3 4.6C with OS unix.
    1-I Would like to know whether the Sorting order of Match code values will change if we change OS from UNIX to solaris.
    I heard that due to Locales, Sorting order for match code likely to get affected due to OS dependencies.
    Please suggest me if its true how to solve this prob
    Thanks.
    Baasha.

    Who tells you that??? The OS has nothing to do with the sort of match code values....Maybe but don't think so....Different DB Engines could make that.....But in my experience....That never happened...
    Greetings,
    Blag.

  • Matchcode object i_status_sys and i_status_usr

    Hi guys,
    I need help regarding matchcode object.
    I copied a program from earlier version of SAP (R/3) to ECC6.
    In that program there is a selection screen field with matchcode object i_status_sys and i_status_usr. I have tried this in R/3 and it works fine, but it doesn't work in ECC6.
    Anybody knows the new version of i_status_sys and i_status_usr?
    Thanks!
    Sam.

    ok. I ran into this same problem. I guess SAP has hard-coded inside the search help 'I_STATUS' the programs that can call it. So if you want your 'Z' program to use this search help 'I_STATUS', you have to do some memory setup to tell the search help it's ok if my program "reuses" you. I know it is weird.
    So enter these three line in your initilization event in your 'Z' program.
      DATA: p_obtyp TYPE j_obtyp.
      p_obtyp = 'IEQ'.
      EXPORT p_obtyp TO MEMORY ID 'PM_OBTYP'.
    Magic? Maybe, but this solved the problem for me.

  • Regarding my object

    Hi....
    good evening..
    today iam going to explain about this object.
    this is a new object which was assigned for me before two days.
    created a report that displays open purchase order for a given plant or delivery period
    what is the selection screen for this report.
    whr are the tables used for this report.please mention fields with discription.
    what is select statement for this report.
    please provide this information.
    thanks and regards ,
    k.swaminath reddy

    Hi
    See the sample report and do accordingly
    *& Report  ZMM_PO_REPORT
    REPORT  ZMM_PO_REPORT message-Id yb
           NO STANDARD PAGE HEADING
           LINE-COUNT 60(1)
           LINE-SIZE 230.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master
            t161,           " PO Doc Types
            t024,           " Purchase Groups
            ekko.           " PO Header
                   T Y P E S  D E C L A R A T I O N S
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_po,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bukrs TYPE bukrs,           " Company Code
            bsart TYPE bbsrt,           " PO Type
            lifnr TYPE lifnr,           " Vendor No
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
           END OF s_po.
    Purchase Orders History Structure
    TYPES: BEGIN OF s_account,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            gjahr TYPE mjahr,           " Fiscal Year
            belnr TYPE mblnr,           " PO Invoice No
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Local Currency
            dmbtr TYPE dmbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
            shkzg TYPE shkzg,           " Dr/Cr Indicator
           END OF s_account.
    Purchase Orders History Structure(Item Sum)
    TYPES: BEGIN OF s_inv_sum,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
           END OF s_inv_sum.
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_rep,
            lifnr TYPE lifnr,           " Vendor No
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bsart TYPE bbsrt,           " PO Type
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
            name1 TYPE name1,           " Plant
            orewr TYPE netpr,           " To be Invoiced Price
            curr  TYPE waers,           " Inv Doc Currency
           END OF s_rep.
               D A T A  D E C L A R A T I O N S
    DATA: gv_title1 TYPE sylisel,            " Report title
          gv_dial.                           " Color flag
                C O N S T A N T S  D E C L A R A T I O N S
    CONSTANTS: c_x                VALUE 'X',   " Flag X
               c_h                VALUE 'H',   " Debit
               c_vgabe TYPE vgabe VALUE '2'.   " Transaction Type
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_po    TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
                                 " Purchase Order
          i_inv   TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
                                         " PO Invoice Values
          i_rep   TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
                                     " PO Invoice Values
          i_ekbe  TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
                               " PO Invoice Values
                     S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
                    s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
                    s_bsart FOR t161-bsart,
                    s_ekgrp FOR t024-ekgrp,
                    s_bedat FOR ekko-bedat.
    SELECTION-SCREEN END OF BLOCK b1.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      ULINE.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Display the Report Output data
      PERFORM display_data.
    At Line-Selection
    AT LINE-SELECTION.
    When double clicked on EBELN display the details of Purchase Doc
      PERFORM line_sel.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Vendor Number
      CLEAR lfa1-lifnr.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT lifnr UP TO 1 ROWS
            INTO lfa1-lifnr
            FROM lfa1
            WHERE lifnr IN s_lifnr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Vendor'(002).
        ENDIF.
      ENDIF.
    Validation of PO Number
      CLEAR ekko-ebeln.
      IF NOT s_ebeln[] IS INITIAL.
        SELECT ebeln UP TO 1 ROWS
            INTO ekko-ebeln
            FROM ekko
            WHERE ebeln IN s_ebeln.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Document Number'(003).
        ENDIF.
      ENDIF.
    Validation of PO Document Type
      CLEAR t161-bsart.
      IF NOT s_bsart[] IS INITIAL.
        SELECT bsart UP TO 1 ROWS
            INTO t161-bsart
            FROM t161
            WHERE bsart IN s_bsart.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
        ENDIF.
      ENDIF.
    Validation of Purchasing Group
      CLEAR t024-ekgrp.
      IF NOT s_ekgrp[] IS INITIAL.
        SELECT ekgrp UP TO 1 ROWS
            INTO t024-ekgrp
            FROM t024
            WHERE ekgrp IN s_ekgrp.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  fetch_data
    Fetching the PO related data from Database Tables
    FORM fetch_data .
      CLEAR i_po.
      REFRESH i_po.
      SELECT a~ebeln            " PO No.
             b~ebelp            " PO Item
             a~bstyp            " PO Category
             a~bukrs            " Company Code
             a~bsart            " PO Type
             a~lifnr            " Vendor No
             a~ekgrp            " Purchase Group
             a~waers            " Currency
             a~bedat            " PO Date
             b~txz01            " Material Text
             b~werks            " Plant
             b~lgort            " Storage Location
             b~matkl            " Material Group
             b~menge            " PR Quantity
             b~meins            " UOM
             b~bprme            " Price Unit
             b~netpr            " Net price
             b~peinh            " Price Unit UOM
             b~pstyp            " Item Category
             b~knttp            " Account Assignment Category
        INTO TABLE i_po
        FROM ekko AS a JOIN ekpo AS b
        ON a~ebeln = b~ebeln
        WHERE a~ebeln IN s_ebeln AND
              a~lifnr IN s_lifnr AND
              a~ekgrp IN s_ekgrp AND
              a~bsart IN s_bsart AND
              a~bedat IN s_bedat.
      SORT i_po BY ebeln ebelp.
      break-point.
      IF NOT i_po[] IS INITIAL.
    Fetch the PO History/Invoice Details from EKBE Table
        CLEAR i_ekbe.
        REFRESH i_ekbe.
        SELECT ebeln           " PO No.
               ebelp           " PO Item
               gjahr           " Fiscal Year
               belnr           " PO Invoice No
               menge           " PR Quantity
               wrbtr           " Price in Local Currency
               dmbtr           " Price in Foreign Currency
               waers           " Currency
               shkzg           " Dr/Cr Indicator
         INTO TABLE i_ekbe
         FROM ekbe
         FOR ALL ENTRIES IN i_po
         WHERE ebeln = i_po-ebeln AND
               ebelp = i_po-ebelp AND
               vgabe = c_vgabe.
      break-point.
        IF sy-subrc = 0.
          SORT i_ekbe BY ebeln ebelp.
          LOOP AT i_ekbe.
            IF i_ekbe-shkzg = c_h.
              i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
            ENDIF.
            MODIFY i_ekbe.
          ENDLOOP.
      break-point.
    Sum up the Item wise Invoice totals
          LOOP AT i_ekbe.
            AT END OF ebelp.
              READ TABLE i_ekbe INDEX sy-tabix.
              SUM.
              MOVE-CORRESPONDING i_ekbe TO i_inv.
              APPEND i_inv.
            ENDAT.
            CLEAR i_inv.
          ENDLOOP.
          SORT i_inv BY ebeln ebelp.
            break-point.
        ENDIF.
      ENDIF.
    Move the Vendor Name and Invoice Values to I_rep Internal Table
      LOOP AT i_po.
        MOVE-CORRESPONDING i_po TO i_rep.
        CLEAR i_inv.
        READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
                                  ebelp = i_po-ebelp.
        IF sy-subrc = 0.
          i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
          i_rep-curr  = i_inv-waers.
        ELSE.
          i_rep-orewr = i_po-menge * i_po-netpr.
          i_rep-curr  = i_po-waers.
        ENDIF.
      break-point.
    Get the Vendor Name
        CLEAR lfa1-name1.
        SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
          WHERE lifnr = i_po-lifnr.
        IF sy-subrc = 0.
          i_rep-name1  = lfa1-name1.
        ENDIF.
        APPEND i_rep.
        CLEAR  i_rep.
          break-point.
      ENDLOOP.
      SORT i_rep BY lifnr ebeln ebelp.
      DELETE i_rep WHERE orewr LE 0.
      break-point.
    ENDFORM.                    " fetch_data
    *&      Form  display_data
    Display the Report Output data
    FORM display_data .
      DATA: lv_flag,               " New Flag
            lv_rec TYPE i.         " No of Records
      CLEAR lv_rec.
      IF i_rep[] IS INITIAL.
        MESSAGE e000 WITH 'No Data found'(022).
      ELSE.
        LOOP AT i_rep.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
    At New Purchase Document
          AT NEW ebeln.
            WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
            lv_flag = c_x.
            lv_rec = lv_rec + 1.
          ENDAT.
          WRITE: 1 sy-vline,
                12 sy-vline,13(4)   i_rep-bsart,
                17 sy-vline,18(10)  i_rep-lifnr,
                28 sy-vline,29(35)  i_rep-name1,
                64 sy-vline,65(4)   i_rep-ekgrp,
                69 sy-vline,70(10)  i_rep-bedat,
                80 sy-vline,81(5)   i_rep-ebelp,
                86 sy-vline,87(40)  i_rep-txz01,
               127 sy-vline,128(9)  i_rep-matkl,
               137 sy-vline,138(1)  i_rep-pstyp,
               139 sy-vline,140(1)  i_rep-knttp,
               141 sy-vline,142(4)  i_rep-werks,
               146 sy-vline,147(4)  i_rep-lgort,
               151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
               165 sy-vline,166(3)  i_rep-meins,
               169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
               185 sy-vline,186(4)  i_rep-waers,
               190 sy-vline,191(5)  i_rep-peinh,
               196 sy-vline,197(4)  i_rep-bprme,
               201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
               217 sy-vline,218(4)  i_rep-curr,
               222 sy-vline,223(7)  i_rep-bstyp centered,
               230 sy-vline.
          NEW-LINE.
          hide: i_rep-ebeln.
        ENDLOOP.
        ULINE.
        FORMAT COLOR OFF.
        WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
                    lv_rec COLOR 3.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  header
    Write the Report Header
    FORM header .
      FORMAT RESET.
    header
      WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
      SKIP.
      FORMAT COLOR COL_HEADING.
      ULINE.
      WRITE:/1 sy-vline,2(10)   'Pur.Doc.No'(006) CENTERED,
            12 sy-vline,13(4)   'Type'(007),
            17 sy-vline,18(10)  'Vendor'(008) CENTERED,
            28 sy-vline,29(35)  'Name'(009) CENTERED,
            64 sy-vline,65(4)   'PGrp'(010) CENTERED,
            69 sy-vline,70(10)  'Doc.Date'(012) CENTERED,
            80 sy-vline,81(5)   'Item'(011),
            86 sy-vline,87(40)  'Material Short Text'(024) CENTERED,
           127 sy-vline,128(9)  'Mat.Group'(013),
           137 sy-vline,138(1)  'I',
           139 sy-vline,140(1)  'A',
           141 sy-vline,142(4)  'Plnt'(014),
           146 sy-vline,147(4)  'SLoc'(015),
           151 sy-vline,152(13) 'Quantity'(016) CENTERED,
           165 sy-vline,166(3)  'UoM'(017),
           169 sy-vline,170(15) 'Net Value'(018) CENTERED,
           185 sy-vline,186(4)  'Curr'(019),
           190 sy-vline,191(5)  'Per'(020),
           196 sy-vline,197(4)  'Unit'(021),
           201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
           217 sy-vline,218(4)  'Curr'(019),
           222 sy-vline,223(7)  'Doc.Cat'(026),
           230 sy-vline.
      ULINE.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  LINE_SEL
    *When double clicked on EBELN field display the details of Purchase Doc
    FORM line_sel.
      CASE sy-lsind.
        WHEN '1'.
          DATA: lv_field(20),
                lv_value(10),
                lv_bstyp like i_rep-bstyp.
          clear: lv_bstyp,lv_value, lv_field.
          GET CURSOR FIELD lv_field VALUE lv_value.
          IF lv_field = 'I_REP-EBELN'.
            IF NOT lv_value IS INITIAL.
              READ LINE sy-index FIELD VALUE i_rep-bstyp
                                       INTO  lv_bstyp.
             READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
              if lv_bstyp = 'F'.
                SET PARAMETER ID 'BES' FIELD lv_value.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
                SET PARAMETER ID 'VRT' FIELD lv_value.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              elseif lv_bstyp = 'A'.
                SET PARAMETER ID 'ANF' FIELD lv_value.
                CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
              endif.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " line_sel
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Regarding purchase order

    hi,
      is there any standard report for open purchase order ?
    what are the tables and field used for open purchase order report.
    thank u
      ravi

    Hi,
    There is no Std report for this;
    See the report for Open PO's
    *& Report  ZMM_PO_REPORT
    REPORT  ZMM_PO_REPORT message-Id yb
           NO STANDARD PAGE HEADING
           LINE-COUNT 60(1)
           LINE-SIZE 230.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master
            t161,           " PO Doc Types
            t024,           " Purchase Groups
            ekko.           " PO Header
                   T Y P E S  D E C L A R A T I O N S
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_po,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bukrs TYPE bukrs,           " Company Code
            bsart TYPE bbsrt,           " PO Type
            lifnr TYPE lifnr,           " Vendor No
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
           END OF s_po.
    Purchase Orders History Structure
    TYPES: BEGIN OF s_account,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            gjahr TYPE mjahr,           " Fiscal Year
            belnr TYPE mblnr,           " PO Invoice No
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Local Currency
            dmbtr TYPE dmbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
            shkzg TYPE shkzg,           " Dr/Cr Indicator
           END OF s_account.
    Purchase Orders History Structure(Item Sum)
    TYPES: BEGIN OF s_inv_sum,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
           END OF s_inv_sum.
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_rep,
            lifnr TYPE lifnr,           " Vendor No
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bsart TYPE bbsrt,           " PO Type
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
            name1 TYPE name1,           " Plant
            orewr TYPE netpr,           " To be Invoiced Price
            curr  TYPE waers,           " Inv Doc Currency
           END OF s_rep.
               D A T A  D E C L A R A T I O N S
    DATA: gv_title1 TYPE sylisel,            " Report title
          gv_dial.                           " Color flag
                C O N S T A N T S  D E C L A R A T I O N S
    CONSTANTS: c_x                VALUE 'X',   " Flag X
               c_h                VALUE 'H',   " Debit
               c_vgabe TYPE vgabe VALUE '2'.   " Transaction Type
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_po    TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
                                 " Purchase Order
          i_inv   TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
                                         " PO Invoice Values
          i_rep   TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
                                     " PO Invoice Values
          i_ekbe  TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
                               " PO Invoice Values
                     S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
                    s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
                    s_bsart FOR t161-bsart,
                    s_ekgrp FOR t024-ekgrp,
                    s_bedat FOR ekko-bedat.
    SELECTION-SCREEN END OF BLOCK b1.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      ULINE.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Display the Report Output data
      PERFORM display_data.
    At Line-Selection
    AT LINE-SELECTION.
    When double clicked on EBELN display the details of Purchase Doc
      PERFORM line_sel.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Vendor Number
      CLEAR lfa1-lifnr.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT lifnr UP TO 1 ROWS
            INTO lfa1-lifnr
            FROM lfa1
            WHERE lifnr IN s_lifnr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Vendor'(002).
        ENDIF.
      ENDIF.
    Validation of PO Number
      CLEAR ekko-ebeln.
      IF NOT s_ebeln[] IS INITIAL.
        SELECT ebeln UP TO 1 ROWS
            INTO ekko-ebeln
            FROM ekko
            WHERE ebeln IN s_ebeln.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Document Number'(003).
        ENDIF.
      ENDIF.
    Validation of PO Document Type
      CLEAR t161-bsart.
      IF NOT s_bsart[] IS INITIAL.
        SELECT bsart UP TO 1 ROWS
            INTO t161-bsart
            FROM t161
            WHERE bsart IN s_bsart.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
        ENDIF.
      ENDIF.
    Validation of Purchasing Group
      CLEAR t024-ekgrp.
      IF NOT s_ekgrp[] IS INITIAL.
        SELECT ekgrp UP TO 1 ROWS
            INTO t024-ekgrp
            FROM t024
            WHERE ekgrp IN s_ekgrp.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  fetch_data
    Fetching the PO related data from Database Tables
    FORM fetch_data .
      CLEAR i_po.
      REFRESH i_po.
      SELECT a~ebeln            " PO No.
             b~ebelp            " PO Item
             a~bstyp            " PO Category
             a~bukrs            " Company Code
             a~bsart            " PO Type
             a~lifnr            " Vendor No
             a~ekgrp            " Purchase Group
             a~waers            " Currency
             a~bedat            " PO Date
             b~txz01            " Material Text
             b~werks            " Plant
             b~lgort            " Storage Location
             b~matkl            " Material Group
             b~menge            " PR Quantity
             b~meins            " UOM
             b~bprme            " Price Unit
             b~netpr            " Net price
             b~peinh            " Price Unit UOM
             b~pstyp            " Item Category
             b~knttp            " Account Assignment Category
        INTO TABLE i_po
        FROM ekko AS a JOIN ekpo AS b
        ON a~ebeln = b~ebeln
        WHERE a~ebeln IN s_ebeln AND
              a~lifnr IN s_lifnr AND
              a~ekgrp IN s_ekgrp AND
              a~bsart IN s_bsart AND
              a~bedat IN s_bedat.
      SORT i_po BY ebeln ebelp.
      break-point.
      IF NOT i_po[] IS INITIAL.
    Fetch the PO History/Invoice Details from EKBE Table
        CLEAR i_ekbe.
        REFRESH i_ekbe.
        SELECT ebeln           " PO No.
               ebelp           " PO Item
               gjahr           " Fiscal Year
               belnr           " PO Invoice No
               menge           " PR Quantity
               wrbtr           " Price in Local Currency
               dmbtr           " Price in Foreign Currency
               waers           " Currency
               shkzg           " Dr/Cr Indicator
         INTO TABLE i_ekbe
         FROM ekbe
         FOR ALL ENTRIES IN i_po
         WHERE ebeln = i_po-ebeln AND
               ebelp = i_po-ebelp AND
               vgabe = c_vgabe.
      break-point.
        IF sy-subrc = 0.
          SORT i_ekbe BY ebeln ebelp.
          LOOP AT i_ekbe.
            IF i_ekbe-shkzg = c_h.
              i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
            ENDIF.
            MODIFY i_ekbe.
          ENDLOOP.
      break-point.
    Sum up the Item wise Invoice totals
          LOOP AT i_ekbe.
            AT END OF ebelp.
              READ TABLE i_ekbe INDEX sy-tabix.
              SUM.
              MOVE-CORRESPONDING i_ekbe TO i_inv.
              APPEND i_inv.
            ENDAT.
            CLEAR i_inv.
          ENDLOOP.
          SORT i_inv BY ebeln ebelp.
            break-point.
        ENDIF.
      ENDIF.
    Move the Vendor Name and Invoice Values to I_rep Internal Table
      LOOP AT i_po.
        MOVE-CORRESPONDING i_po TO i_rep.
        CLEAR i_inv.
        READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
                                  ebelp = i_po-ebelp.
        IF sy-subrc = 0.
          i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
          i_rep-curr  = i_inv-waers.
        ELSE.
          i_rep-orewr = i_po-menge * i_po-netpr.
          i_rep-curr  = i_po-waers.
        ENDIF.
      break-point.
    Get the Vendor Name
        CLEAR lfa1-name1.
        SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
          WHERE lifnr = i_po-lifnr.
        IF sy-subrc = 0.
          i_rep-name1  = lfa1-name1.
        ENDIF.
        APPEND i_rep.
        CLEAR  i_rep.
          break-point.
      ENDLOOP.
      SORT i_rep BY lifnr ebeln ebelp.
      DELETE i_rep WHERE orewr LE 0.
      break-point.
    ENDFORM.                    " fetch_data
    *&      Form  display_data
    Display the Report Output data
    FORM display_data .
      DATA: lv_flag,               " New Flag
            lv_rec TYPE i.         " No of Records
      CLEAR lv_rec.
      IF i_rep[] IS INITIAL.
        MESSAGE e000 WITH 'No Data found'(022).
      ELSE.
        LOOP AT i_rep.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
    At New Purchase Document
          AT NEW ebeln.
            WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
            lv_flag = c_x.
            lv_rec = lv_rec + 1.
          ENDAT.
          WRITE: 1 sy-vline,
                12 sy-vline,13(4)   i_rep-bsart,
                17 sy-vline,18(10)  i_rep-lifnr,
                28 sy-vline,29(35)  i_rep-name1,
                64 sy-vline,65(4)   i_rep-ekgrp,
                69 sy-vline,70(10)  i_rep-bedat,
                80 sy-vline,81(5)   i_rep-ebelp,
                86 sy-vline,87(40)  i_rep-txz01,
               127 sy-vline,128(9)  i_rep-matkl,
               137 sy-vline,138(1)  i_rep-pstyp,
               139 sy-vline,140(1)  i_rep-knttp,
               141 sy-vline,142(4)  i_rep-werks,
               146 sy-vline,147(4)  i_rep-lgort,
               151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
               165 sy-vline,166(3)  i_rep-meins,
               169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
               185 sy-vline,186(4)  i_rep-waers,
               190 sy-vline,191(5)  i_rep-peinh,
               196 sy-vline,197(4)  i_rep-bprme,
               201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
               217 sy-vline,218(4)  i_rep-curr,
               222 sy-vline,223(7)  i_rep-bstyp centered,
               230 sy-vline.
          NEW-LINE.
          hide: i_rep-ebeln.
        ENDLOOP.
        ULINE.
        FORMAT COLOR OFF.
        WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
                    lv_rec COLOR 3.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  header
    Write the Report Header
    FORM header .
      FORMAT RESET.
    header
      WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
      SKIP.
      FORMAT COLOR COL_HEADING.
      ULINE.
      WRITE:/1 sy-vline,2(10)   'Pur.Doc.No'(006) CENTERED,
            12 sy-vline,13(4)   'Type'(007),
            17 sy-vline,18(10)  'Vendor'(008) CENTERED,
            28 sy-vline,29(35)  'Name'(009) CENTERED,
            64 sy-vline,65(4)   'PGrp'(010) CENTERED,
            69 sy-vline,70(10)  'Doc.Date'(012) CENTERED,
            80 sy-vline,81(5)   'Item'(011),
            86 sy-vline,87(40)  'Material Short Text'(024) CENTERED,
           127 sy-vline,128(9)  'Mat.Group'(013),
           137 sy-vline,138(1)  'I',
           139 sy-vline,140(1)  'A',
           141 sy-vline,142(4)  'Plnt'(014),
           146 sy-vline,147(4)  'SLoc'(015),
           151 sy-vline,152(13) 'Quantity'(016) CENTERED,
           165 sy-vline,166(3)  'UoM'(017),
           169 sy-vline,170(15) 'Net Value'(018) CENTERED,
           185 sy-vline,186(4)  'Curr'(019),
           190 sy-vline,191(5)  'Per'(020),
           196 sy-vline,197(4)  'Unit'(021),
           201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
           217 sy-vline,218(4)  'Curr'(019),
           222 sy-vline,223(7)  'Doc.Cat'(026),
           230 sy-vline.
      ULINE.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  LINE_SEL
    *When double clicked on EBELN field display the details of Purchase Doc
    FORM line_sel.
      CASE sy-lsind.
        WHEN '1'.
          DATA: lv_field(20),
                lv_value(10),
                lv_bstyp like i_rep-bstyp.
          clear: lv_bstyp,lv_value, lv_field.
          GET CURSOR FIELD lv_field VALUE lv_value.
          IF lv_field = 'I_REP-EBELN'.
            IF NOT lv_value IS INITIAL.
              READ LINE sy-index FIELD VALUE i_rep-bstyp
                                       INTO  lv_bstyp.
             READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
              if lv_bstyp = 'F'.
                SET PARAMETER ID 'BES' FIELD lv_value.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
                SET PARAMETER ID 'VRT' FIELD lv_value.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              elseif lv_bstyp = 'A'.
                SET PARAMETER ID 'ANF' FIELD lv_value.
                CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
              endif.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " line_sel
    <b>reward points if useful</b>
    regards,
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Regarding Enhancement

    Hi All,
    greetings of the day!!
    In MB5B trasaction(stock  on postning date) one enhancement is there , and  i maintain one select-option in that enhancement ,
    when i execute the report tthe select-option is not shows in the selection screen.
    please tell me what is the  problem.
    Transaction:MB5B
    Report: RM07MLBD 
    Enhancement spot: line no: 343.
    enhancement 4  ad_mpn_pur2_rm07mlbd.    "active version
    select-options:  mfrpn for mara-mfrpn memory id mpn    matchcode object htn.
    select-options: s_matkl for mara-matkl.        "my customised select-option which is not shows in the selection screen
    endenhancement.
    regards,
    Sateesh.

    HI,
    Your problem can solve by an saptechnical site.
    In that site, Demo on Enhancement Framework topic will helps to your requirement.
    It explain from basics. You can get a clear picture.

  • Regarding creation Of Help View

    Hi , Can Any body Tell me what is the step by Step Procedure how to create the Help View. Plz it's urgent .
    Thanks&Regards .
    Nihar.

    Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    Go thru this link plzz
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
    Difference between "Help View" and "Search Help"
    Reward points for useful Answers

  • Problems with a matchcode

    Hi everybody,
    I have a problem with a matchdode in a dynpro. The dynpro has five fields, when the first matchcode is open, it shows you  the five fields and when you press, all the fields are fill except the last one. The fields that are completed appear in blue background but the one with it is not fill doesn't appear in blue. To change it I went to the help search and I set up all the fields with the same import and export parameters but still it doesn't work.
    Does anybody how to solve it??
    Thanks in advance.

    Hi,
    You need to got SE11,
    Then open your table,
    then you need to place the cursor on the field for which you need search help
    then click on the "srch help"  button, then if there is any search help assignment
    it will showup there then you need to make the parameter assignment there.
    You can find this srch help button as follows
    If it is a table
    in SE11 Under the tab fields.
    if it is a strucutre then in SE 11 when you open the strucutre see the tab
    "Entry help/ check".
    You can check how the field is getting values in the TAB "Entry help/Check".
    Regards,
    Sesh

  • Matchcode Sap Portal

    Hi,
    Can I develop a matchcode for input field in web dynpro java?
    If it is possible, how to do it?
    Many thanks...
    Alfonso.

    Hi,
    Check this to know how to enable Single Sign-On to Non-SAP Systems and Applications:
    http://help.sap.com/saphelp_nw04s/helpdata/en/12/9f244183bb8639e10000000a1550b0/frameset.htm
    Single Sign-On to Non-SAP Java Applictions with SAPSSOEXT
    SAP Note Number: [304450 |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_sec/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d333034343530%7d]
    Regards,
    Praveen Gudapati

  • Regarding fields for Purchase order

    can any body help what are the fields reqiured to develop a p.o report to display the change date,user name,time,p.o name and vendor code.

    Hi
    see the sample report for the fieldnames and other logic
    all the PO info is there here.
    *& Report  ZMM_PO_REPORT
    REPORT  ZMM_PO_REPORT message-Id yb
           NO STANDARD PAGE HEADING
           LINE-COUNT 60(1)
           LINE-SIZE 230.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master
            t161,           " PO Doc Types
            t024,           " Purchase Groups
            ekko.           " PO Header
                   T Y P E S  D E C L A R A T I O N S
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_po,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bukrs TYPE bukrs,           " Company Code
            bsart TYPE bbsrt,           " PO Type
            lifnr TYPE lifnr,           " Vendor No
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
           END OF s_po.
    Purchase Orders History Structure
    TYPES: BEGIN OF s_account,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            gjahr TYPE mjahr,           " Fiscal Year
            belnr TYPE mblnr,           " PO Invoice No
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Local Currency
            dmbtr TYPE dmbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
            shkzg TYPE shkzg,           " Dr/Cr Indicator
           END OF s_account.
    Purchase Orders History Structure(Item Sum)
    TYPES: BEGIN OF s_inv_sum,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
           END OF s_inv_sum.
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_rep,
            lifnr TYPE lifnr,           " Vendor No
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bsart TYPE bbsrt,           " PO Type
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
            name1 TYPE name1,           " Plant
            orewr TYPE netpr,           " To be Invoiced Price
            curr  TYPE waers,           " Inv Doc Currency
           END OF s_rep.
               D A T A  D E C L A R A T I O N S
    DATA: gv_title1 TYPE sylisel,            " Report title
          gv_dial.                           " Color flag
                C O N S T A N T S  D E C L A R A T I O N S
    CONSTANTS: c_x                VALUE 'X',   " Flag X
               c_h                VALUE 'H',   " Debit
               c_vgabe TYPE vgabe VALUE '2'.   " Transaction Type
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_po    TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
                                 " Purchase Order
          i_inv   TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
                                         " PO Invoice Values
          i_rep   TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
                                     " PO Invoice Values
          i_ekbe  TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
                               " PO Invoice Values
                     S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
                    s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
                    s_bsart FOR t161-bsart,
                    s_ekgrp FOR t024-ekgrp,
                    s_bedat FOR ekko-bedat.
    SELECTION-SCREEN END OF BLOCK b1.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      ULINE.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Display the Report Output data
      PERFORM display_data.
    At Line-Selection
    AT LINE-SELECTION.
    When double clicked on EBELN display the details of Purchase Doc
      PERFORM line_sel.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Vendor Number
      CLEAR lfa1-lifnr.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT lifnr UP TO 1 ROWS
            INTO lfa1-lifnr
            FROM lfa1
            WHERE lifnr IN s_lifnr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Vendor'(002).
        ENDIF.
      ENDIF.
    Validation of PO Number
      CLEAR ekko-ebeln.
      IF NOT s_ebeln[] IS INITIAL.
        SELECT ebeln UP TO 1 ROWS
            INTO ekko-ebeln
            FROM ekko
            WHERE ebeln IN s_ebeln.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Document Number'(003).
        ENDIF.
      ENDIF.
    Validation of PO Document Type
      CLEAR t161-bsart.
      IF NOT s_bsart[] IS INITIAL.
        SELECT bsart UP TO 1 ROWS
            INTO t161-bsart
            FROM t161
            WHERE bsart IN s_bsart.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
        ENDIF.
      ENDIF.
    Validation of Purchasing Group
      CLEAR t024-ekgrp.
      IF NOT s_ekgrp[] IS INITIAL.
        SELECT ekgrp UP TO 1 ROWS
            INTO t024-ekgrp
            FROM t024
            WHERE ekgrp IN s_ekgrp.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  fetch_data
    Fetching the PO related data from Database Tables
    FORM fetch_data .
      CLEAR i_po.
      REFRESH i_po.
      SELECT a~ebeln            " PO No.
             b~ebelp            " PO Item
             a~bstyp            " PO Category
             a~bukrs            " Company Code
             a~bsart            " PO Type
             a~lifnr            " Vendor No
             a~ekgrp            " Purchase Group
             a~waers            " Currency
             a~bedat            " PO Date
             b~txz01            " Material Text
             b~werks            " Plant
             b~lgort            " Storage Location
             b~matkl            " Material Group
             b~menge            " PR Quantity
             b~meins            " UOM
             b~bprme            " Price Unit
             b~netpr            " Net price
             b~peinh            " Price Unit UOM
             b~pstyp            " Item Category
             b~knttp            " Account Assignment Category
        INTO TABLE i_po
        FROM ekko AS a JOIN ekpo AS b
        ON a~ebeln = b~ebeln
        WHERE a~ebeln IN s_ebeln AND
              a~lifnr IN s_lifnr AND
              a~ekgrp IN s_ekgrp AND
              a~bsart IN s_bsart AND
              a~bedat IN s_bedat.
      SORT i_po BY ebeln ebelp.
      break-point.
      IF NOT i_po[] IS INITIAL.
    Fetch the PO History/Invoice Details from EKBE Table
        CLEAR i_ekbe.
        REFRESH i_ekbe.
        SELECT ebeln           " PO No.
               ebelp           " PO Item
               gjahr           " Fiscal Year
               belnr           " PO Invoice No
               menge           " PR Quantity
               wrbtr           " Price in Local Currency
               dmbtr           " Price in Foreign Currency
               waers           " Currency
               shkzg           " Dr/Cr Indicator
         INTO TABLE i_ekbe
         FROM ekbe
         FOR ALL ENTRIES IN i_po
         WHERE ebeln = i_po-ebeln AND
               ebelp = i_po-ebelp AND
               vgabe = c_vgabe.
        IF sy-subrc = 0.
          SORT i_ekbe BY ebeln ebelp.
          LOOP AT i_ekbe.
            IF i_ekbe-shkzg = c_h.
              i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
            ENDIF.
            MODIFY i_ekbe.
          ENDLOOP.
      break-point.
    Sum up the Item wise Invoice totals
          LOOP AT i_ekbe.
            AT END OF ebelp.
              READ TABLE i_ekbe INDEX sy-tabix.
              SUM.
              MOVE-CORRESPONDING i_ekbe TO i_inv.
              APPEND i_inv.
            ENDAT.
            CLEAR i_inv.
          ENDLOOP.
          SORT i_inv BY ebeln ebelp.
            break-point.
        ENDIF.
      ENDIF.
    Move the Vendor Name and Invoice Values to I_rep Internal Table
      LOOP AT i_po.
        MOVE-CORRESPONDING i_po TO i_rep.
        CLEAR i_inv.
        READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
                                  ebelp = i_po-ebelp.
        IF sy-subrc = 0.
          i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
          i_rep-curr  = i_inv-waers.
        ELSE.
          i_rep-orewr = i_po-menge * i_po-netpr.
          i_rep-curr  = i_po-waers.
        ENDIF.
      break-point.
    Get the Vendor Name
        CLEAR lfa1-name1.
        SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
          WHERE lifnr = i_po-lifnr.
        IF sy-subrc = 0.
          i_rep-name1  = lfa1-name1.
        ENDIF.
        APPEND i_rep.
        CLEAR  i_rep.
          break-point.
      ENDLOOP.
      SORT i_rep BY lifnr ebeln ebelp.
      DELETE i_rep WHERE orewr LE 0.
      break-point.
    ENDFORM.                    " fetch_data
    *&      Form  display_data
    Display the Report Output data
    FORM display_data .
      DATA: lv_flag,               " New Flag
            lv_rec TYPE i.         " No of Records
      CLEAR lv_rec.
      IF i_rep[] IS INITIAL.
        MESSAGE e000 WITH 'No Data found'(022).
      ELSE.
        LOOP AT i_rep.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
    At New Purchase Document
          AT NEW ebeln.
            WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
            lv_flag = c_x.
            lv_rec = lv_rec + 1.
          ENDAT.
          WRITE: 1 sy-vline,
                12 sy-vline,13(4)   i_rep-bsart,
                17 sy-vline,18(10)  i_rep-lifnr,
                28 sy-vline,29(35)  i_rep-name1,
                64 sy-vline,65(4)   i_rep-ekgrp,
                69 sy-vline,70(10)  i_rep-bedat,
                80 sy-vline,81(5)   i_rep-ebelp,
                86 sy-vline,87(40)  i_rep-txz01,
               127 sy-vline,128(9)  i_rep-matkl,
               137 sy-vline,138(1)  i_rep-pstyp,
               139 sy-vline,140(1)  i_rep-knttp,
               141 sy-vline,142(4)  i_rep-werks,
               146 sy-vline,147(4)  i_rep-lgort,
               151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
               165 sy-vline,166(3)  i_rep-meins,
               169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
               185 sy-vline,186(4)  i_rep-waers,
               190 sy-vline,191(5)  i_rep-peinh,
               196 sy-vline,197(4)  i_rep-bprme,
               201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
               217 sy-vline,218(4)  i_rep-curr,
               222 sy-vline,223(7)  i_rep-bstyp centered,
               230 sy-vline.
          NEW-LINE.
          hide: i_rep-ebeln.
        ENDLOOP.
        ULINE.
        FORMAT COLOR OFF.
        WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
                    lv_rec COLOR 3.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  header
    Write the Report Header
    FORM header .
      FORMAT RESET.
    header
      WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
      SKIP.
      FORMAT COLOR COL_HEADING.
      ULINE.
      WRITE:/1 sy-vline,2(10)   'Pur.Doc.No'(006) CENTERED,
            12 sy-vline,13(4)   'Type'(007),
            17 sy-vline,18(10)  'Vendor'(008) CENTERED,
            28 sy-vline,29(35)  'Name'(009) CENTERED,
            64 sy-vline,65(4)   'PGrp'(010) CENTERED,
            69 sy-vline,70(10)  'Doc.Date'(012) CENTERED,
            80 sy-vline,81(5)   'Item'(011),
            86 sy-vline,87(40)  'Material Short Text'(024) CENTERED,
           127 sy-vline,128(9)  'Mat.Group'(013),
           137 sy-vline,138(1)  'I',
           139 sy-vline,140(1)  'A',
           141 sy-vline,142(4)  'Plnt'(014),
           146 sy-vline,147(4)  'SLoc'(015),
           151 sy-vline,152(13) 'Quantity'(016) CENTERED,
           165 sy-vline,166(3)  'UoM'(017),
           169 sy-vline,170(15) 'Net Value'(018) CENTERED,
           185 sy-vline,186(4)  'Curr'(019),
           190 sy-vline,191(5)  'Per'(020),
           196 sy-vline,197(4)  'Unit'(021),
           201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
           217 sy-vline,218(4)  'Curr'(019),
           222 sy-vline,223(7)  'Doc.Cat'(026),
           230 sy-vline.
      ULINE.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  LINE_SEL
    *When double clicked on EBELN field display the details of Purchase Doc
    FORM line_sel.
      CASE sy-lsind.
        WHEN '1'.
          DATA: lv_field(20),
                lv_value(10),
                lv_bstyp like i_rep-bstyp.
          clear: lv_bstyp,lv_value, lv_field.
          GET CURSOR FIELD lv_field VALUE lv_value.
          IF lv_field = 'I_REP-EBELN'.
            IF NOT lv_value IS INITIAL.
              READ LINE sy-index FIELD VALUE i_rep-bstyp
                                       INTO  lv_bstyp.
             READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
              if lv_bstyp = 'F'.
                SET PARAMETER ID 'BES' FIELD lv_value.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
                SET PARAMETER ID 'VRT' FIELD lv_value.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              elseif lv_bstyp = 'A'.
                SET PARAMETER ID 'ANF' FIELD lv_value.
                CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
              endif.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " line_sel
    Regards
    Anji

  • FS00 Matchcode selection with " * "

    Hello Guys,
    I'm working on ECC6 and I am facing the following issue: I launch the FS00 transaction, I want to display all the GL account starting with 4 so I type 4* in the matchcode, I press enter.... nothing happens ! It would normally display the list of the selected account.
    Did anyone already face this issue of the the selection with the " * " character ?
    Thanks in advance.

    Dear Moulin,
    It should display all the records starting with 4... if you give 4*. <b>The popup will ask you for the confirmation. You would need to press enter.</b>
    It could be that there are no GL Accounts starting with 4 in the chart of account. Anyways, try searching with 4.
    However, you can test the searchhelp in SE11 as well.
    Regards,
    Naveen.

  • SQ01 - Limiting Matchcode Box Results?

    I have a query that uses logical database PNP.  One field I'm using for selection is P0077-RACKY, ethnic origin.  When a user using the F-4 matchcode box on this selection field, the results include ethnic origin codes for several country codes.  Since we a USA organization only, is there a way to limit the results in the F-4 list to country grouping 10 ? 
    When the dialog box pops up, I can go to the restrictions and enter 10 which will give me the results I want.  But, I don't see a reason for users to have to do this step.  I'd like the results restricted to country group 10 up front. 
    The MOLGA is set in user parameters to 10, but that still doesn't help.  We also have LND and PNI set to US.
    Thanks,
    John
    John Rich
    HR Team, The University of Tennessee

    Field RACKY includes a foreign key check for MOLGA which is populated from table T001P . Unless you populate personnel area WERKS (which is associated with a country), you continue to see all values for RACKY. Before we invoke the screen which includes RACKY , we should have personnel area in memory for us to restrict RACKY list. That is why we have a restricted list for RACKY field in IT0077 (WERKS is populated before we create/change) and not in a screen without WERKS populated.
    Hope this helps
    Regards
    Ravikumar

  • Matchcode Object for ORGEH field in Selection-Screen

    Hi,
       I need to create a Matchcode Object for ORGEH field in my Selection-Screen. But, I want to have the selection Criteria as the Tcode: Po10 does. Please guide me how to do it. Is there any Standard Matchcode Object provided by SAP for this kind of functionality?. Please provide some kind of solution. I am in urgent need of this.
    Thanks in advance,
    Exertive.

    Hi,
    You can try the following are the search helps (matchcode objects) available for ORGEH (Org Unit).
    HRBAS00OBJID
    RESP_ORG_UNIT
    H_T527X                          Help View for Organizational Units                         
    H_T527X_1                        Seach help for T527X                                       
    Regards,
    Suresh Datti

  • Single search help MAT1L looses matchcodes

    A client asked to limit the MAT1 help for some users. We implemented succesfully a single search help with MAT0M (by erasing all others from shlp_tab) and filters by maktl and t023-begru (which has a very usefull authorization object).
    Now he asked to add a second help window, and I've met an anoying difficulty. If I add the MAT1L and keep the MAT0M, I get the two help tabs, but the MAT1L help doesn't use my MAT1 user exit function. If I delete the MAT0M and keep only the MAT1L, that help uses my MAT1 user exit function, but looses it's internal matchcodes for spras and maktl.
    I've been trying to adjust some parameters in shlp and shlp_tab, but so far with no success.
    I need some pointers to either keep both views and have them use my user exit function or have only the MAT1L with matchcodes enabled.

    Hi Gustavo,
    Maybe you could write your restriction in search help exit(each elementrysearch help could have one exit).
    Regards,
    Markus

  • Multiple Selection on Matchcode in ALV Grid

    I need to implement a Matchcode with multiple selection on a Field in an ALV Grid. On F4 in this specific Field the specific matchcode muss be enable with multiple selection. And after multiple selection by the user, the result muss be concatenate and insert to this field.
    Any suggestions or code?
    Thanks and Best Regards
    Franck

    Check the program: BCALV_TEST_GRID_F4_HELP.
    IN the code, search foor the fm: F4IF_FIELD_VALUE_REQUEST.
    You should pass the parameter MULTIPLE_CHOICE = 'X' for multiple choice in the F4 pop up.
    Once you get the returned table, you can concatenate the result and put it it the target field.
    Regards,
    Ravi

Maybe you are looking for

  • Error installing BOBJ 3.1 SP2 on AIX

    Hi, Has anyone tried installing BOE 3.1 SP2 on AIX successfully? I get an error.. [error] Errcode 1: gzip -dc "/temp_cds3/PATCHES_DOWNLOADED/BOBJ_ENT_SP2/pkg/jdk00000.tar.gz" | /bin/tar xvfb - 1 I checked the pkg directory and can't find the file jdk

  • Materialized View Initial Creation vs Complete Refresh - MAJOR differences

    Hi All, I am currently in the process of setting up MV's for replication via a DBLink and have noticed something that I find quite odd. Basically If I create an MV I get v. large differences than when I do a complete refresh on the same MV after the

  • Acrobat X Upgrade API menus no longer work.

    I just recently upgraded to the New Acrobat X. I have created a pluggin that has simple annotations to be placed in a document. However once I add the toolbar button to Quick Tools. The Toolbar Items are no longer visible. Any suggestions on fixing t

  • Why the **** can I not get firefox on an iPad?!

    The fact that safari cannot download firefox on the ipad2 is ******* ridiculous. It speaks to a deep seated insecurity on apple's part.

  • Contact Sheets in Bridge CC

    i have downloaded the output module for Bridge cc, now how do i create a contact sheet from this?