For almost every standard SAP screen you have to change the layout according to user requirements (e.g., hide or gray out fields, set default values of fields, hide tabs on the screen, or set a default tab for the screen). Sometimes you can handle these from the IMG or transaction code SHD0, but in complex cases, you can’t handle all such requirements using these methods. Learn how to implement a user exit without modification and how to change the design of the standard SAP screen to make it more user friendly. 
  
Key Concept
 Enhancement options allow you to add your own functionality to standard SAP applications without modifying the original objects. Types of enhancements include implicit enhancements, explicit enhancements, customer exits, and user exits. Working with these types of enhancements allows you to solve complex scenarios.   Many SAP screens can provide too much information in their standard displays. For example, you might have fields in certain transactions that some users shouldn’t have access to, or you might merely want to change the attributes of the fields that are displayed to provide a better user experience. If you want to change objects delivered by SAP (that do not start with Z or Y), you have to get an access key from SAP. Changing the objects delivered by SAP is called a modification. SAP does not recommend that you modify any object. However, you can use several enhancement options, including a user exit, to change the design of the screen to customize it for your users without needing an access key.
I will use the standard SAP screen for a sales order creation (transaction VA01) as an example for using enhancements in this article. I’ll cover four scenarios:
 - You want to hide or show some fields or buttons on the screen depending on different conditions, such as to hide fields only if user A creates the sales order. You could also include order type, sales organization, distribution channel, division, sales office, or sales group as conditions. 
  - For a controlling data entry issue such as a wrong entry, you want to fill some fields automatically and make these fields as read only for the end user. The value of the field can depend on all parameters such as user, order type, or sales organization. You can also have a requirement to fill a value automatically in the field for user A and make it read only for this user, but for user B you do not fill this field automatically, so you should make it input enabled to allow the user to enter a value in this field. 
  - Depending on the preceding conditions, you may need to hide or show different tabs. For example, user A can only see the Sales, Item Overview, and Item Detail tabs, but user B can see all the tabs.
  - For fast data entry, the user wants to select some specific tab by default. It can be user dependent; for example, user A wants the Sales tab selected by default, and user B wants the Item Overview tab to be selected.
  
Note
 Just for displaying the real-time changes on the screen after the enhancement implementation, I will use some hard-coding, but it is not a best practice to use hard-coding if you can avoid it. You can later remove the hard-coding with dynamic code, but that topic is outside the scope of this article.
Let’s look at the default screens before making any changes. Use transaction VA01 for the sales order creation screen (Figure 1). Enter values for the Order Type, Sales Organization, Distribution Channel, and Division based on your organization’s needs.

Figure 1
The initial screen for creating a sales order
Press Enter to go to the main screen of the sales order creation (Figure 2).

Figure 2
The main screen for creating a sales order
 
Scenario 1: Hide Fields and Buttons Using a User Exit Without Modification
If a user is not allowed to perform a certain function — such as create the sold-to party — it would be best to remove the button that makes this function possible. Or in other situations, such as if certain fields are not applicable, it might be preferable to remove the field from the screen. In either of these scenarios, it’s a good idea to hide the field or button. Figures 3, 4, and 5 show fields (in the screen in Figure 2, transaction VA01) that should be hidden under the following conditions: the user name is FALTAF, the order type is CS (cash sale), the sales organization is 1000, the distribution channel is 12, and the division is 00.

Figure 3
Fields and buttons to hide from the header of a sales order

Figure 4
Fields and check boxes to hide within the Sales tab

Figure 5
Fields to hide within the Item overview tab
Now I’ll show you how to use a user exit without the need for an access key.
Step 1. Open the program in display mode. You can use transaction code SE80 or SE38. Enter the program name (MV45AFZZ) and click the Display button (in this example, the transaction code used is SE38) to open the program in display mode (Figure 6). The system shows you the code of the program in ABAP Editor (Figure 7).

Figure 6
Open program MV45AFZZ in display mode

