Ads

SAP ABAP Real Time Interview Questions


SAP ABAP  Interview Questions for Experienced and Freshers

As an ABAP developer, I have shared here all ABAP real-time interview questions which I faced several times in different companies. These interview questions are most helpful for all ABAP freshers and experienced consultants when facing the real-time interview. I hope these questions help to crack any SAP ABAP real-time interview if you prepare well all these questions properly.

This post is about real-time SAP ABAP interview questions which are helpful for freshers and experienced ABAP consultants and these are the most important basic interview questions faced at MNC companies and I am sure that this lesson will help you and guide you How to prepare for a real-time interview and how to say real-time object scenarios when the interviewer asks you. This post will whole interview blueprint to prepare any SAP interview.


Tell me about yourself?


My name is ‘Your Name’
I have 3.6 years of exp. in SAP ABAP
I have completed ‘Your qualification’ from Osmania University in 2011
Present, I am working in a company that ‘your working’ and previously worked in ‘you’re working’.

My current project is ‘Your project name’.which is Indian based client. It manufactures steel wheels for passenger cars, utility vehicles, trucks, buses, agricultural tractors, and construction equipment in India.
In Previous Project, I worked for ‘Previous Project name’ which is a leading beds retailer in the U.S and manufactures foundations, frames, pillows, and sofa beds.
These two are implementation projects in which I worked for sd, mm, and fi modules for which I developed the objects reports, BDC, smart forms, adobe forms, enhancements, Badi, bapi , ALE/idocs, and oops.

After Introduction, Start telling about your developed objects earlier.
Objects Like:

1) Recently, I developed ALV report which displays open items for vendor in FI module.
For this report
Selection screen fields are
Vendor code
Company code
Payment terms
Document number
Customer no
For these input fields, system should display open items
From the tables -Lfa1,lfb1,bsik,bsak,bkpf,bseg,bsas,bsis ,kna1,.
Accounting: Secondary Index for G/L Accounts-bsis-bukrs
Vendor Master (General Section)-lfa1-lifnr
Vendor Master (Company Code)-lfb1-bukrs
Accounting: Secondary Index for G/L Accounts (Cleared Items)-bsas-bukrs
Accounting Document Header-bkpf-bukrs-belnr
Accounting Document Segment-bseg-bukrs-belnr
Accounting: Secondary Index for Vendors-bsik-bukrs-lifnr
Accounting: Secondary Index for Vendors (Cleared Items)-bsak-bukrs-lifnr
General Data in Customer Master-kna1-kunnr


1) I uploaded material master data from legacy system to sap system using call transaction method.

For Developing BDC using CALL TRANSACTION method
I have done the recording of the corresponding transaction &flat file in which data is stored.

Here Flat file is Excel File.
In CALL TRANSACTION we also have to create the Error Log file.
In BDC we use structure BDCDATA for Batch Input, which has fields
PROGRAM  -   BDC module pool
DYNPRO-        BDC Screen number
DYNBEGIN-    BDC screen start                                                          
FNAM-            Field name
FVAL-              BDC field value
A BDCDATA structure can contain the batch input data for only a single run of a transaction
In CALL TRANSACTION method, we need to create Log for the Error Message, for this we use structure BDCMSGCOLL.
I declared the internal table structure as per the flat file structure.
Recoding is done using the Transaction – SHDB.
Here i have done Recording for the transaction- mm01.
Now go to ABAP Editor (SE38).
We declare all Structures and internal tables and work areas.
Selection screen declaration.
File path,
Error file path,
Mode parameters
Open the  window for path selection.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'.

* Uploading excel file.
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'.
*Opening window for Error file download
AT SELECTION-SCREEN ON VALUE-REQUEST FOR e_file.
  CALL FUNCTION 'F4_FILENAME'.
LOOP AT t_field INTO fs_field .
    REFRESH: t_bdcdata.
    CLEAR fs_bdcdata.
    PERFORM populate_bdcdata.
    PERFORM insert_data.
  ENDLOOP.                               " LOOP AT it_c.

* Call transaction 'ME51'
  CALL TRANSACTION 'MM01' USING t_bdcdata
    MODE w_mode
    UPDATE 'S'
    MESSAGES INTO t_msg.
Error Found
    LOOP AT t_msg INTO w_msg WHERE msgtyp EQ 'E'.
*     Format Message
      CALL FUNCTION 'MESSAGE_TEXT_BUILD'.
 CALL FUNCTION 'GUI_DOWNLOAD'.
At last we run the program.
2) I created sap script which prints delivery note contains the list of items sent to the customer by the supplier.

For this

I created a company logo in constant window,

Delivery header details in constant window,

Customer details in constant window,

Delivery items in main window,

Page no. in variable window,

Terms and conditions in constant window.

Script print the data for input fields

Delivery doc no,

Customer no.

 from the table’s likp, lips and kna1.
In abap editor, i wrote the source code of script.

By calling fms like open form,
 Write form,
