a user exit is a place in a software program where a customer can arrange for their own tailor

61
A user exit is a place in a software program where a customer can arrange for their own tailor-made code. SD module has a large number of User exit available. The below is the create/ change sales order screen (VA01/VA02). The requirement is to put the validation to the line items such that the quantity field for the line item should not be less than 2 units. Step 1: How to find the appropriate USER EXIT. Go to object navigator(SE80) and select package from the list and enter VMOD in it. All of the userexits in SD are contained in the development class VMOD. Press enter and you will find all includes which contain userexits in SD for different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in it and start coding .

Upload: rsvv-prasad-rao

Post on 03-Jan-2016

357 views

Category:

Documents


1 download

DESCRIPTION

Abap user exits

TRANSCRIPT

Page 1: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

A user exit is a place in a software program where a customer can arrange for their own tailor-made code.

SD module has a large number of User exit available.

The below is the create/ change sales order screen (VA01/VA02).

The requirement is to put the validation to the line items such that the quantity field for the line item should

not be less than 2 units.

Step 1:   How to find the appropriate USER EXIT.

Go to object navigator(SE80) and select package  from the list and enter VMOD in it. All of the userexits in

SD are contained in the development class VMOD. Press enter and you will find all includes which contain

userexits in SD for different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to

the requirement and read the comment inserted in it and start coding .

Page 2: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

There is a lot of confusion in using USER EXIT, like do we need access key to modify the USER EXIT ?.

The answer is Yes as well as NO.

If you see the include MV45AFZZ.we have many FORMS and ENDFORMS init which is in custom name space.

So we don’t need key to modify it. Check out the below screen shot.

Page 3: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

So open that include and write your logic in ZMV45AFZZ_SAVE_DOCUMENT_PREP.

While some EXITs like MV50AFZ1. You need an access key to modify it Don’t get puzzled, this is how SAP has

given J.

Step 2:

So we got our USEREXIT   ZMV45AFZZ_SAVE_DOCUMENT_PREP. Open it and put the below code inside it.

data: lv_flag(1)   type c.

* exit if not SAVE

if sy-ucomm ne ‘SICH’.

leave to screen sy-dynnr.

endif.

* check line items

clear lv_flag.

loop at xvbap where updkz ne ‘D’.

*   This checks for quantity less than 2

*   As xvbap-kwmeng is pack with 3 decimal we are comparing with 2000

if xvbap-kwmeng < 2000.

message i000(fb) with ‘quantity is less than 2′.

Page 4: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

lv_flag = ‘X’.

clear sy-ucomm.

exit.

endif.

endloop.

if lv_flag = ‘X’.

leave to screen sy-dynnr.

endif.

Go To Transaction VA01/VA02 and try to create/change the order item quantity less than 2.

Page 5: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

1. What is a User Exit?

User exits allow you to add additional functions to the SAP standard. Programs with user exits contain Subroutine (Form Routines) calls at certain points in

their syntax that are identified by the prefix USEREXIT. The actual User Exits Form Routines are located in an Include Program that has been

assigned to a Module Pool Program.. The following diagram explains this:

In the User Exits Form Routines customers can include any changes (enhancements) that they want to make to the system. These includes are always processed during program flow

So the SAP developer creates a special include in a module pool. These includes contain one or more subroutines routines that satisfy the naming convention USEREXIT_<name>. The calls for these subroutines have already been implemented in the R/3 program.

A user exit is considered a modification, since technically objects in the SAP namespace are being modified.

After delivering them, SAP never alters includes created in this manner; if new user exits must be delivered in a new release, they are placed in a new include program.

2. In which SAP component User Exits are primarily used?

User exits are primarily used in the Sales and Distribution component.

3. What are the advantages and disadvantages of User Exit?

Advantage: In principle, customers can modify anything they want that is found in the include (tables, structures, and so forth).

Disadvantage: SAP cannot check the individual enhancements themselves which often leads to errors in the enhancement process.

Page 6: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

4. How can we find overview of User Exits as well as a description of those user exits that exist in SD?

We can find overview of User Exits as well as a description of those user exits that exist in SD in the SAP Reference IMG under Sales and Distribution -> System Modification -> User exits.

Steps:

Go to transaction : SPRO Go to Sales and Distribution -> System Modification -> User exits

5. How do you find User Exit in any transaction say VA01 – Create Sales Order?

Step 1: Find the Module Pool Program

Go to the transaction – VA01 – Create Sales Order.

Then Go to SYSTEM in the Menu bar and then to STATUS from where we can find the ‘Program (screen)’.

Page 7: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Step 2: Find the Includes Program that contains User-Exits

Double click that ‘Program (screen)’. Generally user-exits are always at the start of the standard SAP program

Page 8: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Step 3: Find the User Exit Subroutines

Double click on any of these Includes that contains User-Exits. You can see various subroutines with prefix USEREXIT.

Page 9: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Customers can insert their standard code inside these form routines.

Customers can create their own form routines but should begin with ‘ZZ’.

A more faster way to search is to search the string ‘PERFORM USEREXIT’ inside the program.

Next Post:

The term ‘User Exits’ is also used interchangeably for ‘Customer Exists’. While the purpose of User Exits and Customer Exits are same there is significant technical difference between the two. In my next post I will discuss on Customer Exits.

References:

Application-Specific User Exitshttp://help.sap.com/saphelp_nw04/helpdata/en/bf/ec07a25db911d295ae0000e82de14a/frameset.htm

Further Reading:

User Exits In Sales Document Processinghttp://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm

User exits for Billinghttp://help.sap.com/saphelp_40b/helpdata/es/18/f62c7dd435d1118b3f0060b03ca329/content.htm

User exits for Transportationhttp://help.sap.com/saphelp_40b/helpdata/pt/17/f62c7dd

Page 10: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

435d1118b3f0060b03ca329/content.htm User exits for billing plan

http://help.sap.com/saphelp_45b/helpdata/en/22/f62c7dd435d1118b3f0060b03ca329/content.htm

 

Page 11: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Find The User ExitThe Procedure to investigate the user exit used in the transaction:

