cancel
Showing results for 
Search instead for 
Did you mean: 

Field Exit

Former Member
0 Kudos

Hi All,

I want to limit a 40-character screen field to 25 characters. I want to limit the users input manually to just 25 chars even if the field is really up to 40 chars.

How do i do this?

Best Regards,

Kenny

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

<b>Step by step procedure for creating Field Exits</b>

There are eight steps to creating a field exit:

Step 1: Determine Data Element

Step 2: Go To Field Exit Transaction

Step 3: Create Field Exit

Step 4: Create Function Module

Step 5: Code Function Module

Step 6: Activate Function Module

Step 7: Assign Program/Screen

Step 8: Activate Field Exit

Step 1: Determine Data Element

- Before you can begin adding the functionality for a field exit, you must know the corresponding data element.

- An easy way to determine the data element associated to a particular screen field is to:

Go the appropriate screen.

Position the cursor in the appropriate field.

Press ‘F1’ for field-level help.

Click on the ‘Technical info’ pushbutton (or press ‘F9’) on the help dialog box.

On this Technical Information dialog box, the data element will be specified if the field is 'painted' from the ABAP/4 Dictionary.

Step 2: Go To Field Exit Transaction

- The transaction to create field exits is CMOD.

- You can use the menu path Tools -> ABAP/4 Workbench -> Utilities -> Enhancements -> Project management.

- From the initial screen of transaction CMOD, choose the Text enhancements -> Field exits menu path.

- After choosing this menu path, you will be taken to the field exits screen. From here, you can create a field exit.

NOTE : Even though you use transaction CMOD to maintain field exits, you do not need to create a project to activate field exits.

Step 3: Create Field Exit

- From the field exit screen of transaction CMOD, choose the Field exit -> Create menu path.

- After choosing this menu path, a dialog box will prompt you for the appropriate data element .

- Enter the data element name and click the ‘Continue’ pushbutton.

- Now, you will be able to create the function module associated to the data element’s field exit.

Step 4: Create Function Module

- You will automatically be taken to the Function Library (SE37) after entering a data element name and clicking the ‘Continue’ pushbutton.

- In the ‘Function module’ field, a function module name will be defaulted by the system based on the data element specified. This name will have the following convention:

FIELD_EXIT_<data element>

- You can add an identifier (an underscore followed by a single character ).

- The first function module for a data element’s field exit must be created without an identifier.

- To create the function module, click on the ‘Create’ pushbutton, choose menu path Function module -> Create, or press ‘F5’.

- After choosing to create the function module, you will get the warning: "Function module name is reserved for SAP". This message is just a warning so a developer does not accidentally create a function module in the field exit name range. By pressing ‘Enter’, you will be able to go ahead and create the function module.

- Before coding the function module, you will have to specify the function modules attributes -- function group, application, and short text.

Step 5: Code Function Module

- From the function module’s attributes screen, click on the ‘Source code’ pushbutton or choose the Goto -> Function module menu path to the code of the function module.

- Here you will add your desired functionality for the field exit.

- Remember that field exit’s function module will have two parameters -- one importing parameter called "INPUT" and one exporting parameter called "OUTPUT". These parameters will be set up automatically by the system.

- You must remember to assign a value to the OUTPUT field. Even if the value does not change, it must be moved from the INPUT field to the OUTPUT field.

Step 6: Activate Function Module

- After coding the function module, you must remember to activate it.

- Use the Function module -> Activate menu path to activate the function module.

- At this point, you can return to the field exit transaction.

- You should be able to 'green arrow' back to this transaction.

- When you return to the field exit transaction, you will see an entry for the newly created field exit.

- At this point, the field exit is global. That is, it applies to all screens that use a particular data element. On any screen that uses the data element, the corresponding field exit function module will be triggered, once it is active.

- Also, the field exit will not be triggered yet because it is inactive.

Step 7: Assign Program/Screen

- This step is only needed if you want to make a field exit local.

- To make a field exit local, select the field exit and click on the ‘Assign prog./screen’ pushbutton.

- In the dialog box , indicate the appropriate program name and screen number.

This information indicates that the field exit is local to the specified screen in the specified program.

- In the dialog box, you determine which function module gets executed for the field exit by specifying the identifier in the ‘Fld. Exit’ field.

- If this field is left blank, the function module triggered will be 'FIELD_EXIT_<data element>'.

- If a single-character identifier is entered into the field, the function module triggered will be 'FIELD_EXIT_<data element>_<identifier>'.

Step 8: Activate Field Exit

- The field exit must be active for it to be triggered by the system.

- Activate the field exit by choosing the Field exit -> Activate menu path.