Close form.
Sales Document: Header Data-vbak-vbeln
Sales Document: Item Data-vbap-vbeln
Billing Document: Header Data-vbrk-vbeln
Billing Document: Item Data-vbrp-vbeln-posnr
SD Document: Delivery Header Data-likp-vbeln
SD document: Delivery: Item data-lips-vbeln


3) I created a smart form which prints invoice details for the particular customer.
System prints invoice data for input fields

Billing doc.no.(vbeln),

Date,

Customer no.,
 Item (posnr)

 From the tables vbrk, vbrp, kna1

For this

Created a company logo in secondary window,

Sales order billing header details in secondary window,

Customer details in secondary window,

Billing items details with dynamic table in the main window.

Total in secondary window,

Terms and conditions in secondary window,

And page no’s in secondary window.

In abap editor, i wrote the program,

Declared the table structures,

Declared the internal tables and work areas,

Declared selection screen.

Called the fm ssf_function_module_name.

Called the generated function module name.


4) I implemented a BADI which does not allow the user to create alternate BOM for already created BOM.

Hint: If an alternative BOM is created the field STALT from MAST table will be increased by 1. We can control future creation of BOM using this field.


Transaction code is CS01.

For this requirement, first i found the BADI for given tcode.

To this, we go to se24 class builder,
 Where we open cl_exithandler class in which double click on get_instance method.

Put a break point at line of "CALL METHOD cl_exithandler=>get_class_name_by_interface"
now Execute transaction cs01.

6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
Here, I found the BADI ‘BOM_UPDATE’.
Next we open the BADI in se19
Create implementation name for BADI.
Write the source code in change_at_save method.
Method IF_EX_BOM_UPDATE~CHANGE_AT_SAVE.
if I_STLAL > 1.
  Message 'Alternative BOM cannot be created for this particaular material' type 'W'.
  endif.

  LEAVE PROGRAM.
endmethod.

Now, we activate BADI.

5) I implemented an implicit enhancement which restricts the modification of the delivery item texts in the change outbound delivery.

Transaction code is vl02n.
From menu path, go to ->item -> texts.
Where we can see texts in editable mode.
To make it non editable we need to enhance the code.
First we need to debug the application and find the exact place where we need to add the functionality
In this particular case we have to enhance the subroutine
PERFORM TEXT_CONTROL_EINGABEBEREIT.
 Go to this subroutine and then Program –> Enhance,
Then follow Edit ->Enhancement Operations -> Show implicit enhancement Options,
Go to implicit enhancement option at the end of the form and do right click
->    Enhancement Implementation -> Create
Now it will ask for Enhancement type
Declaration, code and cancel.
We have to implement code .
ENHANCEMENT 4  ZTEXT_MODIF_BLOCK.    "active version
call method gv_text_editor->set_readonly_mode
         exporting
              readonly_mode = gv_text_editor->true
         exceptions
              error_cntl_call_method = 1
              invalid_parameter      = 2
              others                 = 3.

ENDENHANCEMENT.
  Activate the code and check VL02N  .

6) I added custom fields to the me21n tcode using customer exit.

Enhancement is MM06E005 which is customer fields in purchasing document.

Create the required custom fields using the include CI_EKKODB .



Description.
Amount.
Currency.
Po quantity.
Order unit.



Create the required sub screen using screen no 0101 with screen fields.
     Go to transaction CMOD and create a project.

Write the code in the fm exits
     EXIT_SAPMM06E_016 (Export Data to Customer Sub screen for PO)
     EXIT_SAPMM06E_018 (Import Data from Customer Sub screen for PO) .

7)I created adobe form which prints shipping delivery instruction form for the given input fields .

Ebeln,
vbeln,
kunnr,
date,
shipment number(tknum).
Vttk->shipment header table.
Ekko,ekpo,likp,lips,t027a,vbrk,vbrp,vttk,vttp.
First, we go to the SFP tcode
 first create an interface for the form


in the interface tab,create the import parameters.
In the types, we define all table structure types,
In initialization,we write the source code of form output.
In globalization,we define the internal tables and work areas.
Now we design the form layout.
Drag the data from interface to context.
Image: double click on the image element in the library.
Select the image into body page.
For the image to be displayed on the form, it is important to do this. Right Click on the image and click on object and check the EMBED IMAGE DATA checkbox.
To put the image as a background, select the image into the body page and right click on the image and choose send backward then it will become the back ground.
Drag the input fields to the master pages.
Output data to sub form of the body pages.
Now drag the fields from the data view to the design view.
Total:
Create one total text field with sub form.
From the drop down list "Show" select Calculate
Enable FormCalc for the text field "Grand Total" as shown below.

Step 10: Code for Grand-Total
We write the code under the area provided for the text field
Sum (Data.Table1.Group1.Row1 [*].PRICE[*])
Click Enter Script Source Changes + to add the script to your form.
Now we need to write ABAP Program.
1. Data retrieval in the report programme.
1).Call Function 'FP_JOB_OPEN '.
 2. Call Function 'FP_FUNCTION _MODULE_NAME (to get the generated
    function module name).
 4. Call Function <generated function module name>.
 5. Call Function 'FP_JOB_CLOSE'.
