Posts

Showing posts from August, 2012

Sample Program On Implementing Customer Exit - Step-By-Step - SAP ABAP

Image
Say there is a requirement to default sold to party while creating a sales order via VA01 transaction code. We have a function module exit already available 'EXIT_SAPMV45A_002' which can be used to pre assign sold to party in any sales order. You need to do the following steps to make this work. 1) Use the program Z_WHERE_USED_EXIT_SMOD_CMOD to find the name of the enhancement and the project of the function module exit. On executing, we get: 2) Here it can be seen there is no project created for the customer exit. 3) Hence the first step is to create a new project name via CMOD transaction. Assign V45A0002 enhancement to the project and activate it as shown. 4) Go to SE37 --> EXIT_SAPMV45A_002 --> Double Click on Z include. You will get a warning message. Click enter button and you will see a pop up window asking you to create a new object. 5) Click On Yes and save it in a package and request. You will get the zinclude in edit mode. Make

Sample Program - Find Where Used Exits & Enhancements - Via CMOD & SMOD.

Image
This sample program will help you to find whether a function module exit has already been assigned to any enhancements. Also it will give information regarding Project name & enhancement name related to the function module exit. SAMPLE PROGRAM: REPORT z_test_where_used_exit_smod_cmod. SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(30) userexit FOR FIELD member1. PARAMETERS: member1 TYPE modsap-member. "Function Module (User EXIT) SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 100. SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) enhname FOR FIELD member2. PARAMETERS: member2 TYPE modact-member. "Enhancement (SMOD) SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 200. SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 5 LINES, TAB (40) button1 USER-COMMAND push1, TAB (40) button2 USER-COMM

SAP ABAP - Implementing Or Activate Customer Exits / Function Module Exits.

Image
CMOD & SMOD are two transactions in SAP to manage exits. SMOD simply displays the enhancements present in the SAP System. This transaction is used to see the list of objects in an enhancement. It is a container which holds many related objects within it. CMOD is the project management of SAP enhancements (i.e. SMOD Enhancements). SMOD contains the actual enhancements while CMOD actually is the grouping of the SMOD enhancements. Transactions CMOD n SMOD are 2 parts of the enhancement. Using SMOD you can search for enhancement and their respective component. An enhancement includes one or more components (function exits, menu enhancements and screen enhancements). CMOD transaction code is used to create a project. Project is also a container, which holds several Enhancements. In case we know the user exit, and we have done the necessary changes as per the requirement then it won’t work unless and until a project is assigned to the exit. Hence it’s import

Finding Customer Exits Via SE81 SAP Transaction - SAP ABAP.

Image
Finding/Searching of customer exits for any SAP transaction can be achieved in many ways and method. The second method is via SE81 SAP transaction code. This method is extremely helpful in case if we are looking for customer exits available for a particular business, say MM-Purchasing, SD-Pricing, etc..) Follow the steps shown below to find customer exits using this method: 1) Go to transaction SE81. 2) Expand MM --> Place The Cursor On MM-PUR --> Go to EDIT option available on the top of the screen --> Click On 'Select Subtree +/-' --> Now Click On Information System Pushbutton available on the screen as shown. 3) You will be directly navigated to the OBJECT NAVIGATOR (SE84). 4) Expand Enhancements --> Expand --> Customer Exits --> Select Enhancements. You can see automatically the package field is filled up with all the packages involved with MM Purchasing. 5) Execute it and you will find all the customer exits available fo

Finding Customer Exits Via SMOD Transaction - SAP ABAP.

Image
Finding/Searching of customer exits for any SAP transaction can be achieved in many ways and method. The second method is via SMOD SAP transaction code. Follow the steps shown below to find customer exits using this method: 1) Go To SMOD Transaction. 2) Press F4 on Enhancement. 3) Click on Information System to make a new search. You will get a new screen as shown: 4) Suppose you want to find all the customer exits for ME21N, ME22N & ME23N. First you need to find the package of these transactions. 5) To find Package of any transaction: Go to ME21N --> System --> Status --> Program --> Double Click On program --> Go to --> Attributes. In The attributes section you can find the package of the transaction code. For ME21N, the package is ME. 6) Now that you have got the package name simply put the package name as shown in step 3 and click enter 7) You will get a list of all the function module exits available for the respective packa

SAP ABAP - Finding Function Module Exits (Customer Exit).

