Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7203099
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2008-05-19 21:43:45

在46C版本以后,SAP已经废弃了Field Exits的使用,但是,如果你非要使用也不是不可以的。
懒得打字了,转几篇英文文章:
 
--------------------第一篇-----------------------------------
 

V4.6c onwards no longer supports field exits!!! In any case here's how to activate them:

Activation of the field exits and assignment of the dynpros is carried out using program RSMODPRF. For this purpose, the program must be started without parameters (input fields remain blank).  If required, new field exits can be created using program RSMODPRF (see below for documentation).

Field Exits for Data Elements

 

Description

 

Maintenance transaction for creating and activating field exits

As part of the extension concept, SAP allows you to install a field exit for each screen field. Similar to the conversion exit, the system branches at the field exit at DCI (DATA COMMUNICATIONS INPUT) to a function module, if the field is an input field and a function code was triggered. The function module must adhere to the following naming convention:

  • Prefix: FIELD_EXIT_
  • Infix:
  • Suffix: _0 to _9 (optional), _A to _Z

The interface is automatically generated during the creation of the function module, and has 2 parameters:

  • Import parameter: INPUT
  • Export parameter: OUTPUT

After a function code has been triggered the contents of the field are made available to the FB via the "INPUT" import parameter. You can edit this and, when changed, make it available to the ABAP/4 processor in "OUTPUT". The input field contents are usually passed on: you can simply write OUTPUT = INPUT.

If, e.g., you have activated the field exit for the data element 'PROGRAM', then the fields of all the screens, which refer to the data element 'PROGRAM', branch to the function module FIELD_EXIT_PROGRAM. This includes the field 'Program' of the initial screen SAPMS38M0100 in transaction SE38, for example.
If you do not want the function module to be accessed from all screens, assign particular screens to the data element PROGRAM. By allocating an exit number, it is also possible to branch to other function modules with the corresponding suffix _0 ... _Z.

Example: You have assigned screen SAPMS38M0100 and exit number 5 to data element 'PROGRAM'. The corresponding field on SAPMS38M0100 branches to FIELD_EXIT_PROGRAMM_5.

As soon as you activate an exit, the corresponding screens are invalidated.

Note: Field exits are only taken into account during screen generation if the parameter abap/fieldexit = 'YES' is set in the system profile.

Requirement

Set the profile parameter abap/fieldexit = 'YES' before system start.

Limitations

The following ABAP statements are not allowed in the function modules of field exits:

BREAK-POINT,
CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT,
COMMIT WORK, ROLLBACK WORK,
COMMUNICATION RECEIVE,
EXIT FROM STEP-LOOP,
MESSAGE I, MESSAGE W.

Note:

  • Field exits cannot be edited with the debugger.
  • You should not use any external Performs in field exits. The ABAP processor shares the table work areas of externally called programs with those of the first caller. This could lead to errors at field exits that can hardly be analyzed, as field exits are sometimes slipped into the flow of the program at unforeseen events.
 
--------------------第二篇-----------------------------------
 

Questions and answers on field exits

1. A field exit was created with the CMOD and activated, but it does not get executed when the screen is called.

  • Since the field exit is not executed until DCI, some action must occur in the screen (e.g. press Return, saving....).
  • Set the abap/fieldexit profile parameter to YES and start the system again.
  • After the FIELD_EXIT... function module has been activated and the field exit has been activated, the transaction in whose screen the field exit is to be executed must be terminated. The screen is not generated until it is called.
  • Do not work on different application servers, otherwise there may be a delay before the field exit becomes active.
  • The profile parameter must be set either on all application servers or on none.
  • If the field exit is to be active in certain screens only, then you should check whether you have selected the correct program and the correct screen number (Careful with SUBSCREENS !).
  • Use SE51, field list, to ensure that the screen field really does have a DDIC reference! Do not rely on the F1 information for the field!

2. How does setting abap/fieldexit affect the performance?

  • If a screen is generated and the profile parameter is set, then the system checks in 2 tables (TDDIR, TDDIRS) to see whether a field exit has to be generated for the field. In practice the screen load after a Put is not generated until the screen is called. The user will not experience a noticeable delay, since screen generation is extremely fast.

3. Can the contents of other screen fields be read in a field exit?

  • In principle all fields can be copied to global variables in the TOP or the function group. However, since the order in which the field exits are called is not guaranteed, this possibility should not be used.