Purchasing Document Header-ekko-ebeln
Purchasing Document Item-ekpo-ebeln-ebelp
Shipment Header-vttk-tknum
Shipment Item-vttp-tknum
Shipping Instructions, Purchasing-t027a-evers

Smart forms and SAP Script are print forms and does not provide Interactive services where as Adobe Interactive forms can be used as both print forms and Interactive forms. Interactive means where the end user can input his data using a PDF and submit it to the SAP Server in Online/Offline mode.

9)I created  an interactive ALV report which displays purchase order header details as a basic list and purchase order item list as secondary list using oops concept.


Initially, create two screens in MP with custom containers for header and item data.
Define the all related table structures.
Declared the object reference variables,internal tables and work areas.
Classes: cl_gui_alv_grid,
cl_gui_custom_container.

Create selection screen fields
Matnr,
Ebeln,
Kunnr,
For this input fields system selects the data from the tables
Mara, ekko, ekpo, kna1, marc, mard, makt.

Next defined the event handler class definition and implementation for event double click.
In handle double click method.
Read itab into wa index e_row.
Select data from the database.
Call the item screen.
Next we fetch header data.
Define field catalog.
Call header screen.
In PBO,
module STATUS_0100 output.
  SET PF-STATUS 'STAT'.
  SET TITLEBAR 'TITLT'.
In module DISPLAY_ALV output.
Create object of container.
Create object of grid.
SET HANDLER HANDLE_EVENT=>HANDLE_DOUBLE_CLICK FOR O_ALV.

        CALL METHOD o_alv->set_table_for_first_display.
module USER_COMMAND_0100 input.
CASE  OK_CODE.
  WHEN 'BACK'.
  LEAVE TO SCREEN 0.
ENDCASE.
endmodule.
For printing,used the methods.
Set_top_of_page.
Set_end_of_page.
For hyperlink, filled the fields HNDR and HREF of internal table LVC_T_HYPE_TAB.
For exeption,filled light and text fields of itab.
I used methods of class cl_salv_table.
Call method factory.
Call method get_columns.
Call method set_exeption_column.
Call method display.

10)I created an ALV interactive webdynpro component which displays open delivery details as primary list and open quantities as a secondary list.

For this, selection screen fields are

Pending quantity-vbap-kwmeng.

Shipping point-vepvg-vstel.

Sales order no.

Date.

Customer name,

Customer no.
For this input system selects the data from tables

VBAK, VBAP, LIKP, LIPS, KNA1, VBUK, VBUP, VBPA, VEPVG, VBFA.

VEPVG-delivery due index table.
Sales Document: Header Status and Administrative Data-vbuk-vbeln
Sales Document: Item Status-vbup-vbeln-
Sales Document: Partner-vbpa-vbeln
Sales Document Flow-vbfa-vbelv
Delivery Due Index-vepvg-vstel


Step 1: Go to the Tcode SE80 and create a webdynpro component.
Step 2: In the main component, Add the component “SALV_WD_TABLE” to the used components table
Step 3: Go to the context tab of the component controller and create a context nodes

Input field nodes and output tables header and item structures nodes.

Choose the required attributes and press enter.
Step 3: In the properties tab of the view controller create a controller usage for the used component to access interface controller.

By doing so it will create two methods in the interface for the view controller.

Step 4 : Go to the layout tab of the view controller and create a view container UI element as shown
The purpose of this view container UI element is to hold the view of the component or another view of the same component.
Step 5: Go the window tab of the window controller, to add the view of the ALV component to the view container UI element which we have created earlier.

Right click on the view container and select embed view to add the view.

Select the view to be embedded as table from the pop up.

Table view of component SALV_WD_TABLE will be embedded in the view container as below.

Step 6: Go to the Interface controller usage of the component usage.

Click on the controller usage button and choose component controller as the controller usage.

Drag and drop the context node EKPO of component controller to the DATA node of the ALV table.

Step 7: Go to the Do init method of the component controller and initialize some values to the context node to be displayed in the table.
Some system Code will be generated.

Note: I have removed the unwanted code.
Initialize some values as shown below.
Code:
DATA lo_nd_ekpo TYPE REF TO if_wd_context_node.
DATA lt_ekpo TYPE wd_this->Elements_ekpo.
lo_nd_ekpo = wd_context->get_child_node( name = wd_this->wdctx_ekpo ).
SELECT *
from ekpo
into CORRESPONDING FIELDS OF TABLE lt_ekpo
UP TO 5 ROWS.
lo_nd_ekpo->bind_table( new_items = lt_ekpo set_initial_elements = abap_true ).
Save and activate the whole component.
Step 8: Create a webdynpro application to test the component.
Output: primary list.

For secondary list.

Now let us see how to create a link to action in the ALV table.
Go to the doinit method of the view controller and set the properties for the ALV table. We can also do it in the doinit method of the component controller by adding the alv controller usage to the properties of the component controller.
* Instantiate the used component.

IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
LO_CMP_USAGE->CREATE_COMPONENT( ).
* Method call in the used controller
LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
).
* Getting the object reference of the column.
CALL METHOD LV_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN
EXPORTING
ID    = ’EBELN’
RECEIVING
VALUE = LO_EBELN.
* Creating an object of cell editor type required.
DATA : LO_LINK TYPE REF TO CL_SALV_WD_UIE_LINK_TO_ACTION.
CREATE OBJECT LO_LINK.
* Set the text for hyperlink
CALL METHOD LO_LINK->SET_TEXT_FIELDNAME
EXPORTING
VALUE  = ’EBELN’
* Setting the cell editor of the column.
CALL METHOD LO_EBELN->SET_CELL_EDITOR
EXPORTING
VALUE = LO_LINK.
Go to the methods tab of the View controller and create an event handler method.

Assign the event handler method to the ON_CLICK event of the ALV component.
Because this is the event triggered by the system when the user click on the Cell in the ALV component. r_param import parameter which is a reference variable of some ALV Interface.
The attribute Value will gives us the value of the cell that the user has selected.

Based on the field symbol ,we select the item data from related tables.
Output:

11)I used the standard BAPI which post document in FI module.

Posted the data from the tables
BSIS, BSAS, BSEG, BKPF.
Created all table types ,internal tables and work areas and also bapiret2 structure.
Selected data from relevant database tables.

Call function ‘BAPI_ACC_GL_POSTING _POST.’
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST' "Accounting: General G/L Account Posting(f-02)
  EXPORTING
    documentheader =            " bapiache08    Document Header
  IMPORTING
    obj_type =                  " bapiache02-obj_type  Reference Transaction
    obj_key =                   " bapiache02-obj_key  Reference Key
    obj_sys =                   " bapiache02-obj_sys  Reference System
  TABLES
    accountgl =                 " bapiacgl08    G/L Account Line Items
    currencyamount =            " bapiaccr08    Line Item Currency Fields
    return =                    " bapiret2      Return Parameter
*   extension1 =                " bapiextc      Table for Customer Enhancement
    .  "  BAPI_ACC_GL_POSTING_POST

Call function ‘bapi_transaction_commit.’


Stage1: Creating a structure in SE11
Stage2: Creating the function module in SE37
 Next we have to release the function module by Function Module>Release>Release.
Stage 3: Creating the business object in SWO1
 Now select ‘Add Method’ from Utilities > API Methods > Add Method.
Now Go to: Edit > Change Release Status > Object type > To Modeled,to implemented.
Stage 4: Viewing the created BAPI in BAPI Explorer
Stage 5: Test your BAPI.
The main and basic difference between BAPIs and RFC is the
business object.Both is remote-enabled calls.
Bapi can't handle exceptions; the calling program has to
handle it whereas RFC fm can handle it.

Every BAPI is a RFc whereas every RFC is not a BAPI.
 Call by value.
Posting of negative values into talble using table maintenance
use the dataelement which is capable of both signs +/- .

For example /IBS/E_RBTRGV:RBD: Amount with +/- Sign
Header: Material Document-mkpf-mblnr
Document Segment: Material-mseg-mblnr
Purchase Requisition-eban-banfn
Purchase Requisition Account Assignment-ebkn-banfn
Filter badi:
Based on filter values, you can have different implementations of the same BADI. For example, if you have company code as filter, these can be handled by different development teams belonging to the respective company code to suit their individul requirements.
Multi-use BADI:
Multiple use for BADI definitions means that there can be several active BADI implementations. When there is a call, they are all called up - however, in an unpredictable sequence.

Methods of a multiple use BAdI can only have importing and changing parameters

If you have multiple-use BADI definitions, the sequence must not play any role therefore. A typical example is the execution of checks before a save.

1) Why are you looking for job change?

First of all, my contract is ending in this month.
Yes, I want career growth so I am expecting new environment which help me to enhance my old skills and learn new skills.

2) What are your roles and responsibilities in support project?

After a go live, the application needs a maintenance/support to resolve the issues/tickets raised by the users when using the application. Ticket is like a request for changes/bug fixing or a request for a new ABAP Developer Role includes bug fixing/change the existing code due to new requirements/build a new code etc.


After once fixing the bug/issue test the application and change the history of the existence TS and prepare the test cases and deliver the delivery document with all updation what are changes made.

1. working closely with functional team
2. debugging on the issues related to customized programs
3. working on new requirements like user exits/reports/forms and other enhancements
4. IDOC's
5. Interfaces
6. Corrections/additions in existing reports/forms and other enhancements.
7. Analyzing some technical related SAP notes when it’s required to implement.


3) What are your roles and responsibilities in implementation project?

