Showing posts with label ABAP FAQ. Show all posts
Showing posts with label ABAP FAQ. Show all posts

Wednesday, August 1, 2007

Performance Tuning

1.

What are ST05 and SE30 used for?

ST05 SQL Trace transaction

SE30 Run time analysis transaction

2.

What are simple rules for increasing performance?

a. Do not use nested loops / select statements.

b. Always use where in select query.

c. Select only required fields

d. Avoid Select – Endselect instead use Into table

e. Modularize the code.

f. Avoid using move corresponding

g. Always check for sy-subrc before sorting, read, select statements and where ever necessary.

h. Perform code inspector check

Enhancements and Modifications

1

What is a user exit?

User exits (Function module exits) are exits developed by SAP. The exit is implemented as a call to a function module. The code for the function module is written by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for function module exits is:
EXIT_<program name><3 digit suffix>

The call to a function module exit is implemented as:
CALL CUSTOMER.-FUNCTION <3 digit suffix>

2.

How to find a exit?

Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT If you know the Exit name, go to transaction CMOD. Choose menu Utilities->SAP Enhancements. Enter the exit name and press enter. You will now come to a screen that shows the function module exits for the exit.

3.

What are the types of exits?

a. Menu exits add items to the pull down menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications

b. Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.

c. Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits.

4.

Where can we search a user exit?

In SMOD

5.

How do we implement a user exit?

Go to CMOD create a project here include the exit that u want to use and within this exit write the appropriate logic that we want.



BADIS


1.

What are BADIS?

BADIs are Business Add-Ins.
The are used to provide custom extension of a standard functionality.
BADIs are the new form of user exit.
They use ABAP OO.
The support multiple implementation.
BADIs are defined in SE18 and implemented in SE19.
Code in application checks to see if and implementation is "active"
and calls it if it has been implemented.


Difference User Exits Vs Badi




Badis

User Exits

1. Object
Oriented paradigm

1. The more traditional types, are ones controlled and implemented via CMOD/SMOD transitions as includes to function modules

2. BADI's can be used any number of times

2. USER-EXITS can be used only one time

Sap Scripts and Smart Forms

1

Tcode for SAP SCRIPTS

SE71

2.

What are the components of scripts?

a. Pages

b. Windows

c. Page Windows

d. Character and paragraph format

e. Header and basic settings

3.

Where can we design styles for sap scripts?

In SE72

4.

What is the most important componenets in sap script?

A script cannot run without a main window.

5.

What are the types of windows?

a. Main

b. Variable

c. Constant

d. Graph.

6.

How many main windows can exist in a script?

Max of 100, 00 to 99.

7.

Can we write code in script?

Yes we can.

8.

How do we call an external subroutine in scripts?

Use syntax 
In script
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
 
And in program 
 
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.
 

9.

What are symbols in sap scripts?

They are the places holders for values.

10

What are different types of symbols?

a. Standard

b. System

c. Program

d. Text

11.

Where do we define a standard symbol?

In SO10.

12

Name some system symbols.

Date/Time/Pageno etc

13

How do we call a script from program?

Use the following FM

OPEN_FORM

WRITE_FORM

CLOSE_FORM

14

Can we modify a standard script?

Yes copy the standard script in to Z and make the changes.

15

Can we migrate a script to smart form ? How?

Yes , just go to smartforms and there is a option of migrate from scripts.

16

Where do we maintain the relation between script and print program?

In TCode NACE





Smart Forms



1.

What is the Tcode for smart forms

SMARTFORMS

2.

Where do we design styles?

In SMARTSTYLES

3.

Is it mandatory for a smartform to have a main window?

No

4.

How do we execute a smartforms?

It creates a FM when activated ,just use this FM as normal we use in the program and pass the parameters to it.



Difference between asmartform and script


Sap script

Smartforms

1. Is client dependents

1. Is client Independents

2. Main window is must

2. Main window is optional

3. Coding layout and design is complex

3. It very easy as compared to scripts

4. Data is not maintained in tree format

4. Data is maintained in tree format

5. Debugging is very tedious

5. Debugging is very easy

6. Does not generate a FM