- After assigning the field exit to a change request, its status will change to ‘Active’ and it will be triggered automatically on the appropriate screen(s).

NOTE : In order to activate the field exit the profile parameter abap/fieldexit = YES must be set on all application servers

rgds,

latheesh

Former Member
0 Kudos

Hi Latheesh,

I have a problem finding the Text enhancements -> Field exits menu path. Basically, I cant get through step 2. Im in transaction CMOD but I cant find field exit.

Help.

Thanks,

Kenny

Former Member
0 Kudos

u can use this program to create field exit

RSMODPRF

Message was edited by: Chandrasekhar Jagarlamudi

Former Member
0 Kudos

Hi Kenny,

TAKE A LOOK AT THE OSS NOTES: 29377 which explains the details about Field Exit.

Note

Field exits are frozen on the 4.6C maintenance level and are not further developed. This means that the existing functionality is kept with all restrictions (see also the last item below). Existing exits can be further used and are called at runtime as usual.

Existing exits can be maintained using program RSMODPRF (run the

program using transaction SE38). Activation of the field exits and

assignment of the dynpros can also be 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 the program documentation).

Solution

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).

Generate the screen on which the exit should be active using SE51. It is possible that it was not correctly generated. If you want to be sure that all screens that use the data element are regenerated, you can transfer Report rsmodfdg from the correction instructions and start it with SE38. The Report uses the affected data element as the input parameter and regenerates all screens that use the data element.

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 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, 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 variables 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 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 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 can lead to an ABAP dump error when function module FIELD_EXIT_<data element name> is called.

This is an error in the kernel which no longer occurs as of Release 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.

Due to performance reasons, the active/inactive indicator is stored in the screenload. This can cause inconsistencies between Source and Load. Generate the affected screen with se51. If you want to be sure that all screens that use the data element are regenerated, you can transfer Report rsmodfdg from the correction instructions and start it with se38. The Report uses the affected data element as the input parameter and regenerates all screens that use the data element.

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_<data_element>. 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 to the dictionary. If the relation is indirect, i.e. via an ABAP declaration (<fieldname> LIKE <dictionary element>), no field exit can be executed.

11. Field exits do not work on selection screens.

Results from the previous item since ABAP-internal fields and never the original Dictionary fields are used on selection screens.

12. Field exists do not work on check buttons.

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

13. How can all screens that use a data element be generated?

If you want to be sure that all screens that use a specific data element are regenerated, you can transfer Report rsmodfdg from the correction instructions into a customer report (e.g. zsmodfdg). The Report regenerates all screens. In this way, you can ensure that active field exits refer to screens and that inactive exits cannot be called on any screen. The Report uses the affected data element as the input parameter. The affected data element is in the name of the exit: FIELD_EXIT_<data element name>.

14. Restriction of usage

Field exit technology was developed for input fields on dynpros and cannot be used for other/new dynpro elements. This means that this technology does not offer support for the new ScreenPainter elements such as graphical elements (e.g. checkbuttons, radiobuttons, dropdown listboxes), controls (except for table controls which are supported like a step loop), or selection screens.

Cheers

VJ

Former Member
0 Kudos

Hi All,

I was able to create the field exit function module but it doesnt work on the transaction.

What do I need to do and check?

Thanks,

Kenny

Former Member
0 Kudos

Hi Chandrasekar,

i want to add two fields in the addtioanal data b tabstrip of the t-code 'va02' . For ex customer and vendor number.

Thanks and regs,

seshu

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi kenny,

1. While typing in the field,

the system will allow 40 characters.

( we cannot control this behaviour,

since the field length in the screen painter

would be 40 characters)

2. However, u can issue some warning/error message

in field exit,

after checking the length of that field

using STRLEN statement.

regards,

amit m.

rahulkavuri
Active Contributor
0 Kudos

hi

This is possible only when are u workin with transactions as u can use screen painter to configure the field length as u want

Former Member
0 Kudos

Hi Rahul,

I just found out field exits are only permitted in versions lower tha 4.6c. Im running on ECC5 already.

I'm using material create transaction. How do I do this?

Best Regards,

Kenny

Former Member
0 Kudos

Hi again,

1. field exits are only permitted in versions lower tha 4.6c

It just means that

in higher versions like ecc5.0

the OLD Field - EXITS will work.

2. But SAP won't use the concept

of field-exits For NEW FIELD EXITS.

(however we can use the old ones, sap will support them)

regards,

amit m.

Former Member
0 Kudos

Hi Amit,

How do I search for field exits? Do you have a step by step guide on how to do field exits?

Thank you so much.

Kenny