As an ABAPer, first I receive the Functional specification document through my Team leader or Mail.
Analyze FS and if I have any doubts, discuss with functional people to understand more about FS.
Start the coding at the same time prepare technical specification document
After completion of coding, send it for the code review.
Check the all test case validations while prepare the unit test plan document.
After get the object approval.
Send it to the testing team who are responsible send it to production client.
Till now, I have worked on three implementation projects which are mostly different in one another .
For first project, I worked for 2 years .for second, 1 year and current, 1.2 years. These three are implementation projects in which I worked for SD, MM, FI Domains and some other domains like pp
And QM for these modules I developed reports like simple, interactive and ALV ,Migrated data from legacy system to sap system using BDC technique and Created normal and interactive forms using scripts, smart forms and adobe forms and involved in Enhancing the standard screens and standard program functionalities using enhancement technique and also Created the custom classes and used standard classes and their components into custom objects as well as Send the data from on client to another client within the sap system using IDOC TECHNIQUE at last Doing the data conversion using BAPI.

What are V1 and V2 Update Function Modules?


An update is divided into different modules. Each module corresponds to an update function module.
There are various types.
V1 modules describe critical or primary changes; these affect objects that have a controlling function in the SAP system, for example, creation of orders and changes to material stock.
V2 modules describe less critical secondary changes. These are pure statistical updates, for example, such as result calculations.
There are also collective runs for function modules that are frequently used.
Differentiating between update components according to priority lets the system process critical database changes ahead of less-critical changes.
The V1 modules are processed consecutively in a single update work process on the same application server. These belong to a single database logical unit of work (LUW) and can be rolled back. V1 updates are executed under the SAP locks held by the transaction that generated the update. This ensures data consistency; concurrent changes to the objects to be updated are not possible.
V2 updates are executed together in a separate LUW. They are not executed under the locks held by the transaction that generated them. If your SAP System contains a work process for V2 updates, these are only carried out in this system. Otherwise, the V2 components are processed by a V1 update process.
All V1 modules of an update must be processed before the V2 modules.
Example:
Assume that a transaction makes dispositive changes to a material and to a financial balance. It also updates two sets of statistics.
Each of these changes is represented by an update module (update function module call) in the update request - the two dispositive changes by a V1 update module (time critical), and the statistical changes by a V2 update module (less critical).

V1 and V2 Update Modules
An update is divided into different modules (see also Update Request). Each module corresponds to an update function module.
There are two types of module.
The SAP System makes a distinction between primary, time-critical (V1) and secondary, non-time-critical (V2) update modules. The system also supports collective runs for function modules that are used on a regular basis.
This distinction allows the system to process critical database changes before less critical changes.
V1 modules describe critical or primary changes; these affect objects that have a controlling function in the SAP System, for example order creation or changes to material stock.
V2 modules describe less critical secondary changes. These are pure statistical updates, for example, such as result calculations.
The V1 modules are processed consecutively in a single update work process on the same application server. This means that they belong to the same database LUW and can be reversed. Furthermore, V1 updates are carried out under the SAP locks of the transaction that creates the update. This ensures that the data remains consistent; simultaneous changes to the objects to be updated are not possible.
All V2 updates are carried out in a separate LUW and not under the locks of the transaction that creates them. If your SAP System contains a work process for V2 updates, these are only carried out in this work process. If this is not the case, the V2 components are processed by a V1 update process.
All V1 modules of an update must be processed before the V2 modules.

Let us assume that a transaction makes planning changes to a material and balance sheet, and updates two sets of statistics.
Each of these changes is represented by means of an update module (call update function module) in the update request  the two planning changes by a V1 update module (time critical), and the statistical changes by a V2 update module (less critical). (The V1 modules have priority, although the V2 modules are usually also processed straight away).
This is described in greater detail in the section entitled The Update Process.

Appending Summarized Lines

The following statement allows you to summate entries in an internal table:
COLLECT <wa> INTO <itab>.
<itab> must have a flat line type, and all of the fields that are not part of the table key must have a numeric type (F, I, or P). You specify the line that you want to add in a work area that is compatible with the line type.
When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
You should only use the COLLECT statement if you want to create summarized tables. If you use other statements to insert table entries, you may end up with duplicate entries.
Lines are added to internal tables as follows:

Standard tables

If the COLLECT statement is the first statement to fill the standard table, the system creates a temporary hash administration that identifies existing entries in the table. The hash administration is retained until another statement changes the contents of key fields or changes the sequence of the lines in the internal table. After this, the system finds existing entries using a linear search. The runtime for this operation increases in linear relation to the number of existing table entries. The system field SY-TABIX contains the index of the line inserted or modified in the COLLECT statement.
Sorted tables

The system uses a binary search to locate existing lines. The runtime for the operation increases logarithmically with the number of existing lines. The system field SY-TABIX contains the index of the line inserted or modified in the COLLECT statement.

Hashed tables
The system finds existing lines using the hash algorithm of the internal table. After the COLLECT statement, the system field SY-TABIX has the value 0, since hashed tables have no linear index.
Example

DATA: BEGIN OF LINE,
        COL1(3) TYPE C,
        COL2(2) TYPE N,
        COL3    TYPE I,
      END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE
          WITH NON-UNIQUE KEY COL1 COL2.
