Enhancement Frame Work

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 70

Adding custom tab to the transaction VF01/VF02/VF03 Header detail screen

By Ugur Baris Turkeli , Istanbul

Go to VF02 transaction

Custom Tab to be added in the header detail

Step by step how can we add custom tab to the billing header detail; In order to fulfill the requirement we need a custom subscreen with some custom fields in that screen.

Steps for creating the custom fields and adding them to the custom sub screen. 1. Creating the Custom fields a) Create the Z fields to the table VBRK, by appending the structure.

b) Give a name to the structure for example ZZVBRK_APPEND. Enter the fields name which will you need. Note: the added fields should follow the naming convention that they should start with ZZxxxxx or YYxxxxx. c) Save and activate.

2. Creating the z* program and its screen and adding the Z fields on layout. a) Create a z*program using transaction SE38 give a name for example ZZBILLHEADER . b) Create a screen using the transaction SE51.

Go to screen layout and get the fields from dictionary on vbrk table

The screen in VF03 before which is in changeable mode. If you write screen pbo module below code it will be read only.

Save and activate program and screen. Go to transaction vf02,

Double click program name SAPMV60A

SAP provides 2 screens for customer addional datas; screen 6001 is for header and screen 6002 is for detail screen.

In the cust_head_activate subroutine we have to activate TABSTRIP_TAB06 for customer header tab screen.

3. Steps to write the code in the enhancement spots. a. First to find the enhancement spots click on the spiral icon in the menu bar, and next click on the edit enhancement operations - show implicit enhancement options.

You will see the arrows . Right click on the arrow line and click Enhancement implemantation >Create

4. Give a name for Enhancement point, for example ZZBILLHEADER_ACTIVATE_TAB

Click enter and save in a package. To make use of this logic use enhancement frame work. We have enhancement spots at the begin/end of the subroutine. 5. Steps to write the code in the enhancement spots. GS_CUST_TAB-HEAD_CAPTION = 'ihracat Ek veriler'.custom GS_CUST_TAB-HEAD_PROGRAM = 'ZZBILLHEADER'.custom GS_CUST_TAB-HEAD_DYNPRO = '0001' custom z* program screen tab z* name program

Activate the enhancement and check in the VF01/ VF02/ VF03 you can find the custom tab with the custom fields. The Data automatically populates to the database table when the data is entered into the Z fields.

Adding custom tab to the transaction VF01/VF02/VF03 item detail screen


2)
By Hema Bobbili, Hewlett Packard

Go to VF02 transaction:

Custom Tab to be added in the item detail

SAP has provided a custom tab in the tab strip (Program name SAPMV60A) screen 6002 which is having the function code PFCU.

In order to fulfill the requirement we need a custom subscreen with some custom fields in that screen.

Steps for creating the custom fields and adding them to the custom sub screen. 1. Creating the Custom fields a) Create the Z fields to the table VBRP, by appending the structure.

b) Give a name to the structure for example zzcustom_fields. Enter the field name.

Note: the added fields should follow the naming convention that they should start with ZZxxxxx. c) Save and activate.

2. Creating the screen and adding the Z fields a) Create a screen using the transaction SE51.

b) Get the field from the dictionary which needs to be added to the screen.

c) Save and activate the screen. 3. Go to SE80 and give the program name (SAPMV60A) of the VF01 transaction. Go to screen -> 6002.

In the MODULE PBO_6002 the subroutine PBO_6002_TABSTRIP_POS specifies the position of the tab.

In order to activate the custom tab for this requirement which is having the function code PFCU, the module CUST_ITEM_ACTIVATE needs to be implemented.

To make use of this logic use enhancement frame work. We have enhancement spots at the begin/end of the subroutine. 4. Steps to write the code in the enhancement spots. a. First to find the enhancement spots click on the spiral icon in the menu bar, and next click on the edit enhancement operations - show implicit enhancement options.

Start of the enhancement spot

End of the enhancement spot

Create the enhancement spot.

Click on the create enhancement implementation

Give some name to the enhancement implementation.

Click enter and save in a package. Select your implementation and then continue.

In between the ENHANCEMENT and ENDENHANCEMENT statements Insert the below code.

Insert your code as below.

Activate the enhancement and check in the vf01/vf02/vf03 you can find the custom tab with the custom fields.

