ERP Database - The Unofficial ERP Knowledge Base

Facebook Twitter del.icio.us Digg it
ERP Database contains a huge collection of articles related to ERP System and Software. Many of the articles are specifically related to SAP. All these ERP/SAP articles are freely available to everyone.

If you would like to submit an article or share any document related to ERP or any specific ERP software. Please mail it to support@erpdb.info. Please make sure that the documents are not copyrighted.
Social Bookmarks:

Archive for October, 2007

APPEND: ABAP Keyword a day

Print This Post Email This Post Written by admin on Oct 31st, 2007 | Filed under: ABAP Keywords

APPEND

Variants:
1. APPEND [wa TO|INITIAL LINE TO] itab.
2. APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.
3. APPEND [wa TO] itab SORTED BY f.

Variant 1
APPEND [wa TO|INITIAL LINE TO] itab.
Appends a new line to the end of the internal table itab. If you specify wa TO, the new line is taken from the contents of the explicitly specified work area wa.
If you use INITIAL LINE TO, a line filled with the correct value for the type is added. If the specification before itab is omitted, the new line is taken from the internal tbale itab. After the APPEND, the system field SY-TABIX contains the index
of the newly added table entry.

Examples
Generate a list with customer numbers:
TABLES SCUSTOM.
DATA: CUSTOMER LIKE SCUSTOM-ID OCCURS 0.

APPEND SCUSTOM-ID TO CUSTOMER.

Append a blank line or a line with its initial value to the above list:

APPEND INITIAL LINE TO CUSTOMER

Generate a compressed list with plane data

PARAMETERS: SEATS_LO LIKE SAPLANE-SEATSMAX DEFAULT 30,
SEATS_HI LIKE SAPLANE-SEATSMAX DEFAULT 50.

DATA: PLANE LIKE SAPLANE OCCURS 0,
PLANE_NEEDED LIKE SAPLANE WITH HEADER LINE.

LOOP AT PLANE INTO PLANE_NEEDED
WHERE SEATSMAX BETWEEN SEATS_LO AND SEATS_HI.

APPEND PLANE_NEEDED.

ENDLOOP.

Notes Performance:
1. When using internal tables with a header line, avoid unnecessary assignments to the header line. Whenever possible, use statements which have an explicit work area.

For example, “APPEND wa TO itab.” is approximately twice as fast as “itab = wa. APPEND itab.”. The same applies to COLLECT and INSERT.

2. In contrast to COLLECT, APPEND does not check whether an entry with the same default key exists. Therefore, it is considerably faster than COLLECT. If the COLLECT logic is not needed or lines with an identical default key cannot occur in a particular situation, you should always use APPEND instead of COLLECT.

3. The runtime required for APPEND increases with the line width of the table and depends on the number of fields. Appending an entry to an internal table with a width of 111 bytes takes about 9 msn (standardized microseconds).

4. To append an internal table to another internal table, you should use the variant APPEND LINES OF … which is 3 to 4 times faster than using a LOOP to process the source table and append the entries line-by-line to the target table.

Variant 2
APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.

Effect Appends the internal table itab1 or an extract from itab1 to the end of the internal table itab2. By specifying FROM idx1 or TO idx2 you can restrict the line area taken from the source table itab1. If there is no FROM specification, it begins with the first line of itab1. If there is no TO specification, it ends with the last line of itab1. This means that the complete table is appended if neither a FROM nor a TO is specified.

After the APPEND, the system field SY-TABIX contains the index of the last table entry appended, i.e. the total number of entries from both tables.

Note By comparing the values of SY-TABIX before and after the APPEND statement, you can determine how many lines were appended to the table.

Example Merge two tables with whole numbers:

DATA: ITAB1 TYPE I OCCURS 100,
ITAB2 TYPE I OCCURS 100.