Figure 7
The code of the program in ABAP Editor
Step 2. Show the enhancement options. Click the enhance (spiral) icon in the toolbar or press Shift-F4 to bring up the screen in Figure 8. Follow menu path Edit > Enhancement Operations > Show Implicit Enhancement Options.

Figure 8
Select Show Implicit Enhancement Options
Step 3. Select the implicit enhancement position. Go to the form USEREXIT_FIELD_MODIFICATION, and you can see a line under it with a black arrow (Figure 9). This line is the implicit enhancement position.

Figure 9
The implicit enhancement position under the form name
Step 4. Create the enhancement implementation. Right-click the line and follow menu path Enhancement Implementation > Create (Figure 10).

Figure 10
Select Create
Step 5. Because you are going to add code in this form, click the Code button in the resulting screen (Figure 11).

Figure 11
Choose an enhancement mode
Step 6. In the list, you can see the standard implemented enhancement. You must not select a standard enhancement implementation and add your code in it because it can be replaced by SAP code in the case of a system upgrade. To create a new enhancement implementation, click the new icon shown in (Figure 12).

Figure 12
Create a new enhancement implementation
Step 7. Name the enhancement implementation. Enter the enhancement implementation name and short text and click the green check mark icon (Figure 13).

Figure 13
Enter the implementation name and short text
Step 8. Name the package. Enter a name (e.g., ZFSL) in the Package field for the package in which you want to save this enhancement. Click the save icon (Figure 14).

Figure 14
Name the package in which to save the enhancement
Step 9. Create a new workbench transport request. Click the new icon shown in Figure 15.

Figure 15
Create a new workbench transport request
Step 10. Describe the transport request. In the Short description field enter a brief description of the transport request. Click the save icon (Figure 16).

Figure 16
Enter a short description of the transport request
Step 11. Place an object in the request. You can see the newly created request selected in the next window (Figure 17). Click the green check mark icon to place your object in this request.

Figure 17
Place an object in the request
Step 12. Select the new enhancement implementation. You can see the newly created enhancement implementation ZFSL_SD_SO_HF (Figure 18). You may need to scroll down to find it. Select it and click the green check mark icon.

Figure 18
Select the new enhancement implementation (ZFSL_SD_SO_HF)
Step 13. Add code to the new enhancement. You can see the white line inside ENHANCEMENT 315 ZFSL_SD_SO_HF … ENDENHANCEMENT (Figure 19). Add your code to this line. Copy the code shown in Figure 20. Paste it inside the ENHANCEMENT … ENDENHANCEMENT area. Remove the asterisk from the start of line 70.

Figure 19
Add code to the new enhancement

Figure 20
Code to add to the new enhancement
Step 14. Activate the enhancment. After adding the code, click the Enhancements button in the toolbar (Figure 21).

Figure 21
Select the enhancement to be activated
Step 15. You can see your enhancement already selected. Just click green check mark icon to activate it (Figure 22). You receive a message indicating that there were no errors.

Figure 22
Activate the enhancement
Now you are ready to test the changes. Use transaction code VA01 again. You can see that the main screen now only has two fields on the header: Sold-to party and Net value (Figure 23). There is also no field on the Sales tab (Figure 23) or on the Item overview tab (Figure 24).

Figure 23
Two fields on the header and no field on the Sales tab

Figure 24
No field on the Item overview tab
Note
 If you change any condition parameter such as user, sales organization, distribution channel, or division, you see the same default screen as in Figure 2.
Scenario 2: Fill Default Values in Fields Using Customer and Explicit Enhancements
In the first example, I describe the way to implement a customer enhancement for filling the Sold-to party field on the sales order creation header. Later, I will elaborate the limitation of using this customer enhancement, and then I’ll use the explicit enhancement to overcome those limitations.
Example 1: Use a Customer Enhancement
Step 1. Name the project. Use transaction code CMOD. Enter a name in the Project field and click the Create button (Figure 25). The Project name must start with a Z or Y (e.g., ZSTP).