1. Running the transaction (ex: ME21), fill in the data needed, and determine in which screen the user exit will be needed.2. While on the screen of the transaction, drill down the “System>Status” and the screen will pop up then we can get the program name used in this screen (ex: SAPMM06E).3. Then we open the “se38″ transaction and we fill in the program name we got from the procedure No.2, choose “Attributes”, choose “Display”, get the “Dev. Class” of the program (ex: ME).4. Go to the transaction “CMOD” > “Utilities” > “SAP Enhancement” > fill in the “Dev. Class” (according the procedure 3) > then “Execute”.5. After procedure 4, the “list of the Exits” will show up (ex: M06E0005)Example of List of Exits:Exit name Short textAMPL0001  User subscreen for additional data on AMPL                 MM06E001  User exits for EDI inbound and outbound purchasing documentsMM06E003  Number range and document number                           MM06E004  Control import data screens in purchase order              MM06E005  Customer fields in purchasing document6. Give the “Check” in the checkbox (ex: MM06E005) > “Display”.7. After the procedure 6, there will be the “lists of the components in SAP Enhancement” of MM06E005.8. In this case there are: “Function Module Exits”, and “Screen Areas”. Beside those also there are the “Function Codes” and “Includes”.Example:Function module ShortTxtEXIT_SAPMM06E_006 Export Data to Customer Subscreen for Purchasing DocumentEXIT_SAPMM06E_007 Export Data to Customer Subscreen for Purchasing DocumentEXIT_SAPMM06E_008 Import Data from Customer Subscreen for Purchasing DocumentProgram Code Short text

“Empty”

Calling screen No. Area Called screen No. ShortTxtSAPMM06E        0101 CUSTSCR1 SAPLXM06        0101 Subscreen: PO headerSAPMM06E        0111 CUSTSCR1 SAPLXM06        0111 Subscreen: PO item SAPMM06E        0201 CUSTSCR1 SAPLXM06        0201 Subscreen: agreementINCLUDEsCI_EKKODB9. Things needed for the investigation (in terms to find the correct includes that will be useful for the enhancement) :- Importing value contained in “Function Module Exits”.- In the function module, there will be one or more than one include, and we can try by giving the “break-point” to be tested in every “includes” in every ‘Function Module Exits”.Example:Break-point.FUNCTION EXIT_SAPMM06E_012.*”——————————start———————————–

Page 12: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

*”*”Lokale Schnittstelle:*”  IMPORTING*”     VALUE(I_EKKO) LIKE  EKKO STRUCTURE  EKKO*”     VALUE(I_TRTYP)*”     VALUE(I_BSTYP) LIKE  EKKO-BSTYP*”     VALUE(I_NO_SCREEN)*”     VALUE(I_LFA1) LIKE  LFA1 STRUCTURE  LFA1*”     VALUE(I_LFM1) LIKE  LFM1 STRUCTURE  LFM1*”     VALUE(I_KEKKO) LIKE  EKKO STRUCTURE  EKKO*”     VALUE(I_AEKKO) LIKE  EKKO STRUCTURE  EKKO*”     VALUE(I_REKKO) LIKE  EKKO STRUCTURE  EKKO*”     VALUE(I_CI_EKKO) LIKE  EKKO_CI STRUCTURE  EKKO_CI*”     VALUE(I_VORGA) LIKE  T160-VORGA*”  TABLES*”      TEKPO STRUCTURE  BEKPO OPTIONAL*”      TEKET STRUCTURE  BEKET OPTIONAL*”      TEKKN STRUCTURE  EKKNU OPTIONAL*”      TKOMV STRUCTURE  KOMV OPTIONAL*”  CHANGING*”     VALUE(C_CI_EKKO) LIKE  EKKO_CI STRUCTURE  EKKO_CI OPTIONAL*”———————————————————————-INCLUDE ZXM06U43 .ENDFUNCTION.———————————end————————————-

*——————————–start———————————-** INCLUDE ZXM06U43 **———————————————————————-*BREAK-POINT.———————————end————————————- - After giving the “break-point” if this include is the one of many include that will be called in the transaction (in this case ME21), after clicking something (Save button), then will go to the debugger.- In this case this include is the correct include.10. If we want to maintain the global data for the function module, In “Function Module Exits”>”Go To”>”Global Data”> we can maintain the global data here.Creating the User Exit1. Create the new ‘Project’. Fill the “Attribute” with the Short text and Development Class2. Fill the ‘Enhancement Assignment’ based on the procedure Find The User Exit , In this case the example would be LMR1M002.3. Automatically, the component of the Function Exit of LMR1M002 will be assigned in the “Component” .4. In each Function Exit consist one or many of includes. In this Includes we can make some modification, make some coding in this Includes. After coding the Includes, we activate the Includes and then activate the Function Exit (p.s. You can trace the use Function Exit by their Importing value and the Exporting Value… in terms the field you will be needed in your project).Example:FUNCTION EXIT_SAPLKONT_011.*”———————————————————————-*”*”Lokale Schnittstelle:*” IMPORTING

Page 13: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

*” VALUE(I_WRXMOD) LIKE WRXMOD STRUCTURE WRXMOD*” EXPORTING*” VALUE(E_KONTO_MODIF) LIKE T030-KOMOK*”———————————————————————-INCLUDE ZXM08U18 .

ENDFUNCTION.

p.s. It is necessary to determine which field’s value need to be retrieved, validated and exported to the next process… This can be done by looking the ‘Importing’, ‘Exporting’ and the ‘Changing’ value that used in the ‘Function Module Exit ‘ that we have found.

Importing Value : Just retrieved the value of the declared field.Exporting Value : Just send the value of the declared field.Changing Value : The value of the declared field can be changed while in the process.———————————–oo———————————–

*———————————————————————-** INCLUDE ZXM08U18 **———————————————————————-*IF SY-UNAME = ‘JAWGU01′.BREAK-POINT.ENDIF.After activating the Includes and the Function Exit, If we go to the components, there will be the display as below:

Project ZWIDY Test for User ExitEnhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenanceFunction exit a EXIT_SAPLKONT_0115. We have to activate the project after we already preparing all the components that we will use for the enhancement project.Project ZWIDY Test for User ExitEnhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenanceFunction exit a EXIT_SAPLKONT_011And all the button will become green and the project, including all the components are ready to use.6. After this we can test it whether the requirement is already fulfilled or not.

Page 14: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Add new parameters and enhance source code of standard Function Module

By Shweta Chavan, Hitachi Consulting

Introduction  

Many times the existing functionality in standard function module is not sufficient for a developer. In such cases, to little more functionality, we copy the standard FM and make the ‘Z’ custom copy of it. Or else create the custom new FM for extra functionality and call multiple function modules.

In SAP’s new enhancement Framework, SAP has provided this new enhancement technique which allow user to enhance the standard function module. So when there are small changes required we can enhance the function module itself. Once we made changes in standard FM, new changes would be available to all objects in environment.

This article will elaborate you the way to enhance the standard function module. Here we are taking example of Function module LAST_WEEK. We are enhancing the parameters in EXPORT & TABLES with source code enhancement. We will also be enhancing the global data to declare some new variables.

First let’s see the original function module, its parameters & output.

Import & Export parameters:

Page 15: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Original Function module

output: 