6. Does generate a FM

7. Can be migrated to smartform

7. Cannot be migrated to scripts

Dialogue Programming

1

What is the Tcode for screen painter and Menu painter

SE51 and SE41

2

What are screen painter and menu painter?

Screen painter: Screen painter is a tool to design and maintain screen and its elements. It allows user to create GUI screens for the transactions. Attributes, layout, filed attributes and flow logic are the elements of Screen painter.

Menu painter: Menu painter is a tool to design the interface components. Status, menu bars, menu lists, F-key settings, functions and titles are the components of Menu painters. Screen painter and menu painter both are the graphical interface of an ABAP/4 applications.

3.

What are the components of a screen painter?

Text, Label, Push button, Radio button, Check box, Table control, Tab strip.

4

What are the types of screen?

a. Normal

b. Modal

c. Subscreen

5.

What are the events in screens?

PBO : Process before output

PAI : Process after input

POH : Process on help request

POV : Process on value request

6.

How can we add F4 help in screen.

1. Specify the dictionary elements in the attributes of the fields or

2. Use values command and give specified set of values or

3. Use POV event

7

How do we validate screen elements in screens.

Use CHAIN ENDCHAIN for group of fields.

8

What is a subscreen?

It is a type of screen which does not have its own GUI status and forms a part of the screen and cannot be a standalone screen as a normal screen.

9

What is a table control?

It’s a control used to for input/output of data at large.

10

I have create a text box on the screen and I want to pass value to it how do I do that?

Just declare a variable of the same name as the text box in the program attached to the screen this will facilitate value passing between program and screen.

BDC & LSMW

1

What is BDC.

BDC means Batch Data Communication and is used to upload mass data at a given time.

2

What are the methods for uploading data.

a. Session method.

b. Call Transaction method.

c. Direct input method.

3.

How do we make a recording.

Through SHDB.

4

What is a typical BDC structure.

a. Program name

b. Screen No

c. Start of screen

d. Field name

e. Field value

5

What should be internal table type used for uploading data to BDC.

Table should be of type BDCDATA.

6

What are the FM used for BDC.

BDC_OPEN_GROUP

BDC_INSERT

BDC_CLOSE_GROUP

7

What thing(s) should we keep in mind while recording.

We should make sure that all the mandatory fields are included in the recording, else BDC will fail.

8

How do we handle currency or quantity field in BDC.

Use write statement with currency/quantity option.

9

Where is session stored.

SM35.

10

What are the modes of executing a BDC.

a. Fore ground.

b. Back ground.

c. Only error screen.

11

Are logs maintained in BDC.

Yes.

12

Is a session stored after execution.

It depends on the selection made by the user in FM BDC_OPEN_GROUP if he has selected the option of Keep = ‘X’ then session is stored else its deleted.

13

Can we generate programs from SHDB recording.

Yes we can, Just select the recording and click new program.

14

What is the difference between a call transaction and session method.

a. No logs are created in call transaction method.

b. No session is created here.

c. Need to execute records one by one in call transaction.

15

What type of internal table should be created for call transaction.

BDCDATA.

16

How can we see error messages during call transaction.

Create a internal table of type BDCMSGCOLL and use this in call transaction, this will return the messages during the call transaction.

17

What is a synchronous and asynchronous methos.

Synchronous method means simultaneous execution while asynchronous means at later stage the execution takes place.

18

Is BDC synchronous or asynchronous.

Session methods can be both Synchronous and Asynchronous but call transaction is always synchronous




LSMW



1

What is LSMW.

Legacy System Migration Workbench.

2

What is the difference between LSMW and BDC.

a. LSMW has least coding.

b. Very simple

c. Has got number of standard recordings.

d. We can group similar recordings forming Projects and Sub-Projects.

e. Documentation can be provided at every stage.

f. We can insert additional coding and rules in LSMW.

g. To run LSMW user does not need to have ABAP knowledge.

3.

What are different import types for data uploading in LSMW.

a. Standard Input.

b. Batch Input.

c. Bapi

d. IDOC

4

Can we upload a given range of records say from 10-80.

Yes we can.




Difference between BDC and LSMW



BDC

LSMW

1. Lots of coding

1. Minimal coding almost nil

2. Data can be uploaded through recording only

2. Has 4 methods for uploading data

a. Standard

b. Recording

c. Bapis

d. Idoc

3. Uploading cannot be done for specific set of records.

3. Uploading can be done for specific set of records.

4. We cannot group logically related BDC

4. We can group the LSMW as project /sub project / objects

5. Does require programming knowledge

5. Does not require programming knowledge

Modularization

1

What does modularization means.

Dividing the program in to sections so as to increase the appearance and readability of the code.

2

What are different modularizing techniques.

a. Includes.

b. Macros.

c. Subroutines.

d. Function Modules.

3

Are includes executables.

No.

4

Where do we create include.

IN SE38 just select type I instead of E as for reports in attributes.

5

Can includes be nested.

Yes.

6

What is a macro.

Macros are like small codes written inside the program or can be global , we can pass parameters to these macros.

7

How many parameters can we pass to the macros.

Maximum 9.

8.

Is it good practice to use macros.

Macros are inserted at the calling point during runtime which increase the length of the codes and hence the execution time so they should not be used frequently.

9

How do we define and call macros.

Definition.

Define <macro name>.

<Code>

End-of-Definition.

Calling a macro.

<Macro name > parameters.

10

What is a subroutine.

Subroutines are local calls made in the program which may or may not return a value.

11

Can parameter be passed to a subroutine.

Yes, They can be

a. Pass by value.

b. Pass by reference.

c. Pass by value and return or changing.

12

How are internal tables passed.

They are always passed as pass by reference.

13

Can a subroutine be called outside a program.

Yes, just put in the program name that contains the subroutine.

Syntax <Subroutine_name>(<Program_name)

14

What is a formal parameter and actual parameter.

Actual Parameter: This is the one that is actually passed to the subroutine.

Formal Parameter: Parameters that hold the values in the actual call in the subroutine are formal parameters.

15

What is a function group.

Logically related function modules are stored under one roof , function group. This is necessary for creating a function group.

16

What is the T-Code for creating function module.

SE37.

17

What are the types of function modules.

a. Normal.

b. Remote enables.

c. Update function module.

18

What are the important tabs in function module.

a. Import

b. Export

c. Changing

d. Tables

e. Exception

There are two more tabs

a. Source code

b. Attributes

19

What is an exception tab.

User can raise exception in the function using the raise statements these exceptions are stored in the exception tab and are handled where the function is called.

20

What is a remote enabled function module.

Function that can be called outside sap by any other application is a remote enabled function module.

21

What is an update function module and why is it used.

When user wants to update any data base table directly then we should use these FM as it work on the principal of commit all(If update is successful) or rollback all(If update fails).

Reports

1

What is the T-Code for creating a report.

SE38

2

Can reports be executed via any other option other than SE38 and its own T-code if any.

Yes,Via SA38

3

What are the basic types reports.

Classical & Interactive

4

What are the events in an reports

INITLIZATION

AT SELECTION-SCREEN ON FIELD

AT SELECTION-SCREEN OUTPUT

AT SELECTION-SCREEN ON BLOCK

START-OF-SELECTION

TOP-OF-PAGE

END-OF-PAGE

TOP-OF-PAGE DURING LINE SELECTION

AT LINE SELECTION

AT PF-STATUS

AT USER COMMAND

END-OF-SELECTION.

5

What is the difference between parameters and select-options.

Parameters are used for input of single values

Select-Options are used for input of multiple values.

6

Can select options be used as parameters .

Yes, with options of No-Intervals and No-extensions.

7

How do we design a selection screen.

Using Begin of block <block name> with frame title text-001.

This will format the selection screen and create a block at the output.

8

How is a report aligned.

Using pretty printer , make sure that intend option is selected in Utilities->Setting->Abap editor

It is always aligned w.r.t to the reports statement.

9

Which is the default event.

START-OF-SELECTION

10

What is Line-Count and Line-Size options.

Line-Count : No of lines in a page , new page is automatically triggered when line-count lines are

Encountered

Line-Size:No of characters in a line.

11

What is Message-ID in the report statement.

It is the default message class to be used throught the report.

12

How to assign a label to the selection screen object.

Use Selection-Text Goto->Text Element->Selection Text

`

What is a modif-id.

If we want to modify the screen at runtime based on the user id then we use a modif id with the screen element.

14

Why do we use a text element.

If we are logged on to different language and if a text element is maintained in that language then it is automatically picked up.

15

When does an event end.

When a new event start the previous event end.

16

My End-Of-Page event is not triggering.

You need to reserve no of lines needed for your page end in the LINE-COUNT(<specify no of lines here) which is used at the report header.

17

When is End-Of-Page event triggered.

It is triggered only when the line count as mentioned in the LINE-COUNT is reached and not before that , we can also trigger page end explicitly by appropriate logic.

18

Do we also need to reserve line for TOP-OF-PAGE

No.

19

What are different types of select statements.

Select single

Select up to

Nested select

Sub Queries

Select into

20

What is the difference between a select single and select up to 1 rows.

Select single retrieves the 1st records depending upon the where condition , where as as select up to 1 rows gives the exact records depending upon the where condition.

21

What are the steps to rember while writing a select stmt for better performance.

a. Always select only required fields from the data base table.

b. Always use where conditions.

c. Avoid using nested selects and sub-queries.

d. If selecting more that one records use internal tables.

e. Do not use inner joins for more than 3 tables at a given time.

f. Do not use move-corresponding unless required.

22

What if select stmt using for all entries of a certain internal table is initial.

It will retire all the records for that select stmt. This should be avoided using proper check.

23

What are the types of internal tables.

a. Standard

b. Sorted

c. Hashed

24

Give names of control loop statements.

a. At New

b. At Last

c. At First

d. At End of.

e. On Change of – Can be used outside loop also.

25

Do we have nested loops?

Yes we do but these should be avoided unless and until required as the performance is hit due to this.

26

Can we have a where condition with the loop.

Yes we can.

27

What if the difference between TOP-OF-PAGE and TOP-OF-PAGE DURING LINE SELECTION.

TOP-OF-PAGE is used for basic list

TOP-OF-PAGE DURING LINE SELECTION used for secondary list.

30

What is an interactive list.

A report which generated a basic list and using the basic list if we are able to generate a secondary list then it is called a interactive reports.

31

How many basic and secondary list do we have.

One basic and 20 Secondary list.

32

What is the system field for list index.

Sy-Lsind.

33

How do we store the clicked records.

Using the HIDE stmt in the Loop..EndLoop.

And then using AT LINE-SELECTION event.

34

How do I display Top of page for secondary list.

Use TOP-OF-PAGE-DURING LINE SELECTION and depending upon the generated list index display the appropriate heading.

35

Name few system variables.

a. Sy-Datum Date

b. Sy-Uzeit Time

c. Sy-Lsind List Index

d. Sy-Pagno Page No

e. Sy-Uname User Name

f. Sy-Sysid System Id

More of these can found in system table SYST.

36

What is a message class.

Message class contain message that are displayed during the program its created in SE91 and contains max of 1000 messages 000-999.

37

What are different types of messages.

a. A bandon

b. E xit

c. S tatus

d. I nformation

e. W Arning

38

Can we have a custom message at runtime.

Yes we can, we can pass maximum of 4 variable to the message class.

39

What is a FORMAT stmt.

FORMAT is used to format the report output.

Its options are

a. COLOR 0-7

b. INPUT 0-1

c. INTENSIFIED 0-1

d. HOTSPOT ON/OFF

e. RESET

40

How do I assign a T-CODE to a report.

Go to SE93 and create a T-CODE it will ask for a report name give the report name here.

41

How do I analyze my report performance.

Use ST05 or SE30 or use extended program check

Programs->Check->Extended program check/Code Inspector

42

What is a Short Dump.

An exception, that occurs in the programs are stored as short dump. You can see it in ST22.

43

How do we call an report from another report.

Using Submit statement.

44

Can we pass parameter to these report.

Yes we can, see the option with the submit statement.

45

What is a program statement.

It is equivalent to a report statement.