Figure 25
Name the project
Step 2. Add a brief description of the project. Populate the Short text field and click the save icon in the toolbar (Figure 26).

Figure 26
Add a brief description of the project
Step 3. Name the package in which to save the enhancement. Enter a name (e.g., ZFSL) in the Package field for the package in which you want to save this enhancement. Click the save icon. Place this object in the same request created in Figure 16.
Step 4. Assign the enhancement to the project. Click the Enhancement assignments button in the toolbar (Figure 27).

Figure 27
Assign the enhancement to the project
Step 5. Enter the name of the enhancement to be assigned to the project. Enter the enhancement name and click the save icon (Figure 28). To see the components available in the enhancement, click the Components button.

Figure 28
Enter the name of the enhancement to be assigned to the project
Step 6. Select the function module exit. Note that only one function module exit is available on the components screen (Figure 29). Double-click the highlighted function module name, EXIT_SAPMV45A_002.

Figure 29
Select the function module name EXIT_SAPMV45A_002
Step 7. Select the include name. Double-click the highlighted include name inside the function module (Figure 30). You receive a message in the status bar indicating that the program names are reserved for includes of exit function groups. Press Enter.

Figure 30
Select the include name
Step 8. Create the include object. In the resulting pop-up screen, click the Yes button to create the include (Figure 31).

Figure 31
Create the include
Step 9. Name the package. On the next screen enter a name (e.g., ZFSL) in the Package field for the package in which you want to save this include and click the save icon. Place this object in the same request created in Figure 16.
Step 10. Just after saving in the transport request, the system leads you to the ABAP Editor with the ZXVVAU04 include open (Figure 32). Add code to auto-fill the Ship-to Party value.

Figure 32
The include for adding code
Step 11. Add code to the include. Add code such as that shown in Figure 33. Click the activate icon in the toolbar to activate the include. The system gives you a message in the status bar indicating that the object has been activated.

Figure 33
Add code and activate the include using the Activate button
Step 12. Activate the project. You have activated the include but your project is still not active. For making the enhancement work, you must activate both the include and the project. To activate the Project, click the activate icon in the toolbar (Figure 34). The red icons become green after activation (Figure 35). You also get a message in the status bar indicating that the enhancement is activated.

Figure 34
Activate the project

Figure 35
The enhancement after activation
Step 13. Test the enhancement. To test the enhancement effects, use transaction code VA01. On the main screen, you can see that the Sold-to party has filled automatically (Figure 36). There are some limitations, such as that you can only use one condition of a user name. In this enhancement, you cannot add the order type, sales organization, or distribution in the condition because SAP doesn’t give parameters in the function module for these fields, so they are not visible in the include program.

Figure 36
The automatically filled value of the Sold-to party
Step 14. Deactivate the customer enhancement. In the next example, I will explain the way to fill the Sold-to party considering all the conditions discussed earlier by using an explicit enhancement. But first, you have to deactivate this customer enhancement. Click the undo activation icon in the toolbar (Figure 37). After deactivating you have to delete the created include and project.

Figure 37
Undo the activation
Step 15. Delete the include. Use transaction code SE38, enter ZXVVAU04 in the Program field, and click the delete (trash can) icon (Figure 38). Click the Yes button in the pop-up window. You receive a message on the status bar that program ZXVVAU04 was deleted successfully.

Figure 38
Delete the include
Step 16. Delete the project. Use transaction code CMOD, enter ZSTP in Project field, and click the delete icon (Figure 39). Click the Yes button in the resulting pop-up window.

Figure 39
Delete the project
Example 2: Use the Explicit Enhancement Point
Step 1. Open the program in display mode. Open program MV45AO0K_KUNDEN_UEBERNEHMEN in display mode using transaction code SE80 or SE38. In this example transaction SE38 is used (Figure 40).