Let’s now enhance this function module. We will add one more parameter in Export which will give no of holidays in that week. We will also add table which hold details on holidays. Once we enhance this function module LAST_WEEK it will start giving more appropriate details of last week.

Steps to Enhance Interface

Page 16: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

1.     Go to Export parameter screen select menu Function Module Enhance

interfac 

2.     A pop-up will come to Create Enhancement Implementation. Give the details to create custom implementation and click on  , give the package and save.  

3.     Now you can add required parameter in editable rows.

Page 17: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

4.     We also need to add new table. So we will also add required table under tables tab.

5.     Save the enhancement and activate it.

Steps to Enhance Global Data

1.     Now to add new global variables, go to menu Goto Global data.

  

2.     An include file will be opened. Click on enhance button  . Now select menu Edit Enhancement Operations Show Implicit Enhancement Option.  

Page 18: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

  

3.     First click anywhere on """""""" line and then right click on same line. Go to Enhancement Implementation  create Implementation.  

  

4.     Create Enhancement Implementation and save it.  

Page 19: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

5.     Write your custom code in enhancement 1. Save and activate it.

Steps to Enhance Source Code  

1.     Now we have to enhance the source code to populate values in our export & table parameters. Go to

source code click on enhance  . Select menu Edit Enhancement Operations Show Implicit Enhancement Option.  

2.     Go to last line of function module. Before ENDFUNCTION statement you will see the available implicit enhancement. Implement custom enhancement by clicking right click and selecting Enhancement Implementation  create Implementation.  

3.     You will get a pop-up like below. Choose option Code.  

Page 20: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

  

4.     Create new implementation.  

  

5.     Write down custom code, save and activate the implementation.  

Page 21: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Result

Run the Function module.

You will see the newly added parameters in Export & Tables.

Page 22: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Notes

         All parameters which you add in IMPORT/EXPORT/TABLE must be optional. This will not affect existing objects which are using function module.  

         SAP doesn’t support this function level enhancement to all standard function modules. There are some FM in central repository which never be enhanced like FM ‘POPUP_TO_CONFIRM’.

Page 23: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Program to get the User exit for any Transaction CodePosted by: amitkhari on: June 19, 2007

In: User Exit 

Comment!

REPORT zuser_exit NO STANDARD PAGE HEADING.TABLES : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.TABLES : tstct.DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.DATA : field1(30).DATA : v_devclass LIKE tadir-devclass.PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.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 EQ enlfdir-area.MOVE : tadir-devclass TO v_devclass.ENDIF.ENDIF.SELECT * FROM tadir INTO TABLE jtabWHERE pgmid = ‘R3TR’AND object = ‘SMOD’AND devclass = v_devclass.SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu ANDtcode 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 ,

Page 24: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

22 ‘Description’,95 sy-vline.WRITE:/(95) sy-uline.LOOP AT jtab.SELECT SINGLE * FROM modsaptWHERE sprsl = sy-langu ANDname = 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.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.

Page 25: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Finding the user-exits of a SAP transaction code Finding the user-exits of a SAP transaction codePosted by: amitkhari on: May 30, 2007

In: User Exit 

Comment!

*Finding the user-exits of a SAP transaction code** Enter the transaction code in which you are looking for the user-exit* and it will list you the list of user-exits in the transaction code.* Also a drill down is possible which will help you to branch to SMOD.** Written by : SAP Basis, ABAP Programming and Other IMG Stuffreport zuserexit no standard page heading.tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.tables : tstct.data : jtab like tadir occurs 0 with header line.data : field1(30).data : v_devclass like tadir-devclass.parameters : p_tcode like tstc-tcode obligatory.select single * from tstc where tcode eq p_tcode.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 eq enlfdir-area.move : tadir-devclass to v_devclass.endif.endif.select * from tadir into table jtabwhere pgmid = ‘R3TR’and object = ‘SMOD’and devclass = v_devclass.

Page 26: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

select single * from tstct where sprsl eq sy-langu andtcode 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 modsaptwhere sprsl = sy-langu andname = 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.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.*—End of Program

Page 27: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Looking for ABAP interview questions? You have come to THE RIGHT place. I have planned tocontinuously update this blog post. So if you have been appearing for interviews recently , share your experiences in the comments below:

Let’s make this list count and add some value to everyone.All the best for your interview preparation .  Here you go!!

The Massive list of ABAP interview questions: 

Important 

Question 1: What is the difference between User Exit and Function Exit?

User Exit Customer Exit

User exit is implemented in the form of a Subroutine i.e. PERFORM xxx.Example: INCLUDE MVF5AFZZ PERFORM userexit_save_document_prepare.

A customer exit can be implemented as:

Function exit

Screen Exit

Menu Exit

Field Exit

Example: CALL Customer function ‘xxx’INCLUDE xxx.You modify this include.

In case of a PERFORM, you have access to almost all the data. So you have better control, but more risk of making the system unstable.

You have access only to the importing, exporting, changing and tables parameter of the Function Module. So you have limited access to data.

User exit is considered a modification and not an enhancement.

A customer exit is considered an enhancement.

You need Access Key for User Exit. You do not need access key.

Changes are lost in case of an upgrade. Changes are upgrade compatible.

User exit is the earliest form of change option Customer exits came later and they overcome

Page 28: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

offered by SAP. the shortcomings of User Exit.

No such thing is required here. To activate a function exit, you need to create a project in SMOD and activate the project.

   What is the difference between RFC and BAPI? 

BAPI RFC

Just as Google offers Image/Chart/Map APIs OR Facebook offers APIs for Comment/Like, SAP offers APIs in the form of BAPIs. BAPI is a library of function modules released by SAP to the public so that they can interface with SAP.

RFC is nothing but a remote enabled function module. So if there is a Function Module in SAP system 1 on server X , it can be called from a SAP system 2 residing on server Y.

There is a Business Object Associated with a BAPI. So a BAPI has an Interface, Key Field, Attributes, Methods, and Events.

No Business Object is associated with a RFC.

Outside world (JAVA, VB, .Net or any Non SAP system) can connect to SAP using a BAPI.

Non–SAP world cannot connect to SAP using RFC.

Error or Success messages are returned in a RETURN table.

RFC does not have a return table.

Question 3:What is the difference between SAPSCRIPT and SMARTFORM? 

SAPSCRIPT SMARTFORM

SAPSCRIPT is client dependent. SMARTFORM is client independent.

SAPSCRIPT does not generate any Function module.

SMARTFORM generates a Function Module when activated.

Main Window is must. You can create a SMARTFORM without a Main Window.

SAPSCRIPT can be converted to SMARTFORMS. Use Program SF_MIGRATE.

SMARTFORMS cannot be converted to SCRIPT.