Image
Searching of customer exits for any SAP transaction can be achieved in many ways and method. The first method for finding a customer exit or function module exit is by searching for CALL CUSTOMER_FUNCTION Keyword. Follow the steps shown below to find customer exits using this method: 1) Consider any SAP Transaction. Let us take transaction 'MIRO' --> System --> Status. 2) Double Click On Program (Screen) Name. In this case it's 'SAPLMR1M'. 3) You will be navigated to the program. Now click on search button and find 'CALL CUSTOMER-FUNCTION'. 4) You will find a list of all the function module exits available for MIRO transaction. 5) Similarly you can find customer exits for any SAP transaction code. RELATED POSTS: - USER EXITS - Introduction, Importance & How To Find Them. - Difference Between BADI & ENHANCEMENTS? - Customer Exits - Introduction, Importance & It's Types. - Difference betw

SAP ABAP - Function Module Exits (Customer Exits).

Image
Function module exits are exits developed by SAP which are implemented as a call to a function module. Code is not written directly in the function module, but in the include program, of the function module. Example: CALL CUSTOMER-FUNCTION '910' The naming standard of function modules for function module exits is: EXIT_<program name>_<3 digit suffix> Some of the function module exits available for MM –Purchasing Check function group ‘XM06’in SE80 – It Contains a list of function module exits for Materials Mgmt. (Purchasing). Similarly check the other screenshots also . MM - Purchase Requisition: Function Group XM02 Sales Order: Function Group XVVA CIN 2.0 HOW TO FIND FUNCTION MODULE EXITS (CUSTOMER EXITS) ? Basically there are three ways, 1) Search 'CALL CUSTOMER' keyword in search programs. 2) Via SMOD transaction. 3) Via SE81 Transaction. RELATED POSTS: - USER EXITS - Introduction, Importa

SAP ABAP - Customer Exits - Types & How It's Different From User Exits.

Customer exits are basically hooks created by SAP within many standard programs, screens and menus on which abapers can “hang” custom functionality to meet business requirements. Initially these exits do not contain any functionality . Hence it’s said that they simply acts as a Hook. We can hang our own add-on functionality onto these hooks. Customer exits are nothing but a include program present in a function module which starts with CALL CUSTOMER-FUNCTION keyword. One can fill it with his/her own source code. Technically this is an enhancement. User exits generally refer to SD module while customer exits refer to all modules like MM, SD, PP, FICO etc. The best part of customer exits is it does not affect standard SAP source code plus these exits do not affect software updates. Types of Customer Exits available are: 1) Function Module Exits. 2) Screen Exits 3) Menu Exits. Difference between User Exits & Customer Exits? - USER EXITS are FORMS and are