LINE-COL1 = 'abc'. LINE-COL2 = '12'. LINE-COL3 = 3.
COLLECT LINE INTO ITAB.
WRITE / SY-TABIX.
LINE-COL1 = 'def'. LINE-COL2 = '34'. LINE-COL3 = 5.
COLLECT LINE INTO ITAB.
WRITE / SY-TABIX.
LINE-COL1 = 'abc'. LINE-COL2 = '12'. LINE-COL3 = 7.
COLLECT LINE INTO ITAB.
WRITE / SY-TABIX.
LOOP AT ITAB INTO LINE.
  WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
ENDLOOP.
The output is:
         1
         2
         1
abc 12 10
Def 34           5
The example fills a sorted table. The first two COLLECT statements work like normal insertion statements. In the third COLLECT statement, the first line of ITAB is modified. The following diagram shows the three steps:





 What are Lock Objects ?

The SAP System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.
Structure of a Lock Object
The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships (see also Conditions for Foreign Keys).

Lock Arguments
The lock argument of a table in the lock object consists of the key fields of the table.
The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. When these function modules are called, the table rows to be locked or unlocked are specified by defining certain values in these fields. These values can also be generic. The lock argument fields therefore define which subset of the table rows should be locked.

The simplest case of a lock object consists of exactly one table and the lock argument of the table is the primary key of this table. Several tables can also be included in a lock object. A lock request therefore can lock an entire logical object, and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a position table.

Locks can also be set from programs in other systems with the corresponding interfaces if the lock object was defined with RFC authorization.
A lock mode can be assigned for each table in the lock object. This mode defines how other users can access a locked record of the table.

Table SFLIGHT in the flight model contains all the scheduled flights of a carrier. Field SEATSMAX contains the number of seats available. Field SEATSOCC contains the number of seats already booked. If a booking is made for a customer (by a travel agency or sales desk), you must check whether there are enough seats available. The number of seats booked is incremented when the booking is made.
This mechanism must ensure that two sales desks do not make the same booking at the same time and that the flight is not overbooked.
This can be done by creating lock object ESFLIGHT. Only the table SFLIGHT must be included in this lock object. The flight can then be locked (with the function modules generated from the lock object) when booking. If another sales desk also wants to book seats for this flight, the lock will prevent the flight from being overbooked.


Example for Lock Objects :


When booking flights (see Flight Model) it is important to prevent flights from being overbooked. For this reason, you have to lock the particular flight as well as all the bookings existing for this flight during processing. You can do this with lock object E_BOOKING.
The flights are recorded in table SFLIGHT and the bookings for the flights in table SBOOK. The two tables are linked with a foreign key. Lock object E_BOOKING must therefore contain table SFLIGHT as primary table and table SBOOK as further table.

The lock argument of table SFLIGHT thus contains the fields MANDT, CARRID, CONNID, and FLDATE. The lock argument of table SBOOK thus contains the fields MANDT, CARRID, CONNID, FLDATE, BOOKID and CUSTOMID.
Select exclusive lock mode that is the locked data can only be displayed and edited by one user.
When the lock object is activated, the following function modules are generated from its definition:
ENQUEUE_ E_BOOKING (set locks)
ENQUEUE_ E_BOOKING (release locks)
These function modules can now be linked to ABAP programs.
The following example shows how function module ENQUEUE_ E_BOOKING is called.

With this call, flight LH 400 on Nov. 29,1998 is exclusively (lock mode E) locked in table SFLIGHT together with all the bookings entered in table SBOOK for this flight (since the initial value 0 is transferred for BOOKID and CUSTOMID). The lock is sent to the update program (_SCOPE = ‘2’). If there is a lock conflict, another attempt is made to set the lock after a certain time (_WAIT = ‘X’).
The set locks can be removed by calling the function module DEQUEUE_E_BOOKING as follows:

The existing exclusive lock entries for flight LH 400 are deleted in table SFLIGHT and the bookings for this flight are deleted in table SBOOK. The request to delete the lock entries is passed on to the update program (_SCOPE = ‘3’).
See also:





Types of locks

You can use different types of locks.
The lock mode describes what type of lock it is. The lock modes are listed in the table below.
Locks Modes
Type of Lock Lock mode Description
Shared lock S (Shared) Several users (transactions) can access locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock set on an object that already has a shared lock will be rejected.
Exclusive lock E (Exclusive) An exclusive lock protects the locked object against all types of locks from other transactions. Only the same lock owner can reset the lock (accumulate).
Exclusive but not cumulative lock X (eXclusive non-cumulative) Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. Each further lock request will be rejected.
Optimistic lock O (Optimistic) Optimistic locks initially behave like shared locks and can be converted into exclusive locks. See Optimistic Locks.



Multiple and Single Use BAdIs


Concerning the programming model, there are two different BAdI types: Single- and multiple use BAdIs.
They have a completely different semantics.

The use case with the calculation I have sketched above is a typical example of a single use BAdI.

