Friday, February 10, 2012

Using Icons & symbols in abap program

*&---------------------------------------------------------------------*
*& Report  YSAP_DATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_date.

INCLUDE <icons>.
INCLUDE <symbol>.
DATA  passengername.
WRITE 'passenger name:ramya'.
WRITE: /'ticket no : 14001212',
       /'time :',15 sy-uzeit.
SKIP.
WRITE: /10 'ticket rate:100 /-',
       /10 'luckage charge:150/-'.
NEW-PAGE.
WRITE:    / 'place: coimbatore',
          / 'date:',15 sy-datum.
WRITE:    /10 icon_date AS ICON, sy-datum, sym_left_hand AS SYMBOL,
          /10 'date and time:', sy-datum, sy-uzeit.



 

Breakpoints in classic debugger

 BREAKPOINTS
A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The Debugger is activated when the program reaches this point. 

The Debugger contains different breakpoint variants:

 Static Breakpoints
A user-specific breakpoint is inserted in the source code as an ABAP statement using the keyword BREAK-POINT. A non user-specific breakpoint is set in the ABAP Editor using the BREAK user name statement.

Dynamic Breakpoints 

Can be set in the ABAP Editor or the Debugger by double-clicking a line, for example. Dynamic breakpoints are always user-specific, and are deleted when you log off from the R/3 System.Dynamic breakpoints are more flexible than static breakpoints because you can deactivate or delete them at runtime. They have the following advantages: 

·        You do not have to change the program code. 

·        You can set them even when the program is locked by another programmer.

·        You can define a counter that only activates the breakpoint after it has been reached.
Special dynamic breakpoints are useful when you want to interrupt a program directly before a particular ABAP statement, a subroutine, or an event, but do not know exactly where to find it in the source code. Event here is used to refer to the occurrence of a particular statement, for example, or calling up a method. Special dynamic breakpoints are user-specific. You can only set them in the Debugger. For more information, refer to the chapter Dynamic Breakpoints.

Breakpoints at Statements

  The Debugger stops the program immediately before the specified statement is executed.

Breakpoints at Subroutines

   The Debugger stops the program immediately before the specified subroutine is called.

Breakpoints at Function Module Calls

  The Debugger stops the program immediately before the specified function module is called.

Breakpoints at Methods

    The Debugger stops the program immediately before the specified method is called.

Breakpoints at System Exceptions

   The Debugger stops the program immediately after a system exception, that is, after a runtime error has been intercepted.









ABAP - Debugger


 DEBUGGER
The Debugger is a programming tool that you can use to execute ABAP programs, by line or by section. With this tool, you can display data objects and check the flow logic of programs

THE CLASSIC DEBUGGER
The Classic ABAP Debugger runs in the same roll area as the application to be analyzed (debuggee). It is therefore displayed in the same window as the application. However, this technology also has some restrictions. For example, some ABAP programs (such as conversion exist) cannot be analyzed in debug mode for technical reasons. However, the most significant restriction is that no ABAP technology can be used for designing the Debugger interface and it is therefore not possible to create a modern user interface.

NEW DEBUGGER:
The New ABAP Debugger, on the other hand, is executed in a separate external session (Debugger), while the application to be analyzed (debuggee) uses a second external session. With this technology, the user interface of the Debugger can be designed freely by ABAP means.
The new Debugger provides the user with a flexible interface that can be configured as required and has more than eight desktops. Here it is possible to place and arrange up to four tools - depending on the user's selection. For example, it is possible to display source texts or structures. In this way, the user can design the Debugger interface according to his own individual requirements.




ABAP - Parameters as list boxes

*&---------------------------------------------------------------------*
*& Report  YRAMYA_LIST_BOXES
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  yramya_list_boxes.


TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
      list TYPE vrm_values,
      value LIKE LINE OF list.