The Data automatically populates to the database table when the data is entered into the Z fields. But where as in display mode it is changeable for it to be made disable, a simple code is to be added. The screen in VF03 before which is in changeable mode.

After adding the code the screen is as follows in VF03 transaction.

Validating the Document Types in MIRO and MIR7 While Posting the Entry
By Khaja Moulali Shaik, Atos

Scenario: By using Transaction code MIRO & MIR7 user can change the document type and post the entry. In order to prevent the user from using different document types apart from RE and AN an enhancement need to be developed to hard stop the transaction. By this, system should show an error message as below if the user uses other document types apart from RE and AN. Error Message: Document Type Entered by User (E.g. SA, KZ, and etc) is not allowed for this transaction. Step by step Solution: Step 1: Find the enhancement point in the include LFDCBFC0.

a) To find the enhancement point, go to Program Enhance (Or) Click on the Enhance .

b) Go to Edit Enhancement Operations Show Implicit Enhancement Options.

Step 2: Now, we will observe commas like below.

Step 3:

Go to Implicit enhancement option at the beginning of the form CHECK_DOCUMENT_TYPE and Right click Enhancement Implementation Create.

Step 4:

Now it will ask for Enhancement Type.

Step 5: We have to implement the code and it will looks like this.

Here you can write the custom code for modifying the functionality. DATA : lv_message TYPE string . IF sy-tcode EQ 'MIRO' or sy-tcode EQ 'MIR7'. IF bkpf-blart NE 'RE' AND bkpf-blart NE 'AN'. CONCATENATE 'Document "' bkpf-blart '" is not allowed for this Transaction' INTO MESSAGE lv_message TYPE 'E' . ENDIF. ENDIF. Activate the code and enhancement. Step 7: Check in MIRO and MIR7 by selecting the Document Types other than RE and AN, it will throw an error message. lv_message .

Scenario on the combination of Transaction variant and enhancement framework


By Sravani Kancharla, Cognizant Technology Solutions

Requirement: Requirement is to create a custom transaction of MEK2 to hide some personal data related to vendor and Material (i.e. descriptions) and to restrict the further drill downs from the menu. This can be done by the combination of implicit enhancement technique and transaction variant. Following are the screenshots that describe step by step procedure of the requirement. Solution: First we will restrict the further drilldowns from the menu bar by Transaction variant. Create a transaction variant for MEK2. Go to the Transaction SHD0. Give the transaction code and the transaction variant name and click on create button.

Then it will lead you to the MEK2 ( Change condition records transaction). th Give the condition type PB00 Gross Price and click on the Key combination and select the 4 radio button and click continue.

Then the following screen appears. Give Name and short text to the screen variant.

Click on continue button. In the next screen, give the proper input values with the help of search help and click on enter. Note: The descriptions which are needed to be hidden will be taken care by implicit enhancement technique. As of know we are working to restrict the further drill downs to other TCodes via menu bar by transaction variant.

After clicking on execute button, Press enter. Then following screen appears. Then click on the menu functions button.

After clicking on the menu functions button, expand the menu bar in the tree and select the menu functions and press on deactivate button on the bottom and press on continue button.

Note: Here the customer wants to restrict the drilldowns to MM03, XD03 and so on... Now click on exit and save button.

Finally enter description and save the variant.

Now go back and create a transaction code for the created transaction variant. Click on Goto-> Create variant transaction

Give the name and short text and press continue.

Finally we deactivated the menu functions to restrict the further drilldowns through transaction variant. Now we will work on implicit enhancement technique to hide the descriptions of material and vendor. This scenario would work from ECC6.0 onwards. In Enhancement Framework, we can add our own Code at particular points. Note: While debugging the standard SAP program, we have to decide at which place we would need to write our own code. There we need to check whether enhancement can be implemented. So while debugging the standard program of MEK2 i.e (SAPMV13A), it is found that code need to be written in this include MV13AKOM. Click on display,

By debugging we will come to know that the code should be written in the form FILL_DEFAULT. So now click on the enhance button.

Now go to Edit-> Enhancement operations -> Show implicit enhancement options.

The following screen appears after clicking the option Show implicit enhancement options

Indicates that we can write the code here. Now right click on the line below and create the enhancement implementation.

Now choose Code

The following screen appears. Now click on Create implementation button at the bottom.

