Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

ABAP - Advanced Business Application Programming

Monday, May 26, 2008

Performance Tuning

For all entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of
entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the
length of the WHERE clause.

The plus

* Large amount of data
* Mixing processing and reading of data
* Fast internal reprocessing of data
* Fast

The Minus

* Difficult to program/understand
* Memory could be critical (use FREE or PACKAGE size)

Some steps that might make FOR ALL ENTRIES more efficient:

* Removing duplicates from the the driver table
* Sorting the driver table

If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
FOR ALL ENTRIES IN i_tab
WHERE mykey >= i_tab-low and
mykey <= i_tab-high. Nested selects The plus: * Small amount of data * Mixing processing and reading of data * Easy to code - and understand The minus: * Large amount of data * when mixed processing isn’t needed * Performance killer no. 1 Select using JOINS The plus * Very large amount of data * Similar to Nested selects - when the accesses are planned by the programmer * In some cases the fastest * Not so memory critical The minus * Very difficult to program/understand * Mixing processing and reading of data not possible Use the selection criteria SELECT * FROM SBOOK. CHECK: SBOOK-CARRID = 'LH' AND SBOOK-CONNID = '0400'. ENDSELECT. SELECT * FROM SBOOK WHERE CARRID = 'LH' AND CONNID = '0400'. ENDSELECT. Use the aggregated functions C4A = '000'. SELECT * FROM T100 WHERE SPRSL = 'D' AND ARBGB = '00'. CHECK: T100-MSGNR > C4A.
C4A = T100-MSGNR.
ENDSELECT.

SELECT MAX( MSGNR ) FROM T100 INTO C4A
WHERE SPRSL = 'D' AND
ARBGB = '00'.

Select with view

SELECT * FROM DD01L
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
SELECT SINGLE * FROM DD01T
WHERE DOMNAME = DD01L-DOMNAME
AND AS4LOCAL = 'A'
AND AS4VERS = DD01L-AS4VERS
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.

SELECT * FROM DD01V
WHERE DOMNAME LIKE 'CHAR%'
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.

Select with index support

SELECT * FROM T100
WHERE ARBGB = '00'
AND MSGNR = '999'.
ENDSELECT.

SELECT * FROM T002.
SELECT * FROM T100
WHERE SPRSL = T002-SPRAS
AND ARBGB = '00'
AND MSGNR = '999'.
ENDSELECT.
ENDSELECT.

Select … Into table

REFRESH X006.
SELECT * FROM T006 INTO X006.
APPEND X006.
ENDSELECT

SELECT * FROM T006 INTO TABLE X006.

Select with selection list

SELECT * FROM DD01L
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
ENDSELECT

SELECT DOMNAME FROM DD01L
INTO DD01L-DOMNAME
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
ENDSELECT

Key access to multiple lines

LOOP AT TAB.
CHECK TAB-K = KVAL.
" ...
ENDLOOP.

LOOP AT TAB WHERE K = KVAL.
" ...
ENDLOOP.

Copying internal tables

REFRESH TAB_DEST.
LOOP AT TAB_SRC INTO TAB_DEST.
APPEND TAB_DEST.
ENDLOOP.

TAB_DEST[] = TAB_SRC[].

Modifying a set of lines

LOOP AT TAB.
IF TAB-FLAG IS INITIAL.
TAB-FLAG = 'X'.
ENDIF.
MODIFY TAB.
ENDLOOP.

TAB-FLAG = 'X'.
MODIFY TAB TRANSPORTING FLAG
WHERE FLAG IS INITIAL.

Deleting a sequence of lines

DO 101 TIMES.
DELETE TAB_DEST INDEX 450.
ENDDO.

DELETE TAB_DEST FROM 450 TO 550.

Linear search vs. binary

READ TABLE TAB WITH KEY K = 'X'.

READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.

Comparison of internal tables

DESCRIBE TABLE: TAB1 LINES L1,
TAB2 LINES L2.

IF L1 <> L2.
TAB_DIFFERENT = 'X'.
ELSE.
TAB_DIFFERENT = SPACE.
LOOP AT TAB1.
READ TABLE TAB2 INDEX SY-TABIX.
IF TAB1 <> TAB2.
TAB_DIFFERENT = 'X'. EXIT.
ENDIF.
ENDLOOP.
ENDIF.

IF TAB_DIFFERENT = SPACE.
" ...
ENDIF.

IF TAB1[] = TAB2[].
" ...
ENDIF.

Modify selected components

LOOP AT TAB.
TAB-DATE = SY-DATUM.
MODIFY TAB.
ENDLOOP.

WA-DATE = SY-DATUM.
LOOP AT TAB.
MODIFY TAB FROM WA TRANSPORTING DATE.
ENDLOOP.

Appending two internal tables

LOOP AT TAB_SRC.
APPEND TAB_SRC TO TAB_DEST.
ENDLOOP

APPEND LINES OF TAB_SRC TO TAB_DEST.

Deleting a set of lines

LOOP AT TAB_DEST WHERE K = KVAL.
DELETE TAB_DEST.
ENDLOOP

DELETE TAB_DEST WHERE K = KVAL.

Tools available in SAP to pin-point a performance problem

The runtime analysis (SE30)

SQL Trace (ST05)

Tips and Tricks tool

The performance database

Optimizing the load of the database
Using table buffering
Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:

* Select DISTINCT
* ORDER BY / GROUP BY / HAVING clause
* Any WHERE clasuse that contains a subquery or IS NULL expression
* JOIN s
* A SELECT... FOR UPDATE

If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause.
Use the ABAP SORT Clause Instead of ORDER BY
The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.

If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.
Avoid ther SELECT DISTINCT Statement
As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.

ABAP - Questions

What is a 'Z' report?
Y or Z report refer to customized abap programs written for modules such as mm, sd, pp or fi/co etc.

Can we create an ABAP program without using Y or Z?
No, this is because all non Yor Z programs are standard SAP programs.

1. How data is stored in cluster table?
Each field of cluster table behaves as tables which contains the no. of entries.

2. What are client dependant objects in abap/sap?
SAP Script layout, text element, and some DDIC objects.

3. On which even we can validate the input fields in module progams?
In PAI (Write field statement on field you want to validate, if you want to validate group of fields put in chain and End chain statement.)

4. In selection screen I have three fields, plant mat no and material group. If I input plant how do I get the mat no and material group based on plant dynamically?
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATERIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' to get material and material group for the plant.

5. How do you get output from IDOC?
Data in IDOc is stored in segments, the output from Idoc is obtained by reading the data stored in its respective segments.

6. When top of the page event is triggered?
After excuteing first write statement in start-of-selection event.

7. Can we create field without data element and how?
In SE11 one option is available above the fields strip. Data element/ direct type.

8. How do we debug sapscript?
Go to SE71 give lay set name , go to utilities select debugger mode on.

9. Which transaction code can I used to analyze the performance of ABAP program.
TCode AL21.

10. How can I copy a standard table to make my own z_table.
Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z table name and press enter.

Following are some of the answers which I gave upto my knowledge.

1. What is the use of 'outerjoin'
Ans. With the use of outer join you can join the tables even there is no entry in all the tables used in the view.
In case of inner join there should be an entry in al the tables use in the view.

2. When to use logical database?
Ans. Advantage of Logical databases:
less coding s required to retrieve data compared to normal internel tables.
Tables used LDB are in hierarchial structure.

3. What is the use of 'table index'?
Ans .Index is used for faster access of data base tables.

4. What is the use of 'FOR ALL ENTRIES'?
Ans. To avoid nested select statements we use SELECT FOR ALL ENTRIES statement.
If there r more than 10000 records SELECT FOR ALL ENTRIES is used.
Performance wise SELECT FOR ALL ENTRIES is better to use.

5. Can you set up background processing using CALL TRANSACTION?
Yes,Using No Screen Mode.

6. What are table buffers?

Table buffers reside locally on each application server in the system. The data of buffered tables can thus be accessed directly from the buffer of the application server. This avoids the time-consuming process of accessing the database. Buffering is useful if table needs to be accessed more no. of times in a program.

1. How do I set a flag for a field in any table?
Create a char field of length 1. for example field STAS-LKENZ is Deletion Indicator. It means that if the value in the field is 'X' then that record has been deleted.

2. Can I execute user exits? If yes, how?
Yes you can. after finding the user exit, you need to use, goto CMOD add ur user-exit to your project. Then activate the FM which you require. Now go into that function module there will be a Include program wit name ZX* . Double click on it, it will ask to create an object, answer it Yes and then write your code in it.

3. How do I find the output type of a table or a program?
Table TNAPR / NAST

4. How to execute a program step by step on the ABAP editor?

First test your code with '/h' type in command window which shall take you to debug or by putting break points with F8. You test your program from code and then go to se30 performance analysis transaction and there you can know what are the drawbacks. Then go to SLIN transaction and do extended syntax check or from code in menu options where you have debugging -> extended check and the program id ready without error.

Tips by : Harichand Chandunair

Testing your code.

As mentioned above after doing syntax check and extended syntax check you have to create a TEST PLAN. You have to test all possible Postive & Negative test cases.

Test for division by zero if it involves calculation or code accordingly.

Try to test for field overflows. If it involves sap script or smart forms try to print outputs which have single page and also multiple page and which does not have any output at all.

Test by leaving all parameters in selection screen blank.

Test by entering wrong values in selection screen and display a pop-up if the user enters wrong selection screen values.

You can also do ABAP trace and SQL trace to make sure that your program is efficient.

Debugging code/program.

As mentioned above type /h in command line and try to execute the program. Another way is to set break-point at the function module or the required line and do single step execute or execute. Once you finished debugging, you can select Delete to clear all the break points.


5) What are dml statements in sap?

Ans: Insert, Update, Delete.

What is the difference between open sql & native sql?

Ans: Open SQL allows you to access all database tables known to the SAP system, regardless of the database manufacturer. Sometimes, however, we may want to use database-specific SQL statements called Native SQL in your ABAP/4 program. To avoid incompatibilities between different database tables and also to make ABAP/4 programs independent of the database system in use, SAP has created a set of separate SQL statements called Open SQL. Open SQL contains a subset of standard SQL statements as well as some enhancements which are specific to SAP.

A database interface translates SAP's Open SQL statements into SQL commands specific to the database in use. Native SQL statements access the database directly

What is Primary key, foreign key ? what is primary index? secondary index?

Ans: Primary index: the primary index contains key fiels of a table and a pointer to non-key fields of the table. The primary index is created automatically when a table is created in database and moreover you can further define reference to the primary index which are known as Secondary index.

How many indexes can be created for a table?

Ans: 9.

What is data class?

Ans: The data class specifies in which table space the table is created in database.

Give few names of cluster tables in sap?

Ans: sorry i dont know

Give few names of pooled tables in sap?

Ans: A pool table has many to one relation with the table in the database. For one table in the database there are many tables in the dictionary. Tha table in the database has a diff name than in the table in the data dict, it has diff no of fields and field names are different. A pooled table is stored in the pool at the database level. A table pool is a databse table with a special struct that enables the data of many R3 tables to be stored in it. It can hold only pooled tables.
Sorry I dont know table names

Give few names of transparent tables?

Ans: A transparent table has a one to one relataionship in the database. The table in the dictionary has the same name, same no of fields, and the fields have the same name as in the R3 table defn. A transparent tabel has application data (Master and Transaction). sorry i dont know table names

What is a buffer and how many types?

Ans: Buffer is othing but which stores data temporarily. there are two types of buffers. they are Roll and Page areas.
Pages : it stores the application data.
Roll area: it stores the data of previous pages.Data areas of used programs are created in roll areas for each internal session.

What is table maintenance generator and how to create that? What is the transaction code?

Ans: Table maintanence generator is nothing but making a table available for adding records and deleting records.
The transaction code used is SM30.

How to add new fields to a standard sap table?

Ans: 1. Appended structures 2. Customizing tables

What are lock objects?

Ans: Lock objects are nothing but which holds a data for particular field value until you remove a lock..

Diff betwn inner & outer join?

Ans:

What is the use of start-of-selection event?

Ans: Start-of-selection is called implicity even it is not used in the program. start-of-selection is triggered after the standard selection screen has been displayed.

What is the difference between end-of-page and end-of-selection?

Ans: End-of-page : is footer of the page. End-of-selection: is triggered At the end of the processing block.

If you write a write statement after end-of-selection, will that be triggered?

Ans: Yes

How to create a button in selection screen?

Ans: Using parametres

How to add a gui status in a selection screen?

Ans: sorry i dont know i thik using set pf.

How to create a check box/option button in a list?

Ans:

For this...

Create an Internal table as :

data: Begin itab occurs 0,
cb_field type char1,
matnr like mara-matnr,
.....
end of itab.

Now you fetch the data into the internal table of itab using
some query...

select * ......

Now you are going to display it as....

Loop at itab.
write:/ cb_field as checkbox...
......
at this time only write the Hide statement.... as...

HIDE: values.... u want...

Endloop..

Now capturing of selected data process...

This can be done by clicking on some USER Command button...

for suppose you're clicking F8 means...

AT pf8.
IF SY-LSIND = 1.
describe table itab lines VARIABLE NAME.
cnt = 3. " Initiate value for Count 3 if you're including page header.
do VARIABLE NAME times.
read line cnt. " Above counter....
if sy-lisel(1) = 'X'.
WRITE:/ 'SELECTED RECORDS:', itab-cb_field,.....
endif.
COUNTER = COUNTER - 1.
cnt = cnt + 1.
enddo.
ENDIF.

Can you call a bdc program from a report? how?

Ans: Yes through Submit and return

Can you call a transaction from a report? how?

Ans: Yes Using Call transaction and leave to.


What are ALV reports? how they are different from normal reports?
Ans: these reports are used to find subtotals and totals in a report. If you want i'll give you an example program

What are the main events that are used in an ALV report?
Ans: sorry i dont know

What is the use of SLIS type pool in alv reports?

Ans: Slis type pool is a global defination of pooltypes of catalog structure, table and layout which we use in ALV reports

Difference between top-of-page and top-of-page during at-line- selection?

Ans: Top-of-page is a header on primary list. Top-of-page during line-selection is a header on secondary lists

In an interactive report, after going to 5th list, can you come back to 2nd list? how?

How many type of internal tables are there?

Ans: Standard, Hashed, Sorted tables

What is the difference between hashed & sorted internal tables?

Ans: Sorted internal table works on Binary Search and Hashed internal tables works on hashed alogorthim through indexes.

What is the difference between standard and sorted internal tables? (in performance wise)

Ans: Sorted table improve the performance in case of a huge table which has no: of records

What is the use of at new statement?

Ans:sorry i dont know

When do you need to create an internal table with header line? and with out a header line? line?