Only one Page format is possible Multiple page formats are possible.

Page 29: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Such thing is not possible in SCRIPT. You can create multiple copies of a SMARTFORM using the Copies Window.

PROTECT … ENDPROTECT command is used for Page protection.

The Protect Checkbox can be ticked for Page Protection.

The way SMARTFORM is developed and the way in which SCRIPT is developed is entirely different. Not listing down those here. That would be too much. 

Question 4:What is the difference between Call Transaction Method and the Session method ?

Session Method Call Transaction

Session method id generally used when the data volume is huge.

Call transaction method is when the data volume is   low

Session method is slow as compared to Call transaction.

Call Transaction method is relatively faster than Session method.

SAP Database is updated when you process the sessions. You need to process the sessions separately via SM35.

SAP Database is updated during the execution of the batch input program.

Errors are automatically handled during the processing of the batch input session.

Errors should be handled in the batch input program.

Question 5: What is the difference between BDC and BAPI?

BAPI BDC

BAPI is faster than BDC. BDC is relatively slower than BAPI.

BAPI directly updates database. BDC goes through all the screens as a normal user would do and hence it is slower.

No such processing options are available in BAPI.

Background and Foreground processing options are available for BDC.

Page 30: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

BAPI would generally used for small data uploads.

BDCs would be preferred for large volumes of data upload since background processing option is available.

For processing errors, the Return Parameters for BAPI should be used.This parameter returns exception messages or success messages to the calling program.

Errors can be processed in SM35 for session method and in the batch input program for Call Transaction method.

Question 6: What is the difference between macro and subroutine?

Macro Subroutine

Macro can be called only in the program it is defined.

Subroutine can be called from other programs also.

Macro can have maximum 9 parameters. Can have any number of parameters.

Macro can be called only after its definition. This is not true for Subroutine.

A macro is defined inside:DEFINE …….END-OF-DEFINITION.

Subroutine is defined inside:FORM …..…..ENDFORM.

Macro is used when same thing is to be done in a program a number of times.

Subroutine is used for modularization.

Question 7: What is the difference between SAP memory and ABAP memory?

SAP Memory ABAP Memory

When you are using the SET/GET Parameter ID command, you are using the SAP Memory.

When you are using the EXPORT IMPORT Statements, you are using the ABAP Memory.

SAP Memory is User Specific.What does this mean?The data stored in SAP memory can be accesses via any session from a terminal.

ABAP Memory is User and Transaction Specific.What does this mean? The data stored in ABAP memory can be accessed only in one session. If you are creating another session, you

Page 31: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

cannot use ABAP memory.

ImportantQuestion 8: What is the difference between AT SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT?AT SELECTION-SCREEN is the PAI of the selection screen whereasAT SELECTION-SCREEN OUTPUT is the PBO of the selection screen.

Question 9: What is the difference between SY-INDEX and SY-TABIX?Remember it this way  TABIX = Table.So when you are looping over an internal table, you use SY-TABIX.When you use DO … ENDDO / WHILE for looping, there is no table involved.So you use SY-INDEX.

For READ statement, SY-INDEX is used. 

Question 10: What is the difference between VIEW and a TABLE?A table physically stores data.A view does not store any data on its own. It can contain data from multiple tables and it just accesses/reads data from those tables.

Question 11: What is the difference between Customizing and Workbench request?A workbench request is client independent whereas a Customizing request is client dependent.Changes to development objects such as Reports, Function Modules, Data Dictionary objects etc. fall under Workbench requests.

Changes in SPRO / IMG that define system behavior fall under customizing requests.An example would be ‘defining number ranges’ in SPRO.

In short, generally a developer would end up creating a Workbench request and a Functional Consultant would create a Customizing request.

Question 12: What is the difference between PASS BY VALUE and PASS BY REFERENCE?These concepts are generally used for Function modules or Subroutines etc. and their meaning can be taken literally.

Page 32: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Say we are passing a variable lv_var:CALL FUNCTION 'DEMO_FM'   EXPORTING     VAR  = lv_var.

When we PASS lv_var by VALUE , the actual value of lv_var is copied into VAR.When we PASS lv_var by REFERENCE , the reference or the memory address of lv_var is passed to the Function module. So VAR and lv_var will refer to the same memory address and have the same value. 

Question 13: What is the difference between Master data and Transaction data?Master data is data that doesn’t change often and is always needed in the same way by business.Ex: One time activities like creating Company Codes, Materials, Vendors, Customers etc.

Transaction data keeps on changing and deals with day to day activities carried out in business. Transactions done by or with Customers, Vendors, and Materials etc. generate Transaction Data. So data related to Sales, Purchases, Deliveries, Invoices etc. represent transaction data

Some important transactions here for Master Data:Material: MM01 MM02 MM03Vendor: XK01 , XK02 , XK03Customer: Xd01 , XD02 , XD03

Some Important transactions for Transaction data:Purchase Order: ME21n , ME22n , ME23nSales Order: VA01 , VA02 , VA03Goods Receipt: MIGOInvoices: MIRO

ImportantQuestion 14: What will you use SELECT SINGLE or SELECT UPTO 1 ROWS ?What will you use SELECT SINGLE or SELECT UPTO 1 ROWS ?There is great confusion over this in the SAP arena.If you Google, you will see lots of results that will say SELECT SINGLE is faster and efficient than SELECT UPTO 1 ROWS.But that is 100% incorrect.

SELECT UPTO 1 ROWS is faster than SELECT SINGLE.If for a WHERE condition, only one record is present in DB, then both are more or less same.However, If for a WHERE condition multiple records are present in DB, SELECT UPTO 1 ROWS will perform better than SELECT SINGLE. 

Page 33: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

 

Question 15: What is the difference between .Include Structure and .Append structure? 

I have seen ridiculous answers for this at many places on the Web.The true answer is this:

Let’s say you want to use the Structure X in your table Y.With .Include X, you can include this structure in multiple tables. With .Append X, you specify that structure X has been used in table Y and that this cannot be used in any other table now.  So you restrict structure X only to Table Y.

Important Question 16: Can you describe the events in ABAP?

LOAD-OF-PROGRAM:INITIALIZATION: If you want to initialize some values before selection screen is calledAT SELECTION SCREEN OUTPUT: PBO for Selection ScreenAT SELECTION SCREEN: PAI for Selection Screen START-OF-SELECTIONEND-OF-SELECTIONTOP-OF-PAGEEND-OF-PAGE

AT USER-COMMAND: When user click on say buttons in application toolbar. SY-UCOMMAT LINE SELECTION: Double click by user on basic list. SY-LISELAT PF##: When User Presses any of the Function KeysTOP-OF-PAGE DURING LINE SELECTION

Question 17:

What events do you know in Module Pool Programming?PBO: you know this . If not you should know this . That's basic.PAI: You know this. If not you should know this . That's basic.POV: Process on Value request … i.e. when you press F4.POH: Process on help request … i.e. when you press F1.

Question 18: Can you show multiple ALVs on a Single Screen?Yes, there are multiple ways of doing this:

Page 34: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

·         If you are using OOALV, you can create multiple custom containers      (cl_gui_custom_container) & put an ALV control (cl_gui_alv_grid) in each of those.

·         You can even use a Splitter container control and place multiple ALVs in each of     the split container.

·         If you are using Normal ALV, You can use the following FMS:

1.      REUSE_ALV_BLOCK_LIST_INIT

2.      REUSE_ALV_BLOCK_LIST_APPEND

3.      REUSE_ALV_BLOCK_LIST_DISPLAY

Question 19: A system has two clients 100 and 500 on the same application server. If you make changes to a SAPSCRIPT on client 100, will the changes be available in client 500?

No. SAPSCRIPT is client dependent. You will have to transport changes from client 100 to client 500. However, for SMARTFORMS, Changes will be made both for client 100 and client 500.

Question 20: There are 1000’s of IDOCs in your system and say you no longer need some of them? How will you get rid of those IDOCs?

One way is to archive the IDOCs using transaction SARA.But what the interviewer was expecting was ‘How do you change IDoc Status’?There are different ways of doing this:

A) Use FM IDOC_STATUS_WRITE_TO_DATABASE

B) USE FMs:     EDI_DOCUMENT_OPEN_FOR_PROCESS and     EDI_DOCUMENT_CLOSE_PROCESS

Question 21: What is the difference between CHAIN … ENDCHAIN and FIELD commands in Module Pool?

If you want to validate a single field in Module Pool, you use the FIELD Command.On error, this single filed is kept open for input.

If you however want to validate multiple fields, you can use the CHAIN … ENDCHAIN command. You specify multiple fields between CHAIN and ENDCHAIN.On error, all fields between CHAIN …… ENDCHAIN are kept open for input.

Page 35: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Question 22: What are the types of Function Modules? What is an UPDATE function module?There are three types of Function Modules: Normal , RFC , UPDATE.

The aim of the Update function module is either to COMMIT all changes to database at once or to ROLLBACK all the changes. By definition, an update function module is used to bundle all the updates in your system in one LUW (logical unit of work).

This FM is called whenever COMMIT WORK statement is encountered in the calling program and the way you call it is CALL FUNCTION XXX IN UPDATE TASK.  

Have a look at FM EDI_DOCUMENT_CLOSE_PROCESS_UPD and do a where used.This FM is used as Update FM in case you make changes to IDoc contents/status via your program.

Question 23: How is the table sorted when you do not specify field name and Ascending or Descending? On what criteria will the table be sorted? Do internal table have keys?

Yes, internal table have keys.The default key is made up of the non-numeric fields of the table line in the order in which they occur.

Question 24: Explain what is a foreign key relationship?Explain this with the help of an example.Let’s discuss about tables EKKO (PO header) and EKPO (PO line item).Can you have an entry in table EKPO without having an entry in table EKKO?In other words can you have PO line items without the PO header?

How does this happen? The answer is foreign key relationship.So foreign keys come into picture when you define relationship between two tables.

Page 36: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

  Foreign keys are defined at field level.Check the foreign key relation for field EBELN of table EKPO.The check table is EKKO. This just means that whenever an entry is made in EKPO, it is checked whether the entered value for EBELN already exists in EKKO. If not, entry cannot be made to EKPO table.  

Question 25 : What is the difference between a value table and a check table?Check table is maintained when you define foreign key relationships.For Check table, read question above..Value table is defined and maintained at a domain level.At a domain level, you can mention allowed values in the form of:1) Single values2) Ranges3) Value tableFor example, have a look at domain SHKZG. Only allowed values are S and H for Debit/Credit indicator. Whenever and wherever you use this domain, the system will force you to use only these two values: S and H.

Another example is domain MATNR. For this domain the value table is MARA.So whenever and wherever, you use this domain the system will force you to use values for MATNR in table MARA.

Page 37: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Question 26: How do you find BAPI?Approach1:You can go to Transaction BAPI and then search for your desired object.Say you want to find a BAPI for creating users in the system, in such case you can search for the ‘User’ and find the relevant BAPIs.

Approach2:Another way is to find a Business Object. Say you want to find a BAPI for creating Material in SAP and you know the BO for Material is BUS1001006. You can go to Transaction SWO1 and enter the BO BUS1001006 in the BOR. Then have a look at the methods for this BO.

Page 38: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Important Question 27: How do you find BADI?Approach1: Go to Class CL_EXITHANDLER in SE24 ---> Put a breakpoint in method GET_INSTANCE.Now go and execute your transaction code for which you want to find BADI. 

Page 39: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

You will find the BADI in the changing parameter exit_name:

Approach 2:Go to Tcode SE84  Enhancements BADIs  Definitions.Find the package for the Tcode for which you are finding the BADI.Enter it as shown and hit execute:

Page 40: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Are we done yet ? Definitely not !Let the questions come and lets keep on updating this blog.

I will update the blog with the following questions soon:Question: Synchronous and asynchronous methods in BDC ?Question: What is the difference between inner joins and outer joins?Question: What is the difference between INSTANCE methods and STATIC methods?Question: What is the difference between Implicit Enhancements and Explicit Enhancements?Question: What is the difference between Enhancement point and Enhancement Section?Question: How do you find Function Exit?

Page 41: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Question: How do you activate a Function Exit?

If you have been appearing for ABAP interviews recently, Post your experience to the comments below: Also provide answers if you wish. I will update the answers soon and keep on adding ABAP interview questions.

And finally , If you have found this post helpful , please consider giving a :

After Observing many interviews. Finally i come up with the following questions which are mostly asked in all

the Big companies including SAP Labs, Accenture, IBM , Deloitte , TCS , Infosys etc…

1. Can we write the code both call transaction and session method in single program?

Ans. Yes it is possible to write call transaction and session in one program.

2. Which BDC you prefer?

Ans. If we want to transfer large amount of data and when we need to use more than one transaction code

we prefer session method. For small or less amount of data and for single transaction use call transaction.

(This is more genric answer but you can add more on to this if you have worked on  BDC)

3. When u prefer LSMW?

Ans. When we need to update medium amount of data we use LSMW. LSMW is also used when the person

like functional consultant has less programming language.

5. Difference between .include and  .append?

Ans.

Include structure allows to add one or more structure into structure or table.Also placed positioning

anywhere. Upto 6 include structure can be used in a table.

