Professional Documents
Culture Documents
Abap Faqs
Abap Faqs
ABAP Certification questions..By Sri nivas : TCS Chennai--You want to use SORT command on the internal table. Is it possible to use SORT c
ommand on a hashed internal table?
Ans : Sort command can be used on a hashed internal table as well as a standard
internal table.
2.. How to monitor the change of content of individual variables?
a .Code for a watch point in the program against the particular variable
X
( Not
Possible)
b.You can set the watch point only in the debugger mode against the variable.
c.You can create multiple watch-points
d.Create watch-point based on the combination of AND/OR operators
3. Any change in sap standard code
Ans : modification
4. How to implement a BADI definition ?
Need to implement the interface defined in BADI. BADI s are based on OOPS concept.
Notes:
1.Execute Business Add-In(BADI) transaction SE18
2.Enter BADI name i.e. HRPBSGB_HESA_NISR and press the display button
3.Select menu option Implementation->Create
4.Give implementation a name such as Z_HRPBSGB_HESA_NISR
5.To access already created implementations simple select menu option Implementa
tion->display or Implementation->change. You can also access existing BADI imple
mentations via transaction SE19
6. You can now make any changes you require to your BADI within the implementati
on, for example choose the Interface tab
7.Double click on the method you want to change, you can now enter any code you
require.
8.Please note to find out what import and export parameters a method has got ret
urn the original BADI definition (i.e. HRPBSGB_HESA_NISR) and double click on th
e method name for example within HRPBSGB_HESA_NISR contract is a method
9.When changes have been made activate the implementation
5) How to access private attributes of a class ?
Ans:
a. Private attributes can be changed/accessed only by the methods of the class.
b. All the users (classes) specified as friends can also access PROTECTED and PR
IVATE components of the class (If modelled flag is not set while defining friend
s). The friends relationship is always one-sided and is not inherited. This mean
s that friends of a superclass are not automatically friends of the subclasses.
6) Widening Cast and Narrowing Cast.
1)created an object for subclass say sub1 (its type is subclass )
2)assing that to superclass : super1 = sub1 (super1 is superclass type) >this
is called upcasting or narrow..ur access is limited to super class attri only
3) now ur assigning back agin to subclass type sub1 ?= super1 (sub1 is subclass
type) > this is called downcast or widening casting..ur access to now not limi
ted only to superclass ,u can also access sub class attri and methods.
WIDENING CAST (down cast) subclass_ref ?= super class obj
u will get ques on this concept .
7) There exists an error in one of the mandatory fields and you want to exit the
application or cancel the transaction without entering the mandatory field. Wha
t will you have to code in the module pool programming to achieve this functiona
lity
Ans : In the PAI Event, MODULE EXIT_TRANSACTION AT EXIT-COMMAND.
The function code for the button should be E .
8 ) You have to write the logic for a custom transaction such that a different l
ogic is followed for each click on button on the Menu. How is this handled in th
e Dialog Programming?
Ans: The buttons function code is captured in system variable sy-ucomm. You have
to define a screen attribute ok_code of type sy-ucomm as a global variable. In
the PAI Event, write a module as below. Sample code can be as below in the PAI E
vent Module.
MODULE user_command_1000.
Ok_code = sy-comm.
CASE SY-COMM.
WHEN SAVE .
Perform save_Date.
WHEN CANCEL .
PERFORM exit_data.
ENDCASE.
ENDMODULE.
9) You have been given to analyse a report program where the events are written
in alphabetical order. What will the series of events executed?
Events are executed by the runtime environment. No matter in which order the eve
nts are written below is the flow of events
1. LOAD-OF-PROGRAM
2. INITIALIZATION
3. AT SELECTION-SCREEN.
4. START-OF-SELECTION.
Ans: TOP-OF-PAGE will be triggered before the first WRITE statement.
10) How to display an ALV grid in the module pool program, say in a custom trans
action user will enter the material and click on execute, then an ALV report is
to be generated in the next screen.
Step 1: Create a Custom Control screen element say with name CCONT .
In the PBO module of the screen.
Step2: Create the container object and the corresponding grid object.
DATA : g_custom_container TYPE REF TO cl_gui_custom_container,
g_grid TYPE REF TO cl_gui_alv_grid,
CREATE OBJECT g_custom_container
EXPORTING
container_name = CCONT .
CREATE OBJECT g_grid
EXPORTING
i_parent = g_custom_container.
Step3: Build the field catalog and layout as required.
DATA : gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.
Step4: Perform the display of data using
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
i_save = c_a
CHANGING
it_fieldcatalog = gt_fieldcat[]
it_outtab = output_data.
11) What will the sequence to declare data in a program?
Ans : TYPES: BEGIN OF TY_CHARDATA,
NAME TYPE CHAR32,
ENDOF TY_CHARDATA.
DATA: LT_CHARDATA TYPE TABLE OF TY_CHARDATA Internal Table without header line
WA_CHARDATA LIKE LINE OF LT_CHARDATA Workarea for lt_chardata.
PARAMETERS: NAME TYPE LT_CHARDATA.
12 ) In which event, will you write the code to perform an authority-check?
Ans : AT SELECTION-SCREEN.
Check for the authority.
AUTHORITY-CHECK OBJECT XXX .
IF SY-SUBRC <> 0.
MESSAGE TYPE E.
ENDIF.
13)You want to make user to reenter the field value if entered wrong how u do