Top Banner
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;
75

Enhancement Frame Work

Dec 01, 2015

Download

Documents

nelsondarla12

Enhancement Frame Work
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Enhancement Frame Work

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.

Page 2: Enhancement Frame Work

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.

Page 3: Enhancement Frame Work

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.

Page 4: Enhancement Frame Work

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.

Page 5: Enhancement Frame Work

Save and activate program and screen.

Go to transaction vf02,

Page 6: Enhancement Frame Work

Double click program name SAPMV60A

Page 7: Enhancement Frame Work

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

Page 8: Enhancement Frame Work

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

Page 9: Enhancement Frame Work

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.

Page 10: Enhancement Frame Work

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

Page 11: Enhancement Frame Work

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

Page 12: Enhancement Frame Work

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 tab name  GS_CUST_TAB-HEAD_PROGRAM = 'ZZBILLHEADER'.”custom z* program  GS_CUST_TAB-HEAD_DYNPRO = '0001'” custom z* program screen

Page 13: Enhancement Frame Work

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.

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

By Hema Bobbili, Hewlett Packard

Go to VF02 transaction:  

Page 14: Enhancement Frame Work

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.  

Page 15: Enhancement Frame Work

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.  

Page 16: Enhancement Frame Work

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.  

Page 17: Enhancement Frame Work

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

Page 18: Enhancement Frame Work

c)     Save and activate the screen.

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

Page 19: Enhancement Frame Work

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.  

 

Page 20: Enhancement Frame Work

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.  

 

Page 21: Enhancement Frame Work

Start of the enhancement spot  

End of the enhancement spot  

Create the enhancement spot.

Page 22: Enhancement Frame Work

Click on the create enhancement implementation  

Give some name to the enhancement implementation.  

Page 23: Enhancement Frame Work

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.  

Page 24: Enhancement Frame Work

 

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.

Page 25: Enhancement Frame Work

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

Page 26: Enhancement Frame Work

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

Page 27: Enhancement Frame Work

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

Step 2:  

Now, we will observe commas like below.  

Step 3:  

Page 28: Enhancement Frame Work

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.  

Page 29: Enhancement Frame Work

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

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.  

Page 30: Enhancement Frame Work

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 down’s 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.  

Page 31: Enhancement Frame Work

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

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

Page 32: Enhancement Frame Work

  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.  

Page 33: Enhancement Frame Work

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.  

Page 34: Enhancement Frame Work

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  

Page 35: Enhancement Frame Work

Give the name and short text and press continue.  

 

Page 36: Enhancement Frame Work

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.  

Page 37: Enhancement Frame Work

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.  

Page 38: Enhancement Frame Work

  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.  

Page 39: Enhancement Frame Work

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:

Page 40: Enhancement Frame Work

Code: DATA: LV_STCODE TYPE SHDTV-TCODE. CALL 'DY_GET_CURRENT_TRANSACTION' “GET THE TCODE FOR TRANSACTION VARIANT 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.   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.

Page 41: Enhancement Frame Work

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.

Page 42: Enhancement Frame Work
Page 43: Enhancement Frame Work

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

Page 44: Enhancement Frame Work

It shows the screen as below :

Page 45: Enhancement Frame Work

Then it shows the Screen as below:

""" indicates we can write our code here. 

Now Right click on """"""""""""" and select Enhancement Implementation -> Create.

Page 46: Enhancement Frame Work
Page 47: Enhancement Frame Work

Select Code.

Page 48: Enhancement Frame Work

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.

Page 49: Enhancement Frame Work

 

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

Page 50: Enhancement Frame Work

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 Type '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 VBAK-AUART 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

Page 51: Enhancement Frame Work

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 VBAP-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_TENDERID.     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

Page 52: Enhancement Frame Work

After Enhancement Implementation

Page 53: Enhancement Frame Work

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)

Page 54: Enhancement Frame Work

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

 

Go to system à status 

 

Double click on Program RVPKMASS.

Page 55: Enhancement Frame Work

 

Click on “Spiral Button” or ProgramàEnhance 

 

Click on “Spiral Button” or ProgramàEnhance 

Page 56: Enhancement Frame Work

Edit à enhancement operationsàShow implicit enhancement 

 

Page 57: Enhancement Frame Work

 

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

 

Page 58: Enhancement Frame Work

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. 

Page 59: Enhancement Frame Work

 

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.

Page 60: Enhancement Frame Work

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

Page 61: Enhancement Frame Work

Explicit enhancement option

Example Scenario: 

One sales person can’t see or change another sales person’s 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 ‘change Enhancement mode’ (the spiral icon available in the editor).

 

 

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

Page 62: Enhancement Frame Work

 

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

Page 63: Enhancement Frame Work

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.

Page 64: Enhancement Frame Work

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

Page 65: Enhancement Frame Work

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  

Page 66: Enhancement Frame Work

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

Page 67: Enhancement Frame Work

 

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

5 .Now you can see

Page 68: Enhancement Frame Work

 

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

 

7 .Now it will ask for Enhancement type

 

We have to implement code and it will look like this  

Page 69: Enhancement Frame Work

 

Here you can write the custom code for modifying the functionality  

8. Include name LV70TFT3  

ENHANCEMENT 4  ZTEXT_MODIF_BLOCK.    "active versioncall 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  

Page 70: Enhancement Frame Work