Enhancements

May 28, 2018 | Author: Mahesh Paleti | Category: Subroutine, Menu (Computing), Databases, Computer Programming, Technology


Comments



Description

Enhancement FrameworkValidating 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 ”. b) Go to Edità Enhancement Operations à Show Implicit Enhancement Options. Step 2: Now, we will observe commas like below. Step 3: Go to Implicit enhancement option at the beginning of the form ‘CHECK_DOCUMENT_TYPE’ 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. ENDIF.Here you can write the custom code for modifying the functionality. it will throw an error message. IF sy-tcode EQ 'MIRO' or sy-tcode EQ 'MIR7'. . DATA : lv_message TYPE string . Activate the code and enhancement. MESSAGE lv_message TYPE 'E' . IF bkpf-blart NE 'RE' AND bkpf-blart NE 'AN'. CONCATENATE 'Document "' bkpf-blart '" is not allowed for this Transaction' INTO lv_message . Step 7: Check in MIRO and MIR7 by selecting the Document Types other than RE and AN. ENDIF. This can be done by the combination of implicit enhancement technique and transaction variant. Solution: First we will restrict the further drilldowns from the menu bar by Transaction variant. Create a transaction variant for MEK2. descriptions) and to restrict the further drill down’s from the menu.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. Give the transaction code and the transaction variant name and click on create button. Go to the Transaction SHD0. . Following are the screenshots that describe step by step procedure of the requirement.e. Click on continue button. give the proper input values with the help of search help and click on enter.Then it will lead you to the MEK2 ( Change condition records transaction). Give Name and short text to the screen variant. In the next screen. . Note: The descriptions which are needed to be hidden will be taken care by implicit enhancement technique. th Give the condition type PB00 Gross Price and click on the Key combination and select the 4 radio button and click continue. Then the following screen appears. As of know we are working to restrict the further drill downs to other TCodes via menu bar by transaction variant. 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.After clicking on execute button. Press enter. . Then click on the menu functions button. Then following screen appears. After clicking on the menu functions button. .. XD03 and so on. Now click on exit and save button. Finally enter description and save the variant.Note: Here the customer wants to restrict the drilldowns to MM03. Click on Goto-> Create variant transaction . Now go back and create a transaction code for the created transaction variant. Give the name and short text and press continue. . Now go to Edit-> Enhancement operations -> Show implicit enhancement options. . In Enhancement Framework. Note: While debugging the standard SAP program.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. By debugging we will come to know that the code should be written in the form FILL_DEFAULT. Click on display. This scenario would work from ECC6. we have to decide at which place we would need to write our own code.0 onwards. So now click on the enhance button. So while debugging the standard program of MEK2 i. we can add our own Code at particular points. it is found that code need to be written in this include MV13AKOM.e (SAPMV13A). There we need to check whether enhancement can be implemented. The following screen appears after clicking the option Show implicit enhancement options “““Indicates that we can write the code here. Now right click on the line below and create the enhancement implementation. . Now click on Create implementation button at the bottom. After clicking on the create button.Now choose Code The following screen appears. Give the name and the description of the enhancement and click on continue. . Select the enhancement and click on continue. Code: . Now place the desired code in the Enhancement and End Enhancement section shown below.Now the created implementation appears in the below list. CASE FD_FIELD. WHEN ‘MATNR’. WHEN ‘EKORG’. material and purchase organization are hidden by implicit enhancement technique. WHEN ‘LIFNR’. ENDCASE. IF LV_STCODE = 'ZMEK2’. CLEAR ‘MAAPV-ARKTX’. The menu functions (drilldowns) are disabled by transaction variant. ENDIF. The descriptions of vendor. “GET THE TCODE FOR TRANSACTION VARIANT Output: Now when you execute ZMEK2. CLEAR ‘LFA1-NAME1’.Code: DATA: LV_STCODE TYPE SHDTV-TCODE. CLEAR ‘T024E-EKOTX’. . CALL 'DY_GET_CURRENT_TRANSACTION' ID 'TRANSACTION_NAME' FIELD LV_STCODE. we have to pick the Material Description from Custom Table. There we need to check whether enhancement can be implemented. In Enhancement Framework.Picking material description from custom table in the SAP Sales Order (VA01 and VA02) using enhancement framework This scenario would work from ECC6. we can add our own Code at particular points.0 onwards. Requirement: In Sales Order (VA01 & VA02). While debugging the standard SAP program. . we have to decide at which place we would need to write our own code. . in .While debugging it is found that the code needs to be written theFORM USEREXIT_MOVE_FIELD_TO_VBAP. Now click on Enhance button as shown below. It shows the screen as below : . . Now Right click on """"""""""""" and select Enhancement Implementation -> Create.Then it shows the Screen as below: """ indicates we can write our code here. . Now click on Create button in the above screen. Another Screen appears as shown below: .Select Code. click on Create Composite Implementation and the following Screen appears. Then click on Continue button (Green tick). Select the Enhancement Implementation which we have created now and click on Continue button. In the below Screen. .In the above screen. Now here we can write our own code as shown below: . SELECT SINGLE TENDERID FROM ZBOQ_HEADER INTO VAR_TENDERID WHERE WERKS EQ V . IF ( SY-TCODE EQ 'VA01' OR SY-TCODE EQ 'VA02' ) AND ( VBAK-AUART EQ 'ZCO1' OR VBAKAUART EQ 'ZER1' ) AND VBAP-WERKS IS NOT INITIAL.06.VAR_TENDERID . IF VBAK-AUART EQ 'ZCO1'. * Date : 08.VAR_MAKTX. CLEAR : VAR_ARKTX.Civil & Order type ZER1 . VAR_MAKTX TYPE ZBOQ_ITEM-MAKTX. "active version * Modification Done By : Sajid Shaik.Code: ENHANCEMENT 315 ZSD_EI_BOQDESC.2009 * Requirement Given by : Avinash Gyale * Requirement : Material Description should be fetched from BOQ based on the Plant and Boq Typ e 'Erection or Civil'. VAR_TENDERID TYPE ZBOQ_ITEM-TENDERID. VAR_LENGTH TYPE INT4.Erection DATA : VAR_ARKTX TYPE VBAP-ARKTX. * : This should work only for Order type ZCO1 . VAR_ARKTX = VAR_MAKTX(40). ENDIF. ENDIF.BAP-WERKS AND TYPE EQ '3'. ENDIF. ENDIF. IF SY-SUBRC NE 0. ELSE. ENDIF. IF VAR_LENGTH LE 40. ENDIF. ENDIF. VBAP-ARKTX = VAR_ARKTX. SELECT SINGLE TENDERID FROM ZBOQ_HEADER INTO VAR_TENDERID WHERE WERKS EQ V BAP-WERKS AND TYPE EQ '2'. OUTPUT : Before Enhancement Implementation . IF SY-SUBRC NE 0. VAR_ARKTX = VAR_MAKTX(VAR_LENGTH). SELECT SINGLE MAKTX FROM ZBOQ_ITEM INTO VAR_MAKTX WHERE TENDERID EQ VAR_TEN DERID. Then Save and Activate it. ELSEIF VBAK-AUART EQ 'ZER1'. VAR_LENGTH = STRLEN( VAR_MAKTX ). IF VAR_ARKTX IS NOT INITIAL. ENDENHANCEMENT. IF SY-SUBRC NE 0. After Enhancement Implementation . 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).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. Go to system à status Double click on Program RVPKMASS. . Click on “Spiral Button” or ProgramàEnhance Click on “Spiral Button” or ProgramàEnhance . Edit à enhancement operationsàShow implicit enhancement . Place the cursor on the enhancement point and create the enhancement is as shown below screen. Enhancement implementationàcreate . Select the appropriate enhancement and click on continue.Create the New Enhancement is screen. Place the below code in the enhancement spot. as shown in below . Loop at screen. Screen-required = '1'. Endif. Screen-required = '1'. Endif. If screen-name = 'so_vbeln-low'. Endloop. If screen-name = 'so_aufnr-low'. . Modify screen. Modify screen.At selection-screen output. 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. Sales person1 (user 1): lz8xzf Owner for Sales order no: 174. Sales person2 (user 2): lzn4rm Steps to Implement the Implicit enhancement option: Step1: Go to SE38 and Open include MV45AFZB Step2: In order to implement any of these Source code enhancements, you need to be in Enhancement mode’ (the spiral icon available in the editor). ‘change Step3: Go to EDIT option in the menu and choose Enhancement Operations -> Show implicit Enhancement Options All Implicit Enhancement option will be displayed. All yellow lines indicate Implicit Enhancement options. In ABAP programs, implicit enhancement options are predefined at the following places: Begin/End of an include. Begin/End of Method/Function Module/Form Routine End of a structure End of Private/Protected/Public Section of a local class Step4: Place the cursor on the yellow line and choose Step6: Here Editor will be enabled to write the code. Step5: Give Implementation name and then create.Enhancement implementation à Create. Write your own code save and activate it. . . Note: Sales order 174 is created by another sales person (lz8xzf). When Sales person (lzn4rm) tries to Open Sales order no 174.Step 7: Once the development is completed you can test the scenario. it gives error message ’Access Denied’. Go to transaction code .Using Implicit enhancement technique 1.Goto->Item->texts Now you can see the item texts in editable mode .Restrict the modification of Delivery item texts .VL02N + press enter 2 . 3.Note: To make it non editable you need to enhance the code . Go to this subroutine and then Program –> Enhance . 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. 4 .Then follow Edit ->Enhancement Operations -> Show implicit enhancement Options 5 .Now you can see . Now it will ask for Enhancement type We have to implement code and it will look like this Enhancement . Go to implicit enhancement option at the end of the form and do right click -> Implementation -> Create 7 .6 . ENDENHANCEMENT. "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. 9. Activate the code and check VL02N .Here you can write the custom code for modifying the functionality 8. Include name LV70TFT3 ENHANCEMENT 4 ZTEXT_MODIF_BLOCK. User Exits/Screen Exits/Menu Exits Adding custom tab to the transaction VF01/VF02/VF03 item detail screen Go to VF02 transaction: . 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. .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’. b) Give a name to the structure for example ‘zzcustom_fields’. Creating the Custom fields a) Create the Z fields to the table VBRP. by appending the structure. .1. Enter the field name. Creating the screen and adding the Z fields a) Create a screen using the transaction SE51. 2. .Note: the added fields should follow the naming convention that they should start with ‘ZZxxxxx’. c) Save and activate. the .b) Get field from the dictionary which needs to be added to the screen. Go to SE80 and give the program name (SAPMV60A) of the VF01 transaction. .c) Save and activate the screen. Go to screen -> 6002. 3. In order to activate the custom tab for this requirement which is having the function code ‘PFCU’.In the ‘MODULE PBO_6002’ the subroutine PBO_6002_TABSTRIP_POS specifies the position of the tab. the module CUST_ITEM_ACTIVATE needs to be implemented. . a. and next click on the edit à enhancement operations -à à show implicit enhancement options. 4. First to find the enhancement spots click on the spiral icon in the menu bar. We have enhancement spots at the begin/end of the subroutine. Steps to write the code in the enhancement spots.To make use of this logic use enhancement frame work. . Start of the enhancement spot End of the enhancement spot Create the enhancement spot. . Click on the create enhancement implementation Give some name to the enhancement implementation. . . Select your implementation and then continue. Insert your code as below.Click enter and save in a package. In between the ENHANCEMENT and ENDENHANCEMENT statements Insert the below code. screen in VF03 before which is in changeable . a simple code is to be added.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. The mode. But where as in display mode it is changeable for it to be made disable. we have to enhance the screen using the exit ‘MM06E005’.After adding the code the screen is as follows in VF03 transaction. 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 . Step1: Go to transaction CMOD to create the project. 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. Step2: Now click on’ Enhancement assignments’ button to add the PO enhancement. .Click on Create button and provide the meaningful description in the following screen. Now open the Layout editor by click on Layout button. . Then it opens screen painter to add the contract number. Double click on screen ‘0101’.Step3: Now click on ‘Component’ button and activate the project. . 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. Save and activate.Select the contract number field from the table EKKO (Add the field contract number to the structure ‘CI_EKKODB’). . pterm TYPE dzterm. it_return LIKE TABLE OF fs_return. DATA: w_lifnr TYPE lifnr. DATA: fs_return TYPE ddshretval. END OF fs_value. FIELD-SYMBOLS : <fs_ekko> TYPE ekko. DATA: BEGIN OF fs_value.TABLES ekko. IF sy-subrc EQ 0. cstart TYPE vbdat_veda. MOVE <fs_ekko>-lifnr TO w_lifnr. ENDIF. vendorno TYPE lifnr. contractno TYPE bbp_er_ctr_no. it_value LIKE TABLE OF fs_value. SELECT vendorno contractno con_start_dt con_end_dt payment_terms FROM zcontract . ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. cend TYPE vndat_veda. When we select the contract number ‘9001’. READ TABLE it_value INTO fs_value WITH KEY contractno. 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 . ENDIF. ENDIF. ekko-contractno TO <fs_ekko>-contractno. When you execute the ME22N. MOVE :fs_return-fieldval TO ekko-contractno. IF sy-subrc EQ 0. ENDIF. the automatically the payment term field is filled with ‘0001’ as shown.INTO TABLE it_value WHERE vendorno EQ w_lifnr. ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. ENDIF. . IF sy-subrc EQ 0. MOVE fs_value-pterm TO <fs_ekko>-zterm. contractno = ekko- Step5: Save and activate include. IF sy-subrc EQ 0. IF sy-subrc EQ 0. READ TABLE it_return INTO fs_return INDEX 1. We can achieve this by enhance the method FS_GET in the method PBO classCL_BASIC_MODEL_VIEW_MM (Write the enhancement spot in the method FS_GET). FIELD-SYMBOLS: <fs_ekko> TYPE ekko. of the Step6: Now create the enhancement spot in the method ‘FS_GET’ and write the following code as shown. . We have to make it to display mode. <fs_fieldselection> TYPE MMPUR_FS.Now it is in enable mode. Go to transaction CMOD and create a project as shown below. IF sy-subrc EQ 0. the payment term field would be disabled. Adding custom fields to the Purchase Order transaction ME22N STEPS: Enhancement used: MM06E005 1. . Step7: Now execute the transaction ME22N. IF sy-subrc EQ 0. After selecting the contract number. READ TABLE my_fieldselection assigning <fs_fieldselection> WITH KEY metafield = '11'. <fs_fieldselection>-fieldstatus = '*'.ASSIGN ('(SAPLMEPO)EKKO') TO <fs_ekko>. ENDIF. ENDIF. IF <fs_ekko>-bsart EQ 'NB' AND <fs_ekko>-contractno NE space. ENDIF. Give the enhance name as MM06E005 and save. . Click on components button the following screen is displayed.2. Screen: 0111 is used for adding custom fields. 4.3.Create the required custom fields using the includes CI_EKKODB and CI_EKPODB The above 5 fields are added. Design the screen with the above fields. . 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 . Double click on the include and write the following code . . Custom tab with custom fields will appear as follow.Go to transaction ME22N and check at item level.The following is the code for the function module EXIT_SAPMM06E_018 6. We achieve this through configuration. Adding a field to "Sales Org View2" of MM01/MM02 (No screen exit/BaDI available) Requirement: In standard transaction Material Management (MM01/MM02). . Step1: Go to transaction SPRO and click on Create Program for Customized Sub screens as shown below. a custom field is to be added in the sales org view2 tab.Enter some data in the custom fields and save.Go to EKPO table and check the data. There is no screen exit or BADI's available. 7. Now select standard function group MGD1 of the transaction MM01. Click on save button. we consider sales org view2 and screen no 2157. These TWO screens (0001. In this case.Step2: Click on execute button. It contains all screens and sub screens of Material Management Transaction. Step3: Now go to SE80 and select FUNCTION GROUP and give the created function group ZMGD1 as shown. Step4: Now we have to identify the screen no where we need to add custom field. 0002) are default screens. the following screen appears and provide the function group ZMGD1. . 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. screen no 2157 copied to our function group as shown. .Click on Ok button. Step8: Now go to layout editor of screen 2157. Step7: Now add the field WBS Element in the table standard table MVKE as shown. We will get the following status message ' Screen SAPLZMGD1 2157 created' Step6: Now if we check the function group ZMGD1. add the following code in PAI. In flow logic. Activate the screen. . Activate the screen. Step10: Again go to SPRO. click on Define Structure of Data Screens for Each Screen Sequence as shown.Step9: Get the WBS Element from the table MVKE. . The following screen appears. Now click on sub screen. Select the screen sequence no 21 Click on Data screen. Now select the sale org view2 as shown.Click on execute button. The following screen will appear. Step11: Now go to MM02.Provide the name SAPLZMGD1 and save it. . 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. Manual printing of the attachments: . • This can be done manually from IW32. but it requires lot of efforts as each time required attachment needs to be opened and printed. it’s a time consuming procedure. So. • So.Step12: When checked at table MVKE. in this tutorial we demonstrate how we can achieve this using custom functionality using Enhancement. attachment list.1. 2. Select order. Go to IW32 and open the work order. 3. it will display the attachments for the work . Select ‘services for object’. for printing the attachments. Enhancement IW010018: Function exit used for this object is ‘EXIT_SAPLCOIH_018’ and screen exit ‘SAPLXWOC’ shown below. user have to follow the above procedure. In order to achieve this functionality. Every time. . open the document and then print it. the procedure becomes time consuming and also involves lots of efforts. 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. 5.4. Below I have demonstrated this functionality. In current scenario. user must to open the document manually and then print it. 6. So. 7. The internal tables being used in the function exit as well as in the screen exit must be declared in this include. Include ‘ZXWOCTOP’ must be used for data declaration.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. . click on include ‘ZXWOCU15’ and create Create a function module and call it in this include. Double it. Equipment number (CAUFVD-EQUNR). CAUFVD-PLNAL) we can fetch the related attachment names. 2. ‘SRGBTBREL’ and ‘SOOD’.Include ‘ZXWOCZZZ’ screen. . must be used to write any logic in the PBO and PAI of the Coding for Function exit: We need to start with the function exit ‘EXIT_SAPLCOIH_018’. task lists (CAUFVD-PLNTY. 1. functional location (CAUFVD-TPLNR). Ø We have CAUFVD structure available in this Function exit. Ø For that we need to use 2 tables. CAUFVD-PLNNR. Based on the work order number (CAUFVDAUFNR). we can fetch attachment name and its details.Ø Table SRGBTBREL will fetch the unique identification number for each attachment (INSTID_B). Coding for Screen exit: . We can take the desired fields from the internal table into new internal table I_WORK and pass it to screen exit. So. Using this number. Ø Below is the screenshot of the data fetching from these 2 tables. I_WORK will be populated with the details of the attachments of the work order. will be populated with the attachment details. Internal table I_OBJECTS. 1. Create a screen ‘0900’ in program ‘SAPLXWOC’, which is called ‘SAPLCOIH’. Create it as a subscreen type. 2. Go to layout and create a table control, which will display the list of attachments. in the program 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). 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. we need to read the contents of the attachment using FM‘SO_DOCUMENT_READ_API1' into internal table. . We are using class ‘CL_GUI_FRONTEND_SERVICES’ to get the attachment path and to print them. 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’. MODULE F_USER_COMMAND_0900_AFTER_LOOP witll check the sy-ucomm and print the attachments.5. For printing the attahcments. 6. 1. . If attachment is of URL type. we need to call METHOD ‘CL_GUI_FRONTEND_SERVICES=>GET_SAPGUI_WORKDIR’ to fetch the path/name of the attachment. then name of the attachment will be fetched.So . Go to IW32. Demo of printing attachments via IW32: Now. After that we need to download it on the local system using FM ‘GUI_DOWNLOAD’. Open work order having attachments. Then print the attachment using method ‘CL_GUI_FRONTEND_SERVICES=>EXECUTE’ with document path and ‘Print’ command. let’s see how enhancement tab displays the attachment details. The selected attachments will be printed. then this FM will give us the full path of the attachment else if attachment is of external type. Go list.2. Select button. 3. attachment it will and display attachment press ‘Print’ . to enhancement the tab. 4. 5. 6. Add fields to “COOMEP01”. Enhancement Process: 1. Once downloading of the attachment is done. so that these fields should get added to the field catalog of CJI3 report. . display message at the bottom after download is So. In CJI3 Vendor name will come for only invoices. Adding Fields to CJI3 Report Target Readers: SAP ABAP developers with basic knowledge of Customer Exits and Basic ABAP syntaxes. 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. Add fields to the view “V_TKALV”. structure “RKPOS” using field exit“CI_RKPOS” using Customer exit 2. the required attachments are printed. It will completed. when offsetting account type(GKONT) is K. but for GRN documents system will not show the vendor no. attachment is opened for printing and once printed it is closed. Purpose of the document: To add Vendor No and Vendor Name in report CJI3. Goto Enhancement Assignment and add “COOMEP01” and double click on include “CI_RKPOS”. Add required code in the exit “EXIT_SAPLKAEP_001” Step 1.3. Goto CMOD and Create a Project. Add customer required fields as shown below: . . For that we need to maintain View V_TKALV. enter V_TKALV and Press Maintain button Double click on “Field catalog information” And press push button “New Entries”.Step 2: Now we need to add the above fields in the field catalog of CJI3 . . Goto SM34. Add the required fields as shown below. . Then select these entries and click on “Selection dependencies” as shown below : . ELSEIF CS_RECORD-EBELN IS NOT INITIAL. CS_RECORD-ZZNAME1 = CS_RECORD-GKONT_KTXT.Press on New Entries and create the following entries: Now save the entries. CS_RECORD-ZZLIFNR = CS_RECORD-GKONT. SELECT SINGLE NAME1 INTO CS_RECORD-ZZNAME1 FROM LFA1 . Add required code in “EXIT_SAPLKAEP_001”. SELECT SINGLE LIFNR FROM EKKO INTO CS_RECORD-ZZLIFNR WHERE EBELN = CS_RECORD-EBELN. *&---------------------------------------------------------------------* *& Include ZXKAEPU01 *&---------------------------------------------------------------------* IF I_REP_OBJECT = 'PD'. IF CS_RECORD-GKONT IS NOT INITIAL AND CS_RECORD-GKOAR = 'K'. Step 3. IF SY-SUBRC = 0. ENDIF. I_REP_OBJECT specifies which report you are using. Now we will check CJI3 Report. so as to avoid unnecessary selection we need to keep the required value only. ENDIF. And activate the enhancement as shown below. ENDIF.WHERE LIFNR = CS_RECORD-ZZLIFNR. For CJI3 report the value for I_REP_OBJECT is ‘PD’. . Execute. . Now go to change catalog you will find the added columns as shown below. Now the O/P will be as shown below: . 1. Create a project YPM01 in CMOD transaction code.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. Then create the custom fields in screen 0100. create the fields in QMEL table of structure CI_QMEL.2. 3. Go to Components and double click on the screen 0100. 5. 4. 7. 6. Before creating the customer fields in screen. Open FM EXIT_SAPMIWO0_008 and create include ZXQQMU0. Open FM EXIT_SAPMIWO0_009 and create include ZXQQMU08. . Add the enhancement assignment QQMA0001 in the project. This FM is used to pass the value from screen to structure to store the value in table. This FM is used to pass the value from table to screen fields. 8. Now we can see how we can get these values in the standard report for notification. and in method FILL_ADD_FIELDS write your logic to fill alv. Now go to IW21 and see the custom fields. You can also add separate group using the method CHANGE_FIELD_CATALOG. 10. The transaction codes are IW28 and IW29. Activate the project. 9. Functional consultant will do the configuration where to show these fields. 11. Implement the BADI BADI_EAM_SINGLELEVEL_LIST. . You can view your group in the filter. If you are not finding the custom fields.12. then choose Settings>Layouts->Current. 13. Now run tcode IW28 and execute. 14. Now you can view the fields in ALV . Choose the custom fields from that. Pre-requisites: Create a transaction which navigates to the required portal or the end user manual as required.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. Enter the program name MENUSYST. . Procedure: Go to transaction SE41. Click on change. Following screen would be displayed: Double-click on System. The menu is expanded. .Select the radio button Status and select the value MEN using F4. Now select “Insert entry” from the context menu.Now you can add your own menu items here. . Please note that the change would reflect in all the transactions this is being used. Enter the custom menu-item as required. Select the position where you would like to include your custom menu-item and do the right-click. ZCOMPANY is the custom transaction code created for testing purpose. Set the function code to “T” in the following popup screen: . Now double-click on “ZCOMPANY”. 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): .Save and activate. To do this: Select the menu item to be deactivated and click on “Function Code”.We can even have sub-menu as well (see the screenshot below): We can also deactivate any of the menu-items as required. . Following message is displayed: Now the menu would look as follows (you can observe that the function “Own Jobs” is deactivated): . Note: along with Menu exits SAP also provides the function module exit to attach the functionality for each menu option. You can specify the menu items text when activating the item in an add-on project. if you get a screen as shown below. Working with Menu Exits Menu exits add items to the pull down menus in standard SAP applications. and press F4. through SMOD. SAP creates menu exits by defining special menu items in the Menu painter. You can use these menu items to call up your screens or to trigger entire add-on applications.You can activate the function by clicking on “Function Code” again. Choose from information system. 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. Go to transaction SMOD. i. Identify the menu exit from the standard transaction. These special entries have function codes that begin with ‘+’ (a plus sign). Example: Adding custom menu options for the standard transaction MC94.e. . 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. 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. 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 Now click on enhancement assignments. and open the project in change mode. Double click on required function code i. which is to be displayed as the menu option and click on Copy.Provide the enhancement name.e. . save it and click on components Now you will get the components of the exit. +CU1. Provide the function text. Save it as a local object and write the code as shown below. It will ask for creation click on Yes. And activate it. 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.Once the test is provided. . Enter the planning type and press enter .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. Execute the transaction MC94. 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. Enter the Material group and Material number.SSR3KOR” which is created now. Now in Menu à Extras à Customer functions you can find the Menu item “Create program . Now you will get a screen as shown below. . Now click on Active version. Click on Create program – SSR3KOR.e. CS02 and CS03 (Bill Of Materials) Requirement: Customer wanted to add two new fields Country and Vendor number to Bill of materials header level. STKO. first we need to add these two fields to BOM header record table i. You will get SE38 screen where you can create a program. then create a sub screen two hold these two fields and write the corresponding logic in the Functional exits provided. Adding custom fields to CS01. . Procedure: We need to add customer specific fields to BOM header level. STEP 2: Find an Enhancement for BOM. 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. A list of tables adjusted will be displayed. Bill of materials transaction CS01/02/03 is assigned to package “CS”. Go to transaction SMOD then go to Utilities-> find.The above steps are explained below in Detail. We can search for relevant Enhancements in CS package. ZZLAND1 and ZZVENDOR Check and Activate the append structure. In the search box provide Package name as “CS” Then Execute. Screen Areas in the next screen. You will get list of available Enhancements for the given package. With the given short text or the enhancement we can use Enhancement PCSD0003. You can see Functional Module Exits. . To see the Enhancement components press display button. Function codes. Then press create . 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.Select the relevant Enhancement and you can test the enhancement from SMOD transaction main screen. Then Click on the enhancement assignments button Add the selected enhancement there and enter then save.In the Next screen fill description for project and save as local object/ save to a package. . Go to back to Attributes of Enhancement project ZTEST screen Use COMPONENTS button to see the components for the enhancement. Now go back to components. Click on the function exit then press enter. Double click on the include A warning message appears ignore it and press enter. Double click on screen exit. Go to screen properties and mark it as sub screen. .From the above screen you can see Project and enhancement Implementation are in red color and other components also. In the next screen you can see Function Module EXIT_SAPLCSDI_004 In the function Module you can see a Include ZXCSAU04. Add customer fields to the screen. It will take you to Screen painter. .Include is ready to implement your code logic. Then go back to include and write your code logic.Double click on the USERDATA structure and Add an append structure. . Add two customer fields to the Append structure. Then activate project. Then go back to components list. We have implemented function exits and screen exit. When we activate the project red button will turn into green. Components will turn into green.Save include. Check and activate. STEP 4: check the added fields in CS03 Display Bill of materials. . For change and display transactions change the screen parameters. Add code to another function exit. Go to CS03 and give any material number. Implementing Screen-exit for transaction MIGO Requirement: Add new Tab to MIGO and store the custom values in a Z table. Solution: Create a BADI implementation for MB_MIGO_BADI . as there is no provision for adding custom fields in MSEG table except for Accounting details by Standard Include (CI_COBL). Select header button to navigate to header window. Plant and BOM usage press enter. There you can see a tab “Customer fields” and two customer fields. 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. 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.).Under the PBO method declare the program name and screen number as shown below: Under PAI method declare the field to ‘X’. 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. 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. In order to do any validations to the custom fields. material. . For these values to be available here in this method use the memory concept “Export to memory id” in the method LINE_MODIFY. ……. ENDIF. MODIFY SCREEN. Following is the transaction with the custom field: . SCREEN-INPUT = '0'. IF SCREEN-NAME = 'ZZGBAGS'. 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’. 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. ENDLOOP. use LOOP AT SCREEN. ZZBAGS = (fetched value from Z table).In order to make the fields to be in display mode during the display of material document. we have the provision for entering the telephone number with extension. Also assume that we do not use telebox for any of our customers and want to use that field for entering the mobile number. fax and telebox.Changing the description of the standard SAP fields Consider the following scenario: When entering the customer master details. Assume that we also need to enter the mobile number of the customer for which there is no provision. the description ‘telebox’ always misguides us. See the screenshot below: . Though you can directly enter the mobile number in the field “telebox” . Press F1 and then F9 to know the data element. See the screenshot below: .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 our first step is to know the data element used for the field “Telebox”. So we need to change the descriptions at the data-element level. Make a note of the data element. Now go to transaction CMOD . Click on Goto à Text enhancements à Keywords à Change . Click enter.Enter the data element. See the screenshot below: . The following screen would appear: Now change the descriptions as per the requirement. Now to verify the changes. Check the short description for the field EXTENSION2: Also go to transaction XD01 / XD02 and check the field: .Click on save. go to SE11 and enter the table name ADDR1_DATA. . Go to Transaction SPRO. Display IMG. 2. 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. Go to Logistics-General à Material Master à Configuring the material master and execute ‘Create Program for Customized Subscreen’.The description “Telebox” is now changed to “Mobile No”. Solution: 1. Create a function group of your own with Y or Z. 5. In this case the function group name given ZMGD1. 4. Open the screen 0001. .3. Using screen design layout (SE51). Go to transaction SE80 and open the function group created. customize the screen according to the requirement. here the function group is ZMGD1. Write the requirement. 7.6. PBO flow logic in PAI and PBO as per the . PAI input when Ztable material for material is displayed change/display .o Inactive (MM03) the fields for o Retrieve the (MM02/MM03) data from o Export the data into memory 8. Select the corresponding screen sequence number and double click on data screen button. .9. 10. 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’. In this case screen sequence ‘21’ has modified. 11. Select logical Subscreens. screen 07 (Basic Data 1) and double click on 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) 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. • • • 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’. so that they can be recognized when the user subscreens are processed. 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. it is possible to transfer to global variables at this point. 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. It was found. Import parameter : I_ANLU will be populated with the values for user-defined fields which will be passed to the subscreen program. 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. 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. 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. there must be some sort of variable assignment from I_ANLU. 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. it is called after reading of the data from the database. EXIT_SAPLAIST_003 Function module Documentation: This function module is called by SAP asset master data maintenance after the screens are processed. (When changing. . that enhancement AIST0002 will serve the purpose. the enhancement is determined.Pre-Analysis Finding out the Enhancement As described above. So. For interpreting or controlling master data fields that are important for user fields. but before saving. 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. which will then be saved into the database. the new custom subscreen will not be displayed in the Asset master screens.Studying the Documentation of the Enhancement The enhancement documentation (as is viewed from the initial screen of SMOD] also supports the idea. In the custom include of the function exit module ‘EXIT_SAPLAIST_002’. The screen group for the screen will be ‘CUST’ (or any name). Proper linkage/configuration has to be done so that the new subscreens get linked to the appropriate subscreen area of the Asset master screen. The changed values in the subscreen fields exist in global variable ANLU for the function group XAIS. The three custom fields added to table ANLU (by creating CI_ANLU) will be used to create new fields in the screen. This function exit module will pass the data back to the SAP main program as E_ANLU. Also. the final course of action was determined. data retrieved from database table ANLU will be passed to this FM as I_ANLU by the standard SAP main program. say. so that the three custom fields (referring to ANLU of XAIS) get populated. In the custom include of the function exit module ‘EXIT_SAPLAIST_003’. So. validation for Location to start with ‘L’ will be added. SrlNo Step Justification 1. This has to be done – otherwise. 1. the custom fields will get appended to the database table ANLU. 3. A custom subscreen. So. then those values will also be available to these function exits as well. referring which the three new subscreen fields are developed. the following code will be written:E_ANLU = ANLU. if the custom subscreen refers to the global data of the function group XAIS. Customizing include CI_ANLU has to be created with the custom fields demanded When CI_ANLU will be developed. 1. The value will be taken and passed to the global variable of the function group XAIS. I_ANLU is the import parameter of this FM. Moreover. 9000 will be developed under function group XAIS. 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. it informs that we need to develop a subscreen under function group XAIS. the following code will be written:ANLU = I_ANLU. 1. A project has to be created using transaction CMOD where the enhancement AIST0002 will be included. 2. these fields will be used to create screen fields in the new subscreen. This is the function group under which the two function exit modules also exist. In the PAI of the subscreen. The value is assigned to the global variable ANLU. . 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. activate everything – the whole project and come out. go back to transaction CMOD and change the function exits.Development Creating a Project to include the enhancement 1. Go to transaction CMOD and create a project. Enter a description for the project. 4. as required. save and activate the screen and come back to screen flow editor. Then. Drag the fields in the screen body and place them. as required . Then. Create the PAI module to add validation for field “Location 2”. 3. For the function group XAIS. Create it as subscreen. 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. Go to ‘Components’. . Then. Develop the subscreen and the program Go to transaction SE80. For that. go to the Layout of the screen and create three new fields from Database table ANLU. Activate the whole function group and come out. 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. Creating Custom Include for ANLU The screen shown below will appear. Double-click on the name of the Include Structure to create it. 2. Then. showing all the enhancement components under the assignment AIST0002. click on the pushbutton ‘Enhancement Assignments’ in the Application Toolbar. Write code in the Function Exits to synchronize the programs Now. Create the include structure with three new fields. save and activate it. create a new subscreen 9000. Enter the name of the enhancement and Save. Then. So. requirement is a bit different. go to transaction AOLK( information has to be obtained from functional consultant). Select the group box from the list. . it has to be copied and manipulated to include our screen group. there are multiple tab pages assigned to it. Then. Since layout ‘SAP’ cannot be changed.Complete the configuration to link the subscreen The development portion is complete. for Asset class 1000. But. for all the user groups. Assign the new Layout to Asset Class Now. Here. An entry will come with “U” padded with the custom subscreen prepared by you. Assets are created under Asset class. You want to put your custom fields in the tab page “General”. System will copy all the settings and will inform you about that. say. all the field groups currently residing in the tab-page “General” are shown. here. YSUB. Add an entry for your newly created fields. this linking can be done in the enhancement itself.Select the Asset Class ‘1000’ and click on folder ‘General Assignment of Layout’. Create new tab layout Go to transaction AOLA. For a layout. linking of the subscreen has to be done with the subscreen area of the main program. Copy the tab layout ‘SAP’ to create another layout. Here. we need to find out which layout is assigned to asset class 1000. save and come out. the requirement is to create these three custom fields in the tab page ‘General’ of asset master screen ( AS01/AS02/AS03/AS91). And for each asset class. In most of the cases. Save and come out. go to tcode AOLK and assign tab layout YSUB for asset class 1000. Later. for each tab page. there are multiple screen groups/field groups assigned. Here. It is done by configuration using SPRO. Determine the Layout To achieve this. Now.For that. select this tab page entry and doubleclick on the folder "Position of Groups". first of all. Select your newly created layout and double-click on the folder ‘Tab page titles’. And. there is a layout assigned to it. tab layout SAP is assigned. the new layout has to be assigned over here. Then. SELECTION-SCREEN SKIP. Add values to them…save. You will see your new fields added to the screen.Test the Exit Everything is over.Enter the Transaction Code that you want to search through for a User Exit REPORT z_find_userexit NO STANDARD PAGE HEADING. *&---------------------------------------------------------------------* *& Selection Screen Parameters *&---------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001. "Directory of Repository Objects modsapt. SELECTION-SCREEN END OF BLOCK a01. "Function Module enlfdir. DATA : field1(30). "SAP® Enhancements . SELECTION-SCREEN SKIP. DATA : v_devclass LIKE tadir-devclass.com Find User exits with TCode Selection Text: P_TCODE: Transaction Code to Search Text Symbols: 001 . "SAP® Transaction Codes tadir. "Additional Attributes for Function Modules tstct. *&---------------------------------------------------------------------* *& Start of main program *&---------------------------------------------------------------------* START-OF-SELECTION. *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Tables *&---------------------------------------------------------------------* TABLES : tstc. *&---------------------------------------------------------------------* *& Enter the transaction code that you want to search through in order *& to find which Standard SAP® User Exits exists. Original Source: ittoolbox. PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.Short Texts modact. "Transaction Code Texts *&---------------------------------------------------------------------* *& Variables *&---------------------------------------------------------------------* DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE. Now. enter into the tcodes again to see whether the values entered by you are being displayed or not. "System table TRDIR tfdir. go to transaction code AS01/02/03 or AS91 to deal with an asset of asset class 1000. "Modifications trdir. . FORMAT COLOR COL_HEADING INTENSIFIED ON. 20(20) p_tcode. LOOP AT jtab. FORMAT COLOR COL_POSITIVE INTENSIFIED OFF. 45(50) tstct-ttext. 21 sy-vline . SELECT SINGLE * FROM trdir WHERE name = tstc-pgmna. SELECT SINGLE * FROM modsapt . * Find Repository Objects for transaction code IF sy-subrc EQ 0. 2 'Exit Name'. WRITE:/(95) sy-uline. IF trdir-subc EQ 'F'. SELECT SINGLE * FROM tfdir WHERE pname = tstc-pgmna. WRITE:/(19) 'Transaction Code . SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name = tstc-pgmna. MOVE : tadir-devclass TO v_devclass. SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR' AND object = 'FUGR' AND obj_name = enlfdir-area. IF NOT jtab[] IS INITIAL. 95 sy-vline.* Validate Transaction Code SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode. ENDIF. SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu AND tcode EQ p_tcode. SKIP. WRITE:/(95) sy-uline. IF sy-subrc NE 0. * Find SAP® Modifications SELECT * FROM tadir INTO TABLE jtab WHERE pgmid = 'R3TR' AND object = 'SMOD' AND devclass = v_devclass. 22 'Description'. MOVE : tadir-devclass TO v_devclass. WRITE:/1 sy-vline.'. SELECT SINGLE * FROM enlfdir WHERE funcname = tfdir-funcname. ENDIF. WHERE sprsl = sy-langu AND name = jtab-obj_name. DESCRIBE TABLE jtab. 2 jtab-obj_name HOTSPOT ON. CHECK field1(4) EQ 'JTAB'. AT LINE-SELECTION. Enter Project Name. 95 sy-vline. WRITE:/(95) 'No User Exit exists'. ENDIF. ELSE. WRITE:/(95) 'Transaction Code Does Not Exist'. * Take the user to SMOD for the Exit that was selected. ENDLOOP. Description & Package à Save . Go to Transaction EEWB à Right click on ProjectàCreate Project. It would also explain the deleting process of the fields. FORMAT COLOR COL_NORMAL INTENSIFIED OFF. 22 modsapt-modtext. 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). FORMAT COLOR COL_TOTAL INTENSIFIED ON. 21 sy-vline . ENDIF. SKIP. FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN. WRITE:/(95) sy-uline. ELSE. sy-tfill. SET PARAMETER ID 'MON' FIELD sy-lisel+1(10). GET CURSOR FIELD field1. WRITE:/1 sy-vline. WRITE:/ 'No of Exits:' . FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. 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). The following wizard is shown. Click on ‘Continue’. Select your Cardinality and Time constraints and click on ‘Continue’. . In the following screen. enter the Frame Title as shown or as per your requirement and click on ‘Continue’. enter the fields that you want on the screen in the tab 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. In the following screen. . The following screen is shown reading ‘Complete’. Click on ‘Complete’. 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. Go to Transaction ‘BP’.The below shown screen will appear as an indication of the fields that you have added and projects the relevant information. Press ‘Enter’. . Enter the business partner details. 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.You can observe that there is an additional tab added named “Customer Data”. . In the pop-up that follows. As shown above. . DELETING PROCESS Come to transaction ‘EEWB’. right click on the Table name that you added and click ‘Delete’. click on ‘Continue’. We are now done with the Creation of the table fields in the custom tab.You can toggle to Change Mode and enter the details in the fields. Right click on the project name and click ‘Delete’. in this screen. The following screen is displayed. click on ‘Yes’.In the pop-up that follows. Now. click on ‘Yes’. . In the pop-up that follows. . Click on ‘Yes’. Working with User-Exits Enter the transaction VA01.In the pop-up that follows. We are now done with the deleting part as well. We will get the name of the program as (SAPMV45A). .Go to menu System and select sub item status. Now go to SE38 Editor and type the program name as SAPM45A. And select subobjects .attributes radio button and press Display. ) . In this case. it is VA Now go to SMOD Transaction (SMOD is used to find the enhancements and user exits.Note the package name. But we don’t known the Enhancement name so press the Utilities > Find menu option.Here if we enter the enhancement name it results the list of user exit names. . .Press Execute . In the above enhancements our program name SAPMV45A Matches four enhancements. If one material is not available what is the other material that has to be used as an alternative.Collector for customer function module pool MV45A .e. • • • • V45A0001 V45A0002 V45A0003 V45A0004 . So.Predefine sold-to party in sales document .Determine alternative materials for product selection . FUNCTION *"---------------------------------------------------------------------*"*"Lokale *" EXIT_SAPFV45S_001. In the below enhancements we have to check the right one. (i. V45A0001 – The Description of this enhancement tell us that it determines the alternative materials for product selection.. So it is item specific). Schnittstelle: IMPORTING . My Analysis : Every Function Module for Enhancement supplies some Import and Export Parameters. Through which we get some values.Copy packing proposal into outbound Delivery. this user exit is not useful.*" *" *" *" *" *" *" 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. So.: Field Modification Sales .Collector for customer function module pool MV45A . TVAK TVTA LIKE Schnittstelle: IMPORTING STRUCTURE TVAK STRUCTURE TVTA VBAK-VKGRP And even the importing parameters are not useful for us. V45A0003 . let us drill down.Rec.) and other header data form VBAK.Copy packing proposal Into Out bound delivery. it is used to populate the field sold-to party through user-exit while entering the data. So.By Description we understand that we can predefine sold-to party in the sales document. FUNCTION *"---------------------------------------------------------------------*"*"Lokale *" *" VALUE(I_TVAK) LIKE *" VALUE(I_TVTA) LIKE *" VALUE(I_VKGRP) *" VALUE(I_VKBUR) LIKE VBAK-VKBUR EXIT_SAPMV45A_002.. We have 2 exits.This description some what looks good . 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.e. ) But our requirement comes after entering the data in the screen and save button is pressed. Function module Short Text EXIT_SAPMV45A_003 Rev. (i.Rec.: Copy Requirements An Header EXIT_SAPMV45A_004 Rev. V45A0004 . V45A0002 . So. there is no chance for us to save the data while we create or change a Sales order. But description there is no functionality mentioned. EXIT_SAPMV45A_003 . LIKE STRUCTURE STRUCTURE LIKE Schnittstelle: IMPORTING FELD-NAME VBAP VBUPVB FELD-GRP4 From Exit 004 Description and Importing parameters we can clearly see that this exit is used for Field modifications. Once we find the user exits.From the Description and Importing parameters we get the header data that can be used for our requirement. FUNCTION *"---------------------------------------------------------------------*"*"Lokale *" *" VALUE(XVBAK) LIKE VBAK *" VALUE(XVBUK) LIKE VBUK *" VALUE(XKOMK) LIKE KOMK STRUCTURE KOMK EXIT_SAPMV45A_003. So.FUNCTION *"---------------------------------------------------------------------*"*"Lokale *" *" VALUE(I_SCREEN_NAME) *" VALUE(I_VBAP) LIKE VBAP *" VALUE(I_VBUP) LIKE VBUPVB *" VALUE(I_SCREEN_GROUP4) *" VALUE(I_T180_AKTYP) LIKE T180-AKTYP EXIT_SAPMV45A_004. We go to CMOD. The purpose of the CMOD is to register what we are going to do in the particular enhancement. . STRUCTURE STRUCTURE Schnittstelle: IMPORTING VBAK VBUK The purpose of SMOD is to find User Exits. at the time of up gradation it will be easy to retain the code. click on Save and then on “Enhancement assignments) Now enter your enhancement name. Now in the next screen (see below).click on Create. click on Save and then on “Components” Now double click on the required function exit . . data: gt_exit type zexit. elseif gs_inr < '100'. ENDIF. gt_exit-vtweg = xvbak-vtweg. gt_exit-zstatus = 'High Value'. . gt_exit-zstatus = 'Normal Value'. insert into zexit values gt_exit. endif. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. if gs_inr > '1000'. clear gt_exit. gt_exit-spart = xvbak-spart. gs_loc type vbak-waerk value 'INR'. gt_exit-vbeln = xvbak-vbeln. 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 . gs_inr TYPE vbak-netwr. gt_exit-vkorg = xvbak-vkorg. elseif gs_inr > '100' and gs_inr < '1000'. gs_vbeln TYPE zexit-vbeln. gt_exit-zstatus = 'Low Value'. IF sy-subrc <> 0. FK01 andMK01. Note : This field Enhancement will reflect in the transactions XD01.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”. em no and Fiscal address under Tax Information (as shown below) Go to “CMOD” transaction . Go to “MK01” transaction Enter the Vendor. Purchase Organization and Check the Control details in General data The Enhancement fields are SS number. Go to Standard Menu : Goto-->Text enhancements-->Keywords-->Change Enter the Data Element: STCD1 Change Description : ss number . Change Tax Code1 is as shown below Press “Save” Specify the Request Number . Enter the Data Element: STCD2 Change Tax Code2 as shown below Press “Save” Specify the Request Number Enter the Data Element : FISKN_K . . Go to transaction MK01. The Field Enhancement details are shown below.Change description is as shown below with “Financial Year” Press “Save” Specify the Request Number Now. Then add a Screen Group (SK here)and meaningful description.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. Save the entry and then SELECT that entry and Click on ‘Label Tab Pages’. . Following screen appears: Go to CHANGE mode and Click ‘New Entries’ button. Click Business Add-in: Processing Master Data Enhancements Create one Implementation by giving implementation name (must start with Z.e. . Function Code and Meaningful Description. enter a Screen Number. The following screen appears.Add a Label Tab Page i. Save the entry and come back to the SPRO screen. Give meaningful description and press enter. ZSURESHKUMAR here). . endif. data: l_flg_active type BOOLE-BOOLE. Add the following code and save. if i_screen_group = 'SK'. method IF_EX_CUSTOMER_ADD_DATA~CHECK_ADD_ON_ACTIVE . e_add_on_active = 'X'. endmethod.Go to Interface and Click on ‘CHECK_ADD_ON_ACTIVE’ method. 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). Enter a meaningful Description and Screen Group (which we created earlier) as shown below. The following screen will come. .Press enter. e_headerscreen_layout = ' '. endcase. endmethod. case i_taxi_fcode. when 'SK_TAB'.Then go to Interface Create a Function Pool SAPLZSURESHKUMAR. method IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN . . Create a Screen ‘1111’ with field old Customer Number – screen group PSK (SE51) Click on GET_TAXI_SCREEN method and add the following code. e_screen = '1111'. "Eart + Objekt e_program = 'SAPLZSURESHKUMAR'. (See the code of the program for other details). Activate and leave the transaction. Now go to XD01 transaction. . Go to KNA1 (Customer Master) table and add a custom field as shown below. Activate the table. . Click the button.The screen we created will appear as shown in the above screen-shot. The following screen will appear. Now we need to disable that field when we are opening the transaction in DISPLAY mode.Enter a customer number and save the transaction. . The value you entered in this screen will appear on there. we have written code for creating the Custom field. Go to include – LZSURESHKUMARTOP and enter the following code and activate the program. Now go to KNA1 table and check the value of the Old Customer Number field’s value. Until now. * SET TITLEBAR 'xxx'. constants: c_oldcustno(24) value '(SAPMF02D)KNA1-ZZOLD_CUST_NO'. screen number 1111. field-symbols: <fse>. * SET PF-STATUS 'xxxxxxxx'. * data: l_oldcustno type kna1-zzold_cust_no. Populating the data into our custom fields By Lokesh Reddy Avutu. MODULE STATUS_1111 OUTPUT. YASH Technologies Add the following code to the program SAPLZSURESHKUMAR. .Now execute the Transaction in display mode and check the output. assign (c_oldcustno) to <fse>. if sy-subrc = 0. assign (c_oldcustno) to <fse>. "l_oldcustname is the screen name of old cust field endif. and write this logic move-corresponding proj to cnci_proj_exp. endif. s_kna1. Loop at screen. Go to se11 and in the PROJ table u will find ci_proj include . 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. 4. . 5. ENDMODULE. Modify screen. Screen-input = 0. "STATUS_1111 OUTPUT Saving the data back to database from screen field In the interface IF_EX_CUSTOMER_ADD_DATA_CS.if sy-subrc = 0. Endif. constants: c_oldcustno(24) value '(SAPLZSURESHKUMAR)l_oldcustname'. go in the INCLUDE ZXCN1U11 and write this logic move-corresponding sap_proj_imp to proj. data:l_zztest type kna1-zztest. in this add the required custom fields. l_oldcustname = <fse>. create the subscreen and in the layout choose Dictionary. Endif. 1. If u want to write any logic before the screen is displayed do it in PBO. go in the INCLUDE ZXCN1U12./Program fields and drag and drop in the screen . add the following code in the method GET_DATA method IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA . If sy-tcode = 'XD03'. field-symbols: <fse> type any. Endloop. 2. Go to se51 give SAPLXCN1 in the program name with screen number 0600 . Activate the project .ZZOLD_CUST_NO = <fse>. Now in the function exit EXIT_SAPLCJWB_003 . Now in the function exit EXIT_SAPLCJWB_002 . If screen-group1 = 'PSK'. 3. endmethod.
Copyright © 2024 DOKUMEN.SITE Inc.