Figure 40
Open the program in display mode
Step 2. Switch to enhancement mode. Click the enhance icon in the toolbar (Figure 41). You can see the enhancement point KUNDEN_UEBERNEHMEN_10 (Figure 42).

Figure 41
Click the enhance icon

Figure 42
Enhancement point MV45AO0K_KUNDEN_UEBERNEHMEN
Step 3. Create the enhancement implementation. Right-click the enhancement point line in the code and follow menu path Enhancement Implementation > Create in the context menu (Figure 43).

Figure 43
Create the enhancement implementation
Step 4. In the list, you can see the standard implemented enhancement, but you must not select a standard enhancement implementation and add your code in it because it can be replaced by SAP code in the case of a system upgrade. To create a new enhancement implementation, click the new icon shown in Figure 44.

Figure 44
Create a new enhancement implemenation
Step 5. Name the enhancement implementation. Populate the Enhancement Implementation and Short Text fields. Click the green check mark icon (Figure 45).

Figure 45
Name the enhancement implementation
Step 6. In the next screen, enter the name in the Package field (e.g., ZFSL) of the package in which you want to save this enhancement. Click the save icon. Place this object in the same request created in Figure 16.
Step 7. Select the new enhancement implementation. Now you can see the newly created enhancement implementation ZFSL_SD_SO_SOTP (Figure 46). You may need to scroll down to find it. Select it and click the green check mark icon.

Figure 46
Select the new enhancement implementation (ZFSL_SD_SO_SOTP)
Step 8. Add code to the new enhancement. Now you can see the white line inside ENHANCEMENT 316 ZFSL_SD_SO_SOTP … ENDENHANCEMENT (Figure 47). Here you can add your code after removing the asterisk at start of the line.

Figure 47
Add code to the new enhancement
Step 9. Activate the new enhancement. Add the code shown in Figure 48 and activate the enhancement using the Enhancements button on the toolbar.

Figure 48
Add code and activate the enhancement
Step 10. You find your enhancement selected in the next window (Figure 49). Click the green check mark icon.

Figure 49
Click the green check mark icon
Step 11. Test the enhancement. For testing purposes, run transaction code VA01 again (Figure 50). You can see the Sold-to party field filled again, but this time all conditions are applicable.

Figure 50
The automatically filled Sold-to party field
 
Scenario 3: Hide or Show Tabs Using an Explicit Enhancement Point
Step 1. Open the program in display mode. Open program MV45AF0T_TAXI_INITIALIZE_CARRI in display mode using transaction code SE80 or SE38 (Figure 51). In this example transaction SE38 is used.

Figure 51
Open the program in display mode
Step 2. Switch to enhancement mode. Click the enhance icon in the toolbar and find enhancement point ISM_SAPMV45A (Figure 52).

Figure 52
Click the enhance icon
Step 3. Right-click the enhancement point line in the code and follow menu path Enhancement Implementation > Create in the context menu (Figure 53).

Figure 53
Select the enhancement implementation
Step 4. Create a new enhancement. In the list, you can see the standard implemented enhancement, but you must not select a standard enhancement implementation and add your code in it because it can be replaced by SAP code in the case of a system upgrade. To create a new enhancement implementation, click the new icon shown in Figure 54.

Figure 54
Create a new enhancement
Step 5. Name the enhancement implementation. Populate the Enhancement Implementation name and Short Text fields. Click the green check mark icon (Figure 55).

Figure 55
Enter the implementation name and description
Step 6. Name the package. On the next window, enter a name in the Package field (e.g., ZFSL) for the package in which you want to save this enhancement. Click the save icon. Place this object in the same request created in Figure 16.
Step 7. Select the new enhancement. Now you can see the newly created enhancement implementation ZFSL_SD_SO_HTAB (Figure 56). You may need to scroll down to find it. Select it and click the green check mark icon.