APPEND 2 TO ITAB1.
APPEND 3 TO ITAB1.
APPEND 5 TO ITAB1.
APPEND 7 TO ITAB1.
APPEND 3 TO ITAB2.
APPEND INITIAL LINE TO ITAB2.
APPEND LINES OF ITAB1 FROM 2 TO 20 TO ITAB2.

The table ITAB2 now contains five lines with the values 3, 0, 3, 5 and 7.

Note Performance:
This variant is 3 to 4 times faster than using a LOOP to process the source table and append the entries line-by-line to the target table.

Variant 3
APPEND [wa TO] itab SORTED BY f.

Effect Inserts the new entry into table and re-sorts the table by the sub-field f in descending order. This only makes sense if the table was sorted beforehand. When the number of table entries reaches the OCCURS parameter value, the last entry is deleted if the value f of a new entry is greater (particularly suitable for ranked lists). You can only sort by one sub-field.
If you specify wa TO, the new line is taken from the contents of the explicitly specified work area wa. Otherwise, it comes from the header line of the internal table itab.

Example
DATA: BEGIN OF COMPANIES OCCURS 3,
NAME(10), SALES TYPE I,
END OF COMPANIES.

COMPANIES-NAME = ‘big’.

COMPANIES-SALES = 90.
APPEND COMPANIES.

COMPANIES-NAME = ‘small’.

COMPANIES-SALES = 10.
APPEND COMPANIES.

COMPANIES-NAME = ‘too small’.
COMPANIES-SALES = 5.

APPEND COMPANIES.

COMPANIES-NAME = ‘middle’.
COMPANIES-SALES = 50.
APPEND COMPANIES SORTED BY SALES.

The table now has three (-> OCCURS 3) entries. The line with the contents ‘too small’ in the sub-field NAME is deleted from the table because the entry for ‘middle’ has a greater value in
the sub-field SALES. This entry now appears in the second table line (after ‘big’ and before ‘small’).

Notes
1. Whenever an internal table is processed with APPEND SORTED BY, it should always be filled in this way.
2. If you specify APPEND with the parameter SORTED BY, the system always searches the entire table. Therefore, it is sometimes better to create the table with a simple APPEND
and then use SORT to sort in descending ot ascending order afterwards. You can also sort in ascending order by first determining the insert position with READ TABLE itab WITH KEY f = itab-f BINARY SEARCH and then by inserting the new entry into the table (perhaps read SY-SUBRC beforehand) with INSERT itab INDEX SY-TABIX. However, you should be aware that, in such cases, the table may contain more entries than specified in the OCCURS
parameter.
3. If several lines with an identical value f are added, lines added later are treated as smaller, i.e. they are inserted after existing lines with the same value f.
4. If you use APPEND … SORTED BY f with an explicitly specified work area, this must be compatible with the line type of the internal table.
5. If the sort criterion f is not known until runtime, you can use SORTED BY (name) to specify it dynamically as the contents of the field name. If name is blank at runtime or contains an invalid component name, a runtime error occurs.
6. Regardless of whether you specify it statically or dynamically, you can restrict the sort criterion f further by defining an offset and/or length.

Related
COLLECT itab, INSERT itab, SELECT / FETCH NEXT CURSOR … INTO/APPENDING TABLE itab, MODIFY itab, WRITE f TO itab INDEX idx, SORT itab, READ TABLE itab, LOOP AT itab, DELETE itab

ASS-RPERF is not an ABAP/4 key word (in R/3).

———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info


More ABAP Technical Interview Questions

Print This Post Email This Post Written by admin on Oct 31st, 2007 | Filed under: FAQs

ABAP Technical Interview Questions(1-103)

1. What is the typical structure of an ABAP program?
2. What are field symbols and field groups.? Have you used “component idx of structure” clause with field groups?
3. What should be the approach for writing a BDC program?
4. What is a batch input session?
5. What is the alternative to batch input session?
6. A situation: An ABAP program creates a batch input session. We need to submit the program and the batch session in background. How to do it?

