Enhancement Framework Validating the Document Types in...

187
Enhancement Framework Validating the Document Types in MIRO and MIR7 While Posting the Entry 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 ”.

Transcript of Enhancement Framework Validating the Document Types in...

Page 1: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enhancement Framework

Validating the Document Types in MIRO and MIR7 While Posting the Entry

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 2: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Step 2:

Now, we will observe commas like below.

Step 3:

Page 3: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to Implicit enhancement option at the beginning of the form ‘CHECK_DOCUMENT_TYPE’ andRight 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 4: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 5: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Scenario on the combination of Transaction variant and enhancement framework

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 6: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 4th 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.

Page 7: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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.

Page 8: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 9: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Give the name and short text and press continue.

Page 10: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 11: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 12: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 13: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 14: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 15: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Picking material description from custom table in the SAP Sales Order (VA01 and VA02) using enhancement framework

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 16: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement
Page 17: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 18: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

It shows the screen as below :

Page 19: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Then it shows the Screen as below:

""" indicates we can write our code here.

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

Page 20: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement
Page 21: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Select Code.

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

Page 22: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 23: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 24: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 25: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 26: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

After Enhancement Implementation

Page 27: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Setting the screen elements as mandatory in the transaction DP95 using Enhancement Framework

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

Page 28: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to system à status

Double click on Program RVPKMASS.

Page 29: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on “Spiral Button” or ProgramàEnhance

Click on “Spiral Button” or ProgramàEnhance

Page 30: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Edit à enhancement operationsàShow implicit enhancement

Page 31: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 32: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 33: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 34: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on Save, Check and Activate.

OUTPUT:-

Demo on Enhancement Framework

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 can’t see or change another sales person’s sales orders.

In my program, I have used following users.

Page 35: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 36: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 37: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 38: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 39: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Restrict the modification of Delivery item texts - Using Implicit enhancement technique

1. Go to transaction code - VL02N + press enter

2 .Goto->Item->texts

Now you can see the item texts in editable mode

Page 40: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 41: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

5 .Now you can see

Page 42: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 43: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 44: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

User Exits/Screen Exits/Menu Exits

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

Go to VF02 transaction:

Page 45: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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.

Page 46: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 47: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 48: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Page 49: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 50: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 51: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 52: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Start of the enhancement spot

End of the enhancement spot

Create the enhancement spot.

Page 53: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on the create enhancement implementation

Give some name to the enhancement implementation.

Page 54: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 55: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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 56: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

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

Automatically filling the field "payment terms" and disable the same while creating PO using the transaction ME22N

The requirement is to capture contract number wise payment terms while creating PO. This contract number is maintained in Z-Table along with vendor and payment terms etc. When we select the contract number the corresponding payment terms should automatically reflect in payment terms irrespective of the original value and make that field display mode immediately.

To add the contract number in the standard PO , we have to enhance the screen using the exit ‘MM06E005’.

Step1: Go to transaction CMOD to create the project.

Page 57: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on Create button and provide the meaningful description in the following screen.

Step2: Now click on’ Enhancement assignments’ button to add the PO enhancement.

Page 58: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step3: Now click on ‘Component’ button and activate the project.

Double click on screen ‘0101’. Then it opens screen painter to add the contract number.

Now open the Layout editor by click on Layout button.

Page 59: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Select the contract number field from the table EKKO (Add the field contract number to the structure ‘CI_EKKODB’).

Save and activate.

Step4: Go back to ‘Flow logic’ and write the following code in POV (Process on Value-Request) to get the F4 help.

Write the following code for getting F4 help as shown below.

Page 60: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement
Page 61: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

TABLES ekko. DATA: fs_return TYPE ddshretval, it_return LIKE TABLE OF fs_return. DATA: BEGIN OF fs_value, vendorno TYPE lifnr, contractno TYPE bbp_er_ctr_no, cstart TYPE vbdat_veda, cend TYPE vndat_veda, pterm TYPE dzterm, END OF fs_value, it_value LIKE TABLE OF fs_value. DATA: w_lifnr TYPE lifnr. FIELD-SYMBOLS : <fs_ekko> TYPE ekko. ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. IF sy-subrc EQ 0. MOVE <fs_ekko>-lifnr TO w_lifnr. ENDIF. SELECT vendorno contractno con_start_dt con_end_dt payment_terms FROM zcontract

Page 62: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

INTO TABLE it_value WHERE vendorno EQ w_lifnr. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'CONTRACTNO' * DYNPPROG = ' ' * DYNPNR = ' ' * DYNPROFIELD = ' ' value_org = 'S' * IMPORTING * USER_RESET = TABLES value_tab = it_value return_tab = it_return EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3 . IF sy-subrc EQ 0. READ TABLE it_return INTO fs_return INDEX 1. IF sy-subrc EQ 0. ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. MOVE :fs_return-fieldval TO ekko-contractno, ekko-contractno TO <fs_ekko>-contractno. READ TABLE it_value INTO fs_value WITH KEY contractno = ekko-contractno. IF sy-subrc EQ 0. IF sy-subrc EQ 0. MOVE fs_value-pterm TO <fs_ekko>-zterm. ENDIF. ENDIF. ENDIF. ENDIF.

Step5: Save and activate include.

When you execute the ME22N,

When we select the contract number ‘9001’, the automatically the payment term field is filled with ‘0001’ as shown.

Page 63: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Now it is in enable mode. We have to make it to display mode.

We can achieve this by enhance the method FS_GET in the method PBO of the classCL_BASIC_MODEL_VIEW_MM (Write the enhancement spot in the method FS_GET).

Step6: Now create the enhancement spot in the method ‘FS_GET’ and write the following code as shown.

FIELD-SYMBOLS: <fs_ekko> TYPE ekko, <fs_fieldselection> TYPE MMPUR_FS.

Page 64: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. IF sy-subrc EQ 0. IF <fs_ekko>-bsart EQ 'NB' AND <fs_ekko>-contractno NE space. READ TABLE my_fieldselection assigning <fs_fieldselection> WITH KEY metafield = '11'. IF sy-subrc EQ 0. <fs_fieldselection>-fieldstatus = '*'. ENDIF. ENDIF. ENDIF.

Step7: Now execute the transaction ME22N,

After selecting the contract number, the payment term field would be disabled.

Adding custom fields to the Purchase Order transaction ME22N

STEPS:

Enhancement used: MM06E005

1. Go to transaction CMOD and create a project as shown below.

Page 65: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

2.Give the enhance name as MM06E005 and save.

Click on components button the following screen is displayed.

Page 66: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

3.Create the required custom fields using the includes CI_EKKODB and CI_EKPODB

The above 5 fields are added.

4.Screen: 0111 is used for adding custom fields. Design the screen with the above fields.

Page 67: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Code in PBO

5.The following two function Exits are used for adding custom fields at item level:

EXIT_SAPMM06E_016 (Export Data to Customer Sub screen for PO)

EXIT_SAPMM06E_018 (Import Data from Customer Sub screen for PO)

Click on the Function Module: EXIT_SAPMM06E_016

The following screen is displayed

Page 68: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Double click on the include and write the following code

Page 69: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The following is the code for the function module EXIT_SAPMM06E_018

6.Go to transaction ME22N and check at item level. Custom tab with custom fields will appear as follow.

Page 70: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enter some data in the custom fields and save.

7.Go to EKPO table and check the data.

Adding a field to "Sales Org View2" of MM01/MM02 (No screen exit/BaDI available)

Requirement: In standard transaction Material Management (MM01/MM02), a custom field is to be added in the sales org view2 tab. There is no screen exit or BADI's available. We achieve this through configuration.

Step1: Go to transaction SPRO and click on Create Program for Customized Sub screens as shown below.

Page 71: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step2: Click on execute button, the following screen appears and provide the function group ZMGD1.

Click on save button.

Step3: Now go to SE80 and select FUNCTION GROUP and give the created function group ZMGD1 as shown.

These TWO screens (0001, 0002) are default screens.

Step4: Now we have to identify the screen no where we need to add custom field. In this case, we consider sales org view2 and screen no 2157. Now select standard function group MGD1 of the transaction MM01. It contains all screens and sub screens of Material Management Transaction.

Page 72: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step5: Now right click on the screen no and copy the screen no to our function group ZMGD1 as show.

We will get the following screen.

Page 73: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on Ok button. We will get the following status message ' Screen SAPLZMGD1 2157 created'

Step6: Now if we check the function group ZMGD1, screen no 2157 copied to our function group as shown.

Step7: Now add the field WBS Element in the table standard table MVKE as shown.

Step8: Now go to layout editor of screen 2157.

Page 74: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step9: Get the WBS Element from the table MVKE.

Activate the screen.

In flow logic, add the following code in PAI.

Activate the screen.

Step10: Again go to SPRO, click on Define Structure of Data Screens for Each Screen Sequence as shown.

Page 75: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on execute button. The following screen appears.

Select the screen sequence no 21

Click on Data screen.

Now select the sale org view2 as shown.

Now click on sub screen. The following screen will appear.

Page 76: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Provide the name SAPLZMGD1 and save it.

Step11: Now go to MM02,

Page 77: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step12: When checked at table MVKE,

Printing Attachments Of Work Order Via IW32

Scenario:

• Business requirement is to display all the attachments related to work order and print the selected attachments via tcode IW32.

• This can be done manually from IW32, but it requires lot of efforts as each time required attachment needs to be opened and printed. So, it’s a time consuming procedure.

• So, in this tutorial we demonstrate how we can achieve this using custom functionality using Enhancement.

Manual printing of the attachments:

Page 78: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

1. Go to IW32 and open the work

order.

2. Select ‘services for

object’.

3. Select attachment list, it will display the attachments for the work

order.

Page 79: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

4. In current scenario, for printing the attachments, user have to follow the above procedure, open the document and then print it. Every time, user must to open the document manually and then print it.

5. So, the procedure becomes time consuming and also involves lots of efforts.

6. In order to achieve this functionality, I have used Enhancement IW010018 to display all the attachments related to work order and we can print as all the attachments at the same time.

7. Below I have demonstrated this functionality.

Enhancement IW010018:

Function exit used for this object is ‘EXIT_SAPLCOIH_018’ and screen exit ‘SAPLXWOC’ shown below.

Page 80: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Data declaration for the exits:

We are using function pool ‘SAPLXWOC’ to create the custom Subscreen and to write logic for populating the table control and printing the attachments.

Include ‘ZXWOCTOP’ must be used for data declaration.

The internal tables being used in the function exit as well as in the screen exit must be declared in this include.

Page 81: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Include ‘ZXWOCZZZ’ must be used to write any logic in the PBO and PAI of the screen.

Coding for Function exit:

We need to start with the function exit ‘EXIT_SAPLCOIH_018’.

1. Double click on include ‘ZXWOCU15’ and create it.

2. Create a function module and call it in this include.

Ø We have CAUFVD structure available in this Function exit. Based on the work order number (CAUFVD-AUFNR), Equipment number (CAUFVD-EQUNR), functional location (CAUFVD-TPLNR), task lists (CAUFVD-PLNTY, CAUFVD-PLNNR, CAUFVD-PLNAL) we can fetch the related attachment names.

Ø For that we need to use 2 tables, ‘SRGBTBREL’ and ‘SOOD’.

Page 82: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Ø Table SRGBTBREL will fetch the unique identification number for each attachment (INSTID_B). Using this number, we can fetch attachment name and its details.

Ø Below is the screenshot of the data fetching from these 2 tables. Internal table I_OBJECTS, will be populated with the attachment details. We can take the desired fields from the internal table into new internal table I_WORK and pass it to screen exit.

So, I_WORK will be populated with the details of the attachments of the work order.

Coding for Screen exit:

Page 83: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

1. Create a screen ‘0900’ in program ‘SAPLXWOC’, which is called in the program

‘SAPLCOIH’.

Create it as a subscreen type.

2. Go to layout and create a table control, which will display the list of attachments.

Page 84: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Create a pushbutton to print the selected attachments. Function code for pushbutton should be ‘ENT1’. No other function code works for the pushbutton in the enhancement tab.

3. Now, go to flow logic tab and in PBO of the screen, write a logic to to fill the table cotrol. We will use the internal table (I_WORK) populated in the function exit.

Loop at the internal table I_WORK and populate the table control (ZATTACHMENT).

Page 85: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In tcode IW32, when we goto enhancement tab, the list of attachment present for that order will be displayed. Then, user can select the attachments to be printed and press ‘Print’ button.

So, we need to check the selected entries and print them, this logic will be written in PAI of the screen.

4. Below is the screenshot of the coding for PAI, Module STATUS_0900. It will fetch the selected attachments.

Page 86: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

5. MODULE F_USER_COMMAND_0900_AFTER_LOOP witll check the sy-ucomm and print the attachments.

For printing the attahcments, we need to read the contents of the attachment using FM‘SO_DOCUMENT_READ_API1' into internal table.

We need to pass the unique identification number for the attachment (I_WORK-INSTID_B) to the FM and fetch the contents of the attachment into internal table ‘I_TAB_OBJCONTX’.

6. We are using class ‘CL_GUI_FRONTEND_SERVICES’ to get the attachment path and to print them.

Page 87: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

So , we need to call METHOD ‘CL_GUI_FRONTEND_SERVICES=>GET_SAPGUI_WORKDIR’ to fetch the path/name of the attachment.

If attachment is of URL type, then this FM will give us the full path of the attachment else if attachment is of external type, then name of the attachment will be fetched.

After that we need to download it on the local system using FM ‘GUI_DOWNLOAD’.

Then print the attachment using method ‘CL_GUI_FRONTEND_SERVICES=>EXECUTE’ with document path and ‘Print’ command.

The selected attachments will be printed.

Demo of printing attachments via IW32:

Now, let’s see how enhancement tab displays the attachment details.

1. Go to IW32. Open work order having attachments.

Page 88: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

2. Go to enhancement tab, it will display attachment list.

3. Select the attachment and press ‘Print’ button.

Page 89: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

4. It will display message at the bottom after download is completed.

5. Once downloading of the attachment is done, attachment is opened for printing and once printed it is closed.

6. So, the required attachments are printed.

Adding Fields to CJI3 Report

Target Readers: SAP ABAP developers with basic knowledge of Customer Exits and Basic ABAP syntaxes.

Purpose of the document: To add Vendor No and Vendor Name in report CJI3.

In CJI3 Vendor name will come for only invoices, when offsetting account type(GKONT) is K, but for GRN documents system will not show the vendor no, so to get this we need to add two fields Vendor No(LIFNR) and Name(NAME1) in CJI3 report where report should give Vendor details for GRN documents also.

Enhancement Process:

1. Add fields to structure “RKPOS” using field exit“CI_RKPOS” using Customer exit “COOMEP01”.

2. Add fields to the view “V_TKALV”, so that these fields should get added to the field catalog of CJI3 report.

Page 90: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

3. Add required code in the exit “EXIT_SAPLKAEP_001”

Step 1.

Goto CMOD and Create a Project.

Goto Enhancement Assignment and add “COOMEP01” and double click on include “CI_RKPOS”. Add customer required fields as shown below:

Page 91: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement
Page 92: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Step 2:

Now we need to add the above fields in the field catalog of CJI3 .

For that we need to maintain View V_TKALV. Goto SM34, enter V_TKALV and Press Maintain

button

Double click on “Field catalog information”

And press push button “New Entries”.

Page 93: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Add the required fields as shown below.

Page 94: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Then select these entries and click on “Selection dependencies” as shown below :

Page 95: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Press on New Entries and create the following entries:

Now save the entries.

Step 3.

Add required code in “EXIT_SAPLKAEP_001”.

*&---------------------------------------------------------------------* *& Include ZXKAEPU01 *&---------------------------------------------------------------------* IF I_REP_OBJECT = 'PD'. IF CS_RECORD-GKONT IS NOT INITIAL AND CS_RECORD-GKOAR = 'K'. CS_RECORD-ZZLIFNR = CS_RECORD-GKONT. CS_RECORD-ZZNAME1 = CS_RECORD-GKONT_KTXT. ELSEIF CS_RECORD-EBELN IS NOT INITIAL. SELECT SINGLE LIFNR FROM EKKO INTO CS_RECORD-ZZLIFNR WHERE EBELN = CS_RECORD-EBELN. IF SY-SUBRC = 0. SELECT SINGLE NAME1 INTO CS_RECORD-ZZNAME1 FROM LFA1

Page 96: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

WHERE LIFNR = CS_RECORD-ZZLIFNR. ENDIF. ENDIF. ENDIF.

I_REP_OBJECT specifies which report you are using, so as to avoid unnecessary selection we need to keep the required value only. For CJI3 report the value for I_REP_OBJECT is ‘PD’.

And activate the enhancement as shown below.

Now we will check CJI3 Report.

Page 97: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Execute. Now go to change catalog you will find the added columns as shown below.

Page 98: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Now the O/P will be as shown below:

Page 99: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Screen Exit for Notification Header (TCode: IW21) and show the custom fields in standard report for notifications (IW28, IW29)

The user exit used is QQMA0001. Steps are given below.

1. Create a project YPM01 in CMOD transaction code.

Page 100: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

2. Add the enhancement assignment QQMA0001 in the project.

3. Go to Components and double click on the screen 0100.

4. Before creating the customer fields in screen, create the fields in QMEL table of structure CI_QMEL.

5. Then create the custom fields in screen 0100.

6. Open FM EXIT_SAPMIWO0_008 and create include ZXQQMU0. This FM is used to pass the value from table to screen fields.

7. Open FM EXIT_SAPMIWO0_009 and create include ZXQQMU08. This FM is used to pass the value from screen to structure to store the value in table.

Page 101: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

8. Activate the project. Now go to IW21 and see the custom fields. Functional consultant will do the configuration where to show these fields.

9. Now we can see how we can get these values in the standard report for notification. The transaction codes are IW28 and IW29.

10. Implement the BADI BADI_EAM_SINGLELEVEL_LIST, and in method FILL_ADD_FIELDS write your logic to fill alv.

11. You can also add separate group using the method CHANGE_FIELD_CATALOG.

Page 102: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

12. Now run tcode IW28 and execute. If you are not finding the custom fields, then choose Settings->Layouts->Current.

13. You can view your group in the filter. Choose the custom fields from that.

14. Now you can view the fields in ALV

Page 103: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Modifications to the SAP standard menu

Scenario:

You would like to include the link to your company intranet portal or the end user manual in all the SAP transactions for making it easier to the end-users.

Pre-requisites:

Create a transaction which navigates to the required portal or the end user manual as required.

Procedure:

Go to transaction SE41.

Enter the program name MENUSYST.

Page 104: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Select the radio button Status and select the value MEN using F4.

Click on change. Following screen would be displayed:

Double-click on System. The menu is expanded.

Page 105: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Now you can add your own menu items here. Please note that the change would reflect in all the transactions this is being used.

Select the position where you would like to include your custom menu-item and do the right-click. Now select “Insert entry” from the context menu.

Enter the custom menu-item as required.

Page 106: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

ZCOMPANY is the custom transaction code created for testing purpose.

Now double-click on “ZCOMPANY”.

Set the function code to “T” in the following popup screen:

Page 107: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Save and activate.

Testing the scenario:

Come back to the main screen and click on “Test”

You can observe that the new custom menu item is part of the standard menu (as shown below):

Page 108: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

We can even have sub-menu as well (see the screenshot below):

We can also deactivate any of the menu-items as required. To do this:

Select the menu item to be deactivated and click on “Function Code”.

Page 109: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Following message is displayed:

Now the menu would look as follows (you can observe that the function “Own Jobs” is deactivated):

Page 110: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

You can activate the function by clicking on “Function Code” again.

Working with Menu Exits

Menu exits add items to the pull down menus in standard SAP applications. You can use these menu items to call up your screens or to trigger entire add-on applications.

SAP creates menu exits by defining special menu items in the Menu painter. These special entries have function codes that begin with ‘+’ (a plus sign). You can specify the menu items text when activating the item in an add-on project.

Note: along with Menu exits SAP also provides the function module exit to attach the functionality for each menu option.

We can add customer menu options in two places:

• To the initial screen on the SAP menu (Area Menus) • To the standard menus of the standard transactions.

Example: Adding custom menu options for the standard transaction MC94.

Identify the menu exit from the standard transaction, i.e. through SMOD.

Go to transaction SMOD. and press F4.

Choose from information system, if you get a screen as shown below.

Page 111: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

You will get the below screen. Enter the package name in Package and press enter.

(You will get the package name using attributes of the program for the transaction)

These are the list of exits available and MCP20003 is the Menu exit.

Page 112: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to the initial screen of SMOD transaction and enter the enhancement name and select the option component and click on display to check the list of components from the enhancement.

You will get the components of the exit.

Page 113: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Note: since the function codes for the menu options are already available, it is enough to provide the meaningful descriptions. But this enables the options only and the functionality can be linked in the function code.

Execute the COMD transaction and provide the project name and click on Create button if the project is

not yet created. Else deactivate the project by clicking on and open the project in change mode.

Now click on enhancement assignments.

Page 114: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Provide the enhancement name, save it and click on components

Now you will get the components of the exit. Double click on required function code i.e. +CU1.

Provide the function text, which is to be displayed as the menu option and click on Copy.

Page 115: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Once the test is provided, we need to link the functionalities for the already activated function codes through the function module exits.

Double click on the function module exit EXIT_SAPMMCP6_003.

Now double click on include ZXSOPU03. It will ask for creation click on Yes.

Save it as a local object and write the code as shown below. And activate it.

Page 116: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Now back to the initial screen of COMD and activate the project

Note: Make sure that the project is always activated and so that the additional functions get activated.

Testing the enhancement

We need to execute the corresponding standard transaction to make sure that the additional options are available and the corresponding functions are called.

Execute the transaction MC94. Enter the planning type and press enter

Page 117: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enter the Material group and Material number. Now click on Active version.

Now you will get a screen as shown below.

Now in Menu à Extras à Customer functions you can find the Menu item “Create program - SSR3KOR” which is created now.

Page 118: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on Create program – SSR3KOR. You will get SE38 screen where you can create a program.

Adding custom fields to CS01, CS02 and CS03 (Bill Of Materials)

Requirement: Customer wanted to add two new fields Country and Vendor number to Bill of materials header level.

Procedure: We need to add customer specific fields to BOM header level, first we need to add these two fields to BOM header record table i.e. STKO, then create a sub screen two hold these two fields and write the corresponding logic in the Functional exits provided.

Page 119: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The above steps are explained below in Detail.

STEP 1: Create an Append structure for table STKO.

Go to SE11 and provide table name STKO.

Click on button Append structure

Give name for Append structure “ZSTKO”

Add new fields to Append structure. ZZLAND1 and ZZVENDOR

Check and Activate the append structure.

A list of tables adjusted will be displayed.

STEP 2: Find an Enhancement for BOM.

Bill of materials transaction CS01/02/03 is assigned to package “CS”.

We can search for relevant Enhancements in CS package.

Go to transaction SMOD then go to Utilities-> find.

Page 120: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the search box provide Package name as “CS”

Then Execute. You will get list of available Enhancements for the given package.

With the given short text or the enhancement we can use Enhancement PCSD0003.

To see the Enhancement components press display button.

You can see Functional Module Exits, Function codes, Screen Areas in the next screen.

Page 121: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Select the relevant Enhancement and you can test the enhancement from SMOD transaction main screen.

STEP 3: Create a project for Enhancement.

Go to CMOD(Project management of SAP Enhancements)

In the Initial Screen give any name (ZTEST) for Project.

Then press create

Page 122: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the Next screen fill description for project and save as local object/ save to a package.

Then Click on the enhancement assignments button

Add the selected enhancement there and enter then save.

Go to back to Attributes of Enhancement project ZTEST screen

Use COMPONENTS button to see the components for the enhancement.

Page 123: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

From the above screen you can see Project and enhancement Implementation are in red color and other components also.

Double click on screen exit. It will take you to Screen painter.

Add customer fields to the screen.

Go to screen properties and mark it as sub screen.

Now go back to components.

Click on the function exit then press enter.

In the next screen you can see Function Module EXIT_SAPLCSDI_004

In the function Module you can see a Include ZXCSAU04.

Double click on the include

A warning message appears ignore it and press enter.

Page 124: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Include is ready to implement your code logic.

Page 125: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Double click on the USERDATA structure and

Add an append structure.

Add two customer fields to the Append structure.

Then go back to include and write your code logic.

Page 126: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Save include. Check and activate.

Then go back to components list.

Add code to another function exit.

We have implemented function exits and screen exit.

Then activate project.

When we activate the project red button will turn into green. Components will turn into green.

For change and display transactions change the screen parameters.

STEP 4: check the added fields in CS03 Display Bill of materials.

Page 127: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to CS03 and give any material number, Plant and BOM usage press enter.

Select header button to navigate to header window.

There you can see a tab “Customer fields” and two customer fields.

Implementing Screen-exit for transaction MIGO

Requirement:

Add new Tab to MIGO and store the custom values in a Z table, as there is no provision for adding custom fields in MSEG table except for Accounting details by Standard Include (CI_COBL).

Solution:

Create a BADI implementation for MB_MIGO_BADI

Page 128: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Create a program with the screen type sub-screen in SE80 and design the layout for the custom fields.

Declare the custom fields in a Z**TOP include.

Page 129: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Under the PBO method declare the program name and screen number as shown

below:

Under PAI method declare the field to ‘X’.

Under the line modify method declare a flag and set to ‘X’ checking for material document number by which we can set the fields to be in display mode when we open MIGO for display of material document created after doing goods receipt.

Under the POST_DOCUMENT method write the code for appending the value to Z table along with the values of the line item (In this case production order number, material, …….). For these values to be available here in this method use the memory concept “Export to memory id” in the method LINE_MODIFY.

In order to do any validations to the custom fields, go to transaction SE80 and mention the program Name created and in PROCESS ON VALUE_REQUEST create a module and provide the validations required for those custom Fields.

Page 130: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In order to make the fields to be in display mode during the display of material document, create a module under PBO and import the flag value and the production order number details in the method LINE_MODIFY and if that flag = ‘X’, use

LOOP AT SCREEN. IF SCREEN-NAME = 'ZZGBAGS'. SCREEN-INPUT = '0'. MODIFY SCREEN. ENDIF. ENDLOOP.

Retrieve the values from the Z table matching the key field (production order number) and pass the value of the custom field on to the screen.

ZZBAGS = (fetched value from Z table).

Following is the transaction with the custom field:

Page 131: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Changing the description of the standard SAP fields

Consider the following scenario:

When entering the customer master details, we have the provision for entering the telephone number with extension, fax and telebox. Assume that we also need to enter the mobile number of the customer for which there is no provision. Also assume that we do not use telebox for any of our customers and want to use that field for entering the mobile number. Though you can directly enter the mobile number in the field “telebox” , the description ‘telebox’ always misguides us. See the screenshot below:

Page 132: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

This tutorial focuses on changing the field descriptions for scenarios similar to above.

All the short-descriptions for the fields are retrieved from the data element level of the corresponding fields. So we need to change the descriptions at the data-element level.

So our first step is to know the data element used for the field “Telebox”. Press F1 and then F9 to know the data element. See the screenshot below:

Page 133: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Make a note of the data element.

Now go to transaction CMOD

Page 134: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on Goto à Text enhancements à Keywords à Change

Page 135: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enter the data element.

Click enter. The following screen would appear:

Now change the descriptions as per the requirement. See the screenshot below:

Page 136: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Click on save.

Now to verify the changes, go to SE11 and enter the table name ADDR1_DATA. Check the short description for the field EXTENSION2:

Also go to transaction XD01 / XD02 and check the field:

Page 137: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The description “Telebox” is now changed to “Mobile No”.

Implement screen exit for MM01/MM02/MM03

Requirement:

Add new field(s) to MM01 basic data 1 view (screen) and store the values into a Ztable along with material number as primary key.

Solution:

1. Go to Transaction SPRO, Display IMG.

2. Go to Logistics-General à Material Master à Configuring the material master and execute ‘Create Program for Customized Subscreen’.

Page 138: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

3. Create a function group of your own with Y or Z. In this case the function group name given ZMGD1.

4. Go to transaction SE80 and open the function group created, here the function group is ZMGD1.

5. Open the screen 0001. Using screen design layout (SE51), customize the screen according to the requirement.

Page 139: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

6. Write the flow logic in PAI and PBO as per the requirement.

7. PBO

Page 140: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

o Inactive the fields for input when material is displayed (MM03)

o Retrieve the data from Ztable for material change/display (MM02/MM03)

8. PAI

o Export the data into memory

Page 141: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

9. Now go to transaction SPRO, Display IMG then go to Logistics-General à Material Master à Configuring the material master and execute ‘Define Structure of Data Screens for Each Screen Sequence’.

10. Select the corresponding screen sequence number and double click on data screen button. In this case screen sequence ‘21’ has modified.

Page 142: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

11. Select logical screen 07 (Basic Data 1) and double click on Subscreens.

12. In change view of subscreens, modify the program name of sub screen 21à07à08 to the subscreen program name which is created in step 6. In this case the program name is SAPLZMGD1. Save the modifications.

13. Now to save the given enhanced field value in the Ztable, write the required code in the user exit EXIT_SAPLMGMU_001.

o Import the data from memory ( The data which is exported in PAI event, refer step 8)

Page 143: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Execute the transaction MM01/MM02/MM03 and test the scenario developed.

How to implement screen exit for a SAP standard transaction

Introduction

SAP provides standard transactions to enter data into database. But a client may want to maintain some additional information in SAP other than what is provided.

To make provisions for this, additional screens have to be provided and additional fields must be added into appropriate database table.

To pave way for this, SAP has provided the option for screen exits. Usually, SAP provides the following:

1. An append structure in the database table with the new fields. 2. A subscreen area into the standard screen – where the programmer can attach his subscreen of

his own program with the new fields. 3. A function group under which the new subscreen has to be created with the new fields. 4. Function exits to synchronize the PBO and PAI of the standard SAP program with the PBO and

PAI of the subscreen – so that data can flow back and forth between the standard SAP program and the program written by the developer for the subscreen. These function modules also exist in the same function group under which the subscreen will have to be developed.

Finally, a linkage has to be done between the subscreen area of standard SAP screen with the custom subscreen constructed by the developer.

Typically, SAP provides an enhancement in which the developer can create an append structure, use the function exits to synchronize the PBO and PAI of the standard SAP program and the custom subscreen program, and make the necessary linking( as mentioned above in step 4. But, again, this is not a hard and fast rule. Linking in some case, is also done by configurations.) SAP also usually provides the name of the function group under which the subscreen has to be developed.

Necessary guidance about implementing a screen exit development is usually available in the Documentation section of the enhancement ( can be availed by transaction SMOD).

Pre-Requisites

The developer to work on screen exit should have essential knowledge on the following:

• DDIC concepts, including the knowledge of append structure.

Page 144: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

• Concept of SAP Enhancements and implementing them using Projects. • Concept of function exits. • Knowledge on Module Pool – including subscreens, Tabstrip controls etc.

Steps

Guidelines

So, a developer can follow the guidelines mentioned below to implement a screen exit to a standard SAP transaction, as and when required:

Find out the Required Enhancements

1. Go to SMOD. Press F4 in the Enhancement field. In the next popup window, click pushbutton ‘SAP Applications’. A list will appear that contains information on all the enhancements, categorized under functional areas. Developer must search for the enhancements relevant to his functional area of interest – for e.g., Purchasing, Asset Accounting, etc.

2. Note down the enhancements. Then, come to the initial screen of SMOD and view the documentation of each enhancement to find out which one is required for your development.

Utilize the Enhancement in a Project

After you have found one, do as directed in the documentation. Generally, the steps are as follows:

1. Create a project using CMOD including your enhancement. 2. Create the append structure with new fields. 3. Go to the desired function group and create a subscreen with the new fields. Write PBO and PAI

for the subscreen, if required. 4. Use the function exits in the enhancement to link the PBO and PAI of the subscreen with that of

the main SAP program supporting the SAP transaction. 5. Maintain necessary linkage between the subscreen area of standard SAP program with the

custom subscreen developed along with the custom program name. This can be done in the project (developed by CMOD including the enhancement) or outside as a part of configuration.

6. Activate the project. 7. Test to ensure that required functionality are met.

Case Study 1

Add three new custom fields for Asset master and maintain information for them

Requirement

Three fields in the legacy system have to be maintained in Asset master. These fields are:

1. Original Asset number – 20 characters 2. Location 2 – 15 Characters. 3. Model no – 20 characters

Location 2 should start with ‘L’.

Page 145: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Pre-Analysis

Finding out the Enhancement

As described above, the enhancement is determined. It was found, that enhancement AIST0002 will serve the purpose. It contains the following components (can be viewed by transaction SMOD):

Exit Type Description EXIT_SAPL1022_001 Function Exit Check of User-Defined Fields when Using Create and Change BAPI EXIT_SAPLAIST_002 Function Exit Transfer Data for User Subscreens in PBO. EXIT_SAPLAIST_003 Function Exit Transfer of User-Defined Fields to SAP Master Data Transactions CI_ANLU Customizing Include Include structure to add new fields

Studying the Function Exits

The function module level documentation for the function exits are then viewed from transaction SE37. The documentation clearly laid out for the purpose for their use:

EXIT_SAPLAIST_002

Function module Level Documentation

This function module is called by asset master data maintenance at the start of the dialog. (When changing, it is called after reading of the data from the database; when creating it is called after the transfer of the default values from the asset class and reference asset.) The purpose of the function module is to enable this function group to recognize the master data. For interpreting or controlling master data fields that are important for user fields, it is possible to transfer to global variables at this point, so that they can be recognized when the user subscreens are processed.

Import Parameters

Understanding

This function module is called at the PBO to pass the information retrieved from the database to pass them to the custom subscreen and its underlying program. Import parameter : I_ANLU will be populated with the values for user-defined fields which will be passed to the subscreen program. So, there must be some sort of variable assignment from I_ANLU.

EXIT_SAPLAIST_003

Function module Documentation: This function module is called by SAP asset master data maintenance after the screens are processed, but before saving. The purpose of the function module is to transfer fields entered on user sub-screens of SAP asset data maintenance to the database for updating. The export parameter for this function module is:

Understanding

This function module will be used to transfer the user entered data in the subscreen fields to the main SAP program, which will then be saved into the database.

Page 146: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Studying the Documentation of the Enhancement

The enhancement documentation (as is viewed from the initial screen of SMOD] also supports the idea. Moreover, it informs that we need to develop a subscreen under function group XAIS. This is the function group under which the two function exit modules also exist. So, if the custom subscreen refers to the global data of the function group XAIS, then those values will also be available to these function exits as well.

Going to SE80 and viewing the function group XAIS helps us to inform that there are three DDIC tables declared for it:

Deciding the Final course of Action

After making all the investigations, the final course of action was determined.

SrlNo Step Justification

1. A project has to be created using transaction CMOD where the enhancement AIST0002 will be included.

2. Customizing include CI_ANLU has to be created with the custom fields demanded When CI_ANLU will be developed, the custom fields will get appended to the database table ANLU. Also, these fields will be used to create screen fields in the new subscreen.

3. A custom subscreen, say, 9000 will be developed under function group XAIS. The screen group for the screen will be ‘CUST’ (or any name). The three custom fields added to table ANLU (by creating CI_ANLU) will be used to create new fields in the screen.

In the PAI of the subscreen, validation for Location to start with ‘L’ will be added. The subscreen with three new fields has to be developed so that it can be attached to a subscreen area of the asset master screens.

1. In the custom include of the function exit module ‘EXIT_SAPLAIST_002’, the following code will be written:-

ANLU = I_ANLU. I_ANLU is the import parameter of this FM. The value is assigned to the global variable ANLU, referring which the three new subscreen fields are developed. So, data retrieved from database table ANLU will be passed to this FM as I_ANLU by the standard SAP main program. The value will be taken and passed to the global variable of the function group XAIS, so that the three custom fields (referring to ANLU of XAIS) get populated.

1. In the custom include of the function exit module ‘EXIT_SAPLAIST_003’, the following code will be written:-

E_ANLU = ANLU. The changed values in the subscreen fields exist in global variable ANLU for the function group XAIS. This function exit module will pass the data back to the SAP main program as E_ANLU.

1. Proper linkage/configuration has to be done so that the new subscreens get linked to the appropriate subscreen area of the Asset master screen. This has to be done – otherwise, the new custom subscreen will not be displayed in the Asset master screens.

Page 147: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Development

Creating a Project to include the enhancement

1. Go to transaction CMOD and create a project. 2. Enter a description for the project. Then, click on the pushbutton ‘Enhancement Assignments’ in

the Application Toolbar. 3. Enter the name of the enhancement and Save. 4. Go to ‘Components’.

Creating Custom Include for ANLU

The screen shown below will appear, showing all the enhancement components under the assignment AIST0002. Double-click on the name of the Include Structure to create it.

Create the include structure with three new fields, as required. Then, save and activate it.

Develop the subscreen and the program

Go to transaction SE80. For the function group XAIS, create a new subscreen 9000.

Create it as subscreen.

Then, go to the Layout of the screen and create three new fields from Database table ANLU.

Drag the fields in the screen body and place them.

Then, save and activate the screen and come back to screen flow editor.

Create the PAI module to add validation for field “Location 2”, as required .

Activate the whole function group and come out.

Write code in the Function Exits to synchronize the programs

Now, code has to be written in the function modules EXIT_SAPLAIST_002 and EXIT_SAPLAIST_003 so that data flows to and fro between the main SAP program and custom subscreen program. For that, go back to transaction CMOD and change the function exits.

Write code in the function module EXIT_SAPLAIST_002 called once at the beginning of the transaction:

Write code in EXIT_SAPLAIST_003 to pass the data from the subscreen to SAP main program.

Then, activate everything – the whole project and come out.

Page 148: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Complete the configuration to link the subscreen

The development portion is complete. Now, linking of the subscreen has to be done with the subscreen area of the main program. In most of the cases, this linking can be done in the enhancement itself. But, here, requirement is a bit different. It is done by configuration using SPRO.

Assets are created under Asset class. And for each asset class, there is a layout assigned to it. For a layout, there are multiple tab pages assigned to it. And, for each tab page, there are multiple screen groups/field groups assigned.

Here, the requirement is to create these three custom fields in the tab page ‘General’ of asset master screen ( AS01/AS02/AS03/AS91).

Determine the Layout

To achieve this, first of all, we need to find out which layout is assigned to asset class 1000.For that, go to transaction AOLK( information has to be obtained from functional consultant).Select the Asset Class ‘1000’ and click on folder ‘General Assignment of Layout’.

Here, for Asset class 1000, for all the user groups, tab layout SAP is assigned. Since layout ‘SAP’ cannot be changed, it has to be copied and manipulated to include our screen group. Later, the new layout has to be assigned over here.

Create new tab layout

Go to transaction AOLA. Copy the tab layout ‘SAP’ to create another layout, say, YSUB.

System will copy all the settings and will inform you about that.

Select your newly created layout and double-click on the folder ‘Tab page titles’.

You want to put your custom fields in the tab page “General”. So, select this tab page entry and double-click on the folder "Position of Groups".

Here, all the field groups currently residing in the tab-page “General” are shown. Add an entry for your newly created fields.

Select the group box from the list. An entry will come with “U” padded with the custom subscreen prepared by you.

Then, save and come out.

Assign the new Layout to Asset Class

Now, go to tcode AOLK and assign tab layout YSUB for asset class 1000.

Save and come out.

Page 149: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Test the Exit

Everything is over. Now, go to transaction code AS01/02/03 or AS91 to deal with an asset of asset class 1000. You will see your new fields added to the screen. Add values to them…save. Then, enter into the tcodes again to see whether the values entered by you are being displayed or not.

Original Source: ittoolbox.com

Find User exits with TCode

Selection Text: P_TCODE: Transaction Code to Search

Text Symbols: 001 - Enter the Transaction Code that you want to search through for a User Exit REPORT z_find_userexit NO STANDARD PAGE HEADING. *&---------------------------------------------------------------------* *& Enter the transaction code that you want to search through in order *& to find which Standard SAP® User Exits exists. *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Tables *&---------------------------------------------------------------------* TABLES : tstc, "SAP® Transaction Codes tadir, "Directory of Repository Objects modsapt, "SAP® Enhancements - Short Texts modact, "Modifications trdir, "System table TRDIR tfdir, "Function Module enlfdir, "Additional Attributes for Function Modules tstct. "Transaction Code Texts *&---------------------------------------------------------------------* *& Variables *&---------------------------------------------------------------------* DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE. DATA : field1(30). DATA : v_devclass LIKE tadir-devclass. *&---------------------------------------------------------------------* *& Selection Screen Parameters *&---------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001. SELECTION-SCREEN SKIP. PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY. SELECTION-SCREEN SKIP. SELECTION-SCREEN END OF BLOCK a01. *&---------------------------------------------------------------------* *& Start of main program *&---------------------------------------------------------------------* START-OF-SELECTION.

Page 150: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

* Validate Transaction Code SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode. * Find Repository Objects for transaction code IF sy-subrc EQ 0. SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name = tstc-pgmna. MOVE : tadir-devclass TO v_devclass. IF sy-subrc NE 0. SELECT SINGLE * FROM trdir WHERE name = tstc-pgmna. IF trdir-subc EQ 'F'. SELECT SINGLE * FROM tfdir WHERE pname = tstc-pgmna. SELECT SINGLE * FROM enlfdir WHERE funcname = tfdir-funcname. SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR' AND object = 'FUGR' AND obj_name = enlfdir-area. MOVE : tadir-devclass TO v_devclass. ENDIF. ENDIF. * Find SAP® Modifications SELECT * FROM tadir INTO TABLE jtab WHERE pgmid = 'R3TR' AND object = 'SMOD' AND devclass = v_devclass. SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu AND tcode EQ p_tcode. FORMAT COLOR COL_POSITIVE INTENSIFIED OFF. WRITE:/(19) 'Transaction Code - ', 20(20) p_tcode, 45(50) tstct-ttext. SKIP. IF NOT jtab[] IS INITIAL. WRITE:/(95) sy-uline. FORMAT COLOR COL_HEADING INTENSIFIED ON. WRITE:/1 sy-vline, 2 'Exit Name', 21 sy-vline , 22 'Description', 95 sy-vline. WRITE:/(95) sy-uline. LOOP AT jtab. SELECT SINGLE * FROM modsapt

Page 151: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

WHERE sprsl = sy-langu AND name = jtab-obj_name. FORMAT COLOR COL_NORMAL INTENSIFIED OFF. WRITE:/1 sy-vline, 2 jtab-obj_name HOTSPOT ON, 21 sy-vline , 22 modsapt-modtext, 95 sy-vline. ENDLOOP. WRITE:/(95) sy-uline. DESCRIBE TABLE jtab. SKIP. FORMAT COLOR COL_TOTAL INTENSIFIED ON. WRITE:/ 'No of Exits:' , sy-tfill. ELSE. FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. WRITE:/(95) 'No User Exit exists'. ENDIF. ELSE. FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. WRITE:/(95) 'Transaction Code Does Not Exist'. ENDIF. * Take the user to SMOD for the Exit that was selected. AT LINE-SELECTION. GET CURSOR FIELD field1. CHECK field1(4) EQ 'JTAB'. SET PARAMETER ID 'MON' FIELD sy-lisel+1(10). CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

Adding Custom Fields using EEWB Transaction

This tutorial would focus on EEWB transaction and would explain the creation and adding of custom fields in a Tab in a transaction (BP). It would also explain the deleting process of the fields.

Go to Transaction EEWB à Right click on ProjectàCreate Project.

Enter Project Name, Description & Package à Save

Page 152: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The following screen appears:

Right click on the Project name and click on ‘Create Extension’.

In the pop-up that follows, enter the following information as shown or as per your requirement and click ‘Continue’ (Enter).

Page 153: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The following wizard is shown. Click on ‘Continue’.

Select your Cardinality and Time constraints and click on ‘Continue’.

Page 154: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the following screen, enter the Frame Title as shown or as per your requirement and click on ‘Continue’.

“Frame title is the title or name of the frame of the table fields that appear on the screen tab.”

In the following screen, enter the fields that you want on the screen in the tab and click on ‘Continue’.

Page 155: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the following screen, check the check boxes for which you want to maintain relevancy integration with BW or you can even leave it unchecked or do as per your requirement.

The following screen is shown reading ‘Complete’. Click on ‘Complete’.

Page 156: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The below shown screen will appear as an indication of the fields that you have added and projects the relevant information.

Go to Transaction ‘BP’. Enter the business partner details. Press ‘Enter’.

Page 157: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

You can observe that there is an additional tab added named “Customer Data”.

Click on that tab to see the contents. You can observe that the fields that you have added in EEWB transaction reflect in this tab.

Page 158: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

You can toggle to Change Mode and enter the details in the fields.

We are now done with the Creation of the table fields in the custom tab.

DELETING PROCESS

Come to transaction ‘EEWB’.

As shown above, right click on the Table name that you added and click ‘Delete’.

In the pop-up that follows, click on ‘Continue’.

Page 159: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the pop-up that follows, click on ‘Yes’.

In the pop-up that follows, click on ‘Yes’.

The following screen is displayed.

Now, in this screen, Right click on the project name and click ‘Delete’.

Page 160: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the pop-up that follows, Click on ‘Yes’.

We are now done with the deleting part as well.

Working with User-Exits

Enter the transaction VA01.

Page 161: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to menu System and select sub item status.

We will get the name of the program as (SAPMV45A).

Now go to SE38 Editor and type the program name as SAPM45A.

And select subobjects - attributes radio button and press Display.

Page 162: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Note the package name. In this case, it is VA

Now go to SMOD Transaction (SMOD is used to find the enhancements and user exits.)

Page 163: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Here if we enter the enhancement name it results the list of user exit names.

But we don’t known the Enhancement name so press the Utilities > Find menu option.

Page 164: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Press Execute .

Page 165: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

In the above enhancements our program name SAPMV45A Matches four enhancements.

So, In the below enhancements we have to check the right one.

• V45A0001 - Determine alternative materials for product selection • V45A0002 - Predefine sold-to party in sales document • V45A0003 - Collector for customer function module pool MV45A • V45A0004 - Copy packing proposal into outbound Delivery.

My Analysis :

Every Function Module for Enhancement supplies some Import and Export Parameters.

Through which we get some values.

V45A0001 – The Description of this enhancement tell us that it determines the alternative materials for product selection. (i.e., If one material is not available what is the other material that has to be used as an alternative. So it is item specific).

FUNCTION EXIT_SAPFV45S_001. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING

Page 166: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

*" VALUE(REQUESTED_DELIVERY_DATE) LIKE VBAK-VDATU *" VALUE(ENTERED_MATERIAL) LIKE VBAP-MATNR *" VALUE(REQUESTED_DELIVERY_QUANTITY) LIKE VBAP-KWMENG *" VALUE(SALES_UNIT) LIKE VBAP-VRKME OPTIONAL *" VALUE(DELIVERED_QUANTITY) LIKE VBAP-KLMENG OPTIONAL *" VALUE(DELIVERING_PLANT) LIKE VBAP-WERKS OPTIONAL *" VALUE(STORAGE_LOCATION) LIKE VBAP-LGORT OPTIONAL

If we observe the Importing parameters

1. There is no way to get VBAK – EBELN (Sales Order No.) and other header data form VBAK.

So, this user exit is not useful.

V45A0002 - By Description we understand that we can predefine sold-to party in the sales document. (i.e., it is used to populate the field sold-to party through user-exit while entering the data. ) But our requirement comes after entering the data in the screen and save button is pressed.

FUNCTION EXIT_SAPMV45A_002. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(I_TVAK) LIKE TVAK STRUCTURE TVAK *" VALUE(I_TVTA) LIKE TVTA STRUCTURE TVTA *" VALUE(I_VKGRP) LIKE VBAK-VKGRP *" VALUE(I_VKBUR) LIKE VBAK-VKBUR

And even the importing parameters are not useful for us.

V45A0004 - Copy packing proposal Into Out bound delivery. This description implies that whenever we create a Delivery Order from Sales Order it copies the packing proposal Based on the already created Sales order. So, there is no chance for us to save the data while we create or change a Sales order.

V45A0003 - Collector for customer function module pool MV45A - This description some what looks good . But description there is no functionality mentioned. So, let us drill down.

We have 2 exits.

Function module Short Text

EXIT_SAPMV45A_003 Rev.Rec.: Copy Requirements An Header

EXIT_SAPMV45A_004 Rev.Rec.: Field Modification Sales

Page 167: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

FUNCTION EXIT_SAPMV45A_004. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(I_SCREEN_NAME) LIKE FELD-NAME *" VALUE(I_VBAP) LIKE VBAP STRUCTURE VBAP *" VALUE(I_VBUP) LIKE VBUPVB STRUCTURE VBUPVB *" VALUE(I_SCREEN_GROUP4) LIKE FELD-GRP4 *" VALUE(I_T180_AKTYP) LIKE T180-AKTYP

From Exit 004 Description and Importing parameters we can clearly see that this exit is used for Field modifications.

EXIT_SAPMV45A_003 - From the Description and Importing parameters we get the header data that can be used for our requirement.

FUNCTION EXIT_SAPMV45A_003. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(XVBAK) LIKE VBAK STRUCTURE VBAK *" VALUE(XVBUK) LIKE VBUK STRUCTURE VBUK *" VALUE(XKOMK) LIKE KOMK STRUCTURE KOMK

The purpose of SMOD is to find User Exits.

Once we find the user exits, We go to CMOD. The purpose of the CMOD is to register what we are going to do in the particular enhancement. So, at the time of up gradation it will be easy to retain the code.

Page 168: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

click on Create.

Now in the next screen (see below), click on Save and then on “Enhancement assignments)

Now enter your enhancement name, click on Save and then on “Components”

Now double click on the required function exit

Page 169: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement
Page 170: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

data: gt_exit type zexit, gs_vbeln TYPE zexit-vbeln, gs_inr TYPE vbak-netwr, gs_loc type vbak-waerk value 'INR'.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY' EXPORTING CLIENT = SY-MANDT date = sy-datum foreign_amount = xvbak-netwr foreign_currency = xvbak-waerk local_currency = gs_loc RATE = 0 TYPE_OF_RATE = 'M' READ_TCURR = 'X' IMPORTING EXCHANGE_RATE = FOREIGN_FACTOR = LOCAL_AMOUNT = gs_inr LOCAL_FACTOR = EXCHANGE_RATEX = FIXED_RATE = DERIVED_RATE_TYPE = EXCEPTIONS NO_RATE_FOUND = 1 OVERFLOW = 2 NO_FACTORS_FOUND = 3 NO_SPREAD_FOUND = 4 DERIVED_2_TIMES = 5 OTHERS = 6 . IF sy-subrc <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.

if gs_inr > '1000'. gt_exit-zstatus = 'High Value'. elseif gs_inr > '100' and gs_inr < '1000'. gt_exit-zstatus = 'Normal Value'. elseif gs_inr < '100'. gt_exit-zstatus = 'Low Value'. endif.

gt_exit-vbeln = xvbak-vbeln. gt_exit-vkorg = xvbak-vkorg. gt_exit-vtweg = xvbak-vtweg. gt_exit-spart = xvbak-spart.

insert into zexit values gt_exit. clear gt_exit.

Page 171: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Implementing Field Exit for the transaction MK01

“In this scenario, I would like to explain about Field exit enhancement for MK01standard transaction in Control tab under Tax information”.

Note : This field Enhancement will reflect in the transactions XD01, FK01 andMK01.

Go to “MK01” transaction

Enter the Vendor, Purchase Organization and Check the Control details in General data

The Enhancement fields are SS number, em no and Fiscal address under Tax Information (as shown below)

Go to “CMOD” transaction

Page 172: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to Standard Menu : Goto-->Text enhancements-->Keywords-->Change

Enter the Data Element: STCD1

Change Description : ss number

Page 173: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Change Tax Code1 is as shown below

Press “Save”

Specify the Request Number

Page 174: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enter the Data Element: STCD2

Change Tax Code2 as shown below

Press “Save”

Specify the Request Number

Enter the Data Element : FISKN_K

Page 175: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Change description is as shown below with “Financial Year”

Press “Save”

Specify the Request Number

Now, Go to transaction MK01.

The Field Enhancement details are shown below.

Page 176: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Creating Custom Screen in XD01

Go to Transaction SPRO à Logistics – General à Business Partner à Customers à Control à Adoption of Customer’s own Master Data fields à Prepare Modification à Free enhancement of Customer Master Record.

Following screen

appears:

Go to CHANGE mode and Click ‘New Entries’ button. Then add a Screen Group (SK here)and meaningful description. Save the entry and then SELECT that entry and Click on ‘Label Tab Pages’.

Page 177: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Add a Label Tab Page i.e. enter a Screen Number, Function Code and Meaningful Description.

Save the entry and come back to the SPRO screen. Click Business Add-in: Processing Master Data Enhancements

Create one Implementation by giving implementation name (must start with Z. ZSURESHKUMAR here). Give meaningful description and press enter. The following screen appears.

Page 178: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Go to Interface and Click on ‘CHECK_ADD_ON_ACTIVE’ method. Add the following code and save.

method IF_EX_CUSTOMER_ADD_DATA~CHECK_ADD_ON_ACTIVE .

data: l_flg_active type BOOLE-BOOLE.

if i_screen_group = 'SK'.

e_add_on_active = 'X'.

endif.

endmethod.

Page 179: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Activate that and come back to SPRO initial screen. Click Business Add-in: Customer Subscreens

The following screen will appear. Create one implementation (ZSURESHKUMAR1 here).

Page 180: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Press enter. The following screen will come. Enter a meaningful Description and Screen Group (which we created earlier) as shown below.

Page 181: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Then go to Interface

Create a Function Pool SAPLZSURESHKUMAR. (See the code of the program for other details). Create a Screen ‘1111’ with field old Customer Number – screen group PSK (SE51)

Click on GET_TAXI_SCREEN method and add the following code.

method IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN .

case i_taxi_fcode.

when 'SK_TAB'.

e_screen = '1111'. "Eart + Objekt

e_program = 'SAPLZSURESHKUMAR'.

e_headerscreen_layout = ' '.

endcase.

endmethod.

Page 182: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Activate and leave the transaction.

Go to KNA1 (Customer Master) table and add a custom field as shown below. Activate the table.

Now go to XD01 transaction.

Page 183: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

The screen we created will appear as shown in the above screen-shot. Click the button. The following screen will appear.

Page 184: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Enter a customer number and save the transaction. Now go to KNA1 table and check the value of the Old Customer Number field’s value. The value you entered in this screen will appear on there.

Until now, we have written code for creating the Custom field. Now we need to disable that field when we are opening the transaction in DISPLAY mode.

Go to include – LZSURESHKUMARTOP and enter the following code and activate the program.

Page 185: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

Now execute the Transaction in display mode and check the output.

Populating the data into our custom fields

By Lokesh Reddy Avutu, YASH Technologies

Add the following code to the program SAPLZSURESHKUMAR, screen number 1111.

MODULE STATUS_1111 OUTPUT. * SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'. * data: l_oldcustno type kna1-zzold_cust_no. constants: c_oldcustno(24) value '(SAPMF02D)KNA1-ZZOLD_CUST_NO'. field-symbols: <fse>. assign (c_oldcustno) to <fse>.

Page 186: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement

if sy-subrc = 0. l_oldcustname = <fse>. "l_oldcustname is the screen name of old cust field endif. If sy-tcode = 'XD03'. Loop at screen. If screen-group1 = 'PSK'. Screen-input = 0. Modify screen. Endif. Endloop. Endif. ENDMODULE. "STATUS_1111 OUTPUT

Saving the data back to database from screen field

In the interface IF_EX_CUSTOMER_ADD_DATA_CS, add the following code in the method GET_DATA

method IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA . data:l_zztest type kna1-zztest. constants: c_oldcustno(24) value '(SAPLZSURESHKUMAR)l_oldcustname'. field-symbols: <fse> type any. assign (c_oldcustno) to <fse>. if sy-subrc = 0. s_kna1- ZZOLD_CUST_NO = <fse>. endif. endmethod.

Screen Exit in CJ01

This article details about the step-by-step procedure in implementing the Screen Exit for CJ01 transaction:

First create a project in CMOD and attach the enhancement CNEX0006 to the project.

1. Go to se11 and in the PROJ table u will find ci_proj include , in this add the required custom fields.

2. Go to se51 give SAPLXCN1 in the program name with screen number 0600 , create the subscreen and in the layout choose Dictionary./Program fields and drag and drop in the screen .

3. If u want to write any logic before the screen is displayed do it in PBO. 4. Now in the function exit EXIT_SAPLCJWB_002 , go in the INCLUDE ZXCN1U11 and write this

logic move-corresponding sap_proj_imp to proj.

5. Now in the function exit EXIT_SAPLCJWB_003 , go in the INCLUDE ZXCN1U12. and write this logic move-corresponding proj to cnci_proj_exp. Activate the project .

Page 187: Enhancement Framework Validating the Document Types in ...docshare01.docshare.tips/files/27339/273390525.pdf · Scenario on the combination of Transaction variant and enhancement