Figure 56
Select the new enhancement (ZFSL_SD_SO_HTAB)
Step 8. Add code to the enhancement. Now you can see the white line inside ENHANCEMENT 317 ZFSL_SD_SO_HTAB … ENDENHANCEMENT (Figure 57). Add your code. Remove the asterisk at the start of line before adding code.

Figure 57
Add the code to the enhancement
Step 9. Add code and activate the enhancement by clicking the Enhancements button in the toolbar (Figure 58). In this code, you need to include function codes of the tabs that you want to hide. For example, UER3 is the function code of the Item detail tab and UBST is the function code of the Ordering party tab). For all function codes of tabs check table TAXITABS using a value of SAPMV45A in the AGIDV field and U0 in the SCREEN_GROUP field in transaction code SE11 (Figures 59 and 60).

Figure 58
Add code and activate the enhancement

Figure 59
Enter parameters and click the execute icon

Figure 60
Function code with caption
Step 10. Activate the enhancement. After clicking the Enhancements button in the screen in Figure 58, you can see your enhancement selected in the next window (Figure 61). Click the green check mark icon.

Figure 61
Click the green check mark icon
Step 11. Test the enhancement. To test the enhancement, use transaction code VA01. You only see Sales and Item overview Tabs on screen (Figure 62).

Figure 62
Only two tabs are showing; all others are hidden
 
Scenario 4: Set the Default Tab Using the Explicit Enhancement Section
Step 1. Open the program in display mode. Open program FV45PF0U in display mode using transaction code SE80 or SE38 (Figure 63). In this example transaction SE38 is used.

Figure 63
Open the program in display mode
Step 2. Click the enhance icon from the toolbar and find the enhancement section uebersicht_ansteuern_10 (Figure 64).

Figure 64
Click the enhance icon
Step 3. Right-click the enhancement point line in the code and follow menu path Enhancement Implementation > Create (Figure 65).

Figure 65
Select Create
Step 4. Create a new enhancement. In the list, you can see the standard implemented enhancement, but you must not select a standard enhancement implementation and add your code in it because it can be replaced by SAP code in the case of a system upgrade. To create a new enhancement implementation, click the new icon shown in (Figure 66).

Figure 66
Create a new enhancement
Step 5. Name the new enhancement. Populate the Enhancement Implementation name and Short Text fields. Then click the green check mark icon (Figure 67).

Figure 67
Enter the implementation name and Short Text
Step 6. Name the package. On the next window enter a name in the Package field (e.g., ZFSL) for the package in which you want to save this enhancement. Click the save icon. Place this object in the same request created in Figure 16.
Step 7. Select the new enhancement. Now you can see the newly created enhancement implementation ZFSL_SD_SO_SDTAB (Figure 68). You may need to scroll down to find it. Select it and click the green check mark icon.

Figure 68
Select the new enhancement (ZFSL_SD_SO_SDTAB)
Step 8. Add code to the enhancement. Now you can see lines of code inside ENHANCEMENT 247 ZFSL_SD_SO_SDTAB … ENDENHANCEMENT (Figure 69). Enter your code after endif on line 93.

Figure 69
Add code at the end of existing code before ENDENHANCEMENT
Step 9. Add code at the end of existing code and activate the enhancement using the Enhancements button on the toolbar (Figure 70).

Figure 70
Add code and activate enhancement
Step 10. Your enhancement is selected in the next window (Figure 71). Click the green check mark icon.

Figure 71
Click the green check mark icon
Step 11. Test the enhancement. To test the enhancement, run transaction code VA01 and you can see Item overview tab selected by default (Figure 72).

Figure 72
Item overview tab selected by default
   Faisal Altaf
 Faisal Altaf is a certified development consultant. He has more than seven years of experience and currently is working with Al Yamamah Steel Industries Co., Saudi Arabia, as the SAP technical division head. He completed his MS in software engineering and intends to complete his Ph.D. in the field of SAP.
  
  
  
   You may contact the author at faisalatsap@gmail.com. 
 If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.