7. What is the difference between a pool table and a transparent table and how they are stored at the database level.
8. What are the problems in processing batch input sessions? How is batch input process different from processing on line?
9. What do you define in the domain and data element.
10. What are the different types of data dictionary objects?
11. How many types of tables exists and what are they in data dictionary?
12. What is the step by step process to create a table in data dictionary?
13. Can a transparent table exist in data dictionary but not in the data base physically?
14. What are the domains and data elements?
15. Can you create a table with fields not referring to data elements?
16. What is the advantage of structures? How do you use them in the ABAP programs?
17. What does an extract statement do in the ABAP program?
18. What is a collect statement? How is it different from append?
19. What is open sql vs native sql?
20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
21. What is the meaning of ABAP editor integrated with ABAP data dictionary?
22. What are the events in ABAP language?
23. What is an interactive report? What is the obvious diff of such report compared with classical type reports?
24. What is a drill down report?
25. How do you write a function module in SAP? describe.
26. What are the exceptions in function module?
27. What is a function group?
28. How are the date abd time field values stored in SAP?
29. What are the fields in a BDC_Tab Table.
30. Name a few data dictionary objects?
31. What happens when a table is activated in DD?
32. What is a check table and what is a value table?
33. What are match codes? describe?
34. What transactions do you use for data analysis?
35. What is table maintenance generator?
36. What are ranges? What are number ranges?
37. What are select options and what is the diff from parameters?
38. How do you validate the selection criteria of a report? And how do you display initial values in a selection screen?
39. What are selection texts?
40. What is CTS and what do you know about it?
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?
42. What is the client concept in SAP? What is the meaning of client independent?
43. Are programs client dependent?
44. Name a few system global variables you can use in ABAP programs?
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?
46. How do you take care of performance issues in your ABAP programs?
47. What are datasets?
48. How to find the return code of a stmt in ABAP programs?
49. What are interface/conversion programs in SAP?
50. Have you used SAP supplied programs to load master data?
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?
53. What specific statements do you using when writing a drill down report?
54. What are different tools to report data in SAP? What all have you used?
55. What are the advantages and disadvantages of ABAP query tool?
56. What are the functional areas? User groups? and how does ABAP query work in relation to these?
57. Is a logical database a requirement/must to write an ABAP query?
58. What is the structure of a BDC sessions.
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?
61. What do you do with errors in BDC batch sessions?
62. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
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?
66. What is a currency factoring technique?
67. How do you document ABAP programs? Do you use program documentation menu option?
68. What is SAPscript and layout set?
69. What are the ABAP commands that link to a layout set?
70. What is output determination?
71. What are IDOCs?
72. What are screen painter? menu painter? Gui status? ..etc.
73. What is screen flow logic? What are the sections in it? Explain PAI and PBO.
74. Overall how do you write transaction programs in SAP?
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?
77. Is ABAP a GUI language?
78. Normally how many and what files get created when a transaction program is written? What is the XXXXXTOP program?
79. What are the include programs?
80. Can you call a subroutine of one program from another program?
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?
84. How do you find if a logical database exists for your program requrements?
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?
86. How do you find the menu path for a given transaction in SAP?
87. What are the different modules of SAP?
88. What is IMG in SAP?
89. How do you get help in ABAP?
90. What are different ABAP editors? What are the differences?
91. What are the different elements in layout sets?
92. Can you use if then else, perform ..etc statements in sap script?
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?
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?
99. In an ABAP program how do you access data that exists on a presentation server vs on an application server?
100. What are different data types in ABAP?
101. What is difference between BDC and Call Transaction?
102. Setting up a BDC program where you find information from?
103. What has to be done to the packed fields before submitting to a BDC session.

Source: Yahoo ABAP Forum
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info


Source Code: Working with database tables and internal tables

Print This Post Email This Post Written by admin on Oct 31st, 2007 | Filed under: ABAP Programs

REPORT ZSOURCE0103.

* Declaration of a work area for a Dictionary table
TABLES CUSTOMERS.

