Anda di halaman 1dari 86

SAP Interview

Questions and
Answers
SAP Interview Questions and Answers
This file was generated by an automated blog to book conversion
system. Its use is governed by the licensing terms of the original
content hosted at
sap-interview-questions-and-answers.blogspot.com.

Powered by
Pothi.com
http://pothi.com
Contents
SAP ABAP Interview Questions Part 3 : Smartforms 1

SAP ABAP Interview Questions Part 1 9

SAP Webdynpro ABAP Interview Questions Part 3 28

BDC Interview Questions 41

SAP ALE IDocs interview questions and answers Part 51


1

SAP Webdynpro ABAP Interview Questions Part 2 59

SAP Web Dynpro ABAP Interview Questions Part1 73


SAP ABAP Interview Questions Part 3 : Smartforms

February 11, 2013

Welcome to yet another post on ABAP interview questions. Here I


have complied a list of interview questions on Smartforms in SAP.
This list is quite comprehensive. Hope you find it useful. Cheers !!

Smartform is SAP's print form technology and is an alternative to


SAP-Scripts. Whenever you activate a Smartform , a function
module is generated for that Smartform. The program that calls this
function module is called the Driver Program for Smartform. The
T.code for Smartforms is SMARTFORMS.
Unlike SAP-Scripts, Smartforms are client independent.

Here we go:

*An SAP R/3 system has 2 clients 800 & 810. You create an
SAP Script Z_Script and a Smartform Z_Smartform in client
800. Will both Z_Script and Z_Smartform be available in client
810 as well?
Client 200 will have just the Smartform Z_Smartform and not the
SAP Script Z_Script.

SAP-Script is client dependent whereas SMARTFORM is client


independent. Many people don't understand what this is all about.
The above answer should suffice. However, if you still do not
understand this, find an SAP system where you have 2 clients.

1
Create a dummy Smartform / script in one client and check whether
they exist in the other client.

*You have created a Smartform in DEV environment. Then you


migrated the Smartform to PROD environment. Will the name
of the function module be same in DEV and PROD?
Once you transport the Smartform from DEV to PROD environment,
a new function module name for the Smartform in generated in the
PROD environment. For a particular Smartform , generated function
module names are different in different systems.One can get the
name of the function module for Smartform by passing the
Smartform name to FM SSF_FUNCTION_MODULE_NAME.

Hence in the driver program for Smartform, it is common practice to


use FM SSF_FUNCTION_MODULE_NAME and then calling the
Smartform Function Module.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'


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

2
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 :).

To see the Smartform Print Preview output as list output,


Type SLIS in the command prompt and hit enter.

3
*How do you achieve Bar Code printing in Smartforms?
Step1: Use SE73 i.e. SAP-Script Font Maintenance and create a
Bar code say ZDEMO.
Step 2: For Smartform, create a character format C1 and use the
recently created Barcode ZDEMO.

It can be finally used to print Barcode as:

How do you add a Watermark Or a Background Image for


Smartforms ?
If you go to the properties of a page in Smartform, you will find a tab
for Background Image.
Specify the source of the image you need here and it can be used
as background image / Watermark in Smartforms.

4
Graphics can be maintained using T.code SE78.

How will you print on both sided of a Smartform?


At the Page level in Smartforms, you can find something called
as Print Mode.
Set the Print mode to duplex to print on both sides of the Smartform.

What is the difference in a Table and a Template in Smartform?


A Template has fixed number of Rows and Columns whereas a
Table can have variable rows and columns i.e. you can have a
internal table with contents associated to a Table element but not to
a Template.

5
You should use a template when the tabular output is fixed!

How do you achieve Page Protection in Smartform ?


While one can use the PROTECT ..... ENDPROTECT command for
SAP-Scripts, for Smartforms the Page-Protection checkbox can be
used to ensure page protection:

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.

6
Can you have a Smartform without a main window?
Yes, you can create a Smartform without a Main Window. But there
is no need to do anything of such sort.
Whenever you create a Smartform, a main window is created by
default. I can't think of a situation , where you will have a situation in
which it is mandatory for you to remove the Main Window. But still I
have seen this question in ABAP interviews. So I have put it here.
How do you find the name of the Function Module for a
Smartform?
When is this function module created?
The function module for Smartform is created when the Smartform
is activated.
You can find the name of the Function Module for a Smartform by
going to
Environment --> Function Module Name.

What is a Copies Window?

What is a Final Window?


Final Window is called after all the other windows are called in a
Smartform.

How do you pass data to Smartforms from the driver program?


How do you Debug Smartforms ?

How would you go about printing a logo in a Smartform?

7
How do you print address number in Smartforms ?

How do you print Symbols and Icons in Smartforms?

What are Basic Nodes and Auxiliary Nodes ?

What is the use of Folder in Smartforms ?

And finally, if you find this stuff useful ; please consider giving a
google plus or share this article with your friends using the 3 buttons
below.

8
SAP ABAP Interview Questions Part 1

July 06, 2012


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

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

SAP ABAP interview questions:

Important
Question 1: What is the difference between User Exit and
Function Exit?
User Exit Customer Exit
User exit is implemented in the A customer exit can be
form of a Subroutine i.e. implemented as:
PERFORM xxx. · Function exit
Example: INCLUDE MVF5AFZZ à · Screen Exit
PERFORM · Menu Exit
userexit_save_document_prepare. · Field Exit
Example: CALL Customer
function ‘xxx’
INCLUDE xxx.
You modify this include.

9
In case of a PERFORM, you have You have access only to the
access to almost all the data. So importing, exporting, changing
you have better control, but more and tables parameter of the
risk of making the system Function Module. So you have
unstable. limited access to data.
User exit is considered a A customer exit is considered an
modification and not an enhancement.
enhancement.
You need Access Key for User You do not need access key.
Exit.
Changes are lost in case of an Changes are upgrade compatible.
upgrade.
User exit is the earliest form of Customer exits came later and
change option offered by SAP. they overcome the shortcomings
of User Exit.
No such thing is required here. To activate a function exit, you
need to create a project in SMOD
and activate the project.

