SAP ABAP Interview Questions
SAP ABAP Interview Questions
PERFORM
userexit_save_document_prepare.
Customer Exit
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.
You have access only to the
importing, exporting, changing and
tables parameter of the Function
Module. So you have limited access
to data.
A customer exit is considered an
enhancement.
You do not need access key.
Changes are upgrade compatible.
Customer exits came later and they
overcome the shortcomings of User
Exit.
To activate a function exit, you need
to create a project in SMOD and
activate the project.
Call Transaction
Call transaction method is when the
data volume is low
Call Transaction method is relatively
faster than Session method.
SAP Database is updated during the
execution of the batch input
program.
Errors should be handled in the
batch input program.
BDC
BDC is relatively slower than BAPI.
BDC goes through all the screens as
a normal user would do and hence it
is slower.
Background and Foreground
processing options are available for
BDC.
BDCs would be preferred for large
volumes of data upload since
background processing option is
available.
Errors can be processed in SM35 for
session method and in the batch
input program for Call Transaction
method.
Subroutine
Subroutine can be called from other
programs also.
Can have any number of parameters.
This is not true for Subroutine.
Subroutine is defined inside:
FORM ..
..
ENDFORM.
Subroutine is used for
modularization.
ABAP Memory
When you are using the EXPORT
IMPORT Statements, you are using
the ABAP Memory.
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
cannot use ABAP memory.
Important
Question 8: What is the difference between AT SELECTIONSCREEN and AT SELECTION-SCREEN OUTPUT?
AT SELECTION-SCREEN is the PAI of the selection screen whereas
AT SELECTION-SCREEN OUTPUT is the PBO of the selection screen.
Question 9: What is the difference between SY-INDEX and SYTABIX?
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.
Important
Question 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.
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:
Lets 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 called
AT SELECTION SCREEN OUTPUT: PBO for Selection Screen
AT SELECTION SCREEN: PAI for Selection Screen
START-OF-SELECTION
END-OF-SELECTION
TOP-OF-PAGE
END-OF-PAGE
AT USER-COMMAND: When user click on say buttons in application
toolbar. SY-UCOMM
AT LINE SELECTION: Double click by user on basic list. SY-LISEL
AT PF##: When User Presses any of the Function Keys
TOP-OF-PAGE DURING LINE SELECTION
Question 17:
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 1000s 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.
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 isCALL 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.
Lets 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?
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.
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:
EXPORTING
formname = 'Z_SMARTFORM'
IMPORTING
fm_name = lv_fm_name
CALL FUNCTION lv_fm_name
*How do you convert a Smartform Output to PDF output?
There is a tricky solution here.But let's keep that for the last. Let us first
discuss the conventional way of getting a PDF output for Smartform. For that
you need to keep in mind the following two function modules and their
importing/exporting parameters:
CONVERT_OTF
CONVERT_OTF_2_PDF
In the Driver program, import the parameter 'job_output_info' from the
Smartform FM and utilize that info in 'OTF' parameter of the two
aforementioned function modules.
Here is one more and probably the easiest way to see PDF output for a
Smartform.
Type PDF! in the command prompt and hit enter :).
Note: You have Page-protection property only for Text Elements in the Main
Window.
Can you move a Smartform from one SAP system to another without
using transports ?
Yes, this can be achieved using the Upload/Download feature for Smartforms.
One can download the Smartform from one system and save it as an XML file.
Once that is done, the XML file can be used to upload the Smartform in another
system.
Session Method
Call TRANSACTION Method
CALL DIALOG (Outdated)
Session Method
Call Transaction
Important:
Question 2: How do you do BDC for a table control?
With other things as usual, there is a special trick that you have to use while
doing BDC for table control.
You need to use the BDC OKCODE '=P+'.
Its the BCD_OKCODE for Page down that can be used for scrolling down in table
control.
Important:
Question3: Is there any method apart from BDC for data upload to SAP?
Apart from BDC and LSMW, you can use BAPIs to upload data into SAP.
BAPIs should be preferred over BDCs, because they process data faster than
BDC.
A BAPI is faster since it updates Database "directly". Whereas BDC
calls transaction and goes through the whole screen sequence as any user would
do.
BAPI
BDC
Example code:
perform bdc_field
using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field
using 'BDC_OKCODE'
'=BU'.
Once the recording is done , one can Transfer it to the Batch input program.
In the batch Input program , The transactional data is read from the file to an
internal table.
Then one can loop over the transactional data in the internal table and start
uploading the data in SAP either by CALL TRANSACTION method or by creating
sessions through the batch input program.
Question 11: What are the different modes of processing batch input
sessions?
Foreground
Background
Question 12: What is the difference between Synchronous and
Asynchronous Update ?
In Synchronous update , the database is updated before the next transaction
is taken for processing in a batch input.
In Asynchronous update , the system doesn't wait for updating the
database before the next transaction is taken for processing in a batch input.
Lets get started . Hope you get some value in these pages :)
Question 1: What is ALE ?
ALE stands for Application Link Enabling. As it's name indicates , it links two systems.
ALE is a technology that can enable exchange of data between two different Systems ( Sap - Sap
OR Sap - Non Sap). ALE technology enables distributed yet integrated installation of SAP
systems.
ALE architecture comprises of 3 layers :
Application layer refers to the application data ( SD , MM , FI or data for any SAP application ) .
In this layer the data is collected to be distributed and then sent to the distribution layer.
Distribution layer determines to whom should the data generated by the application layer has to
be distributed i.e. it is in the distribution layer that the recipient is determined , the data is
formatted or filtered and then an actual is created.
Communication layer takes the responsibility of delivering the Idoc to the receiving system and
communicates to the receiving system via tRFC , File ports , FTP or TCP/IP etc.
ALE uses IDoc as a vehicle to transfer data between two systems.
data into one of the many EDI formats and generates an EDI file in an X12 format. The
middleware then translates the X12 file to an IDOC format and the IDOC is sent to the SAP
system.
Status Records: Control record information for an IDoc is stored in standard table EDIDS.
Question 5: What is an Idoc status? What are the different types of Idoc statuses that you know
?
When an IDoc is sent from one system to another , it goes through variuos stages.The IDoc
status indicates the stage that the Idoc in currently in.
There about 75 IDoc statuses.There is no way you can remember those all .
Don't even try to ! You will probably remember only those on which you have worked .
But here are a few that you should know:
0-49 indicates an Outbound IDoc and 50-75 as Inbound IDoc.
01 IDoc generated
02 Error passing data to port
03 Data passed to port OK
51 Application document not posted
52 Application document not fully posted
53 Application document posted
Question 7: What is a Message type and Idoc Type ? What is the difference between Message
type and an IDoc type?
A Message type and an IDoc type are closely related . In fact, you will find that a Message type is
always associated with an IDoc type.Whereas an IDoc type is a detailed version with all the
segments and fields , a Message type is used just to specify the kind of information that a system
can send or receive to or from another system.
So If system SAP1 has a Partner Profile where it specifies MATMAS as an outbound message
type , it just means that SAP1 can send material master data to say system SAP2.
If system SAP1 has a Partner Profile where it specifies MATMAS as an inbound message type ,
it just means that SAP1 can receive material master data from say system SAP2.
What all fields can be sent and received will be specified in the IDoc type.
Some other message types: DEBMAS( Customers), CREMAS(Vendors) belong to the Master
data.
The link between a message Type and an IDoc type is maintained in Tcode WE82.
Question 8: What is a partner profile ? What are the types of partner profiles ?
To be able to communicate with a partner via an IDoc interface, each system needs to maintain a
partner profile. A partner profile is a mechanism by which the system can specify what kind of
messages (message types) it can send or receive.
Partner profiles can be maintained in WE20.