* Internal table used as snapshot of the database table
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
WITH HEADER LINE.

* Reading the entries of the database table into an internal table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.

* Displaying each line of an internal table
LOOP AT ALL_CUSTOMERS.
WRITE: / ALL_CUSTOMERS-NAME.
ENDLOOP.
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info


ADD-CORRESPONDING : ABAP Keyword a day

Print This Post Email This Post Written by admin on Oct 30th, 2007 | Filed under: ABAP Keywords

ADD-CORRESPONDING

Basic form ADD-CORRESPONDING rec1 TO rec2.

Effect Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header lines. Searches for all sub-fields which occur both in rec1 and rec2 and then, for all relevant field pairs corresponding to the sub-fields ni, generates statements of the form

ADD rec1-ni TO rec2-ni.

The other fields remain unchanged. With complex structures, the complete names of the corresponding field pairs must be textually identical.

Example
DATA: BEGIN OF VECTOR,
X TYPE I,
Y TYPE I,
LENGTH TYPE I,
END OF VECTOR,
BEGIN OF CIRCLE,
VOLUME TYPE P
Y TYPE P,
RADIUS TYPE I,
X TYPE I,
END OF CIRCLE.


ADD-CORRESPONDING VECTOR TO CIRCLE.

The sub-fields X and Y occur in both the field strings VECTOR and CIRCLE. Therefore, the ADD-CORRESPONDING statement is equivalent to both the following statements:

ADD VECTOR-X TO CIRCLE-X.
ADD VECTOR-Y TO CIRCLE-Y.

Note All fields with the same name are added, whether numeric or not. The same conversions are performed as with ADD and similar runtime errors to those possible with ADD can also occur.

Related ADD-CORRESPONDING :

MOVE-CORRESPONDING
SUBTRACT-CORRESPONDING
MULTIPLY-CORRESPONDING
DIVIDE-CORRESPONDING

ADD-SELECTIVE is not an ABAP/4 key word (in R/3).

———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info


ABAP Interview Questions

Print This Post Email This Post Written by admin on Oct 30th, 2007 | Filed under: FAQs

ABAP/4 INTERVIEW QUESTIONS(1-139)

1 What is sap R/3 ?
2 What are the programming standards followed ?
3 What are the contents in technical specifications ?
4 What is an instance ?
5 How to take care of performance in ABAP Development ?
6 What is Function group ? Difference between function group and function module?
7 What is the difference between ‘Select single * ‘ and ‘Select upto 1 rows’?
8 What Function does data dictionary perform ?
9 Difference between domain and data element ? what are aggregate object ?

10 what is view ? Different types of view ? explain ?
11Can u print decimals in type n ? what is difference between float and packed data type?
12 What is step-loop ? explain all the steps ?
13 What is the initial value and maximum length of all data type ?
14 What are the ways to find out the tables used in the program ?
15 Can you have two detail lists from the basic list at the same time ? if yes how and if no why?
16 What are the different functions used in sapscript ? What are the parameters used in function?
17 What is sequence of event triggered in report?
18 What are standard layout sets in the SAP Script?
19 What function module upload data from application server ?
20 What are the various types of selection screen event?
21 What do you know about a client ?
22 What are the system fields ? Explain ?
23 What is sapscript ? what is the purpose of sapscript? difference between sapscript and report?
24 what is the use of occurs in internal table ? can u change occurs value in program?
25 Difference between sy-tabix and sy-index.? where its used ? can u check sy-subrc after perform?
26 Difference between upload And ws_upload?