After clicking on the create button, Give the name and the description of the enhancement and click on continue.

Now the created implementation appears in the below list. Select the enhancement and click on continue.

Now place the desired code in the Enhancement and End Enhancement section shown below.

Code:

Code: DATA: LV_STCODE TYPE SHDTV-TCODE. CALL 'DY_GET_CURRENT_TRANSACTION' ID 'TRANSACTION_NAME' FIELD LV_STCODE. IF LV_STCODE = 'ZMEK2. CASE FD_FIELD. WHEN LIFNR. CLEAR LFA1-NAME1. WHEN MATNR. CLEAR MAAPV-ARKTX. WHEN EKORG. CLEAR T024E-EKOTX. ENDCASE. ENDIF.

GET THE TCODE FOR TRANSACTION VARIANT

Output: Now when you execute ZMEK2, The descriptions of vendor, material and purchase organization are hidden by implicit enhancement technique.

The menu functions (drilldowns) are disabled by transaction variant.

Picking material description from custom table in the SAP Sales Order (VA01 and VA02) using enhancement framework
By Shaik Sajid, Selligence Technologies

This scenario would work from ECC6.0 onwards. In Enhancement Framework, we can add our own Code at particular points. While debugging the standard SAP program, we have to decide at which place we would need to write our own code. There we need to check whether enhancement can be implemented. Requirement: In Sales Order (VA01 & VA02), we have to pick the Material Description from Custom Table.

While debugging it is found that the code needs to be written FORM USEREXIT_MOVE_FIELD_TO_VBAP. Now click on Enhance button as shown below.

in

the

It shows the screen as below :

Then it shows the Screen as below:

""" indicates we can write our code here. Now Right click on """"""""""""" and select Enhancement Implementation -> Create.

Select Code.

Now click on Create button in the above screen. Another Screen appears as shown below:

In the above screen, click on Create Composite Implementation and the following Screen appears.

Then click on Continue button (Green tick). In the below Screen, Select the Enhancement Implementation which we have created now and click on Continue button.

Now here we can write our own code as shown below:

Code: ENHANCEMENT 315 ZSD_EI_BOQDESC. "active version * Modification Done By : Sajid Shaik. * Date : 08.06.2009 * Requirement Given by : Avinash Gyale * Requirement : Material Description should be fetched from BOQ based on the Plant and Boq Typ e 'Erection or Civil'. * : This should work only for Order type ZCO1 - Civil & Order type ZER1 - Erection DATA : VAR_ARKTX TYPE VBAP-ARKTX, VAR_MAKTX TYPE ZBOQ_ITEM-MAKTX, VAR_TENDERID TYPE ZBOQ_ITEM-TENDERID, VAR_LENGTH TYPE INT4. IF ( SY-TCODE EQ 'VA01' OR SY-TCODE EQ 'VA02' ) AND ( VBAK-AUART EQ 'ZCO1' OR VBAKAUART EQ 'ZER1' ) AND VBAP-WERKS IS NOT INITIAL. CLEAR : VAR_ARKTX,VAR_MAKTX,VAR_TENDERID . IF VBAK-AUART EQ 'ZCO1'. SELECT SINGLE TENDERID FROM ZBOQ_HEADER INTO VAR_TENDERID WHERE WERKS EQ V

BAP-WERKS AND TYPE EQ '3'. IF SY-SUBRC NE 0. ENDIF. ELSEIF VBAK-AUART EQ 'ZER1'. SELECT SINGLE TENDERID FROM ZBOQ_HEADER INTO VAR_TENDERID WHERE WERKS EQ V BAP-WERKS AND TYPE EQ '2'. IF SY-SUBRC NE 0. ENDIF. ENDIF. SELECT SINGLE MAKTX FROM ZBOQ_ITEM INTO VAR_MAKTX WHERE TENDERID EQ VAR_TEN DERID. IF SY-SUBRC NE 0. ENDIF. VAR_LENGTH = STRLEN( VAR_MAKTX ). IF VAR_LENGTH LE 40. VAR_ARKTX = VAR_MAKTX(VAR_LENGTH). ELSE. VAR_ARKTX = VAR_MAKTX(40). ENDIF. IF VAR_ARKTX IS NOT INITIAL. VBAP-ARKTX = VAR_ARKTX. ENDIF. ENDIF. ENDENHANCEMENT. Then Save and Activate it. OUTPUT : Before Enhancement Implementation

After Enhancement Implementation

Setting the screen elements as mandatory in the transaction DP95 using Enhancement Framework
By Vikram Chellappa, MouriTech Solutions

Scenario: In this scenario, we would set the fields Sales and Order as Mandatory in the transaction DP95. Following are the technical attributes of these fields (go to technical details by clicking on F1 on the fields)

Screen field names so_vbeln-low(Sales) and so_aufnr-low (Order).

Go to system status

Double click on Program RVPKMASS.

Click on Spiral Button or Program Enhance

Click on Spiral Button or Program Enhance

Edit enhancement operationsShow implicit enhancement

Place the cursor on the enhancement point and create the enhancement is as shown below screen. Enhancement implementationcreate

Create

the

New

Enhancement

is

as

shown

in

below

screen.

Select the appropriate enhancement and click on continue.

Place the below code in the enhancement spot.

At selection-screen output. Loop at screen. If screen-name = 'so_vbeln-low'. Screen-required = '1'. Modify screen. Endif. If screen-name = 'so_aufnr-low'. Screen-required = '1'. Modify screen. Endif. Endloop.

Click on Save, Check and Activate. OUTPUT:-

Demo on Enhancement Framework


By Jagadeshwar Gollapelly, Gems Techno Solutions

Restrict users (sales persons) to view or change Sales order data - Using Enhancement framework: Source Code Enhancement is one of the enhancement technologies available under Enhancement Framework. Implementing this technology is also called as Source Code Plug-In. Technically the source code plug-in implementations are stored in a separate include program and not as part of the original source program. There are two types of Source Code enhancements possible.

Implicit enhancement option

Explicit enhancement option

Example Scenario: One sales person cant see or change another sales persons sales orders. In my program, I have used following users. Sales person1 (user 1): lz8xzf Owner for Sales order no: 174. Sales person2 (user 2): lzn4rm Steps to Implement the Implicit enhancement option: Step1: Go to SE38 and Open include MV45AFZB
Step2: In order to implement any of these Source code enhancements, you need to be in Enhancement mode (the spiral icon available in the editor). change

Step3: Go to EDIT option in the menu and choose Enhancement Operations -> Show implicit Enhancement Options

All Implicit Enhancement option will be displayed. All yellow lines indicate Implicit Enhancement options. In ABAP programs, implicit enhancement options are predefined at the following places: Begin/End of an include. Begin/End of Method/Function Module/Form Routine End of a structure End of Private/Protected/Public Section of a local class

Step4: Place the cursor on the yellow line and choose Enhancement implementation Create.

Step5: Give Implementation name and then create.

Step6: Here Editor will be enabled to write the code. Write your own code save and activate it.

Step 7: Once the development is completed you can test the scenario. When Sales person (lzn4rm) tries to Open Sales order no 174, it gives error message Access Denied. Note: Sales order 174 is created by another sales person (lz8xzf).

Restrict the modification of Delivery item texts - Using Implicit enhancement technique
By Betcy Yohannan, Intelligroup

1. Go to transaction code - VL02N + press enter

2 .Goto->Item->texts

Now you can see the item texts in editable mode

Note: To make it non editable you need to enhance the code . First you need to debug the application and find the exact place where you need to add the functionality You must be knowing that each and every subroutine and method (not modules )will be having implicit enhancement options at the beginning and at the end . In this particular case we have to enhance the subroutine PERFORM TEXT_CONTROL_EINGABEBEREIT. 3. Go to this subroutine and then Program > Enhance

4 .Then follow Edit ->Enhancement Operations -> Show implicit enhancement Options

5 .Now you can see

6 . Go to implicit enhancement option at the end of the form and do right click -> Implementation -> Create

Enhancement

7 .Now it will ask for Enhancement type

We have to implement code and it will look like this

Here you can write the custom code for modifying the functionality 8. Include name LV70TFT3 ENHANCEMENT 4 ZTEXT_MODIF_BLOCK. "active version call method gv_text_editor->set_readonly_mode exporting readonly_mode = gv_text_editor->true exceptions error_cntl_call_method = 1 invalid_parameter =2 others = 3. ENDENHANCEMENT. 9. Activate the code and check VL02N

You might also like