What is the difference between RFC and BAPI?


BAPI RFC

10
Just as Google offers RFC is nothing but a remote
Image/Chart/Map APIs OR enabled function module. So if
Facebook offers APIs for there is a Function Module in SAP
Comment/Like, SAP offers APIs system 1 on server X , it can be
in the form of BAPIs. BAPI is a called from a SAP system 2
library of function modules residing on server Y.
released by SAP to the public so
that they can interface with SAP.
There is a Business Object No Business Object is associated
Associated with a BAPI. So a with a RFC.
BAPI has an Interface, Key Field,
Attributes, Methods, and Events.
Outside world (JAVA, VB, .Net or Non–SAP world cannot connect
any Non SAP system) can to SAP using RFC.
connect to SAP using a BAPI.
Error or Success messages are RFC does not have a return table.
returned in a RETURN table.

Question 3:What is the difference between SAPSCRIPT and


SMARTFORM?
SAPSCRIPT SMARTFORM
SAPSCRIPT is client dependent. SMARTFORM is client
independent.
SAPSCRIPT does not generate SMARTFORM generates a
any Function module. Function Module when activated.
Main Window is must. You can create a SMARTFORM
without a Main Window.

11
SAPSCRIPT can be converted to SMARTFORMS cannot be
SMARTFORMS. Use Program converted to SCRIPT.
SF_MIGRATE.
Only one Page format is possible Multiple page formats are
possible.
Such thing is not possible in You can create multiple copies of
SCRIPT. a SMARTFORM using the Copies
Window.
PROTECT … ENDPROTECT The Protect Checkbox can be
command is used for Page ticked for Page Protection.
protection.

The way SMARTFORM is developed and the way in which SCRIPT


is developed is entirely different. Not listing down those here. That
would be too much.
Question 4:What is the difference between Call Transaction
Method and the Session method ?
Session Method Call Transaction
Session method id generally used Call transaction method is when
when the data volume is huge. the data volume is low
Session method is slow as Call Transaction method is
compared to Call transaction. relatively faster than Session
method.
SAP Database is updated when SAP Database is updated during
you process the sessions. You the execution of the batch input
need to process the sessions program.
separately via SM35.

12
Errors are automatically handled Errors should be handled in the
during the processing of the batch batch input program.
input session.
Question 5: What is the difference between BDC and BAPI?

BAPI BDC
BAPI is faster than BDC. BDC is relatively slower than
BAPI.
BAPI directly updates database. BDC goes through all the screens
as a normal user would do and
hence it is slower.
No such processing options are Background and Foreground
available in BAPI. processing options are available
for BDC.
BAPI would generally used for BDCs would be preferred for large
small data uploads. volumes of data upload since
background processing option is
available.
For processing errors, the Return Errors can be processed in SM35
Parameters for BAPI should be for session method and in the
used.This parameter returns batch input program for Call
exception messages or success Transaction method.
messages to the calling program.
Question 6: What is the difference between macro and
subroutine?

Macro Subroutine
Macro can be called only in the Subroutine can be called from
program it is defined. other programs also.

13
Macro can have maximum 9 Can have any number of
parameters. parameters.
Macro can be called only after its This is not true for Subroutine.
definition.
A macro is defined inside: Subroutine is defined inside:
DEFINE … FORM …..
…. …..
END-OF-DEFINITION. ENDFORM.
Macro is used when same thing is Subroutine is used for
to be done in a program a number modularization.
of times.
Question 7: What is the difference between SAP memory and
ABAP memory?
SAP Memory ABAP Memory
When you are using the SET/GET When you are using the EXPORT
Parameter ID command, you are IMPORT Statements, you are
using the SAP Memory. using the ABAP Memory.
SAP Memory is User Specific. ABAP Memory is User and
What does this mean?àThe data Transaction Specific.What does
stored in SAP memory can be this mean?à The data stored in
accesses via any session from a ABAP memory can be accessed
terminal. only in one session. If you are
creating another session, you
cannot use ABAP memory.
Important
Question 8: What is the difference between AT
SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT?
AT SELECTION-SCREEN is the PAI of the selection screen
whereas

14
AT SELECTION-SCREEN OUTPUT is the PBO of the selection
screen.

Question 9: What is the difference between SY-INDEX and


SY-TABIX?
Remember it this way à TABIX = Table.
So when you are looping over an internal table, you use SY-TABIX.
When you use DO … ENDDO / WHILE for looping, there is no table
involved.
So you use SY-INDEX.

For READ statement, SY-INDEX is used.

Question 10: What is the difference between VIEW and a


TABLE?A table physically stores data.
A view does not store any data on its own. It can contain data from
multiple tables and it just accesses/reads data from those tables.

Question 11: What is the difference between Customizing and


Workbench request?A workbench request is client independent
whereas a Customizing request is client dependent.
Changes to development objects such as Reports, Function
Modules, Data Dictionary objects etc. fall under Workbench
requests.

Changes in SPRO / IMG that define system behavior fall under


customizing requests.

15
An example would be ‘defining number ranges’ in SPRO.

In short, generally a developer would end up creating a Workbench


request and a Functional Consultant would create a Customizing
request.

Question 12: What is the difference between PASS BY VALUE


and PASS BY REFERENCE?These concepts are generally used
for Function modules or Subroutines etc. and their meaning can be
taken literally.

Say we are passing a variable lv_var:


CALL FUNCTION 'DEMO_FM'
EXPORTING
VAR = lv_var.

When we PASS lv_var by VALUE , the actual value of lv_var is


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

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

Transaction data keeps on changing and deals with day to day


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

Some important transactions here for Master Data:


Material: MM01 MM02 MM03
Vendor: XK01 , XK02 , XK03
Customer: Xd01 , XD02 , XD03

Some Important transactions for Transaction data:


Purchase Order: ME21n , ME22n , ME23n
Sales Order: VA01 , VA02 , VA03
Goods Receipt: MIGO
Invoices: MIRO

Important
Question 14: What will you use SELECT SINGLE or SELECT
UPTO 1 ROWS ?

17
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:

Let’s say you want to use the Structure X in your table Y.


With .Include X, you can include this structure in multiple tables.
With .Append X, you specify that structure X has been used in table
Y and that this cannot be used in any other table now. So you
restrict structure X only to Table Y.
Important
Question 16: Can you describe the events in ABAP?

LOAD-OF-PROGRAM:
INITIALIZATION: If you want to initialize some values before

18
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:

What events do you know in Module Pool Programming?


PBO: you know this . If not you should know this . That's basic.
PAI: You know this. If not you should know this . That's basic.
POV: Process on Value request … i.e. when you press F4.
POH: Process on help request … i.e. when you press F1.
Question 18: Can you show multiple ALVs on a Single Screen?
Yes, there are multiple ways of doing this:
· If you are using OOALV, you can create multiple custom
containers
(cl_gui_custom_container) & put an ALV con
(cl_gui_alv_grid) in each of those.

19
· You can even use a Splitter container control and place
multiple ALVs in each of
the split container.
· If you are using Normal ALV, You can use the following FMS:
1. REUSE_ALV_BLOCK_LIST_INIT
2. REUSE_ALV_BLOCK_LIST_APPEND
3. REUSE_ALV_BLOCK_LIST_DISPLAY
Question 19: A system has two clients 100 and 500 on the same
application server. If you make changes to a SAPSCRIPT on client
100, will the changes be available in client 500?

No. SAPSCRIPT is client dependent. You will have to transport


changes from client 100 to client 500. However, for SMARTFORMS,
Changes will be made both for client 100 and client 500.
Question 20: There are 1000’s of IDOCs in your system and say
you no longer need some of them? How will you get rid of those
IDOCs?

One way is to archive the IDOCs using transaction SARA.


But what the interviewer was expecting was ‘How do you change
IDoc Status’?
There are different ways of doing this:
A) Use FM IDOC_STATUS_WRITE_TO_DATABASE
B) USE FMs:
EDI_DOCUMENT_OPEN_FOR_PROCESS and
EDI_DOCUMENT_CLOSE_PROCESS

20
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.

Question 22: What are the types of Function Modules? What is


an UPDATE function module?There are three types of Function
Modules: Normal , RFC , UPDATE.

The aim of the Update function module is either to COMMIT all


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

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

Have a look at FM EDI_DOCUMENT_CLOSE_PROCESS_UPD


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

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

Yes, internal table have keys.


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

Question 24: Explain what is a foreign key relationship?Explain


this with the help of an example.
Let’s discuss about tables EKKO (PO header) and EKPO (PO line
item).
Can you have an entry in table EKPO without having an entry in
table EKKO?
In other words can you have PO line items without the PO header?

How does this happen? The answer is foreign key relationship.


So foreign keys come into picture when you define relationship
between two tables.

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

Question 25 : What is the difference between a value table and


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

23
only these two values: S and H.

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

Question 26: How do you find BAPI?Approach1:


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

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

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.

24
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:

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

I will update the blog with the following questions soon:


Question: Synchronous and asynchronous methods in BDC ?
Question: What is the difference between inner joins and outer
joins?
Question: What is the difference between INSTANCE methods and

26
STATIC methods?
Question: What is the difference between Implicit Enhancements
and Explicit Enhancements?
Question: What is the difference between Enhancement point and
Enhancement Section?
Question: How do you find Function Exit?
Question: How do you activate a Function Exit?

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

And finally , If you have found this post helpful , please consider
giving a :
If you think this can help others too, consider giving a:
It's now time for Sayonara !!

27
SAP Webdynpro ABAP Interview Questions Part 3

July 03, 2012

Web Dynpro ABAP interview questions Part 3:

Now we come to the tougher side of web Dynpro. I have tried to put
together some concepts from the point of view of an interview .
That's why you wont find the details here but an overview.

Question 1: What is Web Dynpro Component Usage?


Real world business scenarios are quite complex and may involve
multiple Web Dynpro Components.
While dealing with multiple WD components, you may come across
a situation where you need to reuse already developed parts of an
existing Web dynpro component.

The Web Dynpro framework provides you with a technique called


‘Component Usage’, with the help of which you can reuse the
events, methods, and context of one WD component into another
WD component.
Standard examples of Component Usage: Select Options , ALV ,
OVS.
You declare component usage both at the Component and at the
view levels:

@Component Level:

28
@View Level:

Question 2: Briefly explain how will you use implement Select


Options in Web Dynpro?
1) Declare Component Usage for Standard WD component
WDR_SELECT_OPTIONS both at component and view level.

2) Place a VIEWCONTAINER on your main view and embed the


view ‘WND_SELECTION_SCREEN’ of component

29
WDR_SELECT_OPTIONS in it.

3) Use the methods CREATE_RANGE_TABLE and


ADD_SELECTION_FIELD for your fields on Selection screen.

4) Use method GET_RANGE_TABLE_OF_SEL_FIELD to read user


input before you do a SELECT.
Question 3: What is the Web Dynpro Phase model?
Whenever a roundtrip occurs from the client (browser) to the server,
a sequence of processing steps is executed. This sequence of
processing steps in web Dynpro is called the ‘Phase Model’.
Executing all the tasks in the phase model is the responsibility of the
Web Dynpro framework.
Each step is executed only once and errors if any are captured.

If you want to get into the details , have a look at the webinar from
Chris Whealy: Understanding the Web Dynpro Phase model.

Important
Question 4: What is OVS? Can you explain the different phases
used in OVS?

30
First we should understand the difference between Value help and
OVS i.e. object Value Selector.
We use generic Value Help only for the field to which it is bound.
OVS is used when we want to populate multiple fields based on one
field on the screen.

So as per the screenshot , If I select Userid from OVS help, First


name and Last name will be populated automatically. The standard
component WDR_OVS is used for implementing OVS.

OVS works on the PHASE MODEL and different tasks are


performed during different phases.
The current phase is indicated by the parameter
PHASE_INDICATOR.

Phase 1:
In this phase you have the possibility to define the texts, if you do
not want to use the defaults: So You can play around with the
highlighted texts in the screenshot below in this phase.
Here we call the method
ovs_callback_object->Set_Configuration

31
Phase 2:
If you do not want the filter fields, you can do that in this phase and
the table will be displayed directly. Refer screenshot below. The
table is displayed directly. I have blurred some results.Here you can
call the method ovs_callback_object->Set_Input_Structure

32
Phase 3:
In this Phase, You write the select queries that should run as per
user input when the user hits ‘Start Search’ button and finally set the
output table.You can call the method
ovs_callback_object->Set_Output_Table for that purpose.

Phase 4:
In this phase , you pass the selected record to the Web dynpro
Fields.
i.e. set the attributes
using ovs_callback_object->context_element->Set_Attribute

Question 5: Briefly explain how will you implement ALV in Web


Dynpro?
To implement ALV in Web Dynpro, you need to use the Standard
WD component SALV_WD_TABLE.
We need to use:
a) the view ‘TABLE’ of component SALV_WD_TABLE
b) the node ‘DATA’ of component SALV_WD_TABLE.
Here is the brief process:

1) Declare component Usage for SALV_WD_TABLE at the WD

33
component level and the view level.
@ Component Level:

@ View Level:

2) Put a VIEWCONTAINER UI element on the MAIN view and


ember the view ‘TABLE’ of
SALV_WD_TABLE into it.

34
3) Let’s say the ALV data is to be populated in NODE_FLIGHT.
Write the logic to select the ALV Data and bind it to
NODE_FLIGHT:
node_flight_alv->BIND_TABLE( lt_node_flight_alv ).

4) Do a Context mapping between NODE_ALV and the node


‘DATA’ of SALV_WD_TABLE.

Question 6: How to make columns in a table editable?


While doing the Binding for the Table, just choose 'Input field'
instead of 'Textview'.
Refer the Screenshot below:

35
Question 7: How will you delete selected rows in a Table /
ALV?
Get the Table / ALV data in an internal table.
Delete the row selected by the user from the internal table.
Re-bind the internal table to the node bound to the Table/ALV.

Question 8: How do you generate POP UP in WD?


This can be easily done using the Wizard:
The CREATE_WINDOW method is used in this case.

Question 9: How do you close a window in Web Dynpro?

There is a special outbound plug called ‘Exit Plug’ that can be used
for this purpose.
wd_this->fire_to_exit_plg( url = url close_window = close_window ).

36
Also explore other Plug Types:

I am going to add some more questions to part 3 :


Let me know if you need answers to the below questions by putting

37
your comments below:

Question: What is the difference between Drop down by key


and drop down by index ?

Question: How do you display error / success / warning messages


in Web Dynpro ?

Question: How do you access methods of component controller in a


view ?

Question: Have you worked on roadmap UI element ? Elaborate .

Question: What is dynamic ALV in web dynpro ?

Question: Can you have Totals and Subtotals in Web dynpro ALV ?
How ?
Hint: First get the reference of the ALV. Then get the columns.
By looping at lt_columns , get to the required column.
Once you achieve this, check methods create_aggr_rule and
create_sort_rule of the class
cl_salv_wd_field.

Question: Can you have TOP OF PAGE and END OF PAGE ? How
?
Hint: Check TOP_OF_LIST and END_OF_LIST events.

Question: Have you worked on events in ALV in web dynpro?


Which events do you know?

38
Question: Can you add custom buttons on Web Dynpro ALV
toolbar ? How?

Question: Can you add custom buttons in Web Dynpro ALV


cells ? How?

Question: Can you add Image / Icons in Web Dynpro ALV cells ?
How?
How do you define and implement action handlers for them?

39
Question: Can you add links in Web Dynpro ALV cells ? How?

I hope this blog helps you crack your web dynpro interview J .
All the best dudes and dudettes !!

If you liked this post so far, please consider hitting the Google plus
button below:

40
BDC Interview Questions

June 28, 2012


What is BDC and why do we use BDC ?
BDC ( Batch Data Communication ) also known as batch input is a
technique by which large volumes of data can be transferred from
Non Sap or Legacy systems to SAP systems.

Example: A Legacy system that is to be replaced by SAP has say


1000 Customers , 2000 vendors and 3000 materials. All this data
needs to be transferred to SAP . In such cases , We can use BDC.

If the old system is replaced by SAP, such a transfer is


called Conversion.
If the old system runs along with SAP, in that case the transfer is
called an Interface.
The two methods for BDC are:
• Session Method

• Call TRANSACTION Method

• CALL DIALOG (Outdated)

41
ABAP interview questions on BDC:

Important:
Question 1:What is the difference between Call Transaction
Method and the Session method ?
Session Method Call Transaction
Session method id generally used Call transaction method is when
when the data volume is huge. the data volume is low
Session method is slow as Call Transaction method is
compared to Call transaction. relatively faster than Session
method.
SAP Database is updated when SAP Database is updated during
you process the sessions. You the execution of the batch input
need to process the sessions program.
separately via SM35.
Errors are automatically handled Errors should be handled in the
during the processing of the batch batch input program.
input session.

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?

42
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
BAPI is faster than BDC. BDC is relatively slower than
BAPI.
BAPI directly updates database. BDC goes through all the screens
as a normal user would do and
hence it is slower.
No such processing options are Background and Foreground
available in BAPI. processing options are available
for BDC.
BAPI would generally used for BDCs would be preferred for large
small data uploads. volumes of data upload since
background processing option is
available.
For processing errors, the Return Errors can be processed in SM35
Parameters for BAPI should be for session method and in the
used.This parameter returns batch input program for Call
exception messages or success Transaction method.
messages to the calling program.
Question 4: How do you process errors in Call Transaction
method ?

Let's have a look at the syntax for CALL TRANSACTION method.

43
Sample code:
DATA: BEGIN OF G_T_MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF G_T_MESSTAB.
CALL TRANSACTION 'MB11'
USING G_T_BDCDATA
MODE 'E'
UPDATE 'S'
MESSAGES INTO G_T_MESSTAB.
All the error messages will be trapped inside G_T_MESSTAB.

Question 5: What is the use of program RSBDCSUB?


There are two ways to process the BDC sessions:
1) Go to SM35 ---> Choose session ---> hit process.
Now See Question no. 10.
2) Use program RSBDCSUB.
RSBDCSUB schedules the session to be processed in
background.

Let's take an example to understand this.

The sessions are created at one point of time and processed at


other point of time and this may create a problem: For example: a
BDC program creates a session for updating 1500 customers in
SAP. However , before this session is processed via SM35 , a user
inserts 100 customers in the system manually. In this case , the
session will have at least 100 errors when the session is processed

44
from SM35.

One way to avoid this is to use the program "RSBDCSUB" in the


batch input program itself so that the session is processed as soon
as it is created.
RSBDCSUB schedules the session to be processed in background.
Question 6: What is the structure of the BDC table?

The BDCDATA consists of the following fields:


§ PROGRAM [CHAR 40] - Online program name.
§ DYNPRO [NUMC 4] - Screen number.
§ DYNBEGIN [CHAR 1] - Flag to indicate the start of a new screen.
§ FNAM [CHAR 132] - Field name of a screen field to be filled with
data.
§ FVAL [CHAR 132] - The actual value to be filled into the specified
screen field.

Sample Screenshot:

45
BDCDATA table structure

Question 7: What is the difference between BDC_OKCODE and


BDC_CURSOR?

BDC_OKCODE: is used for storing commands during the


recording. like '/00' is the command for 'ENTER' Key.
BDC_CURSOR: contains the cursor position. it contians the field in
which cursor will be.
Example code:
perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
Question 8: What are the 3 methods that we use in sequence in
a Batch input session method ?
1) BDC_OPEN_GROUP for opening the Batch Input Session
2) BDC_INSERT for inserting the transactional data into SAP
3) BDC_CLOSE_GROUP for closing the Batch Input Session

46
If there are n records , the BDC_INSERT method should be called n
times.
BDC_OPEN_GROUP and BDC_CLOSE_GROUP are called only
once.

General Information about a session is stored in table APQI.


Transaction data for a session is stored in table APQD.

Question 9: What is your approach for writing a BDC program?

Identify the Tcode and do the recording in SHDB to populate the


BDCDATA.

Once the recording is done , one can Transfer it to the Batch input
program.

47
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 10: How do you process errors in Session method ?


You can go to Transaction SM35 , Choose the session name and
click on Process.

Question 11: What are the different modes of processing batch


input sessions?

The three modes are:

48
Foreground
Display Errors Only
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.
Question 13: What is the transaction for Recording BDC ?
The Tcode is SHDB.

Question 14: How do you read files from the Application


server ?
You can use the commands:
OPEN DATASET ---> opens the file(dataset) either in read /write
mode.
READ DATASET ---> Read the file
CLOSE DATASET ---> Close the dataset once the date has been
read .

Question 15: How do you read files from the presentation


server ?
You can use the Function Modules :
GUI_UPLOAD --> To read data from file into an internal table
GUI_DOWNLOAD --> To write data from internal table to a file on

49
presentation server

If you found the post helpful , consider hitting the Google plus
button------>

Thanks and all the best for your interview :).

50
SAP ALE IDocs interview questions and answers Part 1

May 24, 2012

ALE IDocs in SAP

ALE IDocs in SAP is a lot about configuration and a lot about


Tcodes . So if you have worked on at least one end to end
scenario in ALE IDocs in SAP , you probably already have
answers to a lot of questions.

Cheers!!

But if you haven't , make sure you do this exercise. There are plenty
of step by step guides to ALE IDocs available on the internet . Make
sure you read one understand it all the way . Sending IDoc from
client 800 to say client 810 on the same server is easy . If possible
,Try an exercise in which you send an IDoc from one system to
another system.

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.

51
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.

Question 2: What is EDI ?


EDI stands for Electronic Data Interchange. It refers to the
electronic exchange of business data in a structured format
between two systems. The EDI subsystem generally converts the
Idoc 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.

Question 3: What is an Idoc? What is IDoc Type? What is an

52
IDoc Extension ?
An IDoc (Intermediate document) is a vehicle that is used to transfer
data from one system to another.
IDoc is not a technology of some sort , but it is just a container
that holds data .
It holds data in a structured format i.e. in the Fields of the
Segments.

IDoc Type vs. IDoc:


An IDoc Type is nothing but a collection of one or more structures
defined in a system with specific fields. It does not hold Data.
However, an IDoc is something that holds the values in the fields of
the structure defined by IDOC type.

The transaction code to view an IDoc type (Basic and extension) is


WE30.
Examples: ORDERS04, DEBMAS04, MATMAS04, CREMAS04.
These are all SAP standard Basic IDoc Types.

You can even have an IDoc extension in which you can use the
existing Basic IDoc type and add extra segments and fields to it.
Usually we extend an IDoc when the standard SAP IDoc type is not
able to cater to the business process.

Question 4: What are the types of records in SAP ALE Idocs and
where is this information stored ?
There are three types of records in SAP ALE Idocs:
Control Records: Control record information for an IDoc is stored
in standard table EDIDC.

53
Data Records: Control record information for an IDoc is stored in
standard table EDIDD.
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 6: What is a Port ? What are the types of Ports ?

54
A port is a communication channel through which Messages can be
sent or received in SAP .
The sender and the receiver both specify the port through which
they will communicate.

The common port types are the TRFC Port and the File Port.
If both sender and receiver mention TRFC ports, data is exchanged
via RFC connections.
If however , a file port is mentioned , the IDOC is written in a flat file
at the specified location at the sender system.Then a FTP transfer
should be done from that location to the receiver system or a
Middleware that will send the file to the receiver system.

The transaction to maintain ports is WE21.

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.

55
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.

Question 9: What is a distribution model in ALE IDocs ?


The distribution model describes how ALE messages flow between
different logical systems.
You can mention the sender and receiver logical systems, the
message type to be distributed and also distribute data(IDocs)
based on certain conditions by using the distribution model.
The ALE layer uses the distribution model to control which

56
systems will receive the information(IDocs) and also filter the data
based on certain conditions.
Distribution Models can be created and maintained in transaction
BD64.

Question 10: What are process codes ?


I don't want to make this post too big . So, I will stop here for the
time being.

Question 11: How do you Edit IDoc contents manually?

Question 12: Can you edit IDoc content for successful IDocs ?
No. You cannot.

Question 13: If you send an IDoc say 100008008 from system


ECC1 to system ECC2, will the IDoc number in ECC2 be
100008008?
No. The next number from the IDoc number range in ECC2 will be
picked up.

More interview questions on ALE IDocs :

Question 14: How do you read data from an IDoc in a program ?


Question 15: How do you send Idoc from a program ?
Question 16: How do you achieve filtering in a distribution model ?
Question 17: Can I create a flat file from an IDOC ? If Yes , How ?
Question 18: You want to create and send an IDOC to another the
moment a PO is created in your system . How will yo

57
achieve this ?
Question 19: How to Reprocess Idocs in SAP?
Question 20: What is a change Pointer?
Question 21: What is serialization of Idocs?
Question 22: Important tcodes in ALE Idocs.
Question 23: Important programs in ALE Idocs:

Let me know if you find this post useful .


If yes, I will create ALE IDocs interview questions and answers
Part 2 . So put your comments below and let me know:

58
SAP Webdynpro ABAP Interview Questions Part 2

May 17, 2012


I hope the Web dynpro ABAP Interview Questions part 1 was of
some help to you.

Welcome to part 2! Here we go ahead with some more questions . I


wish these questions offer some value to you.

If you have already worked on web dynpro , these questions should


be easy for you . Even if you haven't had a chance to work on
Webdynpro ABAP , these questions will guide you for your
interviews . In that case, I would suggest you do some hands on
exercises on a sandbox server at least.
Imp*
Question 16:What is an Assistance class in webdynpro ABAP?
Where do you define an assistance class? How many assistance
classes can a webdynpro component have?
Assistance class helps you achieve two things:
1) Segregation of business specific logic (one of the purpose of
MVC).
2) Performance benefit.

We can write the business logic in the methods of the View, Window
or even the Component controller. But it is not a good practice to
load all the business logic in the views or windows. So SAP has
provided an option of assistance class where you can write all your

59
business logic. By this way, you are still in the framework of your
webdynpro and also avoid loading too much logic in the
components of webdynpro itself. Assistance class methods are
much better from a performance point of view than calls of Web
Dynpro controller methods.

A web dynpro component will have only one assistance class and
it is defined at the component level as per the screenshot below.
The assistance class is automatically instantiated when a
component is called. You can access the instance of this class with
the attribute wd_assist, which is created when you create the
assistance class in web dynpro.

Assistance class in web dynpro ABAP

60
Imp*
Question 17: What is Singleton Property of a Context Node?
Understanding Singleton property of a context node and how it
works in conjunction with the lead selection event can be a bit
complicated. If you do not already know what a Singleton set is , I
recommend you going through an example of Cars(Parent node
with cardinality 0..n ) and Customers ( Nested child node with
cardinality 0...n ) on by clicking on the link. This is not that tough ,

61
just spend some time with it and you should be okay.

The best way to answer this question is by taking an example.


Say there are two ALV's on a View:
ALV1 ---> NODE_SO_HEADER----> Displays all the Sales Orders.
ALV2 ---> NODE_SO_ITEMS ------> Displays all the line items for
the Sales Order selected in ALV1.

NODE_SO_ITEMS is the child node for NODE_SO_HEADER and


is declared as Singleton node.
Since this node is declared as singleton , at runtime , it holds the
line item data only for the Lead Selected Sales Order from
NODE_SO_HEADER and not for all the Sales Orders from the
parent node.
Whenever the lead selection changes for the parent node, line item
data for that lead selected order is fetched from database and
populated in the child node.

As a result great performance optimization is achieved.

I hope you get this one :).

62
Question 18: What is a supply function? When is it called?
You can assign a supply function to a context node when you create
a node. In simple terms, supply function is used to populate data
records in the context node. A supply function is called when one or
more elements of the node are accessed for the first time.

Supply function in web dynpro


To give you an analogy, we all know that a constructor method of a
class is called whenever an object of that class is instantiated. In the
same way, a supply function for a context node is called when the
node is accessed for the first time.

The supply function is generally used in combination with singleton


nodes.So whenever the lead selection of the parent node changes ,
the supply function of the singleton node recalculates and
repopulates the child node.

63
Question 19: What is lead selection? Is it an event?
Yes , the lead selection is an event in web dynpro.
At run time a context node may contain many records , but only one
of those is selected .
The user can select any record from the Table/ALV and this
selection is called lead selection.

Lead Selection in Web Dynpro


Question 20: What is Cardinality of a context node?
Cardinality simply indicates the minimum and the maximum no. of
entries the node can have.
The 4 cardinalities are 0:1, 0:n, 1:1, and 1:n .

Question 21: Is there any relation between Cardinality and Lead


selection?

64
Yes , If the cardinality is set to 0:1 or 1:1 , the user cannot select
multiple records on the view.
So if you want the user to be able to select multiple records on the
screen , the cardinality of that particular node must be set to 0:n or
1:n.

Question 22: Some important Web Dynpro attributes that you


should know:
Some attribute in webdynpro that are used very frequently and
some of those that you must know are :

Wd_this
Wd_context

Each controller has the above two mentioned attributes.


To elaborate, if you are using the above two attributes say in a
method of a View Controller, then WD_CONTEXT is the reference
to the Context node of the View and WD_THIS is the reference to
the View Controller itself.

Wd_comp_controller is the reference to the Component


Controller. View and Window controller have this attribute defined
by default and methods/attributes of the Component Controller can

65
be accessed by using this attribute.
For example:

Wd_assist: This attribute is created when the assistance class is


saved and activated for a web dynpro component. All the methods
of the assistance class can be accesses by using this attribute.

Question 23: What are layouts in Web Dynpro ABAP?


Flow layout, Row Layout, Grid Layout, Matrix layout and the form
layout.
The layout can be set at a Container level.

66
Question 24: Can you use multiple layouts in one view?
Layouts can be assigned at the container level. For example, you
define the layout for your view at the ROOTUIELEMENT container
level.
So if at all you want to use multiple layouts in one view, you can
create multiple transparent containers and assign different layouts
to them.

Question 25: How do you introduce line break for a UI element in


any layout?
Say if you are using matrix layout, you will say Matrix Head data for
the UI element for which you need a line break.

67
Question 26:Can you call/launch one web dynpro application from
another webdynpro application?
Yes, you can launch one webdynpro application from another
webdynpro application.
First, you should get the URL of the web dynpro component that
you want to launch and second, call that URL in an external
window.
To get the URL of any web Dynpro component, you use the FM
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'ZDEMO’
IMPORTING
out_absolute_url = str.
Once you get the URL in str, you can call this web dynpro using 'str'
and fm: create_external_window.

Question 27: Can you create a Tcode for Webdynpro Application?

Creating Transaction code for Web dynpro ABAP

68
Yes, you can create a Tcode for webdynpro application. Go to SE93
, create Tcode, choose the last option and maintain default values
as shown in the screenshot:

Question 28: Can you pass parameters in a webdynpro URL?


Yes, you can pass parameters in webdynpro URL and read them
too in your web dynpro component.
Example:
http://domainname.com:8000/sap/bc/webdynpro/sap/zdemo_webdynpro?s

Question 29: How do you read parameters passed in the Web


Dynpro URL?
First lets understand how a typical webdynpro application looks like:
When you create a web dynpro application , you can see the link
URL generated by web dynpro.

69
It will be something like:
http://domainname.com:8000/sap/bc/webdynpro/sap/zdemo_webdynpro?s

Whatever comes after the ‘?’ and is followed by ‘&’ is an URL


parameter. You can see sap-language and sap-client as default
parameters whenever you launch your web dynpro in browser. The
cool thing is you can add some custom variables
too. http://domainname.com:8000/sap/bc/webdynpro/sap/zdemo_webdynp

So var1 and var2 are custom webdynpro URL parameters and you
can read them in the HANDLEDEFAULT method of your main
window:

70
Question 30: Can you run a Webdynpro Application in
background?
This is a tricky question. It doesn’t make sense to run a webdynpro
application in background because in that case you are beating the
purpose of the MVC controller architecture for webdynpro. However,
you can build logic to create background jobs from a Web Dynpro
Application.

So we have by now put a bunch of questions here . Let me know

71
how do you find these questions.
We haven't yet covered Web Dynpro component usage , ALV,
Select Options , OVS , the coding part in web dynpro, Web dynpro
enhancements etc.

If you think these were helpful and we need a part 3 too , let me
know in the comments below:
--> Thanks for your feedback , I have now posted Part 3.

Till then , keep rocking .

72
SAP Web Dynpro ABAP Interview Questions Part1

April 25, 2012


Preparing for SAP web dynpro ABAP interview ? You have come to
the right place :). This blog will be your friend in your preparation . I
believe in doing things one step a time . That is why I am planning
to divide this blog into 3-4 parts for your maximum benefit . Do
these one at a time and you will be all set for your SAP webdynpro
ABAP interview in 3-4 days. All the best!

Let's get started:

Imp*:What is Model-View-Controller MVC architecture in Web


Dynpro ABAP?
This is one of the most common Web Dynpro ABAP interview
questions. I am sure you will be asked about this. This is your
chance to show how much you know about Web Dynpro . Prepare
this answer on your own .I will give you a link to show your
webdynpro flair : Web Dynpro Tutorial part 2

Controllers in Web Dynpro:

Question 1: What are the types of Controllers in Web Dynpro


ABAP?
The types of controllers are listed in the screenshot below:

73
Types of Controllers in webdynpro ABAP
Question 2: What is Component Controller?
Component Controller is the King of all Controllers. It is the
backbone of your Web Dypro Component . It is like a Global or
Top Include for you program . It controls the entire activity of your
Web Dynpro Component.

Question 3: What is an Interface Controller?


Whenever we want views , nodes or methods of a particular web
dynpro component to be available to other the outside world ( i.e.
other webdynpro components) , we make use of Interface controller
. Interface Controller is created by default when a webdynpro
component is created.
Interface Controller would generally come into picture when you are
doing component usage of some sort in web dynpro i.e. re-using
views/methods/nodes of one WD component in another.

Question 4: What is a Custom Controller?


When your Component Controller grows big in size ( say more than
10-15 views and corresponding context nodes , methods , events ,
event handlers etc) , it might become tough to handle everything in
the Component Controller . In such a scenario , you can create one
or more custom controllers and modularize or segregate the logic

74
into separate parts using Custom Controller.

Question 5: Would you prefer creating multiple Custom Controllers


OR would you go for separate Web Dynpro components and then
do Component usage.
This would actually depend on the requirement , but ideally
separate Web dynpro components should be created and
reused.One can also use the assistance class for segregating
business logic.

Question 6: How many component controllers can a Web Dynpro


Component have ?
Component Controller is only one . You can create multiple
controllers , but those are called Custom Controllers.

Note: If you are asked about the Web Dynpro architecture , you
should talk about both the MVC framework and the controllers.
Question 7: Suppose your Web Dynpro has 10 nodes in the
Component Context . Will all 10 the nodes be available in the
Interface controller?
Nodes from the Component context are available to the interface
controller only when the nodes are declared as interface nodes.To
create an interface node , set the interface property to yes as shown
in the screenshot below:

75
Interface Node in Webdynpro ABAP
To create an interface node , set the interface property to yes as
shown in the screenshot to the right :

Once created , the interface node is indicated by a special symbol


as shown in the figure below and the property Interface Node is set
to yes:

Interface Node in Webdynpro ABAP


Question 8: When do views become available in the interface
Controller ?
Whenever we embed any view in a window , at the moment that
view becomes automatically available to the Interface Controller and
shows up as an interface view in the Interface Controller. You do

76
not have to declare a view as an interface view as is the case with
interface nodes.

Question 9: Is it true that each controller has its own Context node
?
Yes , Each controller has it's own context , methods , and Events.

Question 10: At design time how do you decide whether to declare


a node in the Component Controller or in the View Controller?
This again depends on the requirement: If the node is going to be
accessed in multiple views , it should be declared at the Component
Controller level . However , If the node is absolutely specific to only
one view , it can be defined in the View Controller. As the size of
Webdynpro development grows , it starts becoming complex and
the need to define attributes,nodes,methods etc. at the Component
Controller increases.

Hook Methods in Web Dynpro:

Question 11:What are Hook Methods in Web Dynpro ABAP ?

Hook methods in webdynpro are standard web dynpro methods that


are called at different time in the web dynpro lifecycle.These
methods are listed in the screenshot below: These methods start
with WD*.

77
Hook Methods in Webdynpro ABAP
Question 12:Are all the hook methods available to all the
Controllers?
No . They are specific to controllers. See the details in the image
above:

Question 13:Sequence in which web dynpro hook methods are


called:
If you want to understand the sequence , put breakpoints in all
these methods.Execute the web dynpro application , then do some
action on the view , then close the application window:

Have a look at how the control passes from component to window


and then to view:

1.WDDOINIT ( Component Controller )


2.WDDOINIT ( Window Controller
--> Handle default method of the window is called.
3.WDDOBEFORENAVIGATION ( Component Controller )
4.WDDOINIT ( View Controller )
5.WDDOMODIFYVIEW ( View Controller )
6.WDDOPOSTPROCESSING ( Component Controller )

78
Now view is displayed . Suppose user does some action on the
view:

7. WDDOAFTERACTION ( View Controller )


8. WDDOBEFOREACTION ( View Controller )
9. WDDOBEFORENAVIGATION ( Component Controller )
WDDOINIT ( View Controller ) is not
called this time.
10.WDDOMODIFYVIEW ( View Controller )
11.WDPOSTPROCESSING ( Component Controller )

View is displayed again.Now close button is clicked on the browser.

12.WDDOEXIT ( View Controller )


13.WDDOEXIT ( Component Controller )

Application is closed.
So now if you are being asked "What is called first : WDDOINIT or
WDDOMODIFY?" OR
"What is called first WDDOINIT for Window controller or WDDOINIT
for View Controller" ?
You should be able to answer the such questions.

79
Question 14: If one view is called 10 times in the lifespan of a
webdynpro component , how many times will the method
WDDOINIT be called and how may times will WDDOMODIFYVIEW
be called ?
WDDOINIT will be called only once.
WDDOMODIFYVIEW will be called 10 times.
WDDOMODIFYVIEW has a parameter FIRST_TIME . If this is 'X' ,
then the view is getting called first_time.
Question 15: What are PRE POST and OVERWRITE exit methods
in web dynpro?
Whenever a web dynpro component is enhanced , these 3 methods
become available for all methods in Webdynpro. Lets take an
example of these methods for WDDOINIT.

PRE exit: This method is called before WDDOINIT is called.


POST exit: This method is called after WDDOINIT is called.
OVERWRITE exit: In this case , WDDOINIT is not called . Instead ,
OVERWRITE exit method is called.
Let's keep this till 15 questions for today .
See you soon in .

If you have found this post helpful consider giving a :


I highly recommend that you go through the following Web Dynpro
tutorials by Thomas Jung .
They have taught me a lot and I am sure you will not find a better
resource for learning Web Dynpro.
Web Dynpro Tutorial part 1
Web Dynpro Tutorial part 2

80
Web Dynpro Tutorial part 3
Web Dynpro Tutorial part 4
Web Dynpro Tutorial part 5
Web Dynpro Tutorial part 6
Web Dynpro Tutorial part 7

81

Anda mungkin juga menyukai