4. How does the field exit work in step-loop fields?

  • After data input to DCI the field exit will be called as many times as fields are visible on the step-loop. The SY-STEPL system variable is incremented each time. If a new value is assigned to be field, then it will be visible in the module between LOOP. ENDLOOP. This module will also be called as many times as there are visible step-loop lines.

5. Can field exits be debugged?

  • No. Field exits have to be tested in isolation in the development environment. To analyze problems that occur only in the screen environment, the relevant variables can be written to the file system using TRANSFER... and can be analyzed there.

6. What should one do if the field contents are not getting transported to ABAP/4?

  • Check whether you have assigned a value to the OUTPUT field.

7. When does the field exit get called in the case that there is a conversion exit attached to the data element?

  • The field exit will be called after the conversion exit. This means that the INPUT field contains the data in the same form as that in which the ABAP/4 program also gets them.
 
--------------------第三篇-----------------------------------

 

Field exits (SMOD/CMOD) Questions and Answers

1. Field exit was created with CMOD, but is not processed when calling the screen.

-  Since the field exit is not processed until PAI, an action must be triggered on the screen (Return, Save, ...).

-  Set profile parameter abap/fieldexit to YES and restart the system.

-  After activating the function module FIELD_EXIT... and the field exit, leave the transaction on whose screen the field exit is to be executed. The screen is not generated until the transaction is started.

- Do not work on different application servers since there may be some delay before the field exit is activated.

- The profile parameter must be set on all or none of the application servers.

- If the field exit is to only be active on specific screens, check whether you chose the correct program and the correct screen
      number (take care with subscreens).

- Using SE51 -> Field list, check that the screen field does have a reference to a data element. In the name of the field exit use the name of the data element and not the field name.

- After transport, field exits are marked as active but will not be processed. 
   Tip: First try deactivating the field exit once more and then afterwards, activate it again.

2. How is performance affected by setting abap/fieldexit?

- If a screen is generated and the profile parameter is set, a check is run on 2 tables (TDDIR, TDDIRS) to see whether a field exit must be generated for the respective field. In practice, the screen load is not generated until the screen is selected after an
update. The user should not notice any difference because screen generation is very fast.

3. Can you read the contents of other screen fields in the field exit?

- In principle, every field exit can store its value in the global variables of the function group (TOP) and hence make them
available to other field exits. Note here that field exits are always called and not only if an entry is made in the field or if the field is empty. In addition, it is not possible to make any assumptions about the order in which the field exits will be called in the future.

4. How does the field exit behave on step loop fields ?

- After the user has entered data, the field exit is called in PAI as often as there are visible fields in the step loop. The system
variable SY-STEPL is incremented each time. If a new value is assigned to the field, it is displayed in the module between LOOP and ENDLOOP. This module is also called once for each visible step loop line.

5. Can field exits be debugged ?

- No. Field exits must be tested separately in the ABAP/4 Development Workbench. For errors which only occur in the screen environment, it is helpful to write interesting variable to the file system using TRANSFER... . These can then be analysed there.

6. What can you do if the field contents are no longer transported to to ABAP/4.

- Check whether a value is assigned to the field OUTPUT.

7. When is the field exit called if a conversion exit is attached to the
   data element ?

- The field exit is called after the conversion exit. This means that the INPUT field receives the data in the same format as the
ABAP/4 program also receives it.

8. Although a global field exit is inactive, a function module is called which does not exist (for example FIELD_EXIT_PROGRAMM_@)

- This is an error in the kernel which no longer occurs as of 3.0C.  As a temporary measure, it is useful to assign a program and a screen which do not exist to the field exit and then activate the field exit.

9. Field exit is not visible in CMOD, although created.

- If you want to create a field exit for a data element, a function module is proposed with the name FIELD_EXIT_. This
function module must exist for the field exit to work. If you do not create this function module, but do create one with a suffix,
the data element is not displayed in CMOD.

10. Field exit is not executed although it is active.

-  Fields which do not have the 'Input field' attribute usually do not trigger a field exit. The field exit is designed to allow an
extended input check. It is therefore only called for input fields - even if they are not ready for input at runtime of the         application by LOOP AT SCREEN.
This rule does not apply, however, if the field is located within a steploop. Here the field will be always activated, even if it is
invisible.

- Field exits can only be executed for fields that are directly related tothe dictionary. If the relation is indirect, i.e. via an       ABAP declaration (  LIKE ), no field exit can be executed.

11. Field exits on check buttons do not work

-  Field exits are only intended for input fields. As check buttons count as graphical elements, you cannot install field exits on
them.

12. Field exits do not work on selection screens

阅读(5994) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~