The basic program needs the result of a calculation. You leave the implementation details of the calculation to subsequent levels of development, for example the developers for the particular countries.
The business logic requires a result of the calculation, and it must be exactly one result.
The next steps in the program need this result, so you need at least one BAdI implementation and there is no way to process many return values, so you need exactly one result. If you have a single use BAdI, the system takes care that there is exactly one active implementation.
This way the call of the method of a single use BAdI functions like a method call.

Multiple use BAdIs are quite different in this respect. Such a BAdI is suitable for activities, that might be done or not and that might even be consecutively done in different ways in different implementations when a program is executed. Imagine you build a BAdI additional_output that might convert data for different additional output devices such as a Blackberry, handy, etc&#133; many different active implementations can coexist in the program simultaneously, but there might also be no active implementation. So the call of a method of a multiple use BAdI is in a way like sending a message:

 You do not know and do not care how many services react to the message. It corresponds to publish and subscribe mechanism.

1) Difference between BADI and USER-EXIT.
    i) BADI's can be used any number of times, where as USER-EXITS can be used      only one time.

       Ex: - if you’re assigning a USER-EXIT to a project in (CMOD), then you cannot assign the same to other project.
    ii) BADI's are oops based. 1. Customer exits: Implemented as Function Modules within z includes. Anybody can change it and no access key is required.

2. User Exit: Implemented as subroutines within includes (any include except y or z includes). You need access for the specific include and then you can any subroutine (user exit) within that Include.

BADIs are the enhanced version of user exits where the same logic is implemented via classes and object (OOP)

Enhancement point is the latest one introduces with ECC 6.0. Not very sure about that but you can change it without any access key.

Call the BADI implementation from the program.
Go to TCODE - SE38 and create a report program.
Step18. Create a reference variable referring to the Interface name associated with the BADI definition. Then call the static method GET_INSTANCE of the class CL_EXITHANDLER.
Pass the BADI definition name and it will return the object of the active implementing class to the reference variable.
Activate the program and run it.
Pass the BADI NAME and obj of badi interface.

MODIFY itab
MODIFY - Changing an Internal Table

Variants:

1. MODIFY itab [FROM wa] [INDEX idx] [TRANSPORTING f1 ... fn].
2. MODIFY TABLE itab [FROM wa] [TRANSPORTING f1 ... fn].
3. MODIFY itab [FROM wa] TRANSPORTING f1 ... fn WHERE cond.
Variant 1
MODIFY itab [FROM wa] [INDEX idx] [TRANSPORTING f1 ... fn].
Effect: Changes a single entry in the internal table itab, specifying the key explicitly or implicitly. You can only use this variant with index table (standard or sorted tables).

If you specify "FROM wa ", the new values are taken from the work area wa. If you do not specify FROM, the header line of itab is used as the work area.

You can use "INDEX idx" to specify the table index of the line you want to change. This may be omitted within a LOOP at an internal table. In this case, the current table line is changed.
The INDEX specification can come before the FROM addition.

If you specify "TRANSPORTING f1 ... fn", only components f1, f2, ... of the work area are copied into the table. You can also specify components dynamically in the form (name). The actual component name is then taken from the field name at runtime. If name contains an invalid component name, the system triggers a runtime error. You may not use a key field as a TRANSPORTING field with HASHED or SORTED tables.
Variant 2
MODIFY TABLE itab [FROM wa] [TRANSPORTING f1 ... fn].
Effect: Generic change to a single entry in the internal table itab with key. Unlike variant 1, you can use this variant for any table.

You can use "FROM wa" and "TRANSPORTING f1 ... fn" in the same way as in variant 1. If you do not use the TRANSPORTING addition, only the non-key fields are transported.

Variant 3
MODIFY itab [FROM wa] TRANSPORTING f1 ... fn WHERE cond.
Effect Changes several entries in the internal table itab. You can use this variant for any table.

You can use “FROM wa" and "TRANSPORTING f1 ... fn" as in variant 1. If the table has the type SORTED TABLE or HASHED TABLE, the TRANSPORTING list may not contain key fields.
APPEND Syntax Diagram
Variants:


1. APPEND [wa TO|INITIAL LINE TO] itab.
2. APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.
3. APPEND [wa TO] itab SORTED BY f.
Effect appends a new line to the end of the internal table itab. You can only use this variant with index tables (standard or sorted table).

Variant 2

APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.

Appends the internal table itab1 or a block of lines from itab1 to the end of the internal table itab2.

You can only use this variant with index tables (standard or sorted table).

INSERT - Insert into an Internal Table

Variants:

1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].
2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.
3. INSERT LINES OF itab1 [FROM idx1] [TO idx2]
INTO itab2 [INDEX idx3].

4. INSERT LINES OF itab1 [FROM idx1] [TO idx2]
INTO TABLE itab2.
Variant 1
INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].

Effect: Inserts a new line in the internal table itab using an explicit or implicit index specification. You can only use this variant with index tables (standard or sorted tables).
Initializing Internal Tables

Like all data objects, you can initialize internal tables with the
CLEAR itab.