Append structure can be placed only at the end of a structure or table which also stops further insertion of

fields.Only one append structure can be used

6. Preformance techniques

Page 42: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Ans.

1. The sequence of fields must be same as per database table

2. During writing select query write all fields in sequence as per database table.

3. Never write select statements inside loop….endloop.

4. Use st05 SQL trace, se30 run time analysis, code inspector, slin,etc.

5. Use select single * statement instead of select *

6. Always use primary key

7. Use binary search but before using binary search sort that table.

7. How to debug sapscripts ?

Ans.

Two ways to debug sapscript . first way is goto SE 71 and from menu bar select Utilities->activate

debugger .then goto SE38 execute the print program ,it automatically goes to debugging mode …..the other

way is , run the program RSTXDBUG in se 38 . execute it . a message will show that debugger is

activated .now open the print program in se 38 …u vll notice that the print prgm is automatically diverted to

debugging mode.

8. What is partner selection?

Ans. This concept is mainly used in IDOC where u select the partner profile using Tcode We20 .with  Tcode

SM59 you create RFC(remote function call) to create communication link to a remote system.

10. What is occurs in internal table?

Ans. Occurs addition to the Declaration will give initial size to that table.occur statement allocates 8kb of

memory to the internal table.

11. What is page window?

Ans : page window is nothing but a container of a page ,which uniquely identifies a set of data …for example

while creating invoice …we create logo window , billing document header window , customer window , terms

and condition window etc …

12. What is the difference between scrolling a table horizontally and vertically..??

Ans: In table control when you scroll a table vertically presentation server needs to call application server to

fetch the next record and display in the table while in case of horizontal scroll there is no need to call

application server.

13. What are Field Groups?

Page 43: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Ans: A group that combines several fields fewer than one name, at runtime, the INSERT command is used to

define which data fields are assigned to which field group are called Field Groups. It should always be a

HEADER field group that defines how the extracted data will be sorted; the fields grouped under the HEADER

field group sort the data.

14. List the events in ABAP/4 Language?

Ans: The events in ABAP/4 are load of program ,Initialization, Selection Screen, Start of Selection, End of

Selection, Top of page, Line selection, User command, End, First.

15.How the values will be passed to RFC Function module PassbyValue or Passbyreference?

Ans: always Pass by Value.

RFC is Remote Function call so it can’t access the values with Pass by reference.

16. Buffering concept usage?

Ans: There are three type of buffer

1 single record

2 generic buffer

3 full buffer

Buffering is use for improve performance. it improves performance  10 to 100 times more

17. Select up to 1 row and select single difference ?

Ans:  Select single fetches first matching record. If more than one matching records are there then only the

first matching record will be considered other records will not be taken into account. Where as select up to 1

rows will fetch all the matching records from the database.(Again it will assign only One Record to the

internal table/Work area)

18. What are the different buffering methods?

There are two different buffering methods

The system ensures that data transfer between the R/3 System and the database system is as efficient as

possible. To do this, it uses the following techniques:

Table buffering: The program accesses data from the buffer of the application server.

Database request buffering: Individual database entries are not read or passed to the database until required

by an OPEN SQL statement.

19. Different types of locks?

v  Read lock (shared lock)

Page 44: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Protects read access to an object. The read lock allows other transactions read access but not write access to

the locked area of the table.

v  o Write lock (exclusive lock)

Protects write access to an object. The write lock allows other transactions neither read nor write access to

the locked area of the table.

v  o Enhanced write lock (exclusive lock without cumulation)

Works like a write lock except that the enhanced write lock also protects from further accesses from the

same transaction.

20. CHAIN END CHAIN?

Ans: Chain and end chain are used for multiple field validation in Module pool programming .It is written

inside the screen flow logic.

21.How to Debug RFC Function module?

Ans:

SE38 –> Utilities –> Settings –> ABAP Editor –> Debugging

Activate the external debugging and choose the New Debugger option in ABAP debugger.

Go to the particular place in the code and put break point, pop will appear then choose the HTTP break point.

If you are triggering the RFC from SAP portal make sure that both the user ID should be same

If the users are different then provide the XI/Portal User ID in the users field.

22.Why sapscripts are client dependent and smartforms are client independent.?

Ans-: Smartforms create its own function module so it doesn’t need to transport the request through SCC1.As

all the Development Object are stored in client independent tables. Whereas Script doesn’t generate  any

function module while executing so we need to transport the request number through SCC1.Sap script is

stroed in side the client depended table as a TEXT.so sapscripts are client dependent and smartforms are

client independent.

23. Difference between user exit and BADIs?

Ans: User exit is for single implementation and it is procedural approach while BADIs are for multiple

implementation and object oriented approach.

Multiple implementation means Reusability… because we use OOps Concepts for BADI.

24. Control break events in ABAP:-

1. AT-FIRST: This is used when we want to execute the statements before records are processed.

Page 45: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

2. AT-LAST: This event is used when we want to execute the statements after all records are processed.

3. AT-NEW: This event is used when we want to execute the statement before group of records are

processed.

4. AT-END: This event is used when we want to execute the statements after processing of group of records.

25.I am uploading 100 records out of which say 59th record has error so what will happen if i am

using synchronous or asynchronous method of BDC? Can we update the database using local

update mode how?

26. Suppose i am writing following code then what will be output?

LOAD-OF-PROGRAM.

WRITE:/”HELLO”.

Ans:  HELLO

(Explain the importance of LOAD-OF-PROGRAM Event.If you dont know Tell the interviewer as this event is

used in such cases when you want to clear sum buffers or something Before calling that Program)

27. What is TMG?

Ans. TMG stands for Table Maintenance generator. It is a tool available in abap by which we can add or

delete multiple records at a time and it is executed or triggered by the transaction code SM30.

28. Difference between select option and ranges ?

Ans. The main difference between select option and ranges is that ranges implicitly or automatically creates

internal table with fields like OPTION,LOW,HIGH,SIGN,etc . Where as in case of select option we have to

explicitly create internal table.

When u declares a select options it will implicitly declare an internal table (ranges) for you.

While using RANGES syntax u can declare internal table explicitly.

The only need of declaring ranges is when you r not taking input from the user but you want make limit

based selection at that time it will be use full e.g. SELECT ** from ** where MATNR in val_range.

here u can use select-option or ranges : val_range.

29. is it possible to bring select option in module pool screens?

Ans.Create a SELECT-OPTIONS in module pool screen using two methods as shown.

Method 1:—-

a) Create a subscreen area in your screen layout where you want to create the select options.

b) In the top include of your module pool program declare a selection screen as a subscreen e.g.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

Page 46: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

select-options s_matnr for mara-matnr.

SELECTION-SCREEN END OF SCREEN.