SAP ABAP - Hashed Internal Table (Table's Key Access) With Example.

Image
Submitted By: Shilpa Gunjan (L&T Infotech) (Hashed Table performance when the key used is table’s key) Now the table SKB1 has a primary key which is a combination of BUKRS (Company Code) & SAKNR (G/L Account Number). When we make a hashed table with key same as the table key, the performance improves drastically as shown. REPORT z_internal_table_performance. *Sorted Internal table (Performance) PARAMETERS p_ktopl LIKE t001-ktopl. PARAMETERS p_bukrs LIKE skb1-bukrs. PARAMETERS p_saknr LIKE skb1-saknr. DATA: v_time1 TYPE i, v_time2 TYPE i, v_time_f TYPE i. DATA: st_skb1 TYPE STANDARD TABLE OF skb1, so_skb1 TYPE SORTED TABLE OF skb1 WITH UNIQUE KEY bukrs saknr, ha_skb1 TYPE HASHED TABLE OF skb1 WITH UNIQUE KEY bukrs saknr, wa_skb1 TYPE skb1. SELECT * FROM skb1 INTO TABLE st_skb1. WRITE: /'No.Of Entries Fetched:', sy-dbcnt. ULINE. so_skb1 = st_skb1. ha_skb1 = so_skb1. *********STANDARD TABLE************** CLEAR: wa_skb1, v_time1, v

SAP ABAP - Hashed Internal Table (Partial Key Access) With Example.

Image
Submitted By: Shilpa Gunjan (L&T Infotech) Comparison between Standard, Sorted & Hashed internal tables & it's performance. (Hashed Table performance when the key used is table’s partial key) REPORT z_internal_table_performance. *Internal table (Performance) PARAMETERS p_ktopl LIKE t001-ktopl. PARAMETERS p_bukrs LIKE skb1-bukrs. PARAMETERS p_saknr LIKE skb1-saknr. DATA: v_time1 TYPE i, v_time2 TYPE i, v_time_f TYPE i. DATA: st_skb1  TYPE STANDARD TABLE  OF skb1, so_skb1  TYPE   SORTED TABLE OF skb1 WITH UNIQUE KEY  bukrs saknr, ha_skb1  TYPE HASHED TABLE OF skb1 WITH UNIQUE KEY  bukrs saknr, wa_skb1 TYPE skb1. SELECT * FROM skb1 INTO TABLE st_skb1. WRITE: /'No.Of Entries Fetched:', sy-dbcnt. ULINE. so_skb1 = st_skb1. ha_skb1 = so_skb1. *********STANDARD TABLE************** CLEAR: wa_skb1, v_time1, v_time2, v_time_f. GET RUN TIME FIELD v_time1. READ TABLE st_skb1 INTO wa_skb1 WITH KEY bukrs = p_bukrs. GET RUN TIME FIELD v_

SAP ABAP - Hashed Internal Table (Non-Index Table) With Example.

Submitted By: Shilpa Gunjan (L&T Infotech) - Hashed Internal Tables are the most appropriate type of table where the main operation or access is via key and not index. Hashed tables cannot be accessed via index. - Like database tables, hashed tables too have a unique key . Hashed tables cannot have a NON-Unique key. The key has to be Unique and hence one must specify UNIQUE keyword in the table definition . - The response time for key access remain constant, regardless of the number of table entries because the access is carried out via a hash algorithm. - If a hashed table is accessed with a key that is different to the unique table key, the table is handled like a standard table and searched linearly according to the entries. Same applies for partial key also. - Hashed table should only be used where the unique key is the only type of access, particularly if there is a need to process very large table. - Using hashed internal tables the 100,000th record is

SAP ABAP - Sorted Internal Table With INDEX Access (With Example)

Submitted By: Shilpa Gunjan (L&T Infotech) Here's an example on sorted internal table using INDEX access. This example will help you to understand how to improve performance using Sorted Internal Tables. REPORT z_internal_table_test. *Sorted Internal Table (Performance) TYPES: BEGIN OF x_marc, matnr LIKE marc-matnr, werks LIKE marc-werks, pstat LIKE marc-pstat, flag TYPE c, END OF x_marc. *Internal Table Declaration DATA: it_marc TYPE SORTED TABLE OF x_marc WITH NON-UNIQUE KEY werks. * Table Workarea Declaration DATA: wa_marc TYPE x_marc. * Variable Declaration DATA: v_counter TYPE i, v_runtime1 TYPE i, v_runtime2 TYPE i, v_tabix LIKE sy-tabix. SELECT matnr " Material Number werks            " Plant pstat               " Maintenance status FROM marc INTO TABLE it_marc. GET RUN TIME FIELD v_runtime1. READ TABLE it_marc INTO wa_marc WITH KEY werks = '1501'. IF sy-subrc EQ 0. v_tab

SAP ABAP - Sorted Internal Table With Key Access (With Example)

Submitted By: Shilpa Gunjan (L&T Infotech) Here's an example on sorted internal table to verify it's performance. REPORT z_internal_table_test. *Sorted Internal table (Performance) TYPES: BEGIN OF x_marc, matnr LIKE marc-matnr, werks LIKE marc-werks, pstat LIKE marc-pstat, flag TYPE c, END OF x_marc. *Internal Table Declaration DATA: it_marc TYPE SORTED TABLE OF x_marc WITH UNIQUE KEY matnr werks. * Table Workarea Declaration DATA: wa_marc TYPE x_marc. * Variable Declaration DATA: v_counter TYPE i, v_runtime1 TYPE i, v_runtime2 TYPE i, v_tabix LIKE sy-tabix. SELECT matnr       " Material Number werks                     " Plant pstat                       " Maintenance status FROM marc INTO TABLE it_marc. GET RUN TIME FIELD v_runtime1. LOOP AT it_marc INTO wa_marc WHERE werks EQ '1501'. ADD 1 TO v_counter. ENDLOOP. GET RUN TIME FIELD v_runtime2. * Calculate Runtime v_runtime2 = v_runtime2 - v_runtime1.

SAP ABAP - Sorted Internal Table (Index Table) With Example.

Submitted By: Shilpa Gunjan (L&T Infotech) - Sorted tables are always sorted by key i.e. records are always in sorted order. Hence sorted tables cannot be sorted again. If you still try to sort a sorted internal table you will get an error message '<Internal Table Name>' is a table of the kind SORTED. You cannot use the SORT command with this type of table.’ - Sorted tables are also referred as Index tables because the entries can be accessed via index. - Sorted tables can be accessed either by index or by key. For a key access the response time depends logarithmically on the number of tables entries because read access is carried out via binary search. - Reading entries from sorted table is efficient because the access is via binary search. - The key that is used to read sorted table are always either unique or non-unique . Sorted Internal tables cannot be declared without UNIQUE/NON-UNIQUE Keyword. - Sorted tables are mostly used when there i