PARAMETERS: options(10AS LISTBOX VISIBLE LENGTH 15.

AT SELECTION-SCREEN OUTPUT.
  name = 'options'.
  value-key = '1'.
  value-text = 'option1'.
  APPEND value TO list.
  value-key = '2'.
  value-text = 'option2'.
  APPEND value TO list.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = list.

START-OF-SELECTION.
  WRITE: / 'Option selected', options.


 



 

 
 

ABAP - Using Macros and subroutines

*&---------------------------------------------------------------------*
*& Report  YSAP_MACRO1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_macro.


DEFINE MACRO1.
    WRITE :/'SUBroutine' color 6.
  ENDFORM.
END-OF-DEFINITION.

perform test1.
FORM TEST1.
MACRO1.


Defining Macros in abap program

*&---------------------------------------------------------------------*
*& Report  YSAP_MACRO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_macro.

DATA: result TYPE i,
      n1 TYPE i VALUE 5,
      n2 TYPE i VALUE 6.

DEFINE operation.
  result = &1 &2 &3.
  output &1 &2 &3 result.
END-OF-DEFINITION.

DEFINE output.
  write: / 'The result of &1 &2 &3 is', &4.
END-OF-DEFINITION.

operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.

ULINE.


 

ABAP - Using Check boxes

*&---------------------------------------------------------------------*
*& Report  YSAP_CHECK_BOXES
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ysap_check_boxes.

TABLES: pa0002, pa0001.

PARAMETERS: pernr type pa0002-pernr,
            perdet AS CHECKBOX DEFAULT 'X',
            orgdet AS CHECKBOX .
CASE perdet.
  WHEN 'X'.
    WRITE'Employee details' color 3.
    ULINE.
    SELECT * FROM pa0002 where pernr eq pernr .
      WRITE: / pa0002-pernr, pa0002-vorna, pa0002-nachn, pa0002-gbdat, pa0002-natio.
    ENDSELECT.
  WHEN ' '.
    WRITE'You have not selected employee details' color 6.
endcase.
uline.
case orgdet.
  WHEN 'X'.
    WRITE'Org details' color 3.
    ULINE.
    SELECT * FROM pa0001 where pernr eq pernr  .
      WRITE: / pa0001-pernr, pa0001-bukrs, pa0001-werks, pa0001-persg, pa0001-persk.
    ENDSELECT.
 WHEN ' '.
    WRITE'You have not selected org details' color 6.
 endcase.
uline.
if ( ( perdet = 'X' ) and ( orgdet eq 'X') ).
WRITE'You have selected selected both Employee and org details' color 7.
endif.
uline.



 


 


 

 

Wednesday, February 08, 2012

Sample certification questions - SAP ABAP

1.the roles of dynamic internal table screen in screen MODIFY . And how to modify the screen / selection screen?
  • Appear only in certain conditions
  • Are in change or display mode according to user inputs
  • Becomes mandatory subject to specific inputs . Change its format depending upon certain conditions.
  • None of the above.

2. The SAP List Viewer, commonly known as the ALV, is a powerful tool for displaying data. Among the various ALV types, the ALV Grid Control is used for displaying non-hierarchical table data.
  • The ALV Grid Control can be integrated into a list, a selection-screen, and a classical screen (dynpro).
  • By default, a column header will be taken from the data element which is used for specifying the type of the column.
  • When a report with an ALV Grid Control is executed in background processing, the program will terminate abnormally since controls can-not be addressed in background processing.
  • The ALV display is automatically refreshed when the data in the data-base table is changed.
3. What can be grouped in a single simple enhancement spot?
  • New BAdIs and enhancement sections
  • Enhancement implementations
  • New BAdIs
  • Classical BAdIs and new BAdIs
  • Explicit enhancement points and enhancement sections

4. You want to perform database changes using synchronous updates. The update function modules should be executed by an update work process. How do you implement this?
  • Use UPDATE.
  • Use COMMIT WORK AND WAIT.
  • Use COMMIT WORK.
  • Use SET UPDATE TASK LOCAL. €¦ COMMIT WORK.

5. Within the source code of a BAPI, you can execute a CALL TRANSACTION statement.
Determine whether this statement is true or false.
  • True
  • False

6. Extension parameters enable application programmers to use preprogrammed user exits to enhance BAPI interfaces without modifications. Determine whether this statement is true or false.
  • True
  • False

7. Which of the following statements is NOT true about a BAPI? Choose the correct answer(s).
  • You must use the standard data structures such as BAPIRET2 for your RETURN parameter.
  • All error messages have to use the parameter RETURN
  • A BAPI can produce screen output.
  • A BAPI must not cause a program termination (A message).
8. If a page does not have a main window, the system implicitly processes all other windows of the page and continues with the subsequent page. This page must not call itself as subsequent page (recursive call), since this would produce an endless loop. In such a case, SAPscript terminates the output after ___________ subsequent pages.
  • 3
  • 4
  • 99
  • 9

9. In sapscript You cannot delete text lines placed into the window using WRITE_FORM_LINES.
  • True
  • false

10 If you do not SUPPRESS DIALOG in a dynpro before you LEAVE TO LIST - PROCESSING, the following will happen (More than one answer is correct)
  • The screen will be displayed with the report that was built, but the gui -stus will be the one fromo
the previous screen
  • The report will be displayed on the screen only after the user presses the enter key
  • The previous screen (calling screen) will be redisplayed
  • The screen will be displayed, and will be empty

11 A screen field has been dynamically changed in a dialog program. When does it g et reinitialized?
  • At the end of the transaction
  • Only when the program encounters more code to modify the field attributes
  • At PAI execution
  • At PBO execution

12 You have issued a Set Title bar in the PBO of your screen, H on long Will the title remain active?
  • Until the Next screen change
  • Until the next Set TitleBar stement
  • Until the next DB Luw

13 Business want to put validation on plant No. For all the screen. The requirement is to give Error message whenever user give plant 567.what can be most appropriate way to achieve this?

  • Field exit
  • screen exit
  • user exit
  • function module exit


14 SE24: If you have a 'Singleton pattern", you must ensure that only one object can be created from a cl_singleton class. What mechanisms must you avail of here A batch input job with two steps is processed. IMPORT/EXPORT statements are used to pass values between the steps.
Step 1 contains the statements
STATUS='S'. CONT = 'C'.
EXPORT STATUS CONT TO MEMORY ID 'XXXX'.
Step 2 contains the statements
CLEAR:CONT, STATUS, FLAG.
IMPORT CONT FLAG FROM MEMORY ID 'XXXX'.
What do the fields SY-SUBRC, CONT and FLAG contain after the IMPORT statement have been executed?

  • Sy-subrc = 0 . Cont = 'C' .FLAG = C
  • Sy-subrc = 0 . Cont = 'C' .FLAG = S
  • Sy-subrc = 4 . Cont = 'C' .FLAG = B

15 Which of the following statements apply to the SAP grid control
  • Can only be implemented in module pools
  • Provides standard functions such as sorting
  • Can only display single-line lists
  • Cannot print data
  • Can only display structures from the Dictionary

16 The concept of visibility of components is well-known in object oriented languages. Which of the following statements are correct with regard to ABAP objects
  • A programmer can, but need not, determine the visibility of a component. The default visibility of a component is PRIVATE
  • All components of inherited classes are PUBLIC
  • A PROTECTED method METH that is defined in a class SUPER can be overwritten (redefined) in an inherited class SUB
  • A PRIVATE component of a class can be accessed in all methods of that class

17 The SAP List Viewer, commonly known as the ALV, is a powerful tool for displaying data. Amoung the various ALV types, the ALV Grid Control is used for displaying non-hierarchical table data

  • By default, a column header will be taken from the data element which is used for specifying the type of the column
  • When a report with an ALV Grid Control is executed in background processing, the program will terminate abnormally since controls cannot be addressed in background processing.
  • The ALV Grid Control can be integrated into a list, a selection-screen, and a classical screen (dynpro)
  • The ALV display is automatically refreshed when the data in the database table is changed


18 Which of the following stements about inheritance are correct
  • A client (caller) can use interface reference to access all methods of the interfaces and thus archive polmorphism behaviour
  • Interfaces actually stand for an interface (protocol) between a client (interface user) and a server (implementing class)
  • Interfaces are used to call static components of a class
  • Using interfaces you can simulate multiple inheritance
  • Using interface references you can reference all the public components of an object that have been defined in the corresponding interface-implementing class

19 You wish to use a Business Add-In (BAdi) in order to enhance an SAP application. Which of the following statements are correct?
  • If you have filter-dependent BAdis, there can always be only one active implementation for a filter value
  • More than one implementation can exist for BAdis that are not used on a multiple basis
  • BAdis can contain menu enhancements
  • A BAdi always has exactly one interface in which the methods of the enhancement are defined
  • If a default implementation exists for a BAdi, this will always be run

20 Which techniques are basic requirements for polymorphism
  • Implementation of methods of an interface in the respective classes (for polymorphism through interfaces)
  • Widening cast
  • Redefinition of methods (for polymorphism through inheritance)
  • Narrowing cast


21 Amoug the most frequently used enhancement concepts in ABAP, you find customer exits. Which of the following statements about customer exits are NOT correct?
  • If a customer exit is not implemented, the program offering this customer exit will dump (terminate abnormally) at runtime
  • Within one SAP system, a customer exit can have a maximum of one implementation
  • Within one client of an SAP system, a customer exit can have multiple implementations
  • Once a customer exit has been implemented in an SAP system, that implementation can be changed, but it cannot be deactivated any more



22 The reference ME is defined by the system and has the following function

  • You use the reference ME within a class to call attributes and methods of the class itself.
  • You use the reference ME within a class solely to reference the private attributes of the class itself
  • You can use the refence ME within a class solely to reference the private methods of the class itself


23 Which sub objects can an SAP enhancement contain
  • Screen exits
  • Function module exits
  • Menu exits
  • Append Structures
  • User exits

24 Which statement is incorrect for Index?

  • The index also contains a pointer from the index entry to the corresponding table entry to permit all the field contents to be read
  • When you change a data record of a table, you must adjust the index sorting
  • An index can be used to speed up the selection of data records from a table
  • An index can be considered to be a copy of a database table reduced to certain fields
  • All of the fields of the table are contained in the index

25 You are working on a program which is updating the database now you want that if something goes wrong you want that your code should be capable of reverting the changes done in database, which statements can be used to achieve this?
  • Message ‘Changes aborted’ Type ‘A’
  • Roll Back Work
  • Commit Work
  • Message ‘Changes aborted’ type ‘I’

26 You want a subroutine U to have a formal parameter P that is used to return a value. Which of the following definitions of U would you use to ensure that the value is passed back to the calling program only if the processing of U ends normally and is not terminated with a MESSAGE statement
  • FROM U USING p.
  • FORM U CHANGING P.
  • FORM U USING P.
    LOCAL P.
  • FORM U CHANGING VALUE(P)
  • FROM U USING VALUE(p)

27 The search help function know various link options in the ABAP dictionary. Which of the following statements apply
  • search help function that is linked to the data element can return values only for the search field (field where the F4 help was triggered)
  • If the search help function is linked to the data element as well as to the field, the search help for the field is displayed
  • search help function that is linked to the table field can return values only for the search field (field where the F4 help twas triggered)
  • If the search help function is linked to the data element as well as to the field, the search help for the field is displayed
  • If the search help function is linked to a table A, this search help is displayed whenever there are input fields on that screen that have A as the check table

28 Which of the following statements apply to a database view.
  • Using a database view, you can read data from several tables
  • A database view can have one or several base tables
  • A database view supplies the results quantity of an outer join logic
  • Using a database view, you can insert data into several tables.(your answer)
  • A database view is a special view of transparent tables(your answer)

29 Where can you have automatic input checks againsts the check table
  • For input fields on selection screens
  • For input fields on screens if the input fields have been copied from the Dication into the Screen Painter
  • For input fields on ABAP lists

30 In regard to SET PF-STATUS, you can deactivate unwanted function codes by using
  • HIDE
  • WITHOUT
  • IMMEDIATELY
  • EXCLUDING

31 Which is the importance of recording (shdb) in BDC program?
  • SHDB is the transaction to write all the steps while executing the session method
  • SHDB is the transaction to read all the steps while executing the session method
  • SHDB is the transaction to execute all the steps while executing the session method
  • None of the above

32 How to run the sessions in background in BDC?
  • Schedule RSBDCSUB to run periodically in one or more background jobs through transaction SM35
  • Schedule RSBDCSUB to run periodically in one or more background jobs through transaction SM36
  • Schedule RSBDCSUB to run periodically in one or more background jobs through transaction SM37
  • None of the above
33 how can you PRINT a session log file?
  • Execute RSBDCLOG
  • Execute RXBDCLOG
  • Execute RPBDCLOG
  • None of the above

34 With only two exceptions (AT SELECTION-SCREEN and GET), event blocks have no Global data area. All declarative statements in event blocks are handled with the Local data declarations in the program.
  • True
  • False

35 If we want to determine the country indicator , we use the function module
  • HR_COUNTRY_GROUPING_GET
  • HR_COUNTRYGROUPING_GET
  • HR_COUNTRY_GROUPINGGET
  • HRCOUNTRY_GROUPING_GET

36 The following specifications are possible for the return code

  • 0: the return table contains all required records.
  • 4: The return table contains all records , however it is incomplete due to missing authorization
  • 8: The return table is empty because no records were found with specified criteria
  • 12: The return table is empty due to missing authorization.
  • All the above

37 Functions of logical database are

  • Data retrieval
  • screening
  • Authorization
  • None
38 You can use the DIALOG_MODE parameter to specify whether the action is generally run in the
background or whether it only runs in the background until an error occurs, or whether the changes
are generally carried out in dialog mode.

Possible values: ‘0’ indicates

  • The changes are generally processed in the background. If an error occurs (with an E or A
message), the entire step is terminated and the module returns the corresponding error message in
the 'RETURN' structure.
  • The changes are processed in the background. If an error occurs, the system switches to dialog
mode so that the user can correct the entries.
  • The changes are processed in dialog mode.
  • None of the above

39 when an authorization check is performed for persons, the system determines whether the user has
authorizations required for the organizational features of employees when the _________________

Event occurs.
  • Get Pernr
  • Get infotypes
  • Get tables
  • None

40 The header line of results table RT is created as a data object RT_HEADER with the line type

  • PAY99_RESULT
  • H99PAY99_RT
  • PAYROLL_RESULT
  • None of the above

41 The only difference between structural and sequential evaluation is the additional
________________ entry in the tables statement

  • GDSTR
  • PERNR
  • INFOTYPE
  • All the above

42 Which report displays all possible evaluation paths between the starting object type
And the target object type.

  • RHWEGDIO
  • RHSOLO00
  • RHPLOGI0
  • RHACTI01

43 PCL2 contains the following clusters that are relavant for payroll
  • PS schemas
  • xy Payroll results
  • Directory of payroll results
  • All the above

44 Which function module will you use to call smartform from your program.
  • SSF_FUNCTION_MODULE_NAME
  • SSF_FUNCTIONMODULE_NAME
  • SSF_FUNCTION_MODULENAME
  • SSF_SMART_FORM_NAME

45 Transaction code to dubug smartform
  • sftrace
  • smartform_trace
  • St05
  • sm30

46 An IDOC structure is composed of
  • One substructure, substructure consists of several fields
  • Several segments, each segments has several data elements
  • Several substructures, each one made up of several  data fields
  • Several segments, each segment consists of several data fields

47 Which one of the following statements are TRUE?
  • After a TRANSPORT REQUEST is released, no further changes to its' objects are allowed.
  • Development classes can be viewed by using transaction SE80.
  • Local objects CANNOT be transported to another instance. .
  • A TRANSPORT REQUEST contains objects that can be transported to Quality or Production SAP instances

48 Which of the following statements is true?
A. An IDoc type can have many messages types associated with it.
B. An IDoc can have many messages associated with it.
C. A message type can be associated with many IDoc types.
  • A and C
  • A and B
  • Only A
  • All the statements


49    If a break-point statement is written in an ABAP program and the program is run in the background mode, which of the following is true.
  • Break-point statement will be ignored and program will complete the execution.
  • System generates a Sys log message
  • Program will create a short dump
  • None of the above
50 The sequence of events in Interactive Reports is
1.       At Line Selection
2.       At User Command
3.       At PFKEY
4.       Get Cursor
5.       Read

  • 1,2,3,4, 5
  • 1,2,3,5, 4,
  • 1, 2, 4, 5, 3
  • 1, 3, 5, 4, 2