c) In the PBO and PAI of the main screen where the select options needs to be created do a call subscreen of

the above screen (100).

CALL SUBCREEN sub_area INCLUDING <program> <screen>

This CALL SUBSCREEN statement is necessary for transport of values between screen and program.

Note: All validations of the selection screen fields e.g. the s_matnr field created above should be done in

selection screen events like AT SELECTION-SCREEN etc and not in PAI. These selection screen validations etc

should be done in the top include only.

Method 2:——-

a) Create 2 separate fields in your screen layout – one for the low value and one for the high value. Insert an

icon beside the high value which will call the multiple selections popup screen on user command. Use

function module COMPLEX_SELECTIONS_DIALOG to achieve this.

continued ……

struc_tab_and_field-fieldname = con_cust. ” ‘KUNNR’

struc_tab_and_field-tablename = con_kna1. ” ‘KNA1′.

CALL FUNCTION ‘COMPLEX_SELECTIONS_DIALOG’ EXPORTING*

TITLE = ‘ ‘

text = g_titl1 ” ‘Customers’

tab_and_field = struc_tab_and_field

TABLES RANGE = rng_kunnr

EXCEPTIONS

NO_RANGE_TAB = 1

CANCELLED = 2

INTERNAL_ERROR = 3

INVALID_FIELDNAME = 4

OTHERS = 5.

IF NOT rng_kunnr[] IS INITIAL.

* Read the very first entry of the range table and pass it to

* dynpro screen field

*READ TABLE rng_kunnr INDEX 1.

IF sy-subrc = 0.

g_cust = rng_kunnr-low.

ENDIF.

ENDIF.

You can use the return table rng_kunnr to populate your own internal range table with the values entered by

the user. Basically here you are just simulating the work of a select-options parameter by module pool

screen elements.

Page 47: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

30.how we can retrive data using secondary index.explain with simple example

Ans:  First create secondary indexes on required fields of a particular database table.

We can create one primary index and 15 secondary indexes.Once the respective secondary indexes are

created write select queries and within select queries specify secondary indexes field name with where

clause.

31.How can we handle table control in BDC?

Ans.We can handle table control using line index

Line index indicates which line of Table control is to be use for BDC transaction

Ex -

perform bdc_field using ‘RC29K-AUSKZ(01)’

Indicates 1st line of table control is going to be used for transaction which is Line index of Table Control

32. If i want to execute a BDC program only in background not in foreground is there any option

for this?

Ans.The sm37 transaction can be used for running a program in the background. Also in the session method

while processing the session you can specify the processing type as background or foreground.

33.How Can We upload a text file having Delimiters in to Legacy System

Ans.For up loading text file we use the pre-defined FM gui_upload. in that FM we have the parameter

has_field_seperator for that we assign the default delimiter ‘x’.

HAS_FIELD_SEPERATOR ‘X’

‘X’ can provide the Whatever delimiter we used in flat file for separation.

34. What is the land scape in sap.

Ans. In every organisation sap landscape involves three servers viz, Development server, Quality server and

Production server. Whatever new development we do as per clients requirement is done in development

server. Later to test the developed object we move it to quality server for testing and finally once everything

goes clear then the object is moved to production server ,production server data is ready for final business

use.

35. Workbench request are client dependent or client independent

Ans. Workbench request are client independent.

(Common Man Workbench request holds the Program , FM etc…. How it can be Client Dependent!!!!)

36. Tell me about workbench request and customization requests.

Page 48: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Ans.Workbench (ABAP Dev) request is client independent when you import it into one system it reflact it in

all client in same system, but customized request has to import in that client perticular client where it is

created, actually it is client dependent.

Other   Interview questions…

SAP SCRIPTS & FORMS

1. Can we write the code/program inside sap script?

2. How will u create sapscripts & smartforms in multiple language?

3.How to execute sap script & smart forms in Background?

4.How to do total & subtotal in scripts & forms?

=================================================

DATA DICTIONARY

1.Apart from .include & .append how will u do table enhancement?

2.what r the events of table maintainence generator?

3.what will happen if i use projection view and maintainence view together?

4. I created ZEMP table now i want to add more data but prev. data should not disturb how can i do this?

=====================================================

REPORTS

1.How will u print footers in alv report?

2.How will u edit fields from output list of alv?

====================================================

BDC

1.what r the fields u took during recording for mmo1,me21n?

2.If u want to do bdc for xd01 explain me how will be the flow?

=================================================

user exits

1.what r enhancement points?

2.How to write customer exits?

3.what is routine? how it is different from user exits?

Page 49: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

n computer software, a user exit is a place in a software program where a customer can arrange for their own tailor-made program to be called.

In the R/3 system from SAP, a user exit is contrasted with a customer exit and allows a customer's developer to access program components and data objects within the R/3 system. In R/3, some user exits use Include statements to include customer program enhancements that are called from the program.

Other user exits use tables that are accessed through customization.

Overview

Page 50: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Extension of SAP functionality

SAP makes different possibilities available to extend SAP functionality in the R/3 without modifying the delivered R/3-Standard. Thus these extensions are further present also after a R/3-Release-Wechsel.

• User exit• Field exit• Text extensions• Customer exit• Table extensions

1. User exit

User exits are original one in the selling module (SD) developed expandability.They consist of empty subroutines (FORM) in special Includes, which can be filled by a ABAP Use developer.

In special places in the SA P-CODE such subroutine references were inserted by SAP. An extension is thus only possible, where SAP planned it.

They usually offer a rather rudimentary expandability, since purely technically objects in the SAP name area are modified.

2. Field exit

Field exits are bypasses of a Dynprofield with data element purchase into a functional module. These will go through when leaving the Dynpros. There are global and local field exits.

Global field exits

are not limited to a Dynpro. If a data element is used on several Dynpros, after activation of the field exit with all this Dynpros to a functional module one branches out.

Local one field exit

work only on a Dynpro limited. There is the possibility of putting on bus to 36 local field exits to a data element.3. Text extensionsWith text extensions it acts around user keywords and user documentation (F1-Hilfe) to data elements. The new keywords can refer to SAP documentation and to user documentation. Thus one has also the possibility of overwriting the keywords delivered by SAP.With text extensions the changes are global effective for all SAP applications concerned contrary to application extensions after activation.4. Customer exitAn application function can be extended by application extensions by the customer. Customer exits must be intended by SAP. They consist generally of several components. The interface SAP/Kunde is clearly defined.With a R/3-Release-Wechsel and/or. Upgrade remain the customer extensions without effort.

• Function exit• Menu exit• Dynpro exit

A) Function exitBy functional module exits the customer can implement additional logic in an application function.SAP built such exits in different places into many application functions. Thus are the interfaces are already given,

Page 51: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

and/or which data handed over.These functional modules can be filled now by the customer. It can insert also user Dynpros with associated processing logic and GUI surface and put on user text elements.

B) Menu exit

Menu exits make it for the customer possible to build and occupy with a function code in an SAP application new menu entries.SAP determined, where in the program additional function codes are queried and like to it is being reacted, either by a functional module exit or by an already firmly given functionality.

C) Dynpro exit

Dynpro exits permit the customer to arrange ranges of a dynpros reserved by SAP. Within these ranges large information can be indicated or data be seized. Those for this force fields by the customer on a user Dynpro are arranged.

In Details

What is User Exits?

The following document is about exits in SAP: -The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications.SAP creates user exits for specific programs, screens, and menus within standard R/3 applications.These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.

Types of Exits

There are several different types of user exits. Each of these exits acts as hooks where you can attach or "hang" your own add-ons.

Menu Exits

Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own 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 specify the menu item’s text when activating the item in an add-on project.

Screen Exits

Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.

Function Module Exits

Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits.When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated.

Page 52: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Function module exits also control the data flow between standard programs and screen exit fields.

SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs.These calls have the following syntax:

CALL CUSTOMER-FUNCTION ‘001’.

Field Exits

Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field. Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100.The field exit concept lets you create a special function module that contains this logic.You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number.In 4.6c, you can use "RSMODPRF" program to create field exits.An example of a user exits :-MODULE user_exit_0001 INPUTCASE okcode.WHEN 'BACK OR EXIT'.CASE sy-dynnr.WHEN '100'.SET SCREEN 0.LEAVE SCREEN.WHEN '200'.********************************************************************************** Note that you can write any code that satisfy your needs. ******** But in this case, this was wrote as a sample code for reference sake. ******** And you can test it. **********************************************************************************SET SCREEN 100.LEAVE SCREEN.ENDCASE.ENDCASE. 

SAP User Exits Routine

User exits are routine which SAP allows you to add in additional customized programs process without affecting the standard SAP programs.SAP user exit are usually declare as a form routine :-form userexit_xxxxx........................endformIn VL01 - Create Delivery Order, standard program SAPMV50A, the standard program did not check for storage location equal to space, and delivery quantity less than one when the user click the save button. Therefore I have to insert the additional checking into the userexit routine.

Steps:-

• Goto transaction VL01 to pick a Sales Order for delivery (you don't have to save the data)

Page 53: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

• In the initial screen, click System -> Status -> Double click on Program (Screen)• In the dialog program SAPMV50A, click Edit -> Search/replace• Type userexit in the Find field, then click the In program radio button and hit Enter• A number of userexit routines will be displayed. You'll have to roughly decide which is the correct userexit routine to used.Another way of determining the list of user exits could be bus executing the Tcode SE80.For example if U need to search for the user exits for the above mentioned program, execute the Tcode SE80 and enter the above program name,

The highlighted row denotes a user exit, which is used in this programform userexit_save_document_prepare.case xlips-pstyv.when 'TAX' or 'REX'.* Accept this two Delivery item categorywhen 'REN'.if xlips-lgort = space.* Reject this Delivery item categorymessage e001.endif.when others.if xlips-matnr <> space.* Check storage location not spaceif xlips-lgort = space.message e002.endif.* Check delivery quantity not zeroif xlips-pikmg < pgmid =" 'R3TR'" object =" 'PROG'" obj_name =" tstc-pgmna." name =" tstc-pgmna." pname =" tstc-pgmna." funcname =" tfdir-funcname." pgmid =" 'R3TR'" object =" 'FUGR'" pgmid =" 'R3TR'" object =" 'SMOD'" devclass =" v_devclass." sprsl =" sy-langu" name =" jtab-obj_name." zzzz =" up">Bus.transactions->Base parameters->Validation/NORFB->Bus.transactions->Base parameters->SubstitutionExample=ULTE "FI_DOCU 001 "Parked SA,FY,SI=>long text CORRESP. "

=U&VALID_WBS_IN_ZUONR "FI_ITEM 011 Spon.Res: Check WBS valid in ZUONR"

* changed in 4.5B (* Form UFIA -- formerly U&VALID_WBS_IN_ZUONR)User exits are form routines that the user programs. There are two types of

user-exits:

1. Validation exits are used in the prerequisites and checks. They have either the value 'T' for true or 'F' for false. They are interpreted as a part of the logical statement, like a constant or field comparison. For this type of user exit, you must fill a parameter with the results of your check ('T' for true; 'F' for false).ExampleFORM Uzzzz USING B_RESULT. "'T' or 'F'from program ZGGBR000 (ZGGBRI03)2. Substitution exits are used to change one or more fields. However, you can only change those fields that are permitted in the Boolean class for the substitution. You can display these fields by selecting the following menu

options in substitution maintenance: Fields for substitutions> Example FORM Uzzzz USING COST_CENTER.from program ZGGBS000 (ZGGBSI02)

Page 54: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor

Substitution Fields can be found from this window

/NORFB->Bus.transactions->Base parameters->Substitution->Call Pnt 2->Substitution step 3->Extras->Substitution flds The name of the form pool (e.g., ZGGBR000 & ZGGBS000) that contains your user exit must be stored in table T80D.Note1. Data declaration Tables and field stings cannot be declared in form routines, so that the contents can be used along with the calling transaction. 2. Parameter definition It is important that you make declare the code generation program for your user exit; how many and what type of parameters you are using for the user exit. You do this by entering your newly defined user exits in the form routine GET_EXIT_TITLES. found in program ZGGBR000 (ZGGBRTIT)found in program ZGGBS000 (ZGGBSTIT)One exception is the parameter for the results of a validation exit. You must not declare this, it is automatically generated be the system. What types of parameters are available and how you use them is described in the online documentation. When creating your user exits, you can use the example form pools delivered by SAP (RGGBR000 for validations; RGBBS000 for substitutions) as a reference. We recommend that you copy the example form pools delivered by SAP when creating your own user exits. In these example form pools, entries already exist in the form routine GET_EXIT_TITLES for the examples delivered. The GET_EXIT_TITLES must absolutely exist in your form pool. You can find additional information on the creation of user exits in the online documentation on validations and substitutions.SAP exitsSAP exits are form rountines programmed by SAP. The name of the form pool is SAPFGBEB.Syntax: =Szzzz (zzzz = up to four characters)FORM Szzzz using B_result. "'T' or 'F' Example =S01 "SAP exit S01" Display description of T80D configurationReturn ->Change Validation: FI_ITEM (Message view)

Page 55: A User Exit is a Place in a Software Program Where a Customer Can Arrange for Their  Own Tailor