27 Why did u switch to SAP ?
28 What is a Logical Database ?
29 What are the events used for Logical Database ?
30 What is the difference between Get and Get Late ?
31 What are the Types Of Internal Tables ?
32 What are the events used in ABAP in the order of execution ?
33 What are Interactive Reports ?
34What are the commands used for interactive reports ?
35 What are the system fields u have worked with ? Explain ?
36 What is the difference between Primary key and Unique Key ?
37 What are the types of Internal Tables ?
38 If u are using Logical Databases how will u modify the selection-screen elements ?
39 What is an RFC ?
40 If u are using RFC and passing values to a remote system how does it work ?
41 What are the events in Screen Programming ?
42 What is the significance of HIDE ?
43 Where do u code the HIDE statement ?
44 Types of BDC’s ?
45 Advantages & Disadvantages of different types of BDC’s ?
46 What are the events used in Interactive Reports.
47 What is an RDBMS ?
48 What standards u use to follow while coding ABAP programs ?
49 What will you code in START-OF-SELECTION & END-OF-SELECTON & why ?
50 What are joins and different types joins ?
51 Which is the default join ?
52 How do u display a data in a Detail List ?
53 What are the types of windows in SAPSCRIPT ?
54 What are the function modules used in a SAPSCRIPT driver program ?
55 What are Extracts ?
56 How would u go about improving the performance of a Program which selects data from MSEG & MKPF ?
57 How does System work in case of a Interactive Report ?
58 what is LUW?
59 Different types of LUWs. What r they.
60 What is First event triggered in program?
61What are various Joins? What is right outer join ?
62How do u find out whether a file exits on the presentation server? – eps_get_directory_listing for directory
64. Systems fields used – normal + interactive
65. Logo in SAPscript
66. If internal table used in for all entries in empty then what happens
67. If I forgot some command in sapscript eg: suppress zero display – How to do find it?
68. Have to write a BDC – how do u go about it?
69. What is Performance tuning
70. Define Documentation
71. Brief about Testing of programs
72. How do u move on to the next screen in interactive reporting?
73. Create any functions? How to go about it.
74. Advanced topics?
75. Function modules used in f4 help.
76. Work most on which module : Name a few tables.
77. System fields used , system table
78. From a table how do u find whether a material is used in another material BOM?
79. SAPscript layout used.
80. How u used logical database? How is data transferred to program? Corresponding statement in LDB
81. How do u suppress fields on selection screen generated by LDB?
82. Can there be more than 1 main window ?
83. Global and local data in function modules.

84. What are the differences between sap memory and abap memory
85 What are differences between At selection-screen and
at selection-screen output
86. What are the events?
87. what are the interactive events
88. What is Hide?
89. What is the difference between occurs 1 and occurs 2?
90. What is the difference between Free and Refresh?
91. What are elements?
92. Can we have more than one selection-screen and how?
93. How to declare select-option as a parameter?
94. How can u write programmatically value help to a field without using search help and match codes.?
95. What is RFC?
96. How to set destination?
97. What are the function module types?
98. What are tables?
99. what are client-dependant tables and independent tables?
100. how to distinguish them?
101. what is the use of Table maintanance allowed?
102. What are the domains?
103 What are the check tables and value tables?
104 What is the difference between table and structures?
105 How to declare one internal table with out header line without using structures ?
106. what are lock objects?
107. What are datasets? what are the different syntaxes?
108. What is the differences between we_upload and upload?
109. What is the difference between open_form and close_form
110. What are the page windows? How many main windows will be there in a page window?
111. How to include Logo in your layout?
112. How to debugg a script?
113. Tell me different standard layouts which we use?
114. sapscripts and abap programs are client dependent or not? why?
115. what are the different internal tables ? explain them?
116. what is runtime analysis ?
117. what is the difference between select single * and select * upto one row
118. what is the difference between sum and collect?
119. what are session method and call transaction method and explain about them?
120. If you have 10000 records in your file, which method you use in BDC?
130. what are different modes and explain them?
131. what are control events in a loop?
132. what are the events we use in dialog programming? and explain them?
133. what are the differences between se01 , se09 and se10?
134. what is the inside concept in select-options?
135. what is client?
136. what is get cursor field?
137. what is read line?
138. what are the difference between call screen and leave screen?
139. what is the transaction code for Table maintenance?

Well… you know where to search for answers… hint.. hint… :-) (http://www.erpdb.info)
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info