Monday, October 29, 2012

SAP ABAP Interview Question (SAP Labs, Accenture, IBM , Deloitte , TCS , Infosys)

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?
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
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 ?
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?
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)
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.
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?
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 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.
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?
(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.
select-options s_matnr for mara-matnr.
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′.
TITLE = ‘ ‘
text = g_titl1 ” ‘Customers’
tab_and_field = struc_tab_and_field
TABLES RANGE = rng_kunnr
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.
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. 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’.
‘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.
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…
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?
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?
1.How will u print footers in alv report?
2.How will u edit fields from output list of alv?
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?

Most frequently asked Differences in ABAP interview

1.sapscript and smartforms
  • Sap script is client dependent and smart form is client independent.
  • Smartforms has Only 1 main window while Sap script has 99 main windows
  • You can not print labels using smart forms
2.BDC and LSMW
  • In BDC we have to take care of field mapping whereas field mapping is taken care by sap in lsmw.
  • BDC is mostly used for customised data upload while LSMW is used for uploading Master data.
  • In BDC we need to write large code but in LSMW small coding is needed.
3. BADI and BAPI
  • BADI is business add ins, it is used to customize the standard business flow
  • BAPI is Business application programming interface. It is nothing but Remote enabled function module which can be called from outside the SAP System.
4.user exit and customer exit
  • User exit is an include program given by SAP in that you can write your code , It needs Access key from SAP while key is not required in case of customer exit
5. Select single and select up to one row
  • Select single will fetch only one record while select up to n row. Will fetch n rows from database
6. Normal (Classical) report and ALV report
  • To display the output in classical report you use WRITE Statement.
  • To display the output in ALV we have different function modules and class like REUSE_ALV_GRID_DISPLAY , REUSE_ALV_LIST_DISPLAY and CL_SALV_TABLE.
  • If you run the classical report in background after JOB finished you can see it’s output which stored in spool, While in case of ALV you need code extra to store the output as it will not generate the spool.
7. ALV list display and ALV grid display
  • You cannot retrieve the output for the report which is displayed using ALV GRID Display.As spool Request will not be created for the same. While in case of list display Report out put will be there in spool request.
8. Classical and drill down report
  • In classical report user cannot interact with report whereas in drill down report user can interact with report.
  • Drill down facility is not provided in classical report while in drill down it is provided.
  • If they ask you in detail then tell the interviewer that interact with the report means in drill down report we have one basic list and 20 secondary lists so we can directly go to 5th list or 10th list as per our requirement similarly we can come back to any list. Drill down means showing data in basic list first and when we double click on any field we get summarised list. NOTE:- to go to next list in drill down report use following syntax SY-LSIND = < list number> example: to go to 15th list SY-LSIND = 15 to come to 5th list from 15th list use F3 KEY OR PRESS BACK BUTTON
9. BAPI and RFC function module
  • BAPI is nothing but remote enabled function module
  • BAPI is provided as a method of business objects 4.7 and ECC 6.0
  • SAP 4.7 is based on Web AS
  • ECC 6.0 is based of Netweaver 7.0.
11. get cursor and hide in interactive report
  • Get cursor will provide the location cursor position in the report
  • While hide is use to pass the data from basic list to secondary list
12.normal function module and RFC
  • You cannot call normal function module from outside the current system while RFC function module can be called from outside the SAP system.
13. Subroutine and function modules.
  • Subroutine is local to the program while function module is global.
  • To call subroutine from outside its main program you need to write its main program name in the bracket
14.At selection screen and At selection screen output.
  • At selection screen output is called first
  • All dynamic commands and screen modification is done in AT selection screen output. input and batch input
  • The basic difference is validation is not done in direct input by pre defined function while in batch input it is coved.
16.synchronous and asynchronous in BDC
  • Synchronous mode will wait until the BDC session gets over while asynchronous mode will not wait for that selection screen and at selection on field name
  • At selection screen is used to validate the whole screen elements while at selection field is used to validate the particular field.
  • When you display the error message in at selection on field the focus will be on that particular field while in case of At selection screen the focus will not be on any particular field.
18. PBO and PAI event in module pool
  • Process Before Output and Process after input.
  • PBO will be called before the screen is displayed to the user while process after input is called once user interact with screen.
19. Stop , check and exit
  • If you use the STOP statement within an event block, the system stops processing the block Immediately.
  • If you use the EXIT statement within an event block but not in a loop, the system stops Processing the block immediately
  • If you use the CHECK <expr> statement within an event block but not within a loop, and the Condition <expr> is not fulfilled, the system exits the processing block immediately. <expr> can be any logical expression or the name of a selection table. If you specify a selection table and the contents of the corresponding table work are do.
stop_check_exit and refresh in internal table
  • You can use FREE to initialize an internal table (along with header line ) and release its memory space.
  • REFRESH will only initialize an internal table (along with header line)
21.clear and delete.
  • The major difference is clear is used with internal table while delete is used with database table.
22. collect and sum
  • COLLECT <line> INTO <itab>. The statement first checks whether the internal table contains an entry with the same key. If not,it acts like INSERT. If there is already a table entry with the same key, COLLECT does not inserta new line. Instead, it adds the values from the numeric fields of the work area <line> to thevalues in the corresponding fields of the existing table entry.
  • SUM.Can only be used in loops through internal tables. Calculates the sums of the numeric fields in alllines of the current control level and writes the results to the corresponding fields in the workarea.
23. call transaction and session method
  • Call transaction is Synchronous Processing while session (classical) method is Asynchronous Processing
  • In call transaction we can update the database both synchronously and asynchronously. We can specify the mode in the program. While in session method it is Synchronous Database update.
  • In call transaction No batch input processing log is maintained while in session method details log is maintained.
  • Call Transaction method is faster than the session method.
24. at first and at last control break event
  • As the name suggest AT FIRST executed for the first time while AT LAST executed in last.
25. Enhancement point and Enhancement Section
  • Both the enhancement-point and section are available for you to change standard SAP code. Difference is in fact that you use Enhancement-point to add ABAP code to standard SAP and enhancement-section to replace/extend standard SAP code. 
26.end of page and top of page
  • Top of page trigger when report encounter the first write, skip or new-line statements.
  • End of page trigger when page size is over or report display gets over.
27. Table and structure
  • Table has physical definition into the underline database while structure does exist physically in the data base.
28. table and views
  • Table has data init while view does not contain data in it. Both exist in the data base. when u run the view it queries the database and gives the respective data.
29.inner joins and for all entries
  • Inner join joins the table at database level whereas For..All..Entries joins the table at application level.
  • In For..All..Entries when the condition gets satisfied data is fetched in one single shot from database table whereas in inner join data is fetched iteration by iteration
  • It is always good programming practice to join tables at application level because if we join tables at database level then there might be performance issue
30. Transparent table pool table and cluster table
  • Transparent Table: Exists with the same structure both in the dictionary and database exactly with same data and fields. it’s to store transaction data. It’s one to one Relation table
  • Pool tables: These are logical tables must be assigned to a table pool when they are defined. Its use to store control data. its many to one relation table
  • Clustered tables: these also logical tables and must be assigned to table cluster when they are defined. It’s also used to store control data, temporary data or text ex., documentation. It’s also many to one relation table.
31. Top of page and top of page during line selection
  • Top of page is triggered for the basic list while top of page at line selection triggers at secondary list.
32. Start_form and End_form in sap script
  • start_form function module is called if we want to use different forms with similar characteristics in a single spool request ,it must be closed by END_FORM function module
33. open dataset and close dataset
  • Open dataset is use to read / write file into application server while close dataset is use to close that file.
34. data element and domains
  • Domain gives technical details like length , decimal etc..while data elements gives description and business details
35. set screen and call screen
  • Set screen <no> set the next screen value and temporarily override the next screen value in screen attribute. While call screen <no> jump to the screen specified in <no>.
36. Internal Session and External Session
  • External session is nothing but the window you have opened in your screen .By Default you can open 6 external sessions( 6 windows = you can increase it via basis’s setting). Internal session is created when you call any Functional module or any other task in your program. counts for internal sessions are 9.
37. Elementary and collective search help
  • An Elementary Search help defines the flow of a standard input help. It is composed of a selection method that defines where to get the data that will make up the hit list, An interface consisting of search help parameters that define the exchange of data between the screen and the selection method and a dialog type that controls how the hit list will be displayed.
  • Collective Search help is a combination of several elementary search helps giving the user a different search paths. The interface parameters of the elementary search help are assigned to the parameters of the collective search.
38. What is the difference between Clustered Tables and Pooled Tables?
  • A pooled table is used to combine several logical tables in the ABAP/4 dictionary. Pooled tables are logical tables that must be assigned to a table pool when they are defined.
  • Cluster table are logical tables that must be assigned to a table cluster when they are defined.
  • Cluster table can be used to store control data they can also used to store temporary data or text such as documentation.
39. user exits and customer exit.
  • User exit is sap defined includes so to modify it we need key from SAP.while customer exit like function exit , screen exit we don’t need any key.
40. sapscript smart forms and adobe forms
  • Sapscript is client dependent whereas smartform is client independent.
  • Main window is compulsory in scripts whereas main window not compulsory in form.
  • Smartform output can be seen in web while in scripts it is not possible.
  • smartform generates function module while scripts dont generate function module.
41. screen and subscreens in module pool.
  • Screen has it’s own gui status while subscreen does not have any gui status.Subscreens are part of main screen.
42. standard table and hashed tables.
  • Standard table can be accessed by key as well as index while You can only access hashed tables by specifying the key. The system has its own hash algorithm for managing the table.

SAP Online/Remote Access at the most competitive price in the Industry

We offer you the best in online remote access server. You can access SAP Server online through your laptop or desktop via Internet. You can access the server from anywhere in the world without requiring a VPN

• We provide access to all SAP modules. Access to our servers from any part of the world 24/7.
• No fake promotions or sales! We are here to give you 100% support 
• We Provide Quality Servers with 24x7x365 Days Support.
• 3 Months - 6 Months - 12 Months subscriptions are available at better prices

DEVELOPER Access is Free with Every ID


• SAP ECC 6.0 / EHP5 IDES Server (ABAP, FI-CO, MM, SD, HR, PM, PP, QM, WM, ETC...) 
• SAP CRM 7.0 IDES Server
• SAP SRM 7.0 IDES Server
• SAP BI 7.01 Server 
• SAP ESS/MSS, Java Portal with ECC 6.0 EHP5 ETC.


• SAP IDES ECC 6.0 + SAP IDES CRM 7.0 Servers (Both System RFC Connected)
• SAP IDES ECC 6.0 + SAP IDES BI 7.0 Servers (Both System RFC Connected)
• SAP IDES ECC 6.0 + SAP IDES SRM 7.0 Servers (Both System RFC Connected)

• If the server is down for more than 1 day we will extend the server for those many days.
• Special 10% to 30% discount on Dual/ Multiple SAP Remote Access Systems
• We are Providing SAP Remote access in all languages
• Later after 15 Days if you are not happy, the Payment will be refunded.
• We have a 24/7 uptime guarantee with a 24/7 technical support team standing by
• Guaranteed resolution to any ticket opened within 24 hours
• Guaranteed setup of your account within 1 to 2 hour of registration and payment anytime.
• We have the lowest number of users per server in the industry.

So what you are waiting for , We are offering you best server at the most competitive prices in the Industry.
Special packages available on request for Bulk Orders and for Trainers.
If you are interested please email at or call us at +91-9891110466

Saturday, October 27, 2012

Call ABAP Webdynpro Application from a R/3 Transaction

Please find the Code Snippets to Call a Webdynpro ABAP Application from a R/3 Transaction
Create a ABAP Program from SE38 and associate a transaction to it and Call the same.


***data declarations
DATA:gv_url_string TYPE string,
     gv_url_c(250) TYPE c.

CONSTANTS:gc_login_auth TYPE string VALUE '?sap-system-login-basic_auth=X',
          gc_client     TYPE string VALUE '&sap-client=',
          gc_lang       TYPE string VALUE '&sap-language='.

***Get the Url of Webdynpro Applicaion with HTTPS Protocol
CALL METHOD cl_wd_utilities=>construct_wd_url
    application_name = 'WDR_TEST_NAVIGATION'
    in_protocol      = 'HTTPS'
    out_absolute_url = gv_url_string.

***If the server and port have not got added, try without HTTPS Protocol
IF gv_url_string CS '//:/'.
  CALL METHOD cl_wd_utilities=>construct_wd_url
      application_name = 'WDR_TEST_NAVIGATION'
      out_absolute_url = gv_url_string.

***If server and port have still not got added
  IF gv_url_string CS '//:/'.
**Raise a Error Message

***Build the URL
CONCATENATE gv_url_string
            gc_client sy-mandt
            gc_lang   sy-langu
  INTO gv_url_c.

***Call the Browser
    url                    = gv_url_c
    frontend_not_supported = 1
    frontend_error         = 2
    prog_not_found         = 3
    no_batch               = 4
    unspecified_error      = 5
    OTHERS                 = 6.