The memory space required for the table is released, except for the initial memory requirement.
If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table itself, not the header line, during initialization using CLEAR, you must place two square brackets ([]) after the table name.
CLEAR itab[].

To ensure that the table itself has been initialized, you can use the statement

REFRESH itab.

This always applies to the body of the table. With REFRESH, too, the initial memory requirement for the table remains reserved. To release this memory space, use the statement
Effect: Definition of a table key in an internal table.

You use UNIQUE and NON-UNIQUE to specify whether the table key is unique or not. For a table key specified with UNIQUE, a row with a certain key field content can only occur once in an internal table of this type. You can only use NON-UNIQUE for standard tables, you have to use UNIQUE for hashed tables, and both for sorted tables.


Some of the most important questions which faced in the real time



When you are facing client round, you can expect these questions.

The client gone through all the profile and asks you to explain the each and every object scenarios and links b/w the tables and asked about project business process.

 He may be asking you on functional side.

What is difference between Function module and BAPI?

What are the table and view?

What is authorization check?

What is difference between class and interface?

What are function module types?

How many internal table types?

What is BDC screen resolution and what is the structure

Ans: ctu_params.
What is difference between call transaction and session method?

What are authorization types we have?


Why we go for secondary index? is there any advantage?


How will you receive and standard idoc from sender->receiver.
How configuration is take place and from receiver side how will process the data into internal table.

How will you send the idoc?
How will you test the idoc?
How will you receive idoc?

What are the steps you follow to create an custom idoc program in which environment you create the program?



What is the difference between implicit enhancement and explicit enhancement?

What is the difference between user exit and customer exit?

What is the difference between enhancement spot and section?



In ALV,how will you  print a header information if it exceeds limit of 72 characters
what are the function modules you use?
What are the Disadvantages of secondary index?
How to save the input in lower case and uppercase?


What is table control in MPP?
What are the update modes we have in MPP like stack do you have ever hear about this ?


What is table control in bdc?



What is abstract class?


How do you debug idocs?

What will control record do?


In your project, how will you review your code?


Who will give the estimations?


If u r a team lead what are your roles and if any problem occurs how will you resolve?
How your project implementation is takes place?







2. How to include standard text in transport requests?

3. What is t-code to assign program and form to print invoice using vf02?

4. What is difference between customizing and workbench request?

5. Give brief about MM flow with tables and tcodes?

6. Give brief about SD flow?

7. While executing BDC if system return sy-subrc=1001, what could be the error message?

8. Can we run specific record in LSMW when the file contains 1 lacs record? If so how

9. Can we write code in table level?

10. Have you ever created any custom table? Explain scenario?

11. What is development process in your current project explain me in brief?

12. What is statement used to get the number of records in internal table?

13. How to debug script without using/h?

14. How do you come out of screen when you are not giving mandatory fields in MP programming?

15. Can we modify the report output and save it? If so how?

16. Mandatory field in selection should trigger only when u execute the report is it possible how?
17. How do you debug the report in background job?
18. Write the steps to create enhancement spot?

20. What are different types of methods in LSMW?

21. How do you retrieve the OSS note implementation code?

22. Specify the scenario when we need access keys? How do you get the required parameters to get access keys?

23. Provide the steps to retrieve the earlier code of the program which is already moved to production system?

24. What are main difference between conversion and interface program?

25.  What is the difference between FM and BAPI?

26. What are major advantages of BADI?

27. What is sat transaction and uses of it?

28. What is table name for company code and plant?

29. Tcode to forward work item? Steps required for it?

30. How do you print the smart form in front and back? Provide the option?.
In table maintains generator if you want to restrict one field and it should be in grayed out what will u do?
1) We have some custom 5 fields how will add these to particular table or using BAPI?

Ans: by using BAPI-extension in these we have 2 types extension-in and extension-out here we go for extension out

2) what is BAPI extension in and out?

3) How u send idoc’s without using RFC interfac?

4) How will u post idoc’s?

5) What are inbound settings?

6) How will u identify the EDI/ALE and how u create idoc

7) How u modify the inbound ale idoc?

8) What happens if we miss the sender information in outbound-->inbound configuration and what error message you get and what is the status code?

9) How u reprocesses the outbound idoc and reprocesses the inbound idoc?

10) How do you edit the idoc in outbound
11) How do you test the idoc in inbound and outbound?
12) What are purchase order, sales order idoc and their names and idoc types
13) tell me one scenario where we go for idoc and why we go for idoc.


SAP ABAP Data Dictionary Interview Questions



SAP ABAP ALV Reports Interview Questions


SAP ABAP BDC Interview Questions













ABAP Performance check Real time Interview Questions

ABAP OOPs Real Time interview questions


ABAP SD MM and FICO flow Real Time Questions


ABAP ASAP Methodology Real Time Interview Questions


SAP Projects Types Real time Interview Questions


At the end of this post, you will get better confidence to prepare for SAP ABAP real-time interview and You can learn, how to prepare for the real-time interview as an SAP ABAP consultant while facing different questions in different interviews. I wish you all the best for all interviews.

Comments

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced