Saturday, October 27, 2012

Sap abap webdynpro how to hide freely programmable f4 help for an input help

Freely Programmable F4 Helps are created to have custom F4 functionality for a webdynpro input field.
A freely programmable input field can be attached to the context attribute in the definition area.

The following code snippet explains how to hide  and unhide the f4 help if required. This function is mostly required if you have edit and display mode for your screen and you want to hide the f4 function in display mode.

  DATA lref_node_info     TYPE REF TO if_wd_context_node_info.
  DATA lo_nd_input TYPE REF TO if_wd_context_node.
  DATA ls_input TYPE wd_this->element_input.
* navigate from <CONTEXT> to <INPUT> via lead selection
  lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).

  if lo_nd_input is INITIAL.
    return.
  endif.

  CALL METHOD lo_nd_input->get_node_info
    RECEIVING
      node_info = lref_node_info.

  IF iv_active IS INITIAL. "To Deactivate the F4 Help
    CALL METHOD lref_node_info->set_attribute_value_help
      EXPORTING
        name            = 'INPUTFIELD1'    "Input field name
        value_help_mode = if_wd_context_node_info=>c_value_help_mode-deactivated
        value_help      = 'F4_HELP_NAME'. "Freely programmable F4 help name
  ELSE.
    CALL METHOD lref_node_info->set_attribute_value_help
      EXPORTING
        name            = 'INPUTFIELD1'   "Input field name
        value_help_mode = if_wd_context_node_info=>c_value_help_mode-application_defined
        value_help      = 'F4_HELP_NAME'. "Freely programmable F4 help name
  ENDIF.

SAP ABAP Webdynpro Frequently Asked Questions and answers

Questions
1) What is ABAP Webdynpro
2) What is Floorplan Manager(FPM) and its usage in webdynpro
3) How to close popup window in webdynpro ABAP
4) How to display formatted text in webdynpro ABAP
5) How to control the visibility of webdynpro UI elements
6) Controlling message area height in webdynpro ABAP
7) Coding business logic in assistance class of webdynpro component
8) Webdynpro trace tool and its usage
9) ICM Tracing for webdynpro Application
10)F4 help for inputfields in webdynpro abap
11)Messages in webdynpro abap application
********************************************************************
ABAP Webdynpro
Webdynpro ABAP is the SAP UI technology for building Web based UI's using the programming
language ABAP/ABAP OO. ABAP Webdynpro Components and Design tools can be accessed

using the ABAP workbench transaction SE80.

Advantages of ABAP Webdynpro:
->Webdynpro programming model uses MVC(Model View controller)
  design paradigm.
  -->MVC
->Clear separation between the flow logic and the business logic.
  ->Here the flow logic is written in the views,windows,components and the business
    logic is mostly written in Assistance class.
  ->Refer to the package SWDP_DEMO for sample webdynpro demos components
      and applications
->Complete integration of web  based framework into ABAP workbench.
->Reuse of the components possible
->Reuse of the existing back end programs(ex: function modules,classes)
->with EHP2 no Java stack required to run webdynpro applications
->Specific Layout frameworks are provided to use based on the requirments
  ->Example: GAF,OIF,QAF
->Most of the Layout/UI development can be done using graphical
  designer and the code wizard.
********************************************************************
Floorplan Manager and its usage in Webdynpro
Floorplan Manager is the standard UI framework provided by SAP to build web UI's in an Consistent manner so that all the SAP web UI's will have the same look and feel.

The FPM framework is available with the basis release 7.0, SP13

FPM has 3 floorplan types:
1) Object Instance floorplan(OIF). A OIF has usually the create,edit,display
   attributes and tabs to show data to the user.

2) Guided Activity floorplan(GAF): A GAF has the guided procedure to achieve
   a specific task. Ex: Start->Step1->step2->step3->Confirm to close.

3) Quick Activity floorplan(QAF): A QAF is used to quickly perform a task or
   a activity. QAF is used when a specific has to be performed by the UI.

FPM Concepts in Detail:
********************************************************************
Closing Popup windows in webdynpro ABAP
Here are the steps:
1) Create an outbound plug( ex: exit) in the window which is called as popup and add the following
    parameters to the exit plug.
    parameter1: close_window type wdy_boolean  "This is optional
    parameter2: url type string                "This is optional and
                                                           "is used to navigate to other url
    Note: Plug type should be interface and check the interface option

2) Go the view which is embedded in the window and choose properties tab.
    Press create button and add the window.
3) Go to the action(event method) on which the window should be closed and
     fire the exit plug. Assuming your window is w_win and the view is v_view.
     here is the sample piece of code to fire the exit plug.

    To close the window:

    DATA: lo_W_WIN TYPE REF TO IG_W_WIN .
              lo_W_WIN =   wd_this->get_w_win_ctr).
              lo_w_rule->fire_exit_plg(
              close_window =    abap_true ).

    To navigate to the new URL, you can use the code.

    DATA: lo_W_WIN TYPE REF TO IG_W_WIN .
              lo_W_WIN =   wd_this->get_w_win_ctr).
              lo_w_rule->fire_exit_plg(
              url =    'www.google.com'  ).

****************************************************************
Displaying formatted text in webdynpro UI
Steps:
1) Create the text in SE61 using the document class General text
    ex: my_sample_text
2) Go to view in webdynpro and add the ui element
    formatted textview (ex: ftv )
3) Create a context element for formatted textview ex: text1 of the type string
4) bind the context element text1 to formatted text element ftv
5) Write the followed code to populate data in the formmated text view ftv.

*Code snippet
Data: lo_el_context_ftv type ref to if_wd_context_element,
         lv_ftv_text type string,
         lt_ftv_text TYPE STANDARD TABLE OF tline,
         ls_header TYPE thead,
         lo_format_text TYPE REF TO cl_wd_formatted_text,
         lv_doc_state TYPE dokstate,
         se61_object type dokhl-object value 'my_sample_text',
         lo_ft_text type ref to cl_wd_formatted_text.


* Get the formmated text by passing the se61 text id: my_sample_text
  CALL FUNCTION 'DOCU_GET_FOR_F1HELP'
    EXPORTING
      id         = 'TX'
      langu    = sy-langu
      object   = se61_object
    IMPORTING
      dokstate = lv_doc_state
      head       = ls_header
    TABLES
      line     = lt_ftv_text
    EXCEPTIONS
      ret_code = 1
      OTHERS   = 2.


* Format the se61 text
    CALL METHOD cl_wd_formatted_text=>create_from_sapscript
      EXPORTING
        sapscript_head  = ls_header
        sapscript_lines = lt_ftv_text
        type            = cl_wd_formatted_text=>e_type-formatted_text
      RECEIVING
        formatted_text  = lo_ft_text.
    IF lo_ft_text is not initial.
     lv_ftv_text = lo_ft_text->m_xml_text.
    ENDIF.


* Bind the text to the context
  lo_el_context_ftv = wd_context->get_element(  ).
  lo_el_context_ftv->set_attribute(
    EXPORTING
      name =  `TEXT1`
      value = lv_ftv_text ).
****************************************************************

Controlling the visibility of the webdynpro UI elements
-Every webdynpro ui lement has a visibility property with options visible and none. To dynamically
 control the visibility of the ui element refer to the below steps.

1) Create a context attribute called visibility referring to data element wdui_visibility.
   data element wdui_visibility has possible values 01 for invisible and 02 for visible.
2) bind the context attribute visibility to the webdynpro ui elements (ex: tv_textview1) property visible.
3) write code to set the value of the context attribute visibility to 01 to hide the text view ui element
    and 02 to make the text view visible.
****************************************************************
Controlling message area height in webdynpro ABAP

Create a transparent container and under that create a message area. Create a context attribute scroll_mode type WDUI_SCROLLING_MODE and bind the scrolling mode property of the transparent container to context attribute scroll_mode.

Now code to set the scroll_mode to '02' for no scroll, '01' for scroll and '00' for auto scroll.

****************************************************************
Coding business logic in assistance class of webdynpro component

-->It is advised to code the business logic of webdynpro application in an assistance
     class because it adheres to MVC design paradigm and it refers to Model part of MVC.
     it is also called Model class.
-->Coding Business logic in assistance class improves performance and also there is
     a clear separation between the flow logic and the business logic
-->For the management of the dynamic texts by creating text symbols and accessing the
     For ex: if the assistance class has the text symbol: 999, it can be accessed using 
the code:
     dyn_text = wd_assist->if_wd_component_assistance~get_text( key = '999' ).
-->The assistance class is instantiated when the webdynpro component is called
     and an assistance class is inherited from the abstract class 
    
     CL_WD_COMPONENT_ASSISTANCE, a
n object wd_assist is created after
     instantiation. No explicit instantiation is required here.
****************************************************************
Using webdynpro trace tool

-webdynpro trace tool is used to analyse the problems and issues with webdynpro application.
 the trace can be switched on in the transaction WD_TRACE_TOOL for a given user.
 Once this trace is set it is active for 30 minutes and when the application is run during that time trace is
 recorded and that can downloaded.
-The trace tool is shown in the bottom of the webdynpro application.
-To download the trace file, choose the option trace as zip and exit.
****************************************************************
ICM Tracing for webdynpro Application

ICM(Internet Communication Manager)
ICM is used to communicate between the SAP web application server and the outside world
using http,https protocols. ICM trace is use to analyze the behaviour of the webdynpro application on the serverside and see for any communication and performance issues.
ICM trace can be set from the transaction SMICM.
All the ICM parameters can also be used in SMICM transaction: ex: server details,
time out settings etc.Here are the steps
1) Go to transaction: SMICM
2) click on the menu option goto->trace file->Start
   there are different levels of 1 is the lowest and 3 is the highest.
   the data traffic is analysed all the highest level.
****************************************************************
F4 help for inputfields in webdynpro abap
F4 help for inputfields in webdynpro can be achieved in 3 ways:
1) F4 help based on R/3 DDIC searchhelp concept.
    if the inputfield refers to DDIC object and if it has search help, A search help is automatically
    assigned to the inputfield and shown.
2) OVS(Object Value Selection
     you can achieve f4 help by using the standard component wdr_ovs, event: ovs.
3) Freely programmable Input help.  
    you can achieve f4 help by implementing the interface IWD_VALUE_HELP
****************************************************************   

Messages in webdynpro application
You can show messages in the webdynpro application by using the ui element message_area.
note message_area ui element is mandatory to trigger messages in webdynpro application. messages can be triggered using the code wizard and it uses the message manager interface  IF_WD_MESSAGE_MANAGER.

Here are a set of frequently used method to trigger messages.
1) report_success: report a success message on the webdynpro application
2) report_warining: report a warning message on the webdynpro application
3) report_error: report a error message on the webdynpro application
4) report_t100_message: reports a message from the t100 table.
5) clear_messages: clears the messages from the webdynpro application, however this will
   happen automatically on the next event on the ui.
6) is_empty: checks for any messages already raised.
7) report_attribute_error_message: reports an error for the context attribute

Sample code snippet to generate a t100 message.

**Get the message manager
data: lref_current_controller type ref to if_wd_controller.
data: lref_message_manager type ref to if_wd_message_manager.
data: lv_msgv1 type symsgv.
data: lv_msgv2 type symsgv.
data: lv_msgv3 type symsgv.
data: lv_msgv4 type symsgv.

lref_current_controller ?= wd_this->wd_get_api( ).

call method LREF_CURRENT_CONTROLLER->GET_MESSAGE_MANAGER
  receiving
    MESSAGE_MANAGER = LREF_MESSAGE_MANAGER.

* report t100 message
call method LREF_MESSAGE_MANAGER->REPORT_T100_MESSAGE
  exporting
    MSGID         =’ZZZZ’   "Message class
    MSGNO       =’999’    "Message Number
    MSGTY        =’E’         "Message type
    P1                 = lv_msgv1
    P2                 = lv_msgv2
    P3                 = lv_msgv3
    P4                 = lv_msgv4.
****************************************************************  

SAP ABAP webdynpro certification sample questions

Here are few webdynpro multiple choice questions and this covers the basics of webdynpro.
Note: These are not exact certifications questions but a sample to test your webdynpro knowledge.

1) Eliminate the Event that is not part of Webdynpro  
      a)WDDOBEFOREACTION
      b)WDDOENTRY
      c)WDDOINIT
      d)WDDOMODIFYVIEW

2) What is the Cardinality for the Node created for storing the Table

      a) 1:1
      b) 0:1
      c) n:n
      d) 0:n

3) What is the equivalent for Transaction in Webdynpro
      a) Application
      b) Component Controller   
      c) Interface Controller
      d) Plugs
      

4) The Webdynpro Programming model is based on
      a)Classic Dynpro Programming
      b)Business Server Pages(BSP)
      c)Model View Controller(MVC)
      d)Internet Transaction Server(ITS)

5) The UI Element and the Context Attributes of Webdynpro are linked. The process of doing this is called
      a) Binding
      b) Linking
      c) UI Linkage
      d) UI Link

6) A webdynpro Component consists of the below items except
      a) UI elements
      b) Component Controller
      c) Window
      d) Views

7) Identify a layout that is not part of the Webdynpro Layout types
      a) Flow Layout
      b) Row  Layout
      c) Grid Layout
      d) Tree Layout

8) Where does the Business Logic exists in the Webdynpro Component
      a) Methods of the view
      b) Methods of the Controller
      c) Assistance Class
      d) None of the above

9) How do you access the attributes declared in component controller in the method of a view
      Ex: emp_id type numc10
      a) wd_comp->emp_id
      b) wd_Comp_controller->emp_id
      c) wd_controller->emp_id
      d) wd_this->emp_id

10) which method do you use to read the contents of a internal table displayed in the webdynpro window
      a) GET_STATIC_ATTRIBUTES_TABLE
      b) GET_STATIC_TABLE
      c) GET_STATIC_ATTRIBUTES
      d) GET_SELECTED_ELEMENTS

11) Which method do you use to read the contents of a attribute attached to the context node.
      a)GET_ATT
      b)GET_ATTRIBUTE_REF
      c)GET_ATTRIBUTE
      d)GET_STATIC_ATTRIBUTES

12) Identify a Cardinality type that is not part of webdynpro.
      a) N:N
      b) 0:1
      d) 1:1
      c) 0:N

13) which data type do you use to declare a visibility attribute in webdynpro
      a) WD_VISIBILITY
      b) WDUI_VISIBILITY
      c) ABAP_TRUE
      d) BOOLEAN

14) Passing Parameters to webydnpro Application using the Applicatino URL are called_________Parameters
      a)Command Parameters
      b)Commandline Parameters
      c)Command Operators
      d)Ternary Parameters

15) A View in Webdynpro is associated with _______ in SAP GUI.
      a) View
      b) Transaction
      c) Dynpro
      d) Screen

16) Identify a Window Outbound Plug type to exit the View completely
      a) Standard Plug type
      b) Suspend Plug type
      c) Exit Plug type
      d) Inbound Plug type

17) which standard WD component is used to build ALV in Webdynpro
      a) SALV_WD_TABLE
      b) SALV_WD_TABLE_USAGE 
      c) AVL_TABLE
      d) None of the above

18) What is the right sequence of event trigger in Webdynpro
      1-WDDOINIT of Component Controller
      2-WDDOINIT of View
      3-WDDOINIT of Window
      
     a) 3 1 2
     b) 1 3 1
     c) 1 3 2
     d) 2 1 3

19) Which of the Below is not a Valid Webdynpro UI element
     a) Button
     b) Page Header
     c) Message Area
     d) Transparent View

20) Can a view container have more than one view active at a time.
     a) Yes
     b) No
     c) Depends on the Binding
     d) Depends on the Mapping

Answers:

1) b
2) d
3) a
4) c
5) a
6) a
7) d
8) c
9) b
10)a
11)c
12)a
13)b
14)b
15)d
16)c
17)a
18)c
19)d
20)b

ABAP Interview Questions : The Massive List


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!!


The Massive list of 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 form of a Subroutine i.e. PERFORM xxx.
Example: INCLUDE MVF5AFZZ 
à
PERFORM userexit_save_document_prepare.  
A customer exit can be implemented as:
·         Function exit
·         Screen Exit
·         Menu Exit
·         Field Exit
Example: CALL Customer function ‘xxx’
INCLUDE xxx.
You modify this include.
In case of a PERFORM, you have access to almost all the data. So you have better control, but more risk of making the system unstable.
You have access only to the importing, exporting, changing and tables parameter of the Function Module. So you have limited access to data.
User exit is considered a modification and not an enhancement.
A customer exit is considered an enhancement.
You need Access Key for User Exit.
You do not need access key.
Changes are lost in case of an upgrade.
Changes are upgrade compatible.
User exit is the earliest form of change option offered by SAP.
Customer exits came later and 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
Just as Google offers Image/Chart/Map APIs OR Facebook offers APIs for Comment/Like, SAP offers APIs in the form of BAPIs. BAPI is a library of function modules released by SAP to the public so that they can interface with SAP.
RFC is nothing but a remote enabled function module. So if there is a Function Module in SAP system 1 on server X , it can be called from a SAP system 2 residing on server Y.
There is a Business Object Associated with a BAPI. So a BAPI has an Interface, Key Field, Attributes, Methods, and Events.
No Business Object is associated with a RFC.
Outside world (JAVA, VB, .Net or any Non SAP system) can connect to SAP using a BAPI.
Non–SAP world cannot connect to SAP using RFC.
Error or Success messages are returned in a RETURN table.
RFC does not have 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 any Function module.
SMARTFORM generates a Function Module when activated.
Main Window is must.
You can create a SMARTFORM without a Main Window.
SAPSCRIPT can be converted to SMARTFORMS. Use Program SF_MIGRATE.
SMARTFORMS cannot be converted to SCRIPT.
Only one Page format is possible
Multiple page formats are possible.
Such thing is not possible in SCRIPT.
You can create multiple copies of a SMARTFORM using the Copies Window.
PROTECT … ENDPROTECT command is used for Page protection.
The Protect Checkbox can be ticked for Page 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 when the data volume is huge.
Call transaction method is when the data volume is   low
Session method is slow as compared to Call transaction.
Call Transaction method is relatively faster than Session method.
SAP Database is updated when you process the sessions. You need to process the sessions separately via SM35.
SAP Database is updated during the execution of the batch input program.
Errors are automatically handled during the processing of the batch input session.
Errors should be handled in the batch input program.


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 available in BAPI.
Background and Foreground processing options are available for BDC.
BAPI would generally used for small data uploads.
BDCs would be preferred for large volumes of data upload since background processing option is available.
For processing errors, the Return Parameters for BAPI should be used.This parameter returns exception messages or success messages to the calling program.
Errors can be processed in SM35 for session method and in the batch input program for Call Transaction method.


Question 6: What is the difference between macro and subroutine?

Macro
Subroutine
Macro can be called only in the program it is defined.
Subroutine can be called from other programs also.
Macro can have maximum 9 parameters.
Can have any number of parameters.
Macro can be called only after its definition.
This is not true for Subroutine.
A macro is defined inside:
DEFINE …
….
END-OF-DEFINITION.
Subroutine is defined inside:
FORM …..
…..
ENDFORM.
Macro is used when same thing is to be done in a program a number of times.
Subroutine is used for modularization.



Question 7: What is the difference between SAP memory and ABAP memory?

SAP Memory
ABAP Memory
When you are using the SET/GET Parameter ID command, you are using the SAP Memory.
When you are using the EXPORT IMPORT Statements, you are using the ABAP Memory.
SAP Memory is User Specific.
What does this mean?
àThe data stored in SAP memory can be accesses via any session from a terminal. 
ABAP Memory is User and Transaction Specific.What does this mean?à The data stored in ABAP memory can be accessed only in one session. If you are creating another session, you cannot use ABAP memory.


Important
Question 8:
 What is the difference between AT SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT?
AT SELECTION-SCREEN is the PAI of the selection screen whereas
AT SELECTION-SCREEN OUTPUT is the PBO of the selection screen.



Question 9: What is the difference between SY-INDEX and 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.
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.

Workbench vs Customizing work 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. 


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 ?
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 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 control (cl_gui_alv_grid) in each of those.
·         You can even use a Splitter container control and place multiple ALVs in each of
    the split container.
·         If you are using Normal ALV, You can use the following FMS:
1.      REUSE_ALV_BLOCK_LIST_INIT
2.      REUSE_ALV_BLOCK_LIST_APPEND
3.      REUSE_ALV_BLOCK_LIST_DISPLAY

Question 19: A system has two clients 100 and 500 on the same application server. If you make changes to a SAPSCRIPT on client 100, will the changes be available in client 500?

No. SAPSCRIPT is client dependent. You will have to transport changes from client 100 to client 500. However, for SMARTFORMS, Changes will be made both for client 100 and client 500.

Question 20: There are 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


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

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.


Foreign key relationship in ABAP

  
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 table
For 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 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.
How to Find a BAPI ?



Important 
Question 27: How do you find BADI?
Approach1: 

Go to Class CL_EXITHANDLER in SE24 ---> Put a breakpoint in method GET_INSTANCE.Now go and execute your transaction code for which you want to find BADI.
You will find the BADI in the changing parameter exit_name:

How to find a BADI in ABAP ?


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:


How do you find a BADI ?

Find BADI in SAP
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 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.