Ans: If we don't want to use any explicit work area then its better to go for an internal table with header line.

What does it mean occurs 0 while creating an internal table?

Ans: sorry i dont know

Which of these methods can be best used in background process?

Ans : Batch Input method.

What is direct input method?

What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?

Ans: Exec Sql[Performing [Native sql statements]
endexec.
The above is the syntax for the native sql statements.

Disadvantages:

. Syntax check is not done to statements written inside the EXEC SQL statements.

What is the meaning of ABAP/4 editor integrated with ABAP/4 data dictionary?

What transactions do you use for data analysis?

ANs: Sorry i dont know but for runtime analysis we use transaction code : se30.

What are selection texts?

Ans: in the selection screen you can change the name of the field,title etc using selection texts. go to text--> text elemets---> selection texts in the menu bar to set selection texts.

What is the client concept in SAP? What is the meaning of client independent?

How to find the return code of a statement in ABAP programs?

Ans: Through functions.

What are steps you follow to improve the performance of a report?

Ans: 1) USe select fields statements (not select *)
2) Use views rather than tables
3) Don't use nested Select.

What is the role of secondary index in performance?

Ans: sorry i dont know

What is the role of ST05 in performance tuning?

Ans: SQL trace

What is the role of extended syntax check in performance tuning?

Ans: sorry i dont know

Will join conditions in sql queries affect perfomance? how?

Ans : Yes

Will sorted internal tables help in performance?

Ans: Yes

Will where conditions in a sql query help improve performance?

Ans: No Not at all

ABAP - Interview Questions 3

1. What is the typical structure of an ABAP/4 program?
HEADER ,BODY,FOOTER.

2. What are field symbols and field groups.?
Have you used "component idx of structure" clause with field groups?

Field symbols:-

Field groups :-

Can any body explain me what is field group?

Field groups are groups similar fields together into one name. Field group works in conjuction with

INSERT f1 f2 INTO fg
EXTRACT fg
SORT BY fg
LOOP ... ENDLOOP

INSERT f1 f2 INTO fg
---------------------

The insert statement is used to create a field group dynamically by inserting the field into it. Only global data fields can be inserted and not local data fields eg : in form modules.

EXTRACT fg
----------

This will combine all the fields in the fieldgroup and write them to a sequential dataset as a single record.

SORT BY fg
----------

Sorting of sequential dataset by field group.

LOOP AND ENDLOOP
---------------

LOOP.
AT ***
......
....
ENDAT.
AT ***
.....
....
ENDAT.
ENDLOOP. *-- Chinmaya

3. What should be the approach for writing a BDC program?
ANS:-
STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILE to internal table CALLED "CONVERSION".
STEP 2: TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED "SAP DATA TRANSFER".
STEP 3: DEPENDING UPON THE BDC TYPE i)call transaction(Write the program explicity)
ii) create sessions (sessions are created and processed.if success data will transfer).

4. What is a batch input session?
ANS:-
BATCH INPUT SESSION is an intermediate step between internal table and database table.
Data along with the action is stored in session ie data for screen fields, to which screen it is passed,program name behind it, and how next screen is processed.

5. What is the alternative to batch input session?
ANS:-
Call transaction.

6. A situation: An ABAP program creates a batch input session.
We need to submit the program and the batch session in back ground. How to do it?
ANS:-
go to SM36 and create background job by giving
job name,job class and job steps (JOB SCHEDULING)

8. What are the problems in processing batch input sessions?
How is batch input process different from processing online?
ANS:-
PROBLEMS:-
i) If the user forgets to opt for keep session then the session will be automatically removed from the session queue(log remains). However if session is processed we may delete it manually.
ii)if session processing fails data will not be transferred to SAP database table.

10. What are the different types of data dictionary objects?
ans:-
tables, structures, views, domains, data elements, lock objects, Matchcode objects.

11. How many types of tables exists and what are they in data dictionary?
ans :-
4 types of tables
i)Transparent tables - Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. Both Opensql and Nativesql can be used.

ii)Pool tables & iii)Cluster tables -
These are logical tables that are arranged as records of transparent tables.one cannot use native sql on these tables
(only opensql).They are not managable directly using database system tools.

iv)Internal tables - .

12. What is the step by step process to create a table in data dictionary?
ans:-
step 1: creating domains(data type,field length,range).
step 2: creating data elements(properties and type for a table
field).
step 3: creating tables(SE11).

13. Can a transparent table exist in data dictionary but not in the data base physically?
ANS:- NO.
TRANSPARENT TABLE DO EXIST WITH THE SAME STRUCTURE BOTH IN THE DICTIONARY AS WELL AS IN THE DATABASE,EXACTLY WITH THE SAME DATA AND FIELDS.

14. What are the domains and data elements?
ANS:-
DOMAINS : FORMAL DEFINITION OF THE DATA TYPES.THEY SET ATTRIBUTES SUCH AS DATA TYPE,LENGTH,RANGE.
DATA ELEMENT : A FIELD IN R/3 SYSTEM IS A DATA ELEMENT.

15. Can you create a table with fields not referring to data elements?
ANS:-
YES. eg:- ITAB LIKE SPFLI.here we are referening to a data object(SPFLI) not data element.

16. What is the advantage of structures? How do you use them in the ABAP programs?
ANS:-
Adv:- GLOBAL EXISTANCE(these could be used by any other program without creating it again).

17. What does an extract statement do in the ABAP program?
ANS:-
Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
EXTRACT .

When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset

EXTRACT HEADER.

When you extract the data, the record is filled with the current values of the corresponding fields.

As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.

By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.

18. What is a collect statement? How is it different from append?
ANS:-
If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.

19. What is open sql vs native sql?
ANS:- by Madhukar
Open SQL , native SQL are the interfaces to create the database applicatons.
Open SQL is consistant across different types of existing Databases.
Native SQL is the database language specific to database.Its API is specific to the databse.
Open SQL API is consistent across all vendors

20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
ANS:-

21. What is the meaning of ABAP/4 editor integrated with ABAP/4 data dictionary?
ANS:-

22. What are the events in ABAP/4 language?
ANS:-
Initialization, At selection-screen,Start-of-selection,end-of-selection,top-of-page,end-of-page, At line-selection,At user-command,At PF,Get,At New,At LAST,AT END, AT FIRST.

23. What is an interactive report?
What is the obvious diff of such report compared with classical type reports?
ANS:-
An Interactive report is a dynamic drill down report that produces the list on users choice.
diff:-
a) THE LIST PRODUCED BY CLASSICAL REPORT DOESN'T allow user to interact with the system
the list produced by interactive report allows the user to interact with the system.
b) ONCE A CLASSICAL REPORT EXECUTED USER LOOSES CONTROL.IR USER HAS CONTROL.
c) IN CLASSICAL REPORT DRILLING IS NOT POSSIBLE.IN INTERACTIVE DRILLING IS POSSIBLE.

24. What is a drill down report?
ANS:-
Its an Interactive report where in the user can get more relavent data by selecting explicitly.

25. How do you write a function module in SAP? describe.
ANS:-
creating function module:-
called program - se37-creating funcgrp,funcmodule by assigning attributes,importing,exporting,tables,exceptions.
calling program - SE38-in pgm click pattern and write function name- provide export,import,tables,exception values.

26. What are the exceptions in function module?
ANS:-
COMMUNICATION_FAILURE
SYSTEM_FAILURE

27. What is a function group?
ANS:-
GROUP OF ALL RELATED FUNCTIONS.

28. How are the date and time field values stored in SAP?
ANS:-
DD.MM.YYYY. HH:MM:SS

30. Name a few data dictionary objects? //rep//
ANS:-
TABLES,VIEWS,STRUCTURES,LOCK OBJECTS,MATCHCODE OBJECTS.

31. What happens when a table is activated in DD?
ANS:-
It is available for any insertion,modification and updation of records by any user.

32. What is a check table and what is a value table?
Check table will be at field level checking.
Value table will be at domain level checking ex: scarr table is check table for carrid.

33. What are match codes? describe?
ans:-
It is a similar to table index that gives list of possible values for either primary keys or non-primary keys.

34. What transactions do you use for data analysis?
ANS:-

35. What is table maintenance generator?
ANS:-

36. What are ranges? What are number ranges?
ANS:-
max,min values provided in selection screens.

37. What are select options and what is the diff from parameters?
ANS:-
select options provide ranges where as parameters do not.

SELECT-OPTIONS declares an internal table which is automatically filled with values or ranges
of values entered by the end user. For each SELECT-OPTIONS , the system creates a selection table.

SELECT-OPTIONS FOR .

A selection table is an internal table with fields SIGN, OPTION, LOW and HIGH.
The type of LOW and HIGH is the same as that of .
The SIGN field can take the following values: I Inclusive (should apply) E Exclusive (should not apply)
The OPTION field can take the following values: EQ Equal GT Greater than NE Not equal BT Between LE Less
than or equal NB Not between LT Less than CP Contains pattern GE Greater than or equal NP No pattern.
diff:-
PARAMETERS allow users to enter a single value into an internal field within a report.
SELECT-OPTIONS allow users to fill an internal table with a range of values.

For each PARAMETERS or SELECT-OPTIONS statement you should define text elements by choosing
Goto - Text elements - Selection texts - Change.

Eg:- Parameters name(30).
when the user executes the ABAP/4 program,an input field for 'name' will appear on the selection screen.You can change the comments on the left side of the input fields by using text elements as described in Selection Texts.

38. How do you validate the selection criteria of a report?
And how do you display initial values in a selection screen?
ANS:-
validate :- by using match code objects.
display :- Parameters default 'xxx'.
select-options for spfli-carrid.

39. What are selection texts?
ANS:-

40. What is CTS and what do you know about it?
ANS:-

The Change and Transport System (CTS) is a tool that helps you to organize development projects in the ABAP Workbench and in Customizing, and then transport the changes between the SAP Systems and clients in your system landscape.
This documentation provides you with an overview of how to manage changes with the CTS and essential information on setting up your system and client landscape and deciding on a transport strategy. Read and follow this documentation when planning your development project.
For practical information on working with the Change and Transport System, see Change and Transport Organizer and Transport Management System.

41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?
ANS:-

42. What is the client concept in SAP? What is the meaning of client independent?
ANS:-

43. Are programs client dependent?
ANS:-
Yes.Group of users can access these programs with a client no.

44. Name a few system global variables you can use in ABAP programs?
ANS:-
SY-SUBRC,SY-DBCNT,SY-LILLI,SY-DATUM,SY-UZEIT,SY-UCOMM,SY-TABIX.....
SY-LILLI IS ABSOLUTE NO OF LINES FROM WHICH THE EVENT WAS TRIGGERED.

45. What are internal tables? How do you get the number of lines in an internal table?
How to use a specific number occurs statement?
ANS:-
i)It is a standard data type object which exists only during the runtime of the program.
They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
ii)using SY-DBCNT.
iii)The number of memory allocations the system need to allocate for the next record population.

46. How do you take care of performance issues in your ABAP programs?
Performance of ABAPs can be improved by minimizing the amount of data to be transferred.
The data set must be transferred through the network to the applications, so reducing the amount OF time and also reduces the network traffic.

Some measures that can be taken are:

- Use views defined in the ABAP/4 DDIC (also has the advantage of better reusability).
- Use field list (SELECT clause) rather than SELECT *.
- Range tables should be avoided (IN operator)
- Avoid nested SELECTS.

i)system tools

ii)field symbols and field groups.
ans:-
Field Symbols : Field symbols are placeholders for existing fields. A Field Symbol does not physically reserve space for a field,but points to a field which is not known until runtime of the program.
eg:- FIELD-SYMBOL [].

Field groups : A field group combines several fields under one name.At runtime,the INSERT command is used to define which data fields are assigned to which field group.
There should always be a HEADER field group that defines how the extracted data will be sorted,the data is sorted by the fields grouped under the HEADER field group.

47. What are datasets?
ANS:-
The sequential files(ON APPLICATION SERVER) are called datasets. They are used for file handling in SAP.

48. How to find the return code of a statement in ABAP programs?
ANS:-
Using function modules.

49. What are interface/conversion programs in SAP?
ANS :
CONVERSION : LEGACY SYSTEM TO FLAT FILE.
INTERFACE : FLAT FILE TO SAP SYSTEM.


51. What are the techniques involved in using SAP supplied programs?
Do you prefer to write your own programs to load master data? Why?

52. What are logical databases? What are the advantages/disadvantages of logical databases?
ANS:-
To read data from a database tables we use logical database.
A logical database provides read-only access to a group of related tables to an ABAP/4 program.

adv:-
The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
i)An easy-to-use standard user interface.
ii)check functions which check that user input is complete,correct,and plausible.
iii)meaningful data selection.
iv)central authorization checks for database accesses.
v)good read access performance while retaining the hierarchical data view determined by the application logic.

disadv:-
i)If you donot specify a logical database in the program attributes,the GET events never occur.
ii)There is no ENDGET command,so the code block associated with an event ends with the next event
statement (such as another GET or an END-OF-SELECTION).

53. What specific statements do you using when writing a drill down report?
ans:-
AT LINE-SELECTION,AT USER-COMMAND,AT PF.

54. What are different tools to report data in SAP? What all have you used?
ans:-

55. What are the advantages and disadvantages of ABAP/4 query tool?

56. What are the functional areas? User groups? and how does ABAP/4 query work in relation to these?

57. Is a logical database a requirement/must to write an ABAP/4 query?

59. What are Change header/detail tables? Have you used them?

60. What do you do when the system crashes in the middle of a BDC batch session?
ans:-
we will look into the error log file (SM35).

61. What do you do with errors in BDC batch sessions?
ANS:-
We look into the list of incorrect session and process it again. To correct incorrect session we analyize the session to determine which screen and value produced the error.For small errors in data we correct them interactively otherwise
modify batch input program that has generated the session or many times even the datafile.

62. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
ans:-
go to SM36 and create background job by giving job name,job class and job steps(JOB SCHEDULING)

63. Is it possible to run host command from SAP environment? How do you run?

64. What kind of financial periods exist in SAP? What is the relavent table for that?

65. Does SAP handle multiple currencies? Multiple languages?
ans:-
Yes.

66. What is a currency factoring technique?

67. How do you document ABAP/4 programs? Do you use program documentation menu option?

68. What is SAPscript and layout set?
ans:-
The tool which is used to create layout set is called SAPscript. Layout set is a design document.

69. What are the ABAP/4 commands that link to a layout set?
ans:-
control commands,system commands,

70. What is output determination?

71. What are IDOCs?
ans:-
IDOCs are intermediate documents to hold the messages as a container.

72. What are screen painter? menu painter? Gui status? ..etc.
ans:-
dynpro - flow logic + screens.
menu painter -
GUI Status - It is subset of the interface elements(title bar,menu bar,standard tool bar,push buttons) used for a certain screen.
The status comprises those elements that are currently needed by the transaction.

73. What is screen flow logic? What are the sections in it? Explain PAI and PBO.
ans:-
The control statements that control the screen flow.
PBO - This event is triggered before the screen is displayed.
PAI - This event is responsible for processing of screen after the user enters the data and clicks the pushbutton.

74. Overall how do you write transaction programs in SAP?
ans:-
Create program-SE93-create transcode-Run it from command field.

75. Does SAP has a GUI screen painter or not? If yes what operating systems is it available on? What is the other type of screen painter called?

76. What are step loops? How do you program pagedown pageup in step loops?
ans:-
step loops are repeated blocks of field in a screen.

77. Is ABAP a GUI language?
ANS:-
Yes.
ABAP IS AN EVENT DRIVEN LANGUAGE.

78. Normally how many and what files get created when a transaction program is written?
What is the XXXXXTOP program?
ans:-
ABAP/4 program.
DYNPRO

79. What are the include programs?
ANS:-
When the same sequence of statements in several programs are to be written repeadly they are coded in include programs (External programs) and are included in ABAP/4 programs.

80. Can you call a subroutine of one program from another program?
ans:- Yes- only external subroutines Using 'SUBMIT' statement.

81. What are user exits? What is involved in writing them? What precations are needed?

82. What are RFCs? How do you write RFCs on SAP side?

83. What are the general naming conventions of ABAP programs?
ANS:-
Should start with Y or Z.

84. How do you find if a logical database exists for your program requrements?
ans:-
SLDB-F4.

85. How do you find the tables to report from when the user just tell you the transaction he uses? And all the underlying data is from SAP structures?
ans:-
Transcode is entered in command field to open the table.Utilities-Table contents-display.

86. How do you find the menu path for a given transaction in SAP?
ans:-

87. What are the different modules of SAP?
ans:-
FI,CO,SD,MM,PP,HR.

89. How do you get help in ABAP?
ans:-
HELP-SAP LIBRARY,by pressing F1 on a keyword.

90. What are different ABAP/4 editors? What are the differences?
ans:-

91. What are the different elements in layout sets?
ans:-
PAGES,Page windows,Header,Paragraph,Character String,Windows.

92. Can you use if then else, perform ..etc statements in sap script?
ans:-
yes.

93. What type of variables normally used in sap script to output data?

94. How do you number pages in sapscript layout outputs?

95. What takes most time in SAP script programming?
ANS:-
LAYOUT DESIGN AND LOGO INSERTION.

96. How do you use tab sets in layout sets?

97. How do you backup sapscript layout sets? Can you download and upload? How?

98. What are presentation and application servers in SAP?
ANS:-
The application layer of an R/3 System is made up of the application servers and the message server. Application programs in an R/3 System are run on application servers. The application servers communicate with the presentation components, the database, and also with each other, using the message server.

99. In an ABAP/4 program how do you access data that exists on a presentation server vs on an application server?
ans:-
i)using loop statements.
ii)flat

100. What are different data types in ABAP/4?
ans:-
Elementary -
predefined C,D,F,I,N,P,T,X.
userdefined TYPES.
ex: see in intel book page no 35/65

Structured -
predefined TABLES.
userdefined Field Strings and internal tables.

101. What is difference between session method and Call Transaction?
ans:-

102. Setting up a BDC program where you find information from?
ans:-

103. What has to be done to the packed fields before submitting to a BDC session.
ans:-
fields converted into character type.

104. What is the structure of a BDC sessions.
ans:-
BDCDATA (standard structure).

105. What are the fields in a BDC_Tab Table.
ans:-
program,dynpro,dynbegin,fnam,fval.

106. What do you define in the domain and data element.
Technical details like

107. What is the difference between a pool table and a transparent table and how they are stored at the database level.
ans:-
ii)Pool tables is a logical representation of transparent tables .Hence no existence at database level. Where as transparent tables are physical tables and exist at database level.

108. What is cardinality?
For cardinality one out of two (domain or data element) should be the same for Ztest1 and Ztest2 tables. M:N
Cardinality specifies the number of dependent(Target) and independent (source) entities which can be in a relationship.


Sunday, May 25, 2008

TRANSACTION CODES - OTHERS

Config Related

OLEOLE demo transaction

OLI0C Plant Maintenance Master Data

OLI1Set Up INVCO for Material Movements

OLI8Set Up SIS for Deliveries

OLIAC Maintenance Processing

OLIPC Plant Maintenance Planning

OLIQNew set-up of QM info system

OLIXSet Up Copying/Deleting of Versions

OLIYSet Up Deletion of SIS/Inter.Storage

OLIZStat Set Up INVCO: Invoice Verif

OLM2Customizing: Volume-Based Rebates

OLMBC RM-MAT Inventory Management Menu

OLMDC RM-MAT MRP Menu

OLMEC MM Menu: Purchasing

OLMLC MM Menu for Warehouse Management

OLMRC RM-MAT Menu: Invoice Verification

OLMSC RM-MAT Master Data Menu

OLMWC RM-MAT Valuation/Acct. Assgt. Menu

OLPASOP Configuration

OLPESales order value

OLPKCustomizing for capacity planning

OLPRProject System Options

OLPSCustomizing Basic Data

OLPVCustomizing: Std. Value Calculation

OLQBC QM QM in Procurement

OLQIAnalysis

OLQMCustomizing QM Quality Notifications

OLQSC QM Menu Basic Data

OLQWC QM Inspection Management

OLQZQuality Certificates

OLS1Customizing for Rebates

OLSDCustomizing: SD

OLVAC SD Sales Menu

OLVDC SD Shipping Menu

OLVFC SD Billing Menu

OLVSC SD Menu for Master Data

SPROStart SAP IMG (Implementation Guide). (from john.omeara@syskoplan.ie)

TRANSACTION CODES - MM configuration transactions

OLMB-Inventory management/Physical Inventory

OLMD-MM Consumption-Based Planning

OLME-MM Purchasing

OLML-Warehouse Management

OLMR-Invoice Verification

OLMSMaterial Master data

OLMW-MM Valuation/Account Assignment

TRANSACTION CODES - Material Management (MM)

MM06Flag material for deletion. (from john.omeara@syskoplan.ie)

OLMS-materials management configuration menu, most of the stuff under this menu is not under the implementation guide

TRANSACTION CODES - FI Financial Management

FGRPReport Writer screen

FM12View blocked documents by user

FST2Insert language specific name for G/L account. (from john.omeara@syskoplan.ie)

FST3Display G/L account name. (from john.omeara@syskoplan.ie)

KEA0Maintain operating concern. (from john.omeara@syskoplan.ie)

KEKEActivate CO-PA. (from john.omeara@syskoplan.ie)

KEKKAssign operating concern. (from john.omeara@syskoplan.ie)

KL04Delete activity type. (from john.omeara@syskoplan.ie)

KS04Delete a cost centre. (from john.omeara@syskoplan.ie)

KSH2Change cost centre group - delete. (from john.omeara@syskoplan.ie)

OBR2Deletion program for customers, vendors, G/L accounts. (from john.omeara@syskoplan.ie)

OKC5Cost element/cost element group deletion. (from john.omeara@syskoplan.ie)

OKE1Delete transaction data. (from john.omeara@syskoplan.ie)

OKE2Delete a profit centre. (from john.omeara@syskoplan.ie)

OKI1Determine Activity Number: Activity Types (Assignment of material number/service to activity type) (from john.omeara@syskoplan.ie)

OMZ1Definition of partner roles. (from john.omeara@syskoplan.ie)

OMZ2Language dependent key reassignment for partner roles. (from john.omeara@syskoplan.ie)

TRANSACTION CODES - SAP OFFICE

SO00 send a note through SAP, can be sent to internet, X400, etc

TRANSACTION CODES - Sales and Distribution (SD)

OLSDConfig for SD. Use Tools-Data Transfer-Conditions to setup SAP supplied BDC to load pricing data

VA01Create Sales/Returns Order:Initial Screen

VB21Transaction for Volume Lease Purchases (done as a sales deal)

VK15Transaction used to enter multiple sales conditions (most will be entered here)

TRANSACTION CODES - Human Resources (HR)

PA03Change Payroll control record

PA20Display PA Infotypes

PA30Create/Change PA Infotypes

PP02Quick Entry for PD object creation

PU00Delete PA infotypes for an employee. Will not be able to delete an infotype if there is cluster data assigned to the employee.

TRANSACTION CODES - Basis / ABAP

You can execute the following commands in the transaction code (tcode) field with Enter. You will find some useful transaction codes below to work in tandem with the following commands:

To call a transaction - In the same session (window) Enter: /nxxxx (xxxx = transaction code). - In an additional session, Enter: /oxxxx (xxxx = transaction code).

If you enter this function before any of the tcodes below, you are able to break out of your current screen/business and begin a completely new session. Otherwise, the current business process has to be terminated, and return to the initial user screen (the main menu) has to be initiated before entering tcode spro). /o tcode saves you the effort of having to do this.

To end the current transaction Enter: /n. Caution: Unsaved changes are lost without warning

To delete the current session. Enter: /i.

To generate a session list Enter: /o.

To log off from the system Enter: /nend.

From John O'Meara

OSS Note 0026171 has additional information on OKCodes in SAP, and is a very useful read

BASIS/ABAP

USMMPressing F8 will display all hotpacks applied.

SEARCH_SAP_MENU Show the menu path to use to execute a given tcode. You can search by transaction code or menu text.

DI02ABAP/4 Repository Information System: Tables.

LSMWLegacy System Migration Workbench. An addon available from SAP that can make data converstion a lot easier. Thanks to Serge Desland for this one.

OSS1SAP Online Service System

OY19Compare Tables

SM13Update monitor. Will show update tasks status. Very useful to determine why an update failed.

S001ABAP Development Workbench

S001ABAP/4 Development Weorkbench. (from john.omeara@syskoplan.ie)

S002System Administration. (from john.omeara@syskoplan.ie)

SA38Execute a program. (from john.omeara@syskoplan.ie)

SCATComputer Aided Test Tool

SCU0Compare Tables

SE01Old Transport & Corrections screen

SE03Groups together most of the tools that you need for doing transports. In total, more than 20 tools can be reached from this one transaction.

SE09Workbench Organizer

SE10New Transport & Correction screen

SE11ABAP/4 Dictionary Maintenance SE12 ABAP/4 Dictionary Display SE13 Maintain Technical Settings (Tables)

SE12Dictionary: Initial Screen - enter object name. (from john.omeara@syskoplan.ie)

SE13Access tables in ABAP/4 Dictionary. (from john.omeara@syskoplan.ie)

SE14Utilities for Dictionary Tables

SE15ABAP/4 Repository Information System

SE16Data Browser: Initial Screen. (from john.omeara@syskoplan.ie)

SE16NTable Browser (the N stands for New, it replaces SE16). Provided by Smijo Mathew.

SE17General Table Display

SE24Class Builder

SE30ABAP/4 Runtime Analysis

SE32ABAP/4 Text Element Maintenance

SE35ABAP/4 Dialog Modules

SE36ABAP/4: Logical Databases

SE37ABAP/4 Function Modules

SE38ABAP Editor

SE39Splitscreen Editor: Program Compare

SE41Menu Painter

SE43Maintain Area Menu

SE48Show program call hierarchy. Very useful to see the overall structure of a program. Thanks to Isabelle Arickx for this tcode.

SE49Table manipulation. Show what tables are behind a transaction code. Thanks to Isabelle Arickx for this tcode.

SE51Screen Painter: Initial Screen. (from john.omeara@syskoplan.ie)

SE54Generate View Maintenance Module

SE61R/3 Documentation

SE62Industry utilities

SE63Translation

SE64Terminology

SE65R/3 document. short text statistics SE66 R/3 Documentation Statistics (Test!)

SE68Translation Administration

SE71SAPscript layout set

SE71SAPScript Layouts Create/Change

SE72SAPscript styles

SE73SAPscript font maintenance (revised)

SE74SAPscript format conversion

SE75SAPscript Settings

SE76SAPscript Translation Layout Sets

SE77SAPscript Translation Styles

SE80ABAP/4 Development Workbench

SE81SAP Application Hierarchy

SE82Customer Application Hierarchy

SE83Reuse Library. Provided by Smiho Mathew.

SE84ABAP/4 Repository Information System

SE85ABAP/4 Dictionary Information System

SE86ABAP/4 Repository Information System

SE87Data Modeler Information System

SE88Development Coordination Info System

SE91Maintain Messages

SE92Maintain system log messages

SE93Maintain Transaction. (from john.omeara@syskoplan.ie)

SEARCH_SAP_MENUFrom the SAP Easy Access screen, type it in the command field and you will be able to search the standard SAP menu for transaction codes / keywords. It will return the nodes to follow for you.

SEUObject Browser

SHD0Transaction variant maintenance

SM04Overview of Users (cancel/delete sessions)

SM12Lock table entries (unlock locked tables)

SM21View the system log, very useful when you get a short dump. Provides much more info than short dump

SM30Maintain Table Views. (from john.omeara@syskoplan.ie)

SM31Table Maintenance

SM32Table maintenance

SM35View Batch Input Sessions

SM37View background jobs

SM50Process Overview. (from john.omeara@syskoplan.ie)

SM51Delete jobs from system (BDC)

SM62Display/Maintain events in SAP, also use function BP_EVENT_RAISE

SMENDisplay the menu path to get to a transaction

SMOD/CMODTransactions for processing/editing/activating new customer enhancements.

SNROObject browser for number range maintenance. (from john.omeara@syskoplan.ie)

SPROStart SAP IMG (Implementation Guide). (from john.omeara@syskoplan.ie)

SQ00ABAP/4 Query: Start Queries

SQ01ABAP/4 Query: Maintain Queries

SQ02ABAP/4 Query: Maintain Funct. Areas

SQ03ABAP/4 Query: Maintain User Groups

SQ07ABAP/4 Query: Language Comparison

ST05Trace SQL Database Requests. (from john.omeara@syskoplan.ie)

ST22ABAP Dump analysis

SU53Display Authorization Values for User. (from john.omeara@syskoplan.ie)

WEDIEDI Menu. IDOC and EDI base.

WE02Display an IDOC

WE07IDOC Statistics

TRANSACTION CODES - Production Planning (PP)

C001 Create Production Order
C005N Collective Release
C011N Time Ticket
C012 Confirmation - Collective
C013 Confirmation - Cancel
C00IS Production order information system
C0GI Reprocess Goods Movements
C223 Maintain production version

TRANSACTION CODES - Plant Maintenance (PM)

IW31 Create Plant Maintenance Order
IW32 Change Plant Maintenance Order
IW33 Display Plant Maintenance Order
IW34 Create Notification Order
IW51 Create Service Notification
IW52 Change Service Notification
IW53 Display Service Notification
IW54 Create Service Notification :Problem notification
IW55 Create Service Notification :Activity Request
IW56 Create Service Notification :Service Request
IW57 Assign deletion Flag to Completed Service Notifications
IW58 Change Service Notifications: Selection of Notification
IW59 Display Service Notifications: Selection of Notification

ABAP - Interview Questions - 2

1. What is an ABAP data dictionary?

ABAP 4 data dictionary describes the logical structures of the objects used in application development and shows how they are mapped to the underlying relational database in tables/views.

2. What are domains and data element?

Domains:Domain is the central object for describing the technical characteristics of an attribute of an business objects. It describes the value range of the field. Data Element: It is used to describe the semantic definition of the table fields like description the field. Data element describes how a field can be displayed to end-user.

3. What is foreign key relationship?

A relationship which can be defined between tables and must be explicitly defined at field level. Foreign keys are used to ensure the consistency of data. Data entered should be checked against existing data to ensure that there are now contradiction. While defining foreign key relationship cardinality has to be specified. Cardinality mentions how many dependent records or how referenced records are possible.

4. Describe data classes.

Master data: It is the data which is seldomly changed. Transaction data: It is the data which is often changed. Organization data: It is a customizing data which is entered in the system when the system is configured and is then rarely changed. System data:It is the data which R/3 system needs for itself.

5. What are indexes?

Indexes are described as a copy of a database table reduced to specific fields. This data exists in sorted form. This sorting form ease fast access to the field of the tables. In order that other fields are also read, a pointer to the associated record of the actual table are included in the index. Yhe indexes are activated along with the table and are created automatically with it in the database.

6. Difference between transparent tables and pooled tables

Transparent tables: Transparent tables in the dictionary has a one-to-one relation with the table in database. Its structure corresponds to single database field. Table in the database has the same name as in the dictionary. Transparent table holds application data. Pooled tables. Pooled tables in the dictionary has a many-to-one relation with the table in database. Table in the database has the different name as in the dictionary. Pooled table are stored in table pool at the database level.

Thursday, May 15, 2008

SAP System - Fields

ABCDE

Constant: Alphabet (A,B,C,...)

APPLI

SAP applications

BATCH

Background active (X)

IF SY-BATCH EQ SPACE.

WRITE: / 'Report was started on-line'.

WRITE: / 'Using variant:', SY-SLSET.

ELSE.

WRITE: / 'Report was started in background'.

ENDIF.

BATZD

Background SUBMIT: Daily

BATZM

Background SUBMIT: Monthly

BATZO

Background SUBMIT: Once

BATZS

Background SUBMIT: Immediately

BATZW

Background SUBMIT: Weekly

BINPT

Batch input active (X)

This field indicates if the transaction was called in a Batch Input session or by an online user. To test it, a batch input session must be created. From Release 3.1g the next procedure can be used.

o Create a report which displays this system field

o Create a Transaction code for this report

o Use transaction SHDB to record a the previous transaction

o Press the Overview button and choose the 'generate program' function.

o Running the previously generated program it will create a Batch Input session

o Now call transaction SM35 and process the created Batch Input in foreground. It should display an 'X' for system field SY-BINPT.

BREP4

Background SUBMIT: Root name of request report

BSPLD

Background SUBMIT: List output to spool

CALLD

CALL mode active (X)

This field indicates if the transaction was called from another transaction.

o Create a report which displays this system field

o Create a Transaction code for this report

o Create a new report containing the next ABAP command: CALL TRANSACTION tcode. Where tcode is the Transaction code you created. When you run this report, it should display an 'X' for system field SY-CALLD.

CALLR

Print: ID for print dialog function

CCURS

Rate specification/result field (CURRENCY CONVERT)

CCURT

Table rate from currency conversion

CDATE

Date of rate from currency conversion

COLNO

Current column during list creation

WRITE: SY-COLNO, ',', SY-LINNO, 'Cursor position (column, row).'.

CPAGE

Current page number

WRITE: / 'SY-CPAGE:', SY-CPAGE LEFT-JUSTIFIED.

CPROG

Runtime: Main program

WRITE: /5 'Main program:' RIGHT-JUSTIFIED, 40 SY-CPROG.

CTABL

Exchange rate table from currency conversion

CTYPE

Exchange rate type 'M','B','G' from CURRENCY CONVERSION

CUCOL

Cursor position (column)

WRITE: / 'SY-CUCOL:', SY-CUCOL LEFT-JUSTIFIED.

CUROW

Cursor position (line)

WRITE: / 'SY-CUROW:', SY-CUROW LEFT-JUSTIFIED.

DATAR

Flag: Data received

In transaction programming this field indicates the change of data on the screen. In the PBO part you may set default values of the input fields of the dynpro. In the PAI part you can check if they were changed. If SY-DATAR is set, then the user has modified or entered new data on the screen.

DATLO

Local date for user

DATUM

System: Date

DATUT

Global date related to UTC (GMT)

DAYST

Summertime active ? ('daylight saving time')

DBCNT

Number of elements in edited dataset with DB operations

WRITE: /12 'Number of selected records:', SY-DBCNT CENTERED.

DBNAM

Logical database for ABAP/4 program

DBSYS

System: Database system

DCSYS

System: Dialog system

DSNAM

Runtime: Name of dataset for spool output

DYNGR

Screen group of current screen

DYNNR

Number of current screen

FDAYW

Factory calendar weekday

FDPOS

Location of a string

SEARCH T FOR 're'.

READ TABLE T INDEX SY-TABIX.

WRITE: / SY-TABIX, T-FIELD.

SKIP.

WRITE: /9 'At the example of sy-tabix, Row', (3) SY-TABIX, ',' ,

'keyword ''re'' found at off-set position:', (3) SY-FDPOS.

FMKEY

Current function code menu

HOST

Host

INDEX

Number of loop passes

DO 5 TIMES.

WRITE: SY-INDEX.

ENDDO.

LANGU

SAP logon language key

LDBPG

Program: ABAP/4 database program for SY-DBNAM

LILLI

Number of current list line

AT LINE-SELECTION.

DETAIL.

* SY-LSIND is the index of the current list

WRITE: / 'SY-LSIND:', SY-LSIND LEFT-JUSTIFIED.

* SY-LISTI is the index of the previous list

WRITE: / 'SY-LISTI:', SY-LISTI LEFT-JUSTIFIED.

* SY-LILLI is the number of the selected line in the absolute list

WRITE: / 'SY-LILLI:', SY-LILLI LEFT-JUSTIFIED.

LINCT

Number of list lines

WRITE: / SY-LINCT, 'line and', (3) SY-LINSZ, 'column is a page'.

LINNO

Current line for list creation

WRITE: SY-COLNO, ',', SY-LINNO, 'Cursor position (column, row).'.

LINSZ

Line size of list

WRITE: SY-COLNO, ',', SY-LINNO, 'Cursor position (column, row).'.

LISEL

Interact.: Selected line

* contents of the selected line

WRITE: / 'SY-LISEL:', SY-LISEL.

LISTI

Number of current list line

* SY-LISTI is the index of the previous list

WRITE: / 'SY-LISTI:', SY-LISTI LEFT-JUSTIFIED.

LOCDB

Local database exists

LOCOP

Local database operation

LOOPC

Number of LOOP lines at screen step loop

LSIND

Number of secondary list

* SY-LSIND is the index of the current list

WRITE: / 'SY-LSIND:', SY-LSIND LEFT-JUSTIFIED.

LSTAT

Interact.: Status information for each list level

MACDB

Program: Name of file for matchcode access

MACOL

Number of columns from SET MARGIN

MANDT

Client number from SAP logon

MARKY

Current line character for MARK

MAROW

No. of lines from SET MARGIN statement

MODNO

Number of alternative modi

MSGID

Message ID

MSGLI

Interact.: Message line (line 23)

MSGNO

Message number

MSGTY

Message type (E,I.W,...)

MSGV1

Message variable

MSGV2

Message variable

MSGV3

Message variable

MSGV4

Message variable

OPSYS

System: Operating system

PAART

Print: Format

PAGCT

Page size of list from REPORT statement

PAGNO

Runtime: Current page in list

PDEST

Print: Output device

PEXPI

Print: Spool retention period

PFKEY

Runtime: Current F key status

PLIST

Print: Name of spool request (list name)

PRABT

Print: Department on cover sheet

PRBIG

Print: Selection cover sheet

PRCOP

Print: Number of copies

PRDSN

Print: Name of spool dataset

PREFX

ABAP/4 prefix for background jobs

PRIMM

Print: Print immediately

PRNEW

Print: New spool request (list)

PRREC

Print: Recipient

PRREL

Print: Delete after printing

PRTXT

Print: Text for cover sheet

REPID

Program: Name of ABAP/4 program

RTITL

Print: Report title of program to be printed

SAPRL

System: SAP Release

SCOLS

Columns on screen

SLSET

Name of selection set

SPONO

Runtime: Spool number for list output

SPONR

Runtime: Spool number from TRANSFER statement

SROWS

Lines on screen

STACO

Interact.: List displayed from column

STARO

Interact.: Page displayed from line

STEPL

Number of LOOP line at screen step

SUBRC

Return value after specific ABAP/4 statements

SUBTY

ABAP/4: Call type for SUBMIT

SYSID

System: SAP System ID

TABIX

Runtime: Current line of an internal table

SEARCH T FOR 're'.

READ TABLE T INDEX SY-TABIX.

TCODE

Session: Current transaction code

TFDSN

Runtime: Dataset for data extracts

TFILL

Current number of entries in internal table

TIMLO

Local time for user

TIMUT

Global time related to UTC (GMT)

TITLE

Title of ABAP/4 program

TLENG

Line width of an internal table

TMAXL

Maximum number of entries in internal table (?)

TNAME

Name of internal table after an access (?)

TOCCU

OCCURS parameter with internal tables

TPAGI

Flag indicating roll-out of internal table to paging area (?)

TSTLO

Timestamp (date and time) for user

TSTUT

Timestamp (date and time) related to UTC (GMT)

TTABC

Number of line last read in an internal table (?)

TTABI

Offset of internal table in roll area (?)

TVAR0

Runtime: Text variable for ABAP/4 text elements

TVAR1

Runtime: Text variable for ABAP/4 text elements

TVAR2

Runtime: Text variable for ABAP/4 text elements

TVAR3

Runtime: Text variable for ABAP/4 text elements

TVAR4

Runtime: Text variable for ABAP/4 text elements

TVAR5

Runtime: Text variable for ABAP/4 text elements

TVAR6

Runtime: Text variable for ABAP/4 text elements

TVAR7

Runtime: Text variable for ABAP/4 text elements

TVAR8

Runtime: Text variable for ABAP/4 text elements

TVAR9

Runtime: Text variable for ABAP/4 text elements

TZONE

Time difference from 'Greenwich Mean Time' (UTC) in seconds

UCOMM

Interact.: Command field function entry

ULINE

Constant: Underline (---------...)

UNAME

Session: SAP user from SAP logon

UZEIT

System: Time

VLINE

Constant: Vertical bar

WAERS

T001: Company code currency after reading B segment

WILLI

Number of current window line

WINCO

Cursor position in window (column)

WINDI

Index of current window line

WINRO

Cursor position in window (line)

WINSL

Interact.: Selected window line

WINX1

Window coordinate (column left)

WINX2

Window coordinate (column right)

WINY1

Window coordinate (line left)

WINY2

Window coordinate (line right)

WTITL

Standard page header indicator

XCODE

Extended command field

ZONLO

Time zone of user

ABAP - Interview Questions - 1

1. Preparation of the data records by the L.D.B and reading of the data records in the actual
report are accomplished with the command pair Put and Get.

2. The three main elements of LDB are Structure, Selections, and Database Program.

3. In LDB what determines hierarchy of the tables? Structure.

4. In general what are the two ways in which one can retrieve data from tables?

Using Select statements, Database Program.

5. With LDB one can modify the pre-generated selection screen to their needs (T/F).
Yes.

6. Logical databases are programs that read data from Database tables (Dictionary Structures).

7. The event Get

LATE process all tables that are hierarchically superior to the
. (True/False)

False. It processes all tables that are hierarchically inferior to the
.

8. The Database Program of LDB is a collection of SUBROUTINES, which selects data and passes it to the report.

9. The layout of the Database program is determined by both Structure and Selections.
10. The order in which data is made available to the report depends on Structure of the LDB.

11. Apart from the structure and selections of the LDB the GET statements in the report
determines the behavior of the database at runtime.

12. Node at the highest level in the structure is known as Root.

13. There can be more than one node at the highest level in the structure. (T/F)
False.
One can define only one node at the highest level in the structure on LDB.

14. All nodes in the structure of LDB need not be defined in the ABAP/4 Dictionary (T/F).
False.

One has to define all nodes in the Dictionary or one has to select all nodes that are defined in
the Dictionary.

15. It is not possible to use ABAP/4 Dictionary Structures without an underlying database using LDB. (T/F)

True. One can use additionally related tables, along with the tables defined in the structure of LDB.

16. Dynamic selections allow the user to define further selections for database access in addition to the selection criteria already defined in the LDB selections.

17. Check statement can be used along with the event GET in the report for checking the selections, which are not table-specific values.

18. In sense of Database Management System (DBMS) LOGICAL DATABASE is a database Structure. (T/F).

False.

19. It is not necessary to maintain the Parent-Child relationship between the tables in Logical Database Structure. (T/F)

False. One has to maintain the Parent-Child relationship.

20. Is it possible to extract data from tables without using the event ‘GET’ in the report with an appropriate LDB. (T/F).

False. One can extract data from tables using Select statements in a report, though the report is having a LDB attribute.

21. What sorts of tables one can se in designing the hierarchy of a LDB?

Tables, which are having Foreign Key relations.

22. A report program, which uses only SELECT statements, is called SQL Report.

23. One cannot use SELECT statements in a report program linked to a Logical Database (T/F). False.

24. Is it true that the Logical Database reads the data from the database tables using Select Statements (T/F).

Yes. We are coding that in Database part of LDB.

25. In a report with an LDB attribute, you do not have to define how the information should be retrieved from the database tables, but only how the data should be represented on the screen. (T/F).

True.

26. One can use the event GET in a report without LDB attribute. (T/F).

False.

27. The last character of the LDB name denotes Application.

28. The structure of Logical Databases reflects the Foreign Key dependencies of hierarchical tables in the SAP system.

29. It is mandatory that for each table in the LDB hierarchy there should exist one GET statement in the report. (T/F).

False. It is not necessary.

30. What happens if a report does not contain a GET statement for a particular node of a Logical Database.

Process will transfer to the next event.

31. In a Logical Database, one can define input fields on the selection screen with Select-Options and Parameters statements.

32. Suppose a logical database program contains the following lines:

SELECT-OPTIONS CONNID FOR SPFLI-CONNID.

PARAMETERS CARRID LIKE SFLIGHT-CARRID FOR TABLE SFLIGHT.

What will be the output, for the above two statements?

Only select-options connid for spfli-carrid will be displayed on the screen.


33. Consider a report with F1S attribute, what will be the output for the following code. Whether you will get the data from spfli and sflight or not, with corresponding tables statement,

GET SPFLI.

GET SFLIGHT.

Write:/ spfli-carrid, spfli-connid, sflight-fldate, sbook-bookid.

Yes, you will get the data from spfli and sflight.

34. Consider a report with F1S attribute, what will be the output of the following code. Whether you will get the data from sbook or not, with corresponding tables statement.

GET SPFLI.

GET SFLIGHT.

Write:/ spfli-carrid, spfli-connid, sflight-fldate, sbook-bookid.

You cannot extract data from sbook.

35. Identify any errors in the following code and correct the same, and what will be the output. If there exists corresponding tables statement, for spfli, sflight, sbook.

GET SPFLI.

GET SBOOK.

Write:/ spfli-carrid, spfli-connid, sflight-fldate, sbook-bookid, sbook-class.

No syntax errors. You will get data from all the three tables.

36. Does the following two statements do the same task? If so which one takes less time and which one is recommended.

Select * from spfli where spfli-carrid = ‘LH’ and spfli-connid = ‘400’.

Endselect.

Select * from spfli. Check: spfli-carrid = ‘LH’ and spflid-connid = ‘400’.

Endselect.

-Yes they will do the same task. Second Select statement takes less time and is recommended.

37. If you want to improve the response time (time to access data) Logical Databases permits you to achieve this using VIEWS.

38. Is there any upper limit (max) to the possible number of nodes in a logical database structure? If so what is the limit?

Yes, there is an upper limit for defining number of nodes in a Logical Database Structure.

Maximum nodes = 1200 / length where length = max. Length of name in the structure.



39. In the structure of Logical Database nodes at different levels are displayed in the same columns. (T/F) If false what types of nodes are displayed in the same columns. If true what type of nodes are not displayed in the same columns.

False. Nodes at same levels are displayed in the same columns.



40. What are the advantages of Logical Databases?

It offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.



41. Though all the ABAP/4 Dictionary Structures that exists in the structure of the LDB, being defined in Database Program, we are defining the Dictionary Structures in the Report. What is the reason for such declaration?

By declaring so we are providing work areas for data passing between Logical Database and Report. In addition, the logical database configures the selection screen depending on the selection of database tables.



42. Is it mandatory to declare all the tables in Report by the key word tables for all the tables that exist in the structure of LDB, and are being defined in the Database part of LDB.

No, It is not mandatory to declare all tables in report.


43. If one wants to access data using Logical Database, the use of events is unavoidable. (T/F).
True.

ABAP - Performance tuning


For all entries
Nested selects
Select using JOINS
Use the selection criteria
Use the aggregated functions
Select with view
Select with index support
Select … Into table
Select with selection list
Key access to multiple lines
Copying internal tables
Modifying a set of lines
Deleting a sequence of lines
Linear search vs. binary
Comparison of internal tables
Modify selected components
Appending two internal tables
Deleting a set of lines
Tools available in SAP to pin-point a performance problem

Optimizing the load of the database
Other General Tips & Tricks for Optimization


For all entries

The for all entries

creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger

than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.

The plus

  • Large amount of data

  • Mixing processing and

    reading of data

  • Fast internal reprocessing of data

  • Fast

The Minus

  • Difficult to program/understand

  • Memory could be critical (use FREE or PACKAGE size)

Some steps that might make FOR ALL ENTRIES more

efficient:

  • Removing

    duplicates from the the driver table

  • Sorting the driver table

  • If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR

    statement:
    FOR ALL ENTRIES IN i_tab
    WHERE mykey >= i_tab-low and
    mykey <= i_tab-high.

Nested selects

The plus:

  • Small amount of data

  • Mixing processing and reading of data

  • Easy to code - and understand

The minus:



  • Large amount of data

  • when mixed

    processing isn’t needed

  • Performance killer no. 1

Select using JOINS

The plus

  • Very large amount of data

  • Similar to Nested selects - when the accesses are planned by the programmer

  • In some cases the

    fastest

  • Not so

    memory critical

The minus

  • Very

    difficult to program/understand

  • Mixing processing and reading of data not possible

Use the selection criteria



SELECT * FROM SBOOK.          
CHECK: SBOOK-CARRID = 'LH' AND
SBOOK-CONNID = '0400'.
ENDSELECT.
SELECT * FROM SBOOK            
WHERE CARRID = 'LH' AND
CONNID = '0400'.
ENDSELECT.

Use the aggregated functions

C4A = '000'.     
SELECT * FROM T100
WHERE SPRSL = 'D' AND
ARBGB = '00'.
CHECK: T100-MSGNR > C4A.
C4A = T100-MSGNR.
ENDSELECT.

SELECT MAX( MSGNR ) FROM T100 INTO C4A
WHERE SPRSL = 'D' AND
ARBGB = '00'.


Select with view

SELECT * FROM DD01L              
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
SELECT SINGLE * FROM DD01T
WHERE DOMNAME = DD01L-DOMNAME
AND AS4LOCAL = 'A'
AND AS4VERS = DD01L-AS4VERS
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.

SELECT * FROM DD01V
WHERE DOMNAME LIKE 'CHAR%'
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.

Select with index support

SELECT * FROM T100      
WHERE ARBGB = '00'
AND MSGNR = '999'.
ENDSELECT.

SELECT * FROM T002.
SELECT * FROM T100
WHERE SPRSL = T002-SPRAS
AND ARBGB = '00'
AND MSGNR = '999'.
ENDSELECT.
ENDSELECT.


Select … Into table

REFRESH X006.           
SELECT * FROM T006 INTO X006.
APPEND X006.
ENDSELECT

SELECT * FROM T006 INTO TABLE X006.

Select with selection list

SELECT * FROM DD01L        
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
ENDSELECT

SELECT DOMNAME FROM DD01L
INTO DD01L-DOMNAME
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
ENDSELECT

Key access to multiple lines

LOOP AT TAB.    
CHECK TAB-K = KVAL.
" ...
ENDLOOP.

LOOP AT TAB WHERE K = KVAL.
" ...
ENDLOOP.

Copying internal tables

REFRESH TAB_DEST.        
LOOP AT TAB_SRC INTO TAB_DEST.
APPEND TAB_DEST.
ENDLOOP.

TAB_DEST[] = TAB_SRC[].

Modifying a set of lines

LOOP AT TAB.       
IF TAB-FLAG IS INITIAL.
TAB-FLAG = 'X'.
ENDIF.
MODIFY TAB.
ENDLOOP.

TAB-FLAG = 'X'.
MODIFY TAB TRANSPORTING FLAG
WHERE FLAG IS INITIAL.

Deleting a sequence of lines

DO 101 TIMES.         
DELETE TAB_DEST INDEX 450.
ENDDO.

DELETE TAB_DEST FROM 450 TO 550.

Linear search vs. binary

READ TABLE TAB WITH KEY K = 'X'.

READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.

Comparison of internal tables

DESCRIBE TABLE: TAB1 LINES L1,
TAB2 LINES L2.

IF L1 <> L2.
TAB_DIFFERENT = 'X'.
ELSE.
TAB_DIFFERENT = SPACE.
LOOP AT TAB1.
READ TABLE TAB2 INDEX SY-TABIX.
IF TAB1 <> TAB2.
TAB_DIFFERENT = 'X'. EXIT.
ENDIF.
ENDLOOP.
ENDIF.

IF TAB_DIFFERENT = SPACE.
" ...
ENDIF.

IF TAB1[] = TAB2[].
" ...
ENDIF.

Modify selected components

LOOP AT TAB.     
TAB-DATE = SY-DATUM.
MODIFY TAB.
ENDLOOP.

WA-DATE = SY-DATUM.
LOOP AT TAB.
MODIFY TAB FROM WA TRANSPORTING DATE.
ENDLOOP.

Appending two internal tables

LOOP AT TAB_SRC.        
APPEND TAB_SRC TO TAB_DEST.
ENDLOOP

APPEND LINES OF TAB_SRC TO TAB_DEST.

Deleting a set of lines

LOOP AT TAB_DEST WHERE K = KVAL.
DELETE TAB_DEST.
ENDLOOP

DELETE TAB_DEST WHERE K = KVAL.

Tools available in SAP to pin-point a performance problem

  • The runtime analysis (SE30)


  • SQL Trace (ST05)


  • Tips and Tricks

    tool
  • The performance database

Optimizing the load of the

database

Using table

buffering

Using buffered tables

improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the

buffer will be bypassed. These staments are:

  • Select DISTINCT

  • ORDER BY / GROUP BY / HAVING clause

  • Any WHERE clasuse that contains a subquery or IS NULL expression



  • JOIN s

  • A SELECT... FOR UPDATE



If you wnat to explicitly bypass the bufer,

use the BYPASS BUFFER addition to the SELECR clause.

Use the ABAP SORT Clause Instead of ORDER BY

The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed

on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase

server to the application server.

If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to

use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution

and you would want to let the datbase server sort it.

Avoid ther SELECT DISTINCT Statement

As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of

an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.

TIPS & TRICKS FOR OPTIMIZATION



  • Use the GET RUN TIME command to help evaluate performance.

    It's hard to know whether that optimization technique REALLY helps unless you test it out. Using this tool can help you know what is

    effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of

    your program, rather than the whole program.

  • Generally,

    try to reduce I/O first, then memory, then CPU activity.
    I/O operations that read/write to hard disk are always the most expensive

    operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to

    disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).


  • Avoid 'SELECT *', especially in tables that have a lot of fields. Use

    SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.



  • Field-groups can be useful for multi-level sorting and displaying. However, they

    write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only

    appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to

    decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide

    whether to write the data to memory or swap space.

  • Use as

    many table keys as possible in the WHERE part of your select statements.

  • Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the

    transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within

    that month). Then use a SELECT A B C INTO TABLE ITAB statement.

  • Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press

    Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the

    number of records. This is extremely useful in optimizing a program's memory allocation.

  • Try to make the user interface such that the program gradually unfolds more information to the user, rather than

    giving a huge list of information all at once to the user.

  • Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of

    records exceeds NUM_RECS, the data will be kept in swap space (not memory).

  • Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather

    than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS

    NUM_RECS, where NUM_RECS is the number of records you expect to access.

  • If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant

    size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at

    a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.



  • Know how to use the 'collect' command. It can be very efficient.

  • Use the SELECT SINGLE command whenever possible.

  • Many tables contain totals fields (such as monthly expense totals). Use

    these avoid wasting resources by calculating a total that has already been calculated and stored.

ABAP/4 Development Code Efficiency Guidelines

ABAP/4 (Advanced Business Application Programming 4GL) language is an "event-driven",

"top-down", well-structured and powerful programming language. The ABAP/4 processor controls the execution of an event. Because the ABAP/4

language incorporates many "event" keywords and these keywords need not be in any specific order in the code, it is wise to implement in-house

ABAP/4 coding standards.

SAP-recommended customer-specific ABAP/4 development guidelines can

be found in the SAP-documentation.

This page contains some general guidelines for efficient

ABAP/4 Program Development that should be considered to improve the systems performance on the following areas:-

Physical I/O - data must be read from and written into I/O devices. This can be a potential bottle neck. A well

configured system always runs 'I/O-bound' - the performance of the I/O dictates the overall performance.

Memory consumption of the database resources eg. buffers, etc.

CPU

consumption on the database and application servers

Network communication - not critical for

little data volumes, becomes a bottle neck when large volumes are transferred.

Policies and

procedures can also be put into place so that every SAP-customer development object is thoroughly reviewed (quality – program correctness as well

as code-efficiency) prior to promoting the object to the SAP-production system. Information on the SAP R/3 ABAP/4 Development Workbench

programming tools and its features can be found on the SAP Public Web-Server.

--------------------------------------------------------------------------------

CLASSIC GOOD 4GL PROGRAMMING CODE-PRACTICES GUIDELINES

Avoid dead-code

Remove unnecessary code and redundant processing

Spend time documenting and adopt good change control practices

Spend adequate time

anayzing business requirements, process flows, data-structures and data-model

Quality

assurance is key: plan and execute a good test plan and testing methodology

Experience

counts

--------------------------------------------------------------------------------

SELECT * FROM


CHECK:
ENDSELECT

vs.

SELECT * FROM


WHERE
ENDSELECT

In order to keep the amount of data which is relevant to the query the hit set small, avoid

using SELECT+CHECK statements wherever possible. As a general rule of thumb, always specify all known conditions in the WHERE clause (if

possible). If there is no WHERE clause the DBMS has no chance to make optimizations. Always specify your conditions in the Where-clause instead

of checking them yourself with check-statements. The database system can also potentially make use a database index (if possible) for greater

efficiency resulting in less load on the database server and considerably less load on the network traffic as well.

Also, it is important to use EQ (=) in the WHERE clause wherever possible, and analyze the SQL-statement for the

optimum path the database optimizer will utilize via SQL-trace when necessary.

Also, ensure

careful usage of "OR", "NOT" and value range tables (INTTAB) that are used inappropriately in Open SQL statements.

--------------------------------------------------------------------------------

SELECT *

vs.

SELECT SINGLE *

If you are interested in exactly one row of a database table or view,

use the SELECT SINGLE statement instead of a SELECT * statement. SELECT SINGLE requires one communication with the database system whereas

SELECT * requires two.

--------------------------------------------------------------------------------

SELECT

* FROM

INTO
APPEND
ENDSELECT

vs.

SELECT * FROM

INTO TABLE

It is usually faster to use the INTO TABLE version of a SELECT statement than to use APPEND

statements

--------------------------------------------------------------------------------

SELECT ... WHERE + CHECK

vs.

SELECT using aggregate function

If you want to

find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of

computing the aggregates within the program. The RDBMS is responsible for aggregated computations instead of transferring large amount of data

to the application. Overall Network, Application-server and Database load is also considerably less.

--------------------------------------------------------------------------------

SELECT INTO TABLE + LOOP AT T
…………
SELECT * FROM

INTO TABLE .
LOOP AT .
ENDLOOP.

vs.

SELECT * FROM


……….
ENDSELECT

If you process your data only once, use a SELECT-ENDSELECT loop instead of collecting data in

an internal table with SELECT ... INTO TABLE. Internal table handling takes up much more space

--------------------------------------------------------------------------------

Nested

SELECT statements:
SELECT * FROM
SELECT * FROM
……..
ENDSELECT.
ENDSELECT

vs.

Select with view
SELECT * FROM
ENDSELECT

To process a join, use a view wherever possible instead of nested SELECT

statements.
Using nested selects is a technique with low performance. The inner select statement is executed several times which might be an overhead. In

addition, fewer data must be transferred if another technique would be used eg. join implemented as a view in ABAP/4 Repository.



· SELECT ... FORM ALL ENTRIES
· Explicit cursor handling (for more information, goto Transaction SE30 – Tips & Tricks)

--------------------------------------------------------------------------------

Nested

select:
SELECT * FROM pers WHERE condition.
SELECT * FROM persproj WHERE person = pers-persnr.
... process ...
ENDSELECT.
ENDSELECT.

vs.

SELECT persnr FROM pers

INTO TABLE ipers WHERE cond. ……….
SELECT * FROM persproj FOR ALL ENTRIES IN ipers
WHERE person = ipers-persnr
………... process .……………
ENDSELECT.

In the lower version the new Open SQL statement FOR ALL ENTRIES is used. Prior to

the call, all interesting records from 'pers' are read into an internal table. The second SELECT statement results in a call looking like this

(ipers containing: P01, P02, P03):
(SELECT * FROM persproj WHERE person = 'P01')
UNION
(SELECT * FROM persproj WHERE person = 'P02')
UNION
(SELECT * FROM persproj WHERE person = 'P03')

In case of large statements, the R/3's database

interface divides the statement into several parts and recombines the resulting set to one. The advantage here is that the number of transfers

is minimized and there is minimal restrictions due to the statement size (compare with range tables).

--------------------------------------------------------------------------------

SELECT * FROM

vs.

SELECT FROM


Use a select list or a view instead of SELECT *, if you are only interested in specific columns of the

table. If only certain fields are needed then only those fields should be read from the database. Similarly, the number of columns can also be

restricted by using a view defined in ABAP/4 Dictionary. Overall database and network load is considerably less.

--------------------------------------------------------------------------------

SELECT without table buffering support

vs.



SELECT with table buffering support

For all

frequently used, read-only(few updates) tables, do attempt to use SAP-buffering for eimproved performance response times. This would reduce the

overall Database activity and Network traffic.

--------------------------------------------------------------------------------

Single-line inserts
LOOP AT
INSERT INTO

VALUES
ENDLOOP

vs.

Array inserts



Whenever possible, use array operations instead of single-row operations to modify the database tables.

Frequent communication between the application program and database system produces

considerable overhead.

--------------------------------------------------------------------------------

Single-line updates
SELECT * FROM



UPDATE

ENDSELECT

vs.

Column updates
UPDATE

SET

Wherever possible, use column

updates instead of single row updates to update your database tables

--------------------------------------------------------------------------------

DO....ENDDO loop with Field-Symbol

vs.

Using CA operator

Use the special operators CO, CA, CS instead of programming the

operations yourself
If ABAP/4 statements are executed per character on long strings, CPU consumprion can rise substantially

--------------------------------------------------------------------------------

Use of a CONCATENATE function module

vs.

Use of a CONCATENATE statement

Some function modules for string manipulation have

become obsolete, and should be replaced by ABAP statements or functions

STRING_CONCATENATE... ---> CONCATENATE
STRING_SPLIT... ---> SPLIT
STRING_LENGTH... ---> strlen()
STRING_CENTER... ---> WRITE..TO. ..CENTERED
STRING_MOVE_RIGHT ---> WRITE...TO...RIGHT-JUSTIFIED

--------------------------------------------------------------------------------

Moving

with offset

vs.

Use of the CONCATENATE

statement

Use the CONCATENATE statement instead of programming a string concatenation of

your own

--------------------------------------------------------------------------------

Use of SEARCH and MOVE with offset

vs.

Use of SPLIT statement

Use the SPLIT statement instead of programming a string split yourself

--------------------------------------------------------------------------------

Shifting by SY-FDPOS places

vs

Using SHIFT...LEFT DELETING LEADING...

If you want ot delete

the leading spaces in a string use the ABAP/4 statements SHIFT...LEFT DELETING LEADING... Other constructions (with CN and SHIFT... BY SY-FDPOS

PLACES, with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast

--------------------------------------------------------------------------------

Get a

check-sum with field length

vs

Get a

check-sum with strlen ()

Use the strlen () function to restrict the DO loop to the relevant part of the field, eg.

when determinating a check-sum

Wednesday, May 14, 2008

ALV

1) ALV GRID CONTROL

2)
SAP List Viewer




ABAP - REPORT GENERATION - FORMATTING

REPORT GENERATION – FORMATTING

1. The alignment of a type ‘c’ field in a report is left Aligned.
2. In the statement Write:/15(10) Ofal-lifnr. what do the number 15 and 10 stand for
15 stand for the offset on the screen and 10 stands for the field length displayed.

3. Specify the default alignment for the following field types:
‘D’ – Left, ‘F’-Right, ‘N’-Left, ‘I’-Right, ‘T’-Left.

4. If s_time has the value ‘123456’ how would you get an output of 12:34:56 with a single
‘Write:’ statement. Write:s_time using edit mask’--:--:--‘.

5. In order to suppress the leading zeroes of a number field the keywords used are NO-ZERO.

6. The total no of date formats that can be used to display a date during output is MM/DD/YY, DD/MM/YY, DD/MM/YYYY, MM/DD/YYYY, MMDDYY, DDMMYY, YYMMDD.

7. The UNDER Command allows for vertical alignment of fields one below the other.

8. In order to concatenate strings only for output purposes the command NO-GAP can be used in conjunction with the ‘Write’ statement.

9. The no of decimal places for output can be defines within a write statement. (T/F).

TRUE. Write:/ decimals 2.

10.

Data can be moved from one field to another using a ‘Write:’ Statement and stored in the desired format. (T/F).

TRUE. Write: Date_1 to Date_2 format DD/MM/YY.

11.

In the statement Write:/15(10) lfa1-lifnr. The values 15 and 11 can also be defined by variables (T/F). False.
12.

Differentiate between the following two statements if any.

ULINE.

Write: sy-uline.

No-difference. Except that uline is used outside the ‘Write’ Statement.

13.

In order to skip a single line the number of lines need not be given as an assignment (T/F)

TRUE.

14.

The “SKIP TO LINE line number” is dependent on the LINE-COUNT statement included in the report statement of the program.
15.

In order to skip columns the command used is POSITION .
16.

In order to have boldfaced text as output the command used is Write:INTENSIFIED.
17.

Background and foreground colors can be interchanged using the command Format Inverse.
18.

In order to restore the system defaults for all changes made with the format statement is Format Reset.
19.

Like ULINE the statement VLINE is used to insert vertical lines. (T/F).

False.

20. Suppressing the number signs (+/-) is carried out using the addition NO-SIGNS to the Write statement. (T/F). False.

21.

If SY-UZEIT has the value 6:34:45 it can be displayed as 063445 using No Edit Mask.
22.

If the variable “Text” has the value ‘ABCDEF’ the output for the statement “Write:/Text+2(3)” will be “CDE”
23.

The fields specified by select-options and parameters statement cannot be grouped together in the selection screen. (T/F). False.
24.

When calling an external report the parameters or select-options specified in the external report cannot be called. (T/F)

FALSE.

25.

Selection Texts in the text elements of the program helps in changing the displayed names of variables in the parameters statement.
26.

Type F datatype cannot be used to define parameters.

27. Rounding off of values can be carried out using the write statement. (T/F). TRUE

28.

How would you define the exponents for a type ‘f’ field?

Exponent .

29.

How would you format the output as left, centered or right-justified using the write statement.

Left-justified, Centered, Right-justified.

30.

If the same formatting options were used for a WRITE statement that follows the FORMAT statement, which settings would take precedence.

The settings in the Write Statement.

31.

For each new event, the system resets all formatting options to their default values (T/F)

TRUE.

32.

All formatting options have the default value OFF. (T/F).

TRUE.

33.

How would you set the formatting options statically and dynamically within a report? Statically: FORMAT [ON|OFF]….

Dynamically: FORMAT = =….

34.

The page footer is defined using the statement END-OF-PAGE.
35.

The processing block following END-OF-PAGE is processed only if you reserve lines for the footer in the LINE-COUNT option of the REPORT statement. (T/F)

TRUE.

36.

To execute a page break under the condition that less than a certain number of lines is left on a page is achieved by RESERVE n lines.
37.

The RESERVE statement only takes effect if output is written to the subsequent page. No blank pages are created and it defines a block of lines that must be output as a whole. (T/F). TRUE.
38.

To set the next output line to the first line of a block of lines defined with the RESERVE statement the statement BACK is used.
39.

What is the limit for the length of a page if the page length is not specified in the report statement. 60,000 lines.
40.

How would you start the printing process from within the program while creating a list?

NEW-PAGE PRINT ON.

41.

You can change the width of pages within list levels triggered by page breaks. (T/F).

FALSE.

42.

Hotspots are special areas of an output list used to trigger events. (T/F) TRUE.
43.

To designate fields as hotspots at runtime, use FORMAT HOTSPOT = .
44.

Horizontal lines created with ULINE and blank lines created with SKIP can be formatted as hotspots. (T/F). FALSE.
45.

How would you suppress the display of a parameter on the selection screen?

Parameters

………..No-Display.

46.

Can you assign a matchcode object to a parameter? If so how?

Yes. PARAMETERS

……..MATCHCODE OBJECT ……..

47.

For each SELECT-OPTIONS statement, the system creates a selection table. (T/F)

TRUE.

48.

To position a set of parameters or comments on a single line on the selection screen, you must declare the elements in a block enclosed by

SELECTION-SCREEN BEGIN OF LINE.

……..

SELECTION-SCREEN END OF LINE.

49.

How can Symbols or R/3 icons be output on the screen?

WRITE AS SYMBOL.

WRITE AS ICON.

50.

In the standard setting, you cannot create empty lines with the WRITE statement alone. (T/F). TRUE.


REPORTING – GENERAL

1.

The system field, which indicates success or failure of a SQL operation, is SY-SUBRC.
2.

What is the syntax for specifying database table name at runtime in SELECT statement.

NAME = ‘SPFL1’.

SELECT * FROM (NAME).

……………….

……………….

ENDSELECT.

3.

How do you read selected lines of database table into an internal table in packages of predefined size.

SELECT * FROM INTO TABLE PACKAGE SIZE.

Where n is variable.

4.

Name the WILDCARD characters which are used for comparisons with character strings & numeric strings. ‘%’ and ‘-‘.
5.

In SELECT statements can you specify a variable in WHERE condition or a part of the condition, if so what is the syntax.

SELECT * FROM

WHERE .

6.

Name the ABAP/4 key words, which are used to change the contents of database table.

UPDATE or MODIFY.



7. How to specify a client for database table processing.

TABLES SPFLI.

SELECT * FROM SPFLI CLIENT SPECIFIED WHERE MANDT BETWEEN ‘001’ AND ‘003’.

……..

ENDSELECT.

8.

How do you write a DATA object from ABAP/4 program to ABAP/4 memory and restore the same from memory to program.

EXPORT [FROM ][FROM ]…. TO MEMORY ID .

The ID , which can be up to 32 characters long, identifies the data in memory.

9.

What are DATA CLUSTERS?

You can group any complex internal data objects of an ABAP/4 program together in data clusters and store them temporarily in ABAP/4 memory or for longer periods in databases. You can store data clusters in special databases of the ABAP/4 Dictionary. These databases are known as ABAP/4 cluster databases and have a predefined structure. Storing a data cluster is specific to ABAP/4. Although you can also access cluster databases using SQL statements, only ABAP/4 statements are able to decode the structure of the stored data cluster.

10.

Statements used to delete data objects in ABAP/4 memory FREE MEMORY [ID ].
11.

How will you create a file on application server.

Open dataset for output.

12.

ABAP/4 statement for opening a file on application server for reading Open dataset for input.
13.

How will you transfer data into a file in application server?

Data fname(60) value ‘mYFILE’.

Data num type i.

Open dataset fname for output.

Do 10 times.

Num = Num +1.

Transfer num to fname.

Enddo.

…….etc.

14.

Name the function modules to write data from an Internal Table to the Presentation Server.

DOWNLOAD and WS_DOWNLOAD.

15.

Name the function module that can be used to give information about files on Presentation Server and about its Operating System.

WS_QUERY.

16.

Name the ABAP/4 key word, which is used to clear the Headerline of an Internal Table.

CLEAR.

17.

Name the function modules to read data from Presentation Server into an Internal Table.

UPLOAD and WS_UPLOAD.

18.

Name the ABAP/4 keywords to initialize an Internal Table with and without headerline.

REFRESH .

19.

How to determine the attributes of an internal table?

DESCRIBE TABLE [LINES ] [OCCURS ].

20.

Name the ABAP/4 key word for searching a string in an Internal Table.

SEARCH FOR .

The different options () for the search in an internal table are:



ABBREVIATED

Searches tablefor a word containing the character string specified in , where other characters might separate the characters. The first letter of the word and the string must be the same.

STARTING AT

Searches table for , starting at line . <\lin1> can be a variable.

ENDING AT

Searches table for upto line. can be a variable.

AND MARK

If the search string is found, all the characters in the search string (and all the characters in between when using ABBREVIATED) are converted to upper case.

21.

What are the different attributes that can be assigned to a variant?

The different attributes that can be assigned to a variant are….

Description

Enter a short, meaningful description of the variant. This may be upto 30 characters long.

Background only

Specify whether you want to use the variant in background processing only, or in online environment as well.

Protected variant.

Mark the field if you want to protect your variant against being changed by other users.

Do not display variant.

Mark this field if you want the variant name to be displayed in the catalog only, but not in the F4 value list.

For the selections you cover in a variant, you can enter the following attributes:

Type

The system displays whether the field is a parameter or a select option.

Protected

Mark this field for each field on the selection screen you want to protect from being overwritten. Values that you mark this way are displayed to the users, but they cannot change them, that are they are not ready to accept input.

Invisible

If you mark this column, the system will not display the corresponding field on the selection screen the user sees when starting the report program.

Variable

Mark this column if you want to set the value for this field at runtime.

22.

Is it possible to create new dynamic programs during runtime of an ABAP/4 program? If so how?

To create new dynamic programs during the runtime of an ABAP/4 program, you must use an internal table. For this purpose, you should create this internal table with one character type column and a line width of 72. You can use any method you like from Filling Internal Tables to write the code of your new program into the internal table. Especially, you can use internal fields in which contents are dependent on the flow of the program that you use to create a new one, to influence the coding of the new program dynamically. The following example shows how to proceed in principal:

DATA CODE (72) OCCURS 10.

APPEND ‘REPORT ZDYN1.’

TO CODE.

APPEND ‘WRITE/”Hello, I am dynamically created!”.’

TO CODE.

Two lines of a very simple program are written into the internal table CODE.

In the next step you have to put the new module, in the above example it is a report, into the library. For this purpose you can use the following statement:

Syntax

INSERT REPORT FROM .

The program is inserted in your present development class in the R/3 Repository. If a program with this name does not already exists, it is newly created with the following attributes:

Title: none,

Type: 1 (Reporting),

Application: S (Basis).

You can specify the name of the program explicitly within single quotation marks or you can write the name of a character field, which contains the program name. The name of the program must not necessarily be the same as given in the coding, but it is recommended to do so. is the internal table containing the source code. For the above example you could write:

INSERT REPORT ‘ZDYN1’ FROM CODE.

Or

DATA REP (8).

REP = ‘ZDYN1’

INSERT REPORT REP FROM CODE.

23.

Data types can be elementary or structured (T/F).

TRUE.

24.

The amount of memory associated with a data type is ZERO.
25.

Data objects are the physical units a program uses at runtime. (T/F).

TRUE.

26.

The data object does not occupy any space in memory. (T/F)

FALSE.

27.

What are the three hierarchical levels of data types and objects?

Program-independent data, defined in the ABAP/4 Dictionary.

Internal data used globally in one program.

Data used locally in a procedure (subroutine, function module)

28.

How would you find the attributes of a data type or data object?

DESCRIBE FIELD [LENGTH [COMPONENTS ]]

[OUTPUT-LENGTH ] [DECIMALS ]

[EDIT MASK ].

29.

The components of a field string cannot have different data types. (T/F).

FALSE.

30.

Field strings are also called as Record or Structures.
31.

If a field string is aligned (Left, centered, right justified etc.), the filler fields are also added to the length of the type C field. (T/F).

TRUE.

32.

You cannot assign a local data object defined in a subroutine or function module to a field group. (T/F)

TRUE.

33.

Field group reserves storage space for the fields, and does not contain pointers to existing fields (T/F).

False.

34.

Defining a field group as ‘HEADER’ is optional (T/F)

FALSE.

35.

How would you define a field symbol?

FIELD-SYMBOLS.

36.

Which function module would you use to check the user’s authorization to access files before opening a file?

AUTHORITY_CHECK_DATASET

37. Name the function module used to convert logical file names to physical file names in ABAP/4 programs.

FILE_GET_NAME.

38.

Parameters, which are defined during the definition of a subroutine with the FORM statement, are called Formal Parameters.
39.

Parameters which are specified during the call of a subroutine with the PERFORM statement are called Actual Parameters.
40.

In subroutines internal tables that are passed by TABLES, are always called by value and result. (T/F)

FALSE. They are called by reference.

INTERACTIVE REPORTING

1. What is interactive reporting?

It helps you to create easy-to-read lists. You can display an overview list first that contains general information and provide the user with the possibility of choosing detailed information that you display on further lists.

2.

What are the uses of interactive reporting?

The user can actively control data retrieval and display during the session. Instead of an extensive and detailed list, you create a basic list with condensed information from which the user can switch to detailed displays by positioning the cursor and entering commands. The detailed information appears in secondary lists.

3.

What are the event key words in interactive reporting?

Event Keyword Event

AT LINE-SELECTION Moment at which the user selects a line by double clicking on it or by positioning the cursor on it and pressing F2.

AT USER-COMMAND Moment at which the user presses a function key.

TOP-OF-PAGE DURING Moment during list processing of a

LINE-SELECTION secondary list at which a new page starts.



4.

What is secondary list?

It allows you to enhance the information presented in the basic list. The user can, for example, select a line of the basic list for which he wants to see more detailed information. You display these details on a secondary list. Secondary lists may either overlay the basic list completely or you can display them in an extra window on the screen. The secondary lists can themselves be interactive again.

5.

How to select valid lines for secondary list?

To prevent the user from selecting invalid lines, ABAP/4 offers several possibilities. At the end of the processing block END-OF-SELECTION, delete the contents of one or more fields you previously stored for valid lines using the HIDE statement. At the event AT LINE-SELECTION, check whether the work area is initial or whether the HIDE statement stored field contents there. After processing the secondary list, clear the work area again. This prevents the user from trying to create further secondary lists from the secondary list displayed.

6.

How to create user interfaces for lists?

The R/3 system automatically, generates a graphical user interface (GUI) for your lists that offers the basic functions for list processing, such as saving or printing the list. If you want to include additional functionality, such as pushbuttons, you must define your own interface status. To create a new status, the Development Workbench offers the Menu Painter. With the Menu Painter, you can create menus and application toolbars. And you can assign Function Keys to certain functions. At the beginning of the statement block of AT END-OF-SELECTION, active the status of the basic list using the statement: SET PF-STATUS ‘STATUS’.

7.

What is interactive reporting?

A classical non-interactive report consists of one program that creates a single list. Instead of one extensive and detailed list, with interactive reporting you create basic list from which the user can call detailed information by positioning the cursor and entering commands. Interactive reporting thus reduces information retrieval to the data actually required.

8.

Can we call reports and transactions from interactive reporting lists?

Yes. It also allows you to call transactions or other reports from lists. These programs then use values displayed in the list as input values. The user can, for example, call a transaction from within a list of change the database table whose data is displayed in the list.

9.

What are system fields for secondary lists?

SY-LSIND Index of the list created during the current event (basic list = 0)

SY-LISTI Index of the list level from which the event was triggered.

SY-LILLI Absolute number of the line from which the event was triggered.

SY-LISEL Contents of the line from which the event was triggered.

SY-CUROW Position of the line in the window from which the event was triggered (counting starts with 1)

SY-CUCOL Position of the column in the window from which the event was triggered (counting starts with 2).

SY-CPAGE Page number of the first displayed page of the list from which the event was triggered.

SY-STARO Number of the first line of the first page displayed of the list from which the event was triggered (counting starts with 1). Possibly, a page header occupies this line.

SY-STACO Number of the first column displayed in the list from which the event was triggered (counting starts with 1).

SY-UCOMM Function code that triggered the event.

SY-PFKEY Status of the displayed list.

10.

How to maintain lists?

To return from a high list level to the next-lower level (SY-LSIND), the user chooses Back on a secondary list. The system then releases the currently displayed list and activates the list created one step earlier. The system deletes the contents of the released list. To explicitly specify the list level, into which you want to place output, set the SY-lsind field. The system accepts only index values, which correspond to existing list levels. It then deletes all existing list levels whose index is greater or equal to the index specify. For example, if you set SY-LSIND to 0, the system deletes all secondary lists and overwrites the basic list with the current secondary list.

11.

What are the page headers for secondary lists?

On secondary lists, the system does not display a standard page header and it does not trigger the event. TOP-OF-PAGE. To create page headers for secondary list, you must enhance TOP-OF-PAGE: Syntax TOP-OF-PAGE DURING LINE-SELECTION. The system triggers this event for each secondary list. If you want to create different page headers for different list levels, you must program the processing block of this event accordingly, for example by using system fields such as SY-LSIND or SY-PFKEY in control statements (IF, CASE).

12.

How to use messages in lists?

ABAP/4 allows you to react to incorrect or doubtful user input by displaying messages that influence the program flow depending on how serious the error was. Handling messages is mainly a topic of dialog programming. You store and maintain messages in Table T100. Messages are sorted by language, by a two-character ID, and by a three-digit number. You can assign different message types to each message you output. The influence of a message on the program flow depends on the message type. In our program, use the MESSAGE statement to output messages statically or dynamically and to determine the message type.

Syntax:REPORT MESSAGE-ID .

13.

What are the types of messages?

A message can have five different types. These message types have the following effects during list processing:

.A (=Abend):

.E (=Error) or W (=Warning):

.I (=Information):

.S (=Success):

14.

What are the user interfaces of interactive lists?

If you want the user to communicate with the system during list display, the list must be interactive. You can define specific interactive possibilities in the status of the list’s user interface (GUI). To define the statuses of interfaces in the R/3 system, use the Menu Painter tool. In the Menu Painter, assign function codes to certain interactive functions. After an user action occurs on the completed interface, the ABAP/4 processor checks the function code and, if valid, triggers the corresponding event.

15.

What are the drill-down features provided by ABAP/4 in interactive lists?

ABAP/4 provides some interactive events on lists such as AT LINE-SELECTION (double click) or AT USER-COMMAND (pressing a button). You can use these events to move through layers of information about individual items in a list.

16.

What is meant by stacked list?

A stacked list is nothing but secondary list and is displayed on a full-size screen unless you have specified its coordinates using the window command.

17.

Is the basic list deleted when the new list is created?

No. It is not deleted and you can return back to it using one of the standard navigation functions like clicking on the back button or the cancel button.

18.

What is meant by hotspots?

A Hotspot is a list area where the mouse pointer appears as an upright hand symbol. When a user points to that area (and the hand cursor is active), a single click does the same thing as a double-click. Hotspots are supported from R/3 release 3.0c.

19.

What is the length of function code at user-command?

Each menu function, push button, or function key has an associated function code of length FOUR (for example, FREE), which is available in the system field SYUCOMM after the user action.

20.

Can we create a gui status in a program from the object browser?

Yes. You can create a GUI STATUS in a program using SET PF-STATUS.

21.

In which system field does the name of current gui status is there?

The name of the current GUI STATUS is available in the system field SY-PFKEY.

22.

Can we display a list in a pop-up screen other than full-size stacked list?

Yes, we can display a list in a pop-up screen using the command WINDOW with the additions starting at X1 Y1 and ending at X2 Y2 to set the upper-left and the lower-right corners where x1 y1 and x2 y2 are the coordinates.

23.

What is meant by hide area?

The hide command temporarily stores the contents of the field at the current line in a system-controlled memory called the HIDE AREA. At an interactive event, the contents of the field are restored from the HIDE AREA.

24.

When the get cursor command used in interactive lists?

If the hidden information is not sufficient to uniquely identify the selected line, the command GET CURSOR is used. The GET CURSOR command returns the name of the field at the cursor position in a field specified after the addition field, and the value of the selected field in a field specified after value.

25.

How can you display frames (horizontal and vertical lines) in lists?

You can display tabular lists with horizontal and vertical lines (FRAMES) using the ULINE command and the system field SY-VLINE. The corners arising at the intersection of horizontal and vertical lines are automatically drawn by the system.

26.

What are the events used for page headers and footers?

The events TOP-OF-PAGE and END-OF-PAGE are used for pager headers and footers.

27.

How can you access the function code from menu painter?

From within the program, you can use the SY-UCOMM system field to access the function code. You can define individual interfaces for your report and assign them in the report to any list level. If you do not specify self-defined interfaces in the report but use at least one of the three interactive event keywords. AT LINE-SELECTION, AT PF, OR AT USER-COMMAND in the program, the system automatically uses appropriate predefined standard interfaces. These standard interfaces provide the same functions as the standard list described under the standard list.

28.

How the at-user command serves mainly in lists?

The AT USER-COMMAND event serves mainly to handle own function codes. In this case, you should create an individual interface with the Menu Painter and define such function codes.

29.

How to pass data from list to report?

ABAP/4 provides three ways of passing data:

---Passing data automatically using system fields

---Using statements in the program to fetch data

---Passing list attributes

30.

How can you manipulate the presentation and attributes of interactive lists?

---Scrolling through Interactive Lists.

---Setting the Cursor from within the Program.

---Modifying List Lines.

31.

How to call other programs?

Report Transaction

Call and return SUBMIT AND RETURN CALL TRANSACTION

Call without return SUBMIT LEAVE TO TRANSACTION

You can use these statements in any ABAP/4 program.

32.

What will exactly the hide statement do?

For displaying the details on secondary lists requires that you have previously stored the contents of the selected line from within the program. To do this, ABAP/4 provides the HIDE statement. This statement stores the current field contents for the current list line. When calling a secondary list from a list line for which the HIDE fields are stored, the system fills the stored values back into the variables in the program. In the program code, insert the HIDE statement directly after the WRITE statement for the current line. Interactive lists provide the user with the so-called ‘INTERACTIVE REPORTING’ facility. For background processing the only possible method of picking the relevant data is through ‘NON INTERACTIVE REPORT’ . After starting a background job, there is no way of influencing the program. But whereas for dialog sessions there are no such restrictions.

33.

How many lists can a program can produce?

Each program can produce up to 21 lists: one basic list and 20 secondary lists. If the user creates a list on the next level (that is, SY-LSIND increases), the system stores the previous list and displays the new one. Only one list is active, and that is always the most recently created list.

FALSE.

ABAP - ABAP SYNTAX

Sunday, May 11, 2008

ABAP - Creating and Changing ABAP Programs

ABAP programs are objects of the R/3 Repository. Like all other Repository objects, you maintain them using an ABAP Workbench - in this case, the ABAP Editor. This section provides a brief description of the ABAP Workbench and an overview of how to create and edit ABAP programs. It describes the different ways of starting the ABAP Editor. In the text below, 'open a program' always means 'start the ABAP Editor and use it to open a program'.

Starting the ABAP Editor : To start the ABAP Editor to create or change ABAP programs, the R/3 system offers three possibilities:

Using the Repository Browser : The Repository Browser in the ABAP Workbench (transaction SE80) offers a hierarchical overview of all R/3 Repository objects, ordered by development class, user name of the programmer, object type, and so on. If you enter a program name, you can directly access all of its components, such as the main program, subroutines, and global data. If you select a program object in the Repository Browser and choose Change, the system automatically opens the appropriate tool; in this case, the ABAP Editor. This method is suitable for complex programs, since the Repository Browser always provides you with an overview of all of the program components. 

Using the ABAP Editor :
You can open a program directly by choosing ABAP Editor from the initial screen of the ABAP Workbench (Transaction SE38). If you want to change a program using this method, you must already know its name and environment. This procedure is suited for maintaining or creating relatively simple or short programs, which have few or no additional components.

Using Forward Navigation
: In any of the tools in the ABAP Workbench, you can open a different Repository object by positioning the cursor on it and double-clicking. The system automatically opens the object using the correct tool. This also applies to ABAP programs. Forward navigation by double-clicking is possible wherever an ABAP program is called from another object, such as screen flow logic or another program.

Naming ABAP Programs : The name of an ABAP program can be between 1 and 30 characters long.


ABAP - ABAP Statements

ABAP statements always begin with an ABAP keyword and are always concluded with a period (.) . Statements can be several lines long; conversely, a line may contain more than one statement.

Comments are distinguished by the preceding signs * (at the beginning of a line) and “ (at any
position in a line).

ABAP statements use ABAP data types and objects.

Statements and Keywords : The first element of an ABAP statement is the ABAP keyword. This determines the category of the statements. The different statement categories are as follows:

Declarative Statements :
These statements define data types or declare data objects which are used by the other statements in a program or routine. The collected declarative statements in a program or routine make up its declaration part.

Examples of declarative keywords: TYPES, DATA, TABLES

Modularization Statements :

1) Event Keywords : You use statements containing these keywords to define event blocks. There are no special statements to conclude processing blocks - they end when the next processing block is introduced.
Examples of event keywords are: AT SELECTION SCREEN, START-OF-SELECTION, AT USER-COMMAND

2) Defining keywords : You use statements containing these keywords to define subroutines, function modules, dialog modules and methods. You conclude these processing blocks using the ENDstatements.

Examples of definitive keywords:
FORM ..... ENDFORM, FUNCTION ... ENDFUNCTION,
MODULE ... ENDMODULE.

Control Statements :
You use these statements to control the flow of an ABAP program within a processing block
according to certain conditions.

Examples of control keywords: IF, WHILE, CASE

Call Statements :
You use these statements to call processing blocks that you have already defined using modularization statements. The blocks you call can either be in the same ABAP program or in a
different program.
Examples of call keywords: PERFORM, CALL, SET USER-COMMAND, SUBMIT, LEAVE TO

Operational Statements : These keywords process the data that you have defined using declarative statements.
Examples of operational keywords: WRITE, MOVE, ADD

Database Statements :
These statements use the database interface to access the tables in the central database system. There are two kinds of database statement in ABAP: Open SQL and Native SQL.

Open SQL : Open SQL is a subset of the standard SQL92 language. It contains only Data Manipulation Language (DML) statements, such as SELECT, IINSERT, and DELETE. It does not contain any Data Definition Language (DDL) statements (such as CREATE TABLE or CREATE INDEX). Functions of this type are contained in the ABAP Dictionary. Open SQL contains all of the DML functions from SQL92 that are common to all of the database systems supported by SAP. It also contains a few SAP-specific functions. ABAP programs that use only Open SQL statements to access the database are fully portable. The database interface converts the OPEN SQL commands into commands of the relevant database.

Native SQL : Native SQL statements are passed directly from the database interface to the database without first being converted. It allows you to take advantage of all of your database’s characteristics in your programs. In particular, it allows you to use DDL operations. The ABAP Dictionary uses Native SQL for tasks such as creating database tables. In ordinary ABAP programs, it is not worth using DDL statements, since you cannot then take advantage of the central administration functions of thie ABAP Dictionary. ABAP programs that use Native SQL statements are database-specific, because there is no standardized programming interface for SQL92.

ABAP - Program Types and Execution

In the R/3 System, there are various types of ABAP program. The program type determines the
basic technical attributes of the program, and you must set it when you create it. The main difference between the different program types is the way in which the runtime environment calls its processing blocks. When you run an application program, you must call at least the first processing block from outside the program, that is, from the runtime environment. This processing block can then either call further processing blocks or return control to the runtime environment. When you start an ABAP program, the runtime environment starts a processor (dependent on the program type), which calls the first ABAP processing block. An ABAP program can be started either by the user or by the system (for example, in background processing), or through an external interface (for example, Remote Function Call). There are two ways of allowing users to execute programs - either by entering the program name or by entering a transaction code. You can assign a transaction code to any program. Users can then start that program by entering the code in the command field. Transaction codes are also usually linked to a menu path within the R/3 System.

The following program types are relevant to application programming:

Type 1 :
Type 1 programs have the important characteristic that they do not have to be controlled using
user-defined screens. Instead, they are controlled by the runtime environment, which calls a series of processing blocks (and selection screens and lists where necessary) in a fixed sequence. User actions on screens can then trigger further processing blocks. You can start a type 1 program and the corresponding processor in the runtime environment using the SUBMIT statement in another ABAP program. There are also various ways of starting a type1 program by entering its program name. This is why we refer to type 1 programs as executable programs.
When you run a type 1 program, a series of processors run in a particular order in the runtime environment. The process flow allows the user to enter selection parameters on a selection screen. The data is them selected from the database and processed. Finally, an output list is displayed. At no stage does the programmer have to define his or her own screens. The runtime
environment also allows you to work with a logical database. A logical database is a special ABAP program which combines the contents of certain database tables. The flow of a type 1 program is oriented towards reporting, whose main tasks are to read data from the database, process it, and display the results. This is why executable programs (type 1) in the R/3 System are often referred to as reports, and why running an executable program is often called reporting. Since it is not compulsory to define event blocks, you can yourself determine the events to which your ABAP program should react. Furthermore, you can call your own screens or processing blocks at any time, leaving the prescribed program flow. You can use this, for example, to present data in a table on a dialog screen instead of in a list. The simplest executable program (report) contains only one processing block (START-OF-SELECTION). Executable programs do not require any user dialog. You can fill the selection screen using a variant and output data directly to the spool system instead of to a list. This makes executable programs (reports) the means of background processing in the R/3 System. You can also assign a transaction code to an executable program. Users can then start it using the transaction code and not the program name. The reporting-oriented runtime environment is also called when you run a report using a transaction code. This kind of transaction is called a report transaction. It is appropriate to use executable programs (reports) when the flow of your program corresponds either wholly or in part to the pre-defined flow of the runtime environment. Until Release 4.5A, the only way to use a logical database was to use an executable program. However, from Release 4.5A, it is also possible to call logical databases on their own.

Type M : The most important technical attribute of a type M program is that it can only be controlled using screen flow logic. You must start them using a transaction code, whcih is linked to the program and one of its screens (initial screen). Another feature of these programs is that you must define your own screens in the Screen Painter (although the intial screen can be a selection screen). When you start a program using a transaction code, the runtime environment starts a processor that calls the initial screen. This then calls a dialog module in the corresponding ABAP program. The remainder of the program flow can take any form. For example, the dialog module can:  return control to the screen, after which, the processing passes to a subsequent screen. Each screen has a following screen, set either statically or dynamically.  call other sequences of screens, selection screens or lists, from which further processing blocks in the ABAP program are started.  call other processing blocks itself, either internally or externally. call other application programs using CALL TRANSACTION (type M program) or SUBMIT (type 1 program). ABAP programs with type M contain the dialog modules belonging to the various screens. They are therefore known as module pools. It is appropriate to use module pools when you write dialog-oriented programs using a large number of screens whose flow logic largely determines the program flow.

Type F : Type F programs are containers for function modules, and cannot be started using a transaction code or by entering their name directly. Function modules are special procedures that you can call from other ABAP programs. Type F programs are known as function groups. Function modules may only be programmed in function groups. The Function Builder is a tool in the ABAP Workbench that you can use to create function groups and function modules. Apart from function modules, function groups can contain global data declarations and subroutines. These are visible to all function modules in the group. They can also contain event blocks for screens in function modules.

Type K : You cannot start type K programs using a transaction code or by entering the program name. They are containers for global classes in ABAP Objects . Type K programs are known as class definitions. The Class Builder is a tool in the ABAP Workbench that you can use to create
class definitions.

Type J : You cannot start type J programs using a transaction code or by entering the program name. They are containers for global interface in ABAP Objects . Type J programs are known as
interface definitions. Like class definitions, you create interface definitions in the Class Builder.

Type S : You cannot start a type S program using a transaction code or by entering the program name. Instead, they are containers for subroutines, which you can call externally from other ABAP programs. Type S programs are known as subroutine pools. They cannot contain screens.

Type I: Type I programs - called includes - are a means of dividing up program code into smaller, more manageable units. You can insert the coding of an include program at any point in another ABAP program using the INCLUDE statement. There is no technical relationship between include programs and processing blocks. Includes are more suitable for logical programming units, such as data declarations, or sets of similar processing blocks. The ABAP Workbench has a mechanism for automatically dividing up module pools and function groups into include programs.


ABAP - Application Servers

R/3 programs run on application servers. They are an important component of the R/3 System.
The following sections describe application servers in more detail. The individual components are:

1) Work Processes : An application server contains work processes, which are components that can run an application. Each work process is linked to a memory area containing the context of the application being run. The context contains the current data for the application program. This needs to be available in each dialog step. Further information about the different types of work process is contained later on in this documentation.

2) Dispatcher : Each application server contains a dispatcher. The dispatcher is the link between the work processes and the users logged onto the application server. Its task is to receive requests for dialog steps from the SAPgui and direct them to a free work process. In the same way, it directs screen output resulting from the dialog step back to the appropriate user.

3) Gateway : Each application server contains a gateway. This is the interface for the R/3 communication protocols (RFC, CPI/C). It can communicate with other application servers in the same R/3 System, with other R/3 Systems, with R/2 Systems, or with non-SAP systems. The application server structure as described here aids the performance and scalability of the entire R/3 System. The fixed number of work processes and dispatching of dialog steps leads to optimal memory use, since it means that certain components and the memory areas of a work process are application-independent and reusable. The fact that the individual work processes work independently makes them suitable for a multi-procecssor architecuture. The methods used in the dispatcher to distribute tasks to work processes are discussed more closely in the section Dispatching Dialog Steps.

4) Shared Memory : All of the work processes on an application server use a common main memory area called shared memory to save contexts or to buffer constant data locally. The resources that all work processes use (such as programs and table contents) are contained in shared memory. Memory management in the R/3 System ensres that the work processes always address the correct context, that is the data relevant to the current state of the program that is running. A mapping process projects the required context for a dialog step from shared memory into the address of the relevant work process. This reduces the actual copying to a minimum. Local buffering of data in the shared memory of the application server reduces the number of database reads required. This reduces access times for application programs considerably. For optimal use of the buffer, you can concentrate individual applications (financial accounting, logistics, human resources) into separate application server groups.


ABAP - Layers in ABAP

Database Layer The database layer consists of a central database system containing all of the data in the R/3 System. The database system has two components - the database management system (DBMS), and the databse itself. SAP does not manufacture its own database. Instead, the R/3 System supports the following database systems from other suppliers: ADABAS D, DB2/400 (on AS/400), DB2/Common Server, DB2/MVS,INFORMIX, Microsoft SQL Server, ORACLE, and ORACLE Parallel Server. The database does not only contain the master data and transaction data from your business applications, all data for the entire R/3 System is stored there. For example, the database contains the control and Customizing data that determine how your R/3 System runs. It also contains the program code for your applications. Applications consist of program code, screen definitions, menus, function modules, and various other components. These are stored in a special section of the database called the R/3 Repository, and are accordingly called Repository objects. You work with them in the ABAP Workbench.

Application Layer The application layer consists of one or more application servers and a message server. Each application server contains a set of services used to run the R/3 System. Theoretically, you only need one application server to run an R/3 System. In practice, the services are distributed across more than one application server. This means that not all application servers will provide the full range of services. The message server is responsible for communication between the application servers. It passes requests from one application server to another within the system. It also contains information about application server groups and the current load balancing within them. It uses this information to choose an appropriate server when a user logs onto the system.

Presentation Layer
The presentation layer contains the software components that make up the SAPgui (graphical user interface). This layer is the interface between the R/3 System and its users. The R/3 System uses the SAPgui to provide an intuitive graphical user interface for entering and displaying data. The presentation layer sends the user’s input to the application server, and receives data for display from it. While a SAPgui component is running, it remains linked to a user’s terminal session in the R/3 System. This software-oriented view can be expanded to include further layers, such as an Intenet Transaction Server (ITS).


ABAP - The R/3 Basis System: Overview

The R/3 Basis system is the platform for all other applications (financial accounting, logistics,
human resources management) in the R/3 System. This documentation explains just what the Basis system is, and how it ties in with the R/3 System as a whole. It starts by introducing the Basis system in general. The second part concentrates on one central component - the application server. Finally, it will explain about work processes, which are components of the application server.

Position of the Basis System Within the R/3 System :
The following sections describe three different views of the R/3 System, which show the role of
the Basis system.

Logical View : The difference between the logical view and a hardware- or software-based view is that not all of the above components can be assigned to a particular hardware or software unit. The above diagram shows how the R/3 Basis system forms a central platform within the R/3 System. Below are listed the tasks of the three logical components of the R/3 Basis system.

Kernel and Basis Services :
The kernel and basis services component is a runtime environment for all R/3 applications that is hardware-, operating system- and database-specific. The runtime environment is written
principally in C and C++. However, some parts are also written in ABAP. The tasks of the kernel
and basis services component are as follows:

Running applications
All R/3 applications run on software processors (virtual machines) within this component. User and process administration. An R/3 System is a multi-user environment, and each user can run several independent applications. In short, this component is responsible for the tasks that usually belong to an Position of the Basis System Within the R/3 System 22 April 2001 operating system. Users log onto the R/3 System and run applications within it. In this way, they do not come into contact with the actual operating system of the host. The R/3 System is the only user of the host operating system.  Database access Each R/3 System is linked to a database system, consisting of a database management system (DBMS) and the database itself. The applications do not communicate directly with the database. Instead, they use Basis services.

Communication

R/3 applications can communicate with other R/3 Systems and with non-SAP systems. It isalso possible to access R/3 applications from external systems using a BAPI interface. The services required for communication are all part of the kernel and basis services component.

System Monitoring and Administration
The component contains programs that allow you to monitor and control the R/3 System while it is running, and to change its runtime parameters.

ABAP Workbench
The ABAP Workbench component is a fully-fledged development environment for applications
in the ABAP language. With it, you can create, edit, test, and organize application developments.
It is fully integrated in the R/3 Basis system and, like other R/3 applications, is itself written in
ABAP.

Presentation Components : The presentation components are responsible for the interaction between the R/3 System and the user, and for desktop component integration (such as word processing and spreadsheets).

Software-oriented View : The following illustration represents a software-oriented view of the R/3 System. The softwareoriented view describes the various software components that make up the R/3 System. In the software-oriented view, all of the SAPgui components and application servers in the R/3 System make up the R/3 Basis system

The R/3 Basis system is a multi-tier client/server system. The individual software components are arranged in tiers and function, depending on their position, as a client for the components below them or a server for the components above them.

Thursday, May 8, 2008

ABAP - What is ABAP

ABAP the Advanced Business Application Programming is a programming language for developing (to tailor and enhance SAP applications) applications for the SAP R/3 system. ABAP is one of many application-specific fourth-generation languages (4GLs) first developed in the 1980s. By 2001, all but the most basic functions were written in ABAP. In 1999, SAP released an object-oriented extension to ABAP called ABAP Objects, along with R/3 release 4.5.

ABAP/4 is the language created by SAP AG for implementation and customization of their R/3 system. The rough English translation of the acronym would be A Business Application Programming language, version 4. It is a block-structured language.

ABAP/4 contains some highly report-oriented event-driven control structures.