Sie sind auf Seite 1von 442

Beginner’s Guide to ALE

and IDocs – a step-by-step


approach
By Riyaz | Published: January 19, 2008

This article will help you understand the basics of ALE and
IDocs via a simple do-it-yourself example. We will create a custom IDoc in one SAP
system and then post some business data through it to another SAP system. Business
data will be picked up from custom data dictionary tables.

ALE – Application Link Enabling is a mechanism by which SAP systems


communicate with each other and with non-SAP EDI subsystems. Thus it helps
integration of distributed systems. It supports fail-safe delivery which implies that
sender system does not have to worry about message not reaching the source due to
unavoidable situations. ALE can be used for migration and maintenance of master
data as well as for exchanging transactional data.

The messages that are exchanged are in the form of IDocs or Intermediate
Documents. IDocs act like a container or envelope for the application data. An
IDOC is created as a result of execution of an Outbound ALE. In an Inbound ALE
an IDOC serves as an input to create application document. In the SAP system
IDocs are stored in the database tables. They can be used for SAP to SAP and SAP
to non-SAP process communication as long as the participating processes can
understand the syntax and semantics of the data. Complete documentation on
IDOC is obtained by using transaction WE60.

Every IDoc has exactly one control record along with a number of data records and
status records. Control record has the details of sender/receiver and other control
information. Data records contain the actual business data to be exchanged while
the status records are attached to IDoc throughout the process as the IDoc moves
from one step to other.

Now, let us understand the ALE Configuration by means of an example scenario


below:

The Scenario

Data from custom tables (created in customer namespace) is to be formatted into an


IDoc and sent from one SAP R/3 system to another using ALE service. We need to
have two instances of SAP R/3 systems or we can simulate this on two clients of the
same SAP R/3 system.
Create three tables as shown below.

Creating Custom IDoc type and Message type


All the objects created should be present on both source as well as target system(s).

1. Create segments – Transaction WE31

• Create a segment ZRZSEG1


• Add all fields of table ZCUSTOMERS to it
• Save the segment
• Release it using the menu path Edit -> Set Release
• Similarly create two more segments given below
• Seg. ZRZSEG2 – to hold all fields of table ZSOHEADERS
• Seg. ZRZSEG3 – to hold all fields of table ZSOITEMS

2. Create Basic IDoc type – Transaction WE30


• Create a Basic type ZRZORDER
• Add the created segments in the hierarchy shown
• Maintain attributes for each of the segments
• Save the object and go back
• Release the object using the menu path Edit -> Set Release

3. Create/Assign Message type – Transactions WE81/WE82

• Go to WE81
• Create a new Message type ZRZSO_MT
• Save the object
• Go to WE82 and create new entry
• Assign the message type ZRZSO_MT to the basic type ZRZORDER
• Also specify the Release Version
• Save the object

Thus we have defined the IDoc structure which will hold the data to be transferred.
In the next part of the article we will understand the outbound settings, i.e. the
settings to be done in the source system.
Archive for the ‘ABAP’ Category

Object Oriented ABAP (OOABAP) – FAQs


Written by admin on Jul 7th, 2010 | Filed under: ABAP, FAQs

Here are some of the questions which you must know, when you say that you are
good in Object Oriented Programming in SAP ABAP.

1. Priniples of oops?
2. What is difference between procedural & OO Programming?
3. What is class?
4. What is object?
5. Can we instantiate a class within implementation of other class?
6. What is deferred key word ?
7. How we can refer to a class without defining it?
8. Can we put non declarative statement e.g. START-OF-SELECTION within a
class
9. What is static attribute & method?
Continue Reading …

Comments (0) Get FREE daily updates by RSS or e-mail

Understanding and Working with BAPI’s


Written by admin on Jul 6th, 2010 | Filed under: ABAP

A Business Application Programming Interface is a precisely defined interface


providing access process and data in Business Applications Systems Such as SAP.

What are the Benefits of BAPI

• Can be used in diverse languages / Development Environments(ABAP,


Visual Basic, Java, C++, etc.)
• Can be called from diverse platforms (COM, CORBA, Unix)
• Reduced development cost
• Reduced maintenance cost
• “Best-of-both-worlds” approach
• Rich functionality of the R/3 system
• User-specific front-ends

Steps involved in Creation of BAPI’s

1. Defining BAPI Data structures in SE11


2. Program a RFC enabled BAPI function module for each method
3. Create a Business object for the BAPI in the BOR
4. Documentation of the BAPI
5. Generate ALE interface for asynchronous BAPIs
6. Generate and release

Need more info? Download the 40 Page document on working with BAPI’s ->
Working with BAPI\'s (71)

Comments (0) Get FREE daily updates by RSS or e-mail

Difference between Master Data, Transaction Data and


Customizing Data
Written by admin on May 18th, 2010 | Filed under: ABAP, SAP General

Customizing Data refers to the customized information for a particular Client. This
includes data such as payment terms, discounts, pricing, tolerance limits, etc., which
you do not normally change on a day-to-day basis.

Transaction Data is the day-to-day recording of business information such as


purchase orders, sales returns, invoices, payments, collections, etc. This includes
both system-generated data (tax, discount, etc., automatically calculated by the
system during document posting) as well as user generated data.

Master Data is the control information required to decide how transaction data gets
posted into various accounts (such as customers, vendors, GL, etc.). The master data
is usually shared across modules (for example, customer master records are
common both to FI and SD in SAP) obviating the need for defining it in various
application areas. The master data remains in the system for fairly a long period.
Archive for the ‘ABAP’ Category

Purpose of Modification Assistant


Written by admin on Apr 10th, 2010 | Filed under: ABAP

The Modification Assistant is the tool that offers you support when making
modifications to the standard, by branching to a special modification mode
whenever you are modifying objects from the standard in an ABAP workbench
editor. Originals are initially protected in this mode and can only be changed with
the help of the additional pushbuttons that are placed at your disposal. All changes
that you make to the system are logged with the help of the Modification Assistant.
This provides you with a detailed overview of modifications that is easy to read and
that dramatically reduces the amount of effort needed to upgrade your system.

The Modification Assistant offers support in the following areas:

• ABAP Editor
• Class Builder
• Screen Painter
• Menu Painter
• Text Element maintenance
• Function Builder
• ABAP Dictionary

If an object can be edited using the Modification Assistant, a dialogue box appears
the first time that you attempt to edit that object informing you that editing
functions are limited in modification mode. This dialogue box appears exactly once
per user for each of the various kinds of transport objects.

Comments (0) Get FREE daily updates by RSS or e-mail

Difference betwen Screen Painter and Menu Painter


Written by admin on Apr 9th, 2010 | Filed under: ABAP

Screen Painter is an ABAP Workbench tool used to create or modify the screens for
your transactions. The screen painter allows you to make modifications to screen
attributes, the flow control logic, or the layout.
Menu Painter is a tool used to design the interface components. Status, Menu Bars,
Menu Lists, F-key settings, Functions, and Titles are the components of Menu
Painter.

Comments (0) Get FREE daily updates by RSS or e-mail

What is SAP Script? What are the componets in SAP Script?


Written by admin on Apr 8th, 2010 | Filed under: ABAP, SAP Scripts

SAPscript is the SAP Systems own text-processing system which is used to generate
documents containing logos, tables and other objects and which look like a pre-
printed documents. SAPscript is tightly integrated and used for many text-
processing tasks. SAP Standard Styles and Layout Sets are always held in Client
000.

Layout Sets are used for the Page Layout of SAPscript documents. A layout set has
the following elements:

• Header Data: Data related to development (created by, development class,


etc.) and the layout set information (which elements are used) are both stored
in the header data. A start page must be entered here.
• Paragraph Formats: Paragraph formats are required in layout sets.
However, they are also used for word processing in layout sets, for example,
to format text elements.
• Character Formats: You can also use character formats to format texts or
paragraphs. Unlike paragraph formats, however, they are used to format
text within a paragraph.
• Windows: Windows are names and window types, which are not physically
positioned until they are allocated to pages and units of measurement are
specified.
• Pages: Pages are defined to provide the system with a start and end point in
text formatting.
• Page Windows: Page windows are the combination of windows and pages,
where the dimensions of a window and its position on a page are specified.

Comments (0) Get FREE daily updates by RSS or e-mail

What is SAP Query or ABAP Query?


Written by jimstex on Apr 7th, 2010 | Filed under: ABAP

ABAP Query (also known as an SAP Query or Query) is a powerful tool used to
generate simple reports without any coding. Typically, an ABAP query is created
first by defining a User Group and a Functional Group. The functional group can
either be created with reference to a logical table or a database table. Once the
functional group is defined, the user group is assigned to the functional group. The
last step is to create the query on the functional group that is generated.

An ABAP Query can be used to create the following three types of reports:

• Basic Lists: Reports with basic formatting without any calculated fields.
• Statistics: Reports with statistical functions such as average, percentages, etc.
• Ranked Lists: Ranked lists are used for analytical purposes.

Comments (0) Get FREE daily updates by RSS or e-mail

What is SAP Dynpro


Written by jimstex on Apr 6th, 2010 | Filed under: ABAP

DynPro in SAP refers to Dynamic Programming relating to the screens and flow
logic, which controls the processing and display of these screens. On a broader scale,
a screen is also referred to as a DynPro.
Archive for the ‘ABAP’ Category

What is an RFC?
Written by admin on Apr 5th, 2010 | Filed under: ABAP

A Remote Function Call (RFC) is a call to a function module running in a system


different from the calling-system. The remote function can also be called from
within the same system (as a remote call), but usually the calling-system and the
called-system will be in different systems.

An RFC helps to take care of the following communication:

• Communications between two independent SAP systems.


• Client-server communications between an external Client and an SAP system
acting as the server.
• Client-server communications between an SAP System acting as the Client
and an external server.

Comments (0) Get FREE daily updates by RSS or e-mail

What is BDC Programming in SAP?


Written by admin on Apr 3rd, 2010 | Filed under: ABAP

BDC (Batch Data Conversion) is an automated procedure for transferring large


volumes of external or legacy data into the SAP system using batch input
programming. There are three ways to do this:

• Call Transaction Method


• Session Method
• Direct Input Method

Irrespective of the method, the techniques use the following steps:


o Identify the screens of the transaction that the program will process.
o Write a program to build the BDC table that will be used to submit the data (i.e.,
text file) to SAP.
o Submit the BDC table to the system in the ‘batch mode’ or as a ‘single
transaction’ by the CALL TRANSACTION command.
The Call Transaction method cannot be used when you want to process multiple
transactions. Instead, use the BDC-insert function to achieve this.

Comments (0) Get FREE daily updates by RSS or e-mail

What are Internal Tables?


Written by admin on Apr 2nd, 2010 | Filed under: ABAP

Internal Tables are standard data type objects which exist only during the Runtime
of an ABAP program. They are used to perform table calculations on subsets of
database tables and for re-organizing the contents of database tables according to a
user’s need. Internal tables fulfill the need for arrays in ABAP.

There are three types of internal tables:

• Standard Tables with a ‘linear’ index. The key is always ‘non-unique.’


• Sorted Tables with either a ‘unique’ or ‘non-unique’ key.
• Hashed Tables (they do not have a linear index) with the key defined always
as ‘unique.’

Comments (0) Get FREE daily updates by RSS or e-mail

Different types of ABAP Programs


Written by admin on Apr 1st, 2010 | Filed under: ABAP

There are nine types of ABAP Programs in SAP:

• 1 Executable Programs (ABAP Reports)


• I INCLUDE Program
• M Module Pool/Dialogue programs
• S Sub-Routine Pool
• J Interface Pool
• K Class Pool
• T Type Pool
• F Function Group
• X XSLT Program

Comments (0) Get FREE daily updates by RSS or e-mail


Purpose of Drilldown or interactive report
Written by admin on Apr 1st, 2010 | Filed under: ABAP

A Drill-Down Report, also called an Interactive Report, is a report with more detail.
Imagine that you are looking at a Balance Sheet, presented as a drill-down report.
The topmost list, also known as the Basic List, contains the top-level information
such as current assets, fixed assets, etc., under the grouping assets on one side of the
Balance Sheet. The drill-down functionality helps you select a line item from the
Basic List (e.g., fixed assets) and drill-down further to a detailed list (secondary list)
which displays various components of the fixed assets such as land, buildings,
machinery, etc. You may drill-down even further by double clicking the building
line, which will bring up the next detailed list and so on.

You will be able to create a drill-down report with a maximum drill level of 20; that
is, including the Basic List you will have a total of 21 levels in a single drill-down
report.
1. If a table does not have MANDT as part of the primary key, it is ____.

A: A structure
B: Invalid
C: Client-independent
D: Not mandatory

2. In regard to CALL, which of the following is NOT a valid statement?

A: CALL FUNCTION
B: CALL SCREEN
C: CALL TRANSACTION
D: CALL PROGRAM

3. Name the type of ABAP Dictionary table that has these characteristics:

Same number of fields as the database table


Same name as database table
Maps 1:1 to database table

A: Pooled
B: Cluster
C: Transparent
D: View

4. An event starts with an event keyword and ends with:

A: Program execution.
B: END-OF-EVENT.
C: Another event keyword.
D: END-EVENT.

5. What is the system field for the current date?

A: SY-DATUM
B: SY-DATE
C: SY-DATID
D: SY-SDATE

6. The following code indicates:

SELECT fld1 fld2 FROM tab1 APPENDING TABLE itab


WHERE fld1 IN sfld1.

A: Add rows to the existing rows of itab.


B: Add rows to itab after first deleting any existing rows of itab.
C: Select rows from tab1 for matching itab entries.
D: Nothing, this is a syntax error.

7. You may change the following data object as shown below so that it equals 3.14.

CONSTANTS: PI type P decimals 2 value ’3.1′.


PI = ’3.14′.

A: True
B: False

8. The SAP service that ensures data integrity by handling locking is called:

A: Update
B: Dialog
C: Enqueue/Dequeue
D: Spool

9. Which of these sentences most accurately describes the GET VBAK LATE.
event?

A: This event is processed before the second time the GET VBAK event is
processed.
B: This event is processed after all occurrences of the GET VBAK event are
completed.
C: This event will only be processed after the user has selected a basic list row.
D: This event is only processed if no records are selected from table VBAK.

10. Which of the following is not a true statement in regard to a hashed internal
table type?

A: Its key must always be UNIQUE.


B: May only be accessed by its key.
C: Response time for accessing a row depends on the number of entries in the table.
D: Declared using internal table type HASHED TABLE.
11. TO include database-specific SQL statements within an ABAP program, code
them between:

A: NATIVE SQL_ENDNATIVE.
B: DB SQL_ENDDB.
C: SELECT_ENDSELECT.
D: EXEC SQL_ENDEXEC.

12. To measure how long a block of code runs, use the ABAP statement:

A: GET TIME .
B: SET TIME FIELD .
C: GET RUN TIME FIELD .
D: SET CURSOR FIELD .

13. When a secondary list is being processed, the data of the basic list is available by
default.

A: True
B: False

14. Given:

DATA: BEGIN OF itab OCCURS 10,


qty type I,
END OF itab.

DO 25 TIMES. itab-qty = sy-index. APPEND itab. ENDDO.

LOOP AT itab WHERE qty > 10.


WRITE: /1 itab-qty.
ENDLOOP.

This will result in:

A: Output of only those itab rows with a qty field less than 10
B: Output of the first 10 itab rows with a qty field greater than 10
C: A syntax error
D: None of the above

15. After a DESCRIBE TABLE statement SY-TFILL will contain

A: The number of rows in the internal table.


B: The current OCCURS value.
C: Zero, if the table contains one or more rows.
D: The length of the internal table row structure.
16. You may declare your own internal table type using the TYPES keyword.

A: True
B: False

17. After adding rows to an internal table with COLLECT, you should avoid adding
more rows with APPEND.

A: True
B: False

18. Which of the following is not a component of control break processing when
looping at an internal table?

A: AT START OF
B: AT FIRST
C: AT LAST
D: AT NEW

19. A dictionary table is made available for use within an ABAP program via the
TABLES statement.

A: True
B: False

20. Which of the following would be best for hiding further selection criteria until a
function is chosen?

A: AT NEW SELECTION-SCREEN
B: SELECTION-SCREEN AT LINE-SELECTION
C: SUBMIT SELECTION-SCREEN
D: CALL SELECTION-SCREEN

21. What must you code in the flow logic to prevent a module from being called
unless a field contains a non-initial value (as determined by its data type)?

A: ON INPUT
B: CHAIN
C: FIELD
D: ON REQUEST

22. The AT USER-COMMAND event is triggered by functions defined in the ____.

A: screen painter
B: ABAP report
C: menu painter status
D: ABAP Dictionary

23. In regard to a function group, which of the following is NOT a true statement?

A: Combines similar function modules.


B: Shares global data with all its function modules.
C: Exists within the ABAP workbench as an include program.
D: Shares subroutines with all its function modules.

24. In regard to SET PF-STATUS, you can deactivate unwanted function codes by
using ____.

A: EXCLUDING
B: IMMEDIATELY
C: WITHOUT
D: HIDE

25. In regard to data transported in PAI when the FIELD statement is used, which
of the following is NOT a true statement?

A: Fields in PBO are transported directly from PAI.


B: Fields with identical names are transported to the ABAP side.
C: Fields not defined in FIELD statements are transported first.
D: Fields that are defined in FIELD statements are transported when their
corresponding module is called.

26. The order in which an event appears in the ABAP code determines when the
event is processed.

A: True
B: False

27. A field declared as type T has the following internal representation:

A: SSMMHH
B: HHMMSS
C: MMHHSS
D: HHSSMM

28. Which of the following is NOT a component of the default standard ABAP
report header?

A: Date and Time


B: List title
C: Page number
D: Underline

29. Assuming a pushbutton with function code ‘FUNC’ is available in the toolbar of
a list report, what event is processed when the button is clicked?

A: AT USER-COMMAND.
B: AT PFn.
C: AT SELECTION-SCREEN.
D: END-OF-SELECTION.

30. In regard to field selection, what option of the SELECT statement is required?

A: FOR ALL ENTRIES


B: WHERE
C: INTO
D: MOVE-CORRESPONDING

31. The following program outputs what?

report zjgtest1

write: /1 ‘Ready_’.

PARAMETER: test.

INITIALIZATION.
write: /1 ‘Set_’.

START-OF-SELECTION.
write: /1 ‘GO!!’.

A: Set_ GO!! (each on its own line)


B: Set_ Ready_ GO!! (all on their own lines)
C: Ready_ GO!! (each on its own line)
D: Ready_ Set_ GO!! (all on their own lines)

32. To declare a selection criterion that does not appear on the selection screen, use:

A: NO-DISPLAY
B: INVISIBLE
C: MODIF ID
D: OBLIGATORY

33. An internal table that is nested within another internal table should not contain
a header line.
A: True
B: False

34. What is output by the following code?

DATA: BEGIN OF itab OCCURS 0, letter type c, END OF itab.

itab-letter = ‘A’. APPEND itab. itab-letter = ‘B’. APPEND itab.


itab-letter = ‘C’. APPEND itab. itab-letter = ‘D’. APPEND itab.

LOOP AT itab.
SY-TABIX = 2.
WRITE itab-letter.
EXIT.
ENDLOOP.

A: A
B: A B C D
C: B
D: B C D

35. To select all database entries for a certain WHERE clause into an internal table
in one step, use

A: SELECT_INTO TABLE itab_


B: SELECT_INTO itab_
C: SELECT_APPENDING itab
D: SELECT_itab_

36. After a successful SELECT statement, what does SY-SUBRC equal?

A: 0
B: 4
C: 8
D: Null

37. This selection screen syntax forces the user to input a value:

A: REQUIRED-ENTRY
B: OBLIGATORY
C: DEFAULT
D: SELECTION-SCREEN EXCLUDE

38. If the following code results in a syntax error, the remedy is:
DATA: itab TYPE SORTED TABLE OF rec_type WITH UNIQUE KEY field1
WITH HEADER LINE.

itab-field1 = ‘Company’. itab-field2 = ’1234′. INSERT TABLE itab.


itab-field1 = ‘Bank’. itab-field2 = ‘ABC’. INSERT TABLE itab.

SORT itab.

LOOP AT itab.
write: /1 itab-field1, itab-field2.
ENDLOOP.

A: There is no syntax error here


B: Remove the SORT statement
C: Change INSERT to APPEND
D: Add a WHERE clause to the loop

39. If this code results in an error, the remedy is:

SELECT fld1 fld2 FROM tab1 WHERE fld3 = pfld3.


WRITE: /1 tab1-fld1, tab1-fld2.
ENDSELECT.

A: Add a SY-SUBRC check.


B: Change the WHERE clause to use fld1 or fld2.
C: Remove the /1 from the WRITE statement.
D: Add INTO (tab1-fld1, tab1-fld2).

40. When modifying an internal table within LOOP AT itab. _ ENDLOOP. you
must include an index number.

A: True
B: False

41. To allow the user to enter values on the screen for a list field, use:

A: OPEN LINE.
B: SET CURSOR FIELD.
C: WRITE fld AS INPUT FIELD.
D: FORMAT INPUT ON.

42. Before a function module may be tested, it must first be:

A: Linked
B: Authorized
C: Released
D: Active

43. To include a field on your screen that is not in the ABAP Dictionary, which
include program should contain the data declaration for the field?

A: PBO module include program


B: TOP include program
C: PAI module include program
D: Subroutine include program

44. If a table contains many duplicate values for a field, minimize the number of
records returned by using this SELECT statement addition.

A: MIN
B: ORDER BY
C: DISTINCT
D: DELETE

45. The system internal table used for dynamic screen modification is named:

A: ITAB
B: SCREEN
C: MODTAB
D: SMOD

46. Within the source code of a function module, errors are handled via the
keyword:

A: EXCEPTION
B: RAISE
C: STOP
D: ABEND

47. Which system field contains the contents of a selected line?

A: SY-CUCOL
B: SY-LILLI
C: SY-CUROW
D: SY-LISEL

48. The following statement writes what type of data object?

WRITE: /1 ‘Total Amount:’.


A: Text literal
B: Text variable
C: In-code comment
D: Text integer

49. For the code below, second_field is of what data type?

DATA: first_field type P, second_field like first_field.

A: P
B: C
C: N
D: D

50. Which of the following describes the internal representation of a type D data
object?

A: DDMMYYYY
B: YYYYDDMM
C: MMDDYYYY
D: YYYYMMDD

51. A BDC program is used for all of the following except:

A: Downloading data to a local file


B: Data interfaces between SAP and external systems
C: Initial data transfer
D: Entering a large amount of data

52. In regard to PERFORM, which of the following is NOT a true statement?

A: May be used within a subroutine.


B: Requires actual parameters.
C: Recursive calls are allowed in ABAP.
D: Can call a subroutine in another program.

53. What is the transaction code for the ABAP Editor?

A: SE11
B: SE38
C: SE36
D: SE16

54. In regard to HIDE, which of the following is NOT a true statement?


A: Saves the contents of variables in relation to a list line’s row number.
B: The hidden variables must be output on a list line.
C: The HIDE area is retrieved when using the READ LINE statement.
D: The HIDE area is retrieved when an interactive event is triggered.

55. Database locks are sufficient in a multi-user environment.

A: True
B: False

56. The complete technical definition of a table field is determined by the field’s:

A: Domain
B: Field name
C: Data type
D: Data element

57. In regard to LEAVE, which of the following is NOT a true statement?

A: May be used to return immediately to a calling program.


B: May be used to stop the current loop pass and get the next.
C: May be used to start a new transaction.
D: May be used to go to the next screen.

58. The following code indicates:

SELECT fld6 fld3 fld2 fld1 FROM tab1 INTO CORRESPONDING FIELDS OF
TABLE itab
WHERE fld3 = pfld3.

A: The order of the fields in itab does not matter.


B: Fill the header line of itab, but not the body.
C: Table itab can only contain fields also in table tab1.
D: None of the above.

59. The ABAP statement below indicates that the program should continue with the
next line of code if the internal table itab:

CHECK NOT itab[] IS INITIAL.

A: Contains no rows
B: Contains at least one row
C: Has a header line
D: Has an empty header line

60. What will be output by the following code?


DATA: BEGIN OF itab OCCURS 0, fval type i, END OF itab.

itab-fval = 1. APPEND itab.


itab-fval = 2. APPEND itab.

FREE itab.
WRITE: /1 itab-fval.

A: 2
B: 0
C: blank
D: 1

61. To allow the user to enter a range of values on a selection screen, use the ABAP
keyword:

A: DATA.
B: RANGES.
C: PARAMETERS.
D: SELECT-OPTIONS.

62. If an internal table is declared without a header line, what else must you declare
to work with the table’s rows?

A: Another internal table with a header line.


B: A work area with the same structure as the internal table.
C: An internal table type using the TYPES statement.
D: A PARAMETER.

63. Assuming an internal table contains 2000 entries, how many entries will it have
after the following line of code is executed?

DELETE itab FROM 1500 TO 1700.

A: This is a syntax error.


B: 1801
C: 1800
D: 1799

64. To remove lines from a database table, use ____.

A: UPDATE
B: MODIFY
C: ERASE
D: DELETE
65. All of the following may be performed using SET CURSOR except:

A: Move the cursor to a specific field on a list.


B: Move the cursor to a specific list line.
C: Move the cursor to a specific pushbutton, activating that function.
D: Move the cursor to a specific row and column on a list.

66. When is it optional to pass an actual parameter to a required formal parameter


of a function module?

A: The actual parameter is type C.


B: The formal parameter contains a default value.
C: The formal parameter’s ”Reference” attribute is turned on.
D: It is never optional.

67. Coding two INITIALIZATION events will cause a syntax error.

A: True
B: False

68. Adding a COMMIT WORK statement between SELECT_ENDSELECT is a


good method for improving performance.

A: True
B: False

69. To save information on a list line for use after the line is selected, use this
keyword.

A: APPEND
B: EXPORT
C: WRITE
D: HIDE

70. To bypass automatic field input checks, include this in PAI.

A: AT EXIT-COMMAND
B: ON INPUT
C: ON REQUEST
D: LEAVE TO SCREEN 0.

71. Within a function module’s source code, if the MESSAGE_RAISING statement


is executed, all of the following system fields are filled automatically except:

A: SY-MSGTY
B: SY-MSGNO
C: SY-MSGV1
D: SY-MSGWA

72. The following code indicates:

REPORT ZLISTTST.
START-OF-SELECTION.
WRITE: text-001.
FORMAT HOTSPOT ON.
WRITE: text-002.
FORMAT HOTSPOT OFF.
AT LINE-SELECTION.
WRITE / text-003.

A: Text-002 may not be selected.


B: The value of text-002 is stored in a special memory area.
C: Text-002 may be clicked once to trigger the output of text-003.
D: None of the above.

73. The ____ type of ABAP Dictionary view consists of one or more transparent
tables and may be accessed by an ABAP program using Open SQL.

A: Database view
B: Projection view
C: Help view
D: Entity view

74. A concrete field is associated with a field-symbol via ABAP keyword

A: MOVE
B: WRITE
C: ASSIGN
D: VALUE

75. The output for the following code will be:

report zabaprg.
DATA: char_field type C.

char_field = ‘ABAP data’.

WRITE char_field.

A: ABAP data
B: A
C: Nothing, there is a syntax error
D: None of the above

76. Page footers are coded in the event:

A: TOP-OF-PAGE.
B: END-OF-SELECTION.
C: NEW-PAGE.
D: END-OF-PAGE.

77. The event AT SELECTION-SCREEN OUTPUT. occurs before the selection


screen is displayed and is the best event for assigning default values to selection
criteria.

A: True
B: False

78. The TABLES statement declares a data object.

A: True
B: False

79. Assuming tab1-fld7 is not a key field, how can you prevent reading all the table
rows?

SELECT fld1 fld2 fld3 FROM tab1 INTO (fld4, fld5, fld6)
WHERE fld7 = pfld7.
WRITE: /1 fld4, fld5, fld6.
ENDSELECT.

A: Take fld7 out of the WHERE clause.


B: Create an index in the ABAP Dictionary for tab1-fld7.
C: Use INTO TABLE instead of just INTO.
D: Take the WRITE statement out of the SELECT_ENDSELECT.

80. Which of the following is NOT a required attribute when creating an ABAP
program?

A: Application
B: Title
C: Status
D: Type

81. When creating a transparent table in the ABAP Dictionary, which step
automatically creates the table in the underlying database?
A: Adding technical settings to the table
B: Checking the table syntax
C: Saving the table
D: Activating the table

82. Within the ABAP program attributes, Type = 1 represents:

A: INCLUDE program
B: Online program
C: Module pool
D: Function group
E: Subroutine pool

83. If this code results in an error, the remedy is:

SELECT fld1 SUM( fld1 ) FROM tab1 INTO_

A: Remove the spaces from SUM( fld1 ).


B: Move SUM( fld1 ) before fld1.
C: Add GROUP BY f1.
D: Change to SUM( DISTINCT f1 ).

84. Which keyword adds rows to an internal table while accumulating numeric
values?

A: INSERT
B: APPEND
C: COLLECT
D: GROUP

85. Assuming itab has a header line, what will be output by the following code?

READ TABLE itab INDEX 3 TRANSPORTING field1.


WRITE: /1 itab-field1, itab-field2.

A: The contents of the third row’s itab-field1.


B: The contents of the third row’s itab-field1 and itab-field2.
C: The contents of the third row’s itab-field2.
D: Nothing.

86. The following code indicates:

SELECTION-SCREEN BEGIN OF BLOCK B1.


PARAMETERS: myparam(10) type C,
Myparam2(10) type N,
SELECTION-SCREEN END OF BLOCK.
A: Draw a box around myparam and myparam2 on the selection screen.
B: Allow myparam and myparam2 to be ready for input during an error dialog.
C: Do not display myparam and myparam2 on the selection screen.
D: Display myparam and myparam2 only if both fields have default values.

87. Which statement will sort the data of an internal table with fields FRUIT, QTY,
and PRICE so that it appears as follows?

FRUIT QTY PRICE

Apples 12 22.50
Apples 9 18.25
Oranges 15 17.35
Bananas 20 10.20
Bananas 15 6.89
Bananas 5 2.75

A: SORT itab DESCENDING BY QTY PRICE.


B: SORT itab BY PRICE FRUIT.
C: SORT itab.
D: SORT itab BY PRICE DESCENDING.

88. Which keyword adds a line anywhere within an internal table?

A: APPEND
B: MODIFY
C: ADD
D: INSERT

89. To read a single line of an internal table, use the following:

A: LOOP AT itab. _ ENDLOOP.


B: READ itab.
C: SELECT SINGLE * FROM itab.
D: READ TABLE itab.

90. Which Open SQL statement should not be used with cluster databases?

A: UPDATE
B: MODIFY
C: DELETE
D: INSERT

91. To include a field on your screen that is not in the ABAP Dictionary, which
include program should contain the data declaration for the field?
A: PBO module include program
B: TOP include program
C: PAI module include program
D: Subroutine include program

92. This flow logic statement is used to make multiple fields open for input after an
error or warning message.

A: GROUP
B: FIELD-GROUP
C: CHAIN
D: LOOP AT SCREEN

93. Given:

PERFORM subroutine USING var.

The var field is known as what type of parameter?

A: Formal
B: Actual
C: Static
D: Value
Archive for the ‘ABAP’ Category

ABAP Memory & SAP Memory


Written by jimstex on May 27th, 2009 | Filed under: ABAP

The memory area of each main session has an area called ABAP Memory, which the
programs in the internal session can access with EXPORT TO MEMORY and
IMPORT FROM MEMORY. Data in the ABAP Memory is conserved through a
sequence of program calls. To transfer data to a called program, it can be placed in
the ABAP Memory with the EXPORT statement before the program is called. The
internal session of the called program then replaces the internal session of the
calling program and the data can be read from the ABAP Memory with the
IMPORT statement. Data can be passed in exactly the same way when the system
returns to the calling program.

The SAP Memory is a memory area to which all sessions of a SAP logon have
common access. In ABAP programs, the SET PARAMETER and GET
PARAMETER commands can be used to access the so-called SPA/GPA parameters
stored in the SAP Memory. Input fields on screens can be linked to this type of
parameter and default entries thereby established.
Comments (0) Get FREE daily updates by RSS or e-mail

Ending ABAP Programs


Written by jimstex on May 27th, 2009 | Filed under: ABAP

The execution of an ABAP program is always ended when the corresponding


process in the runtime environment ends. From an ABAP programmer’s
perspective, this is when the last of the processing blocks triggered by the runtime
environment is ended. You can, however, program ABAP programs to end at any
time with the LEAVE PROGRAM statement.

The LEAVE TO TRANSACTION statement and the SUBMIT statement without


the AND RETURN addition also end an ABAP program.

Comments (0) Get FREE daily updates by RSS or e-mail

Calling ABAP Programs Internally


Written by jimstex on May 27th, 2009 | Filed under: ABAP

From a user perspective there are two ways of starting programs: direct execution
using the program name for executable programs, or selecting a transaction code
for module pools. These two ways of calling programs can also be performed in
ABAP programs that are already running. We have mentioned the relevant
SUBMIT statement for executable programs. The corresponding statements for
transactions are LEAVE TO TRANSACTION and CALL TRANSACTION. We
can distinguish program calls from other ABAP programs by whether the calling
program is being canceled completely or whether the called program is embedded in
the calling program.

Canceling the calling program completely


You cancel the calling program completely by calling another program with
SUBMIT prog.
Continue Reading …

Comments (0) Get FREE daily updates by RSS or e-mail

Module Pool Execution Flow


Written by jimstex on May 27th, 2009 | Filed under: ABAP

Module pools are executed in a very different manner than executable programs.
Executing a module pool does not start a process in the runtime environment that
sends events to the ABAP program in a specified sequence. Neither can module
pools be started by entering their name or using SUBMIT. Transaction code To
start a module pool you need to create at least one screen and define a transaction
code, which is linked to one of the module pool screens. This screen then becomes
the initial screen of a transaction with the ability to call other screens of the module
pool.

Comments (0) Get FREE daily updates by RSS or e-mail

Screens in SAP
Written by jimstex on May 27th, 2009 | Filed under: ABAP

The following screens can belong to and be processed by executable programs,


module pools, and function groups.

General screens
General screens or simply screens consist of the actual layout and a flow logic. The
German term for a general screen is Dynpro, meaning dynamic program. The
screen flow logic is a program layer that handles screen events and lies between the
actual ABAP application program and the runtime environment. The layout and
flow logic of a screen program are created with the Screen Painter tool.

Selection screens
Selection screens are special screens that are created through ABAP statements and
not the Screen Painter. The flow logic of selection screens is embedded in the
runtime environment; the screen events are converted to selection screen events.

Classical lists
Classical lists, previously known simply as lists, are screens with a special layout
that has a single output area that can be filled with formatted contents using ABAP
statements. As with selection screens, the screen flow logic is embedded in the
runtime environment and its events are forwarded to the ABAP program as list
events.

SAP ABAP Program Types


Written by jimstex on May 26th, 2009 | Filed under: ABAP

Each ABAP program has a type, which is defined in the program


attributes. What is the purpose of all the different program types? The program
type determines which processing blocks a program can contain, how the program
is handled and executed by the runtime environment, and whether it can work with
its own screens. The following ABAP program types are available.
Executable programs (Type 1)
Executable programs are introduced with the REPORT statement. They can
contain their own screens and are executed via the SUBMIT statement or
transaction codes. Executable programs can contain all the various processing
blocks in ABAP, except for function modules, and any number of local classes. They
can be created directly with the ABAP Editor tool. While they are running, all the
runtime environment events can occur.

Module pools (Type M)


Module pools are introduced with the PROGRAM statement. They can contain
their own screens and can only be executed through transaction codes. Module pools
can contain all the various processing blocks in ABAP, except for reporting event
blocks and function modules, and any number of local classes. While they are
running, all the runtime environment events can occur, except for reporting events.
They can be created directly with the ABAP Editor tool.

Function groups (Type F)


Function groups or pools are introduced with the FUNCTION – POOL statement.
They can contain their own screens. Normally, function groups are not executed
directly. They are loaded by calling their function modules. They can contain all the
various processing blocks in ABAP, except for reporting event blocks, and any
number of local classes. They are the only programs that can contain function
modules and are created with the Function Builder tool.

Class pools (Type K)


Class pools are introduced with the CLASS-POOL statement. They cannot contain
their own screens and no other processing blocks than methods. Class pools can
contain a single global class and any number of local classes. They cannot be
executed directly. They are loaded by using their global classes.3 They are created
with the Class Builder tool.

Interface pools (Type J)


Interface pools are introduced with the INTERFACE-POOL statement. They
cannot contain their own screens or processing blocks. They contain a single
definition of a global interface, which can be implemented in any global or local
class. They are created with the Class Builder tool.

Subroutine pools (Type S)


Subroutine pools are introduced with the PROGRAM statement. They cannot
contain their own screens and apart from the LOAD-OF-PROGRAM event block
can have only subroutines or methods of local classes as processing blocks.
Subroutine pools are not executed directly. They are loaded by calling their
procedures externally. They are created with the ABAP Editor.

Type groups
Type groups or pools are introduced with the TYPE-POOL statement. They cannot
contain their own screens or processing blocks. They contain the definitions of
global data types, which can be made visible in any ABAP program by the TYPE-
POOLS statement. They are created with the ABAP Dictionary tool.

Include programs (Type I)


Include programs have no introductory program statement and, unlike all other
program types, they do not represent independent compilation units with their own
memory space. Include programs provide a library function for ABAP source code
and can be embedded at any location in other ABAP programs using the INCLUDE
statement. Include programs have no technical relationship to processing blocks.
However, it is preferable to separate logical program units, such as the declaration
part for global data, and similar or individual processing blocks into independent
include programs. The ABAP Workbench supports the automatic division of
module pools, function groups, and class pools into include programs. You can
create your own include programs directly with the ABAP Editor.

If you like this post, you may as well like these too:

1. ABAP Program: Sample program for OLE Automation REPORT


ZSOURCE2801. * Including OLE types INCLUDE OLE2INCL. * Tables and variables for
later use TABLES: CUSTOMERS. DATA: APPLICATION TYPE OLE2_OBJECT,
WORKBOOK TYPE OLE2_OBJECT, SHEET TYPE OLE2_OBJECT, CELLS TYPE
OLE2_OBJECT....
2. Different types of ABAP Programs There are nine types of ABAP Programs in SAP:
1 Executable Programs (ABAP Reports) I INCLUDE Program M Module Pool/Dialogue
programs S Sub-Routine Pool J Interface Pool K Class Pool...
3. ABAP Source Code: Character types REPORT ZSOURCE0403. * Type c is the
default type when no type is specified.* Initial value is space, if it is not specified
explicitly.DATA: NAME(25) TYPE C, CITY(25), FLAG, SINGLE_CHARACTER...
4. ABAP Source Code: Types, data, constants REPORT ZSOURCE0402.* Type flag
defines an abstract typeTYPES FLAG TYPE C. * Field address_flag will allocate space in
main memory at runtimeDATA ADDRESS_FLAG TYPE FLAG VALUE ‘X’.* Constants
are defined...
5. ABAP Programs: Form parameters with generic types REPORT
ZSOURCE1009.* Variable for later useDATA: SHORT_STRING(3) VALUE ‘AB’,
SHORT_NUMBER(3) TYPE N VALUE ’0′, ALL_CUSTOMERS LIKE CUSTOMERS
OCCURS 100.* Calling forms with different actual parameters* Correct call (actual
paramter is...

Business API (BAPI)


Written by jimstex on May 11th, 2009 | Filed under: ABAP

Business API (BAPI) is the most important component of SAP Business


Framework. BAPI enables SAP and third party applications to interact and
integrate with each other at the Business Object / Process level.

Till some time back, SAP was deep into its not-so-friendly interface and
architecture, which it inherited from the IBM Mainframe based parent system. But
now it has come up with truly platform independent business object interfaces using
BAPIs. Business Objects and BAPIs provide an object-oriented view of SAP’s
business functionality.

BAPIs are implemented using Remotely callable Function modules. These RFCs are
assigned as a callable method of a Business Object in the Business Object
Repository (BOR). All BAPIs are independent of the screen and hence can work in
the background without user intervention. BAPI supports both inbound and
outbound processing. Since it follows object-oriented approach, SAP has positioned
itself to support interfacing through BAPIs in the future.

Rules for Better SQL Programming # Tip 5


Written by admin on May 11th, 2009 | Filed under: ABAP, ABAP Programs

Tip #5. Remove the load from the database.

Check if the table meets the criteria for table buffering. When applying the table
buffering check if the table is frequently read, should be relatively small and
deferred visibility of changes is acceptable.

Do not apply table buffering for tables which are changed heavily or if the contents
of the table must be always up-to-date.

Ensure that you use the correct SELECT STATEMENT. Here are some of the
statements which bypass the table buffer.

SELECT ... DISTINCT


SELECT ... COUNT, SUM, AVG, MIN, MAX
SELECT ... ORDER BY f1 ... fn
SELECT ... GROUP BY / HAVING
SELECT ... FOR UPDATE
SELECT ... JOIN
WHERE clause contains IS NULL statement
WHERE clause contains subquery
SELECT ... BYPASSING BUFFER

Avoid reading the same data again and again.

Wrong

SELECT SINGLE * FROM scarr


INTO xcarr
WHERE carrid = 'LH '.
...
SELECT SINGLE * FROM scarr
INTO zcarr
WHERE carrid = 'LH '.
Right

SELECT SINGLE * FROM scarr


INTO xcarr
WHERE carrid = 'LH '.

zcarr = xcarr.

Check whether a SELECT is really needed before an UPDATE is made.

Wrong

SELECT SINGLE * FROM sflight


INTO xflight
WHERE carrid = 'LH ' AND
connid = '0300' AND
fldate = '20021204'.
xflight-seatsocc = 1.
UPDATE sflight FROM xflight.

Right

UPDATE sflight
SET seatsocc = 1
WHERE carrid = 'LH ' AND
connid = '0300' AND
fldate = '20021204'.

Avoid the ORDER BY clause if the desired sorting doesn’t correspond to the index
used.

Wrong

SELECT P~airpfrom P~airpto F~fldate P~deptime


INTO xflight
FROM spfli AS P INNER JOIN sflight AS F
ON P~carrid = F~carrid
AND P~connid = F~connid
WHERE P~carrid = 'LH '
ORDER BY P~airpfrom P~airpto F~fldate P~deptime.
WRITE: / xflight-airpfrom, xflight-airpto,
xflight-fldate, xflight-deptime.
ENDSELECT.

Right

SELECT P~airpfrom P~airpto F~fldate P~deptime


INTO TABLE flights
FROM spfli AS P INNER JOIN sflight AS F
ON P~carrid = F~carrid
AND P~connid = F~connid
WHERE P~carrid = 'LH '.
SORT flights BY airpfrom airpto fldate deptime.
LOOP AT flights INTO xflight.
WRITE: / xflight-airpfrom, xflight-airpto,
xflight-fldate, xflight-deptime.
ENDLOOP.

If you like this post, you may as well like these too:

1. Rules for Better SQL Programming # Tip 1 Always try to keep the hit list small by
using the where clause were ever required or by describing the full search condition in the
where clause. Select Query #1...
2. Rules for Better SQL Programming # Tip 2 Tip #2 : Minimize the Amount of
Transferred Data Minimize the amount of data transferred between the database and the
application server. Wrong SELECT * FROM sflight INTO xflight WHERE...
3. Rules for Better SQL Programming # Tip 3 Tip #3: Keep the number of round trips
between the database and the application server small. Use high-speed array operations with
UPDATE, INSERT, DELETE, MODIFY. Wrong LOOP AT itab INTO...
4. Rules for Better SQL Programming # Tip 4 Tip #4: Keep the Cost of the Search
Down Specify the WHERE clause to keep the number of searches down and create suitable
indices if necessary. Wrong SELECT bookid FROM...

Archive for the ‘ABAP’ Category

Purpose of Table Buffering


Written by jimstex on Dec 8th, 2008 | Filed under: ABAP

Table buffering is used to increase performance when reading data from database
table. Data from a buffered table is read from a local buffer on the application
server thus reducing database access.

There are three different types of table buffering that can be used in SAP:

1. Full Buffering : All Records of the table are loaded into the buffer when a
record in the table is accessed.
2. Generic Buffering: All Records with the same key fields are loaded into the
buffer when a record in the table is accessed.
3. Single Record Buffering: The specific record that was accessed is loaded into
the buffer.

Comments (0) Get FREE daily updates by RSS or e-mail

What is the Difference between Domain and Data Element


Written by jimstex on Dec 8th, 2008 | Filed under: ABAP

A Domain describes the value range of a field and is assigned to a data element. All
fields that use the data element will have the value range of the domain. The value
range is defined by specifying the type and length of the domain. Fixed value
intervals can also be defined for the domain and are automatically used as check
values on screen entries.

A Data element describes the business meaning of a domain. Information about the
meaning of a field such as its label is assigned to the data element and is accessible
from all screen fields that use the data element.

Comments (0) Get FREE daily updates by RSS or e-mail

Data Transport from ABAP to Screen and back


Written by jimstex on Nov 26th, 2008 | Filed under: ABAP

Data Transport between screens and ABAP programs is automatically handled by


the system.

The First data transport occurs after all the PBO Modules have been executed and
prior to a screen being displayed. The system will transport the contents of the
ABAP work area in the program into the corresponding screen fields.

The Second data transport trigger is done once all the data entry is completed by
the user and before the first PAI Module is executed. The system will copy the
contents of the screen fields back to the corresponding ABAP work area in the
program.

Comments (0) Get FREE daily updates by RSS or e-mail


SELECT SINGLE Statement
Written by jimstex on Nov 26th, 2008 | Filed under: ABAP

The Select Single Statement is used to ensure that only one row is read from the
Database. The Search is terminated as soon as the that row is found with the
required criteria. Select Single will definetly produce better performance then
SELECT … UP TO 1 ROWS … END SELECT when you have something is search
for in the where clause.

Comments (0) Get FREE daily updates by RSS or e-mail

View Locked Transaction


Written by admin on Nov 6th, 2008 | Filed under: ABAP

As you know, you can lock/unlock transaction codes via SM01. But, how do you go
about viewing the transactions that are locked in the system? You need to look in
field CINFO of the table TSTC.

Within SAP, you can either SE11 or SE16 to browse the table contents. Make sure
you enter ‘A0′ as the “Hex01 data element for SYST” starting value and ‘A9′ as the
ending value. This will list all the transactions locked in the system.

• Home
• Beginners
• FAQs
• Online Store
• Archives

• RSS
• EMAIL
• What is RSS?
Recent Posts

• Understanding SAP Transactions and their Structure


• Object Oriented ABAP (OOABAP) – FAQs
• Web Dynpro for ABAP – Where to Start?
• Understanding and Working with BAPI’s
• How to Create GL Account Master data
• Reversal of Documents in SAP
• What is Automatic Posting?
• What is Account Assignment Model?
• Connection of Account Type with Document Type
• What is the Document Change Rule?
• What do you mean by Net Postings?

Hi Guest!
You can contribute to ERP Database on any topic. ERP Database might be the right
place for your Ideas/Opinions to reach a larger audience.

New to ERP Database? Register Now


Already a member? Login
Social Bookmarks:

Archive for the ‘ABAP’ Category

Calling BAPI from Visual Basic(VB)


Written by admin on Sep 26th, 2008 | Filed under: ABAP

In this exercise you will learn about logging onto the SAP system and you will also
use a BAPI and create a sales order in SAP. All without logging onto SAP. This Step
by Step guide on BAPI Exercise from sappoint will take you through all the steps.

Comments (2) Get FREE daily updates by RSS or e-mail

ABAP Performance Tuning


Written by admin on Sep 25th, 2008 | Filed under: ABAP
ABAP Performance Tuning(PDF) Tips and Tricks on

• SQL Interface
• String manipulation
• Internal Tables
• Internal tables vs Field group
• Typing
• If, Case,
• Field Conversion
• Modularization
o Subroutines
o Function Modules
• Tools
o Static Analysis (Extended program check)
o Dynamic Analysis
o Database Access
• Getting the data / Data table identification
o F1-F9 / Technical info
o Runtime analysis
o Debug
o SE38
o Sql trace
o Logical database
o Function modules
• List of important tables & Function Modules

Comments (0) Get FREE daily updates by RSS or e-mail

Remote Function Call


Written by admin on Sep 19th, 2008 | Filed under: ABAP

RFC is a communication interface that provides the ability to call a function


remotely from another SAP System or Non SAP System.
Each function module has a defined interface through which data, tables and return
codes can be exchanged. The only difference between calling a function module
remotely and locally is a extra parameter which is provided remotely that specifies
the target server on which the function module should be executed.

There are 3 types of RFCs:

1. Synchronous RFC call: The calling program stops until the function module
executes on the target server and returns results.
2. Asynchronous RFC call: The calling program runs in parallel with the
function module on the target server. The target system must be available.
3. Transactional RFC call(tRFC): Several function modules are grouped into a
transaction. They are processed in the target system in the sequence in which
they are called.

What is ABAP?
Written by admin on Apr 8th, 2008 | Filed under: ABAP, Beginners, SAP
General
We already talked about SAP and ERP. Here is some little
information on ABAP and how it relates to SAP.

What is ABAP?

Well, ABAP stands for Allgemeiner Berichts-Aufbereitungs-Prozessor. I know it’s


kind of difficult to understand. But that’s the german standing of it. It means
“General report creation processor”, Made it a little simpler, isn’t it. Okay, The
actual english version of it is Advanced Business Application Programming. It’s a
high level programming language created by SAP and has a syntax similar to Cobol
and is based on Fourth Generation language.

The ABAP Programming language was originally invented by SAP for developers to
develop SAP R/3 and is primarily used to develop custom functionality on SAP like
Creating Reports, Smart forms… etc.

Types of ABAP Programs

We have various types of ABAP Programs like Reports, BDC, Subroutine Pools,
Function Modules, Includes, Type Pools, Class Pools, Interface Pools & Classes.

ABAP Workbench

This Workbench contains different tools for editing repository objects. These tools
allow to develop and complete almost everything and some of the objects include
ABAP Editor, ABAP Dictionary, Screen and Menu Painter, Function Builder and
Class Builder.

Data Types

Refer the image below for all the Data Types.


Where to Go from here? If you are new to ABAP and then you can find lots of
ABAP Programs and ABAP Keywords and Syntax on SAP Database.
Archive for the ‘ABAP’ Category

What is a Client?
Written by admin on Sep 11th, 2008 | Filed under: ABAP

A client is a independent unit in the SAP system from an organizational point of


view.

Each client has it’s own data environment. The client concept allows for the joint
operation of several enterprises in one system that are independent of each other in
business terms.

During each user session, a client is chosen from the main login screen in order to
specify which environment a user will access.

Comments (0) Get FREE daily updates by RSS or e-mail

Data Transfer Techniques


Written by admin on Sep 10th, 2008 | Filed under: ABAP

In order to load the data into the SAP system we have many techniques in use which
will get the job done. Majorly we have three techniques through which you can get
the data transfer done. These are Batch Input, Direct Input and BAPI’s.

1. Batch Input , also known as Batch Data Communication (BDC) : This approach
is used extensively in ABAP programming and remains a popular choice when no
other method exists. The online transaction processes is simulated and the data
transfer is done exactly as it is done online. A batch input session is created using
SHDB containing all of the data and screens and then processed. Well, if you make
any changes to the screen then you will have add these screens in the program or
else the BDC will fail.

2. Direct Input : The data in the input file is transferred directly to the SAP
database. No screens are involved. This methods used function modules to
accomplish the task. Well, not everything can be accomplished through this method.

3. BAPI’s (Business Application Programming Interface) : These are standard


API’s that provide external access to SAP Objects. That does not mean you cannot
run these inside SAP. You can still use them inside SAP too. BAPI’s are defined in
the Business Object Repository as methods of SAP Objects.
Comments (2) Get FREE daily updates by RSS or e-mail

Interface
Written by admin on Sep 9th, 2008 | Filed under: ABAP

An Interface is a declaration of a set of Methods with no information given about


the implementation of those methods. Interfaces are used to define common
functionality that can be used by different classes. Interfaces are implemented in
classes by listing the interface name in the definition part of the class.

CLASS customer DEFINITION.


Public Section.
INTERFACES <interface_name>.
ENDCLASS.

An interface can be implemented publicly. The methods defined in the interface are
implemented in the class. All methods that are defined in the interfaces must be
present in the implementing class.

Much like a class, an interface defines methods. However, unlike a class, an


interface never implements methods; instead, classes that implement the interface
provide the implementation to the methods defined by the interface.

An interface can be accessed using an object reference as long as that objects class
implements the interface. This is done using the interface resolution operator ‘~’:
<object_name>-><interface_name>~<method_name>.

Comments (0) Get FREE daily updates by RSS or e-mail

Getting Started checklist for Programmers


Written by admin on Sep 8th, 2008 | Filed under: ABAP

Quick checklist which you must know before your start with the program
development. Ask these questions before you go to SE38.

1. In which system and clients are the programs to be developed or modified


(development system and client)?
2. In which system and clients will the programs be tested (test system and
client)?
3. In which systems and clients will the programs be used in production
(production system and clients)?
4. In which language will the comments in the source code be composed
(comment language)?
5. In which language will the program interface, print forms, notifications, and
texts be composed (interface language)?
6. In which language will the technical documentation in the system be
composed (development language)?
7. Has SAP reserved its own namespace and if so, what is it (customer or
project namespace)?
8. What programming guidelines and conventions exist for naming
development objects and data in the project (programming guidelines)?
9. Which data and interfaces of existing SAP R/3 business modules, solutions,
or individual developments will be used?

Comments (0) Get FREE daily updates by RSS or e-mail

Garbage Collector
Written by admin on Sep 8th, 2008 | Filed under: ABAP

What is Garbage Collector?

The Garbage Collector removes objects from memory that no longer have a
reference pointing to it. The garbage collector is a automatic system routine that will
delete the object from memory and release the memory.

Archive for the ‘ABAP’ Category

Redefined Method
Written by admin on Sep 5th, 2008 | Filed under: ABAP

A Redefined method is a method in a subclass that provides a new definition of an


inherited method from a super class in order to provide a more specialized
implementation of the subclass.

The Redefined method will have the same name and interface, but will have a new
implementation.

Redefined methods cannot be defined as final methods in the super class. Defining a
method as final indicates that the method cannot be overridden or redefined.

A constructor method cannot be redefined as it is implicitly a final method.


The method declaration and implementation in the super class is not affected. The
redefined method in the subclass “hides” the original method in the super class. All
references to an object in the subclass will use the redefined method. The system
checks for methods first in the current class and then ‘up the hierarchy’.

Only an inherited public or protected instance method can be redefined. Static


Methods cannot be redefined.

Comments (0) Get FREE daily updates by RSS or e-mail

How To Find The Tables For The Given Transaction?


Written by admin on Sep 4th, 2008 | Filed under: ABAP

There is a very easy way to find out all the tables related to a given transaction.
Suppose you want to know the list of tables used when you create Sales Order or
Purchase Order. How can we achive it? How to we track the list of all the tables use
by SAP?

There is a very easy trick which will help you achieve that? It’s SQL trace. just start
ST05 and and start the SQL trace and go to any transaction and do any activity and
let the document get saved. Now again go to SQL trace screen and stop the SQL
trace and then click on display SQL trace that’s it. It will show you the list of all the
tables which have been accessed or updated.

Comments (0) Get FREE daily updates by RSS or e-mail

Should I use Instance Method or Static Method?


Written by admin on Sep 4th, 2008 | Filed under: ABAP

Instance methods are called using the following syntax:


CALL METHOD instance_name->instance_method_name

A static method which is also called as class method can be called using the class and
does not require an Instance. Static methods are called using the following syntax:
CALL METHOD class_name=>instance_method_name

Class Methods are similar to instance methods but can only use static components.

Comments (0) Get FREE daily updates by RSS or e-mail


Difference between Class and Object
Written by admin on Sep 3rd, 2008 | Filed under: ABAP

In Object Oriented Programing, A class can be considered as a blueprint or


template for a object that specified the attributes and behaviour that all objects of
that class will have.

Objects are instances of the class that are created by an ABAP Program at run time.

Comments (0) Get FREE daily updates by RSS or e-mail

Object Oriented Programming in SAP ABAP


Written by admin on Aug 28th, 2008 | Filed under: ABAP

Object Oriented Programming in SAP ABAP

Object oriented programming tries to map the real world


objects with their attributes and methods as realistically as possible in program
constructs. The aim is to create the program flow in such a way as if it is taking
place in the real world. This makes the interaction between the developer and the
user easier. The user can formulate business requirements on a program in the
language in which the user is familiar with and the developer can convert these
directly instead of the classic programming model.

In the object oriented programming model a different approach is used. Attributes


and methods which belong to a specific object are grouped together and made
accessible to the user using a well defined interface behind which the actual
implementation details are hidden. so, the attributes of the object are only changed
by the methods of the object and not directly by the user of and object. This ensures
that the status of the object is always consistent.

When do you call an object an object oriented programming? if it has these


features.

Abstraction
Abstraction refers to the ability to reflect the real world processes as realistically as
possible through programming. These processes can be a business or a technical
nature.

Encapsulation
Implementation details are hidden behind well-defined an documented interfaces.
They ensure that the abstract representation of a object is used only in accordance
with its spefication.

Inheritance
New abstractions i.e. classes are derived from existing ones. They inherit all the
attributes and methods of the higher class and can expand and specialize them.

Polymorphism
Different objects can present the same interface to the outside. A user only needs to
know the interface and need not know every minute details of the classes.

Archive for the ‘ABAP’ Category

Difference Between Elementary and Collective Search Help


Written by admin on Aug 27th, 2008 | Filed under: ABAP

An Elementary Search help defines the flow of a standard input help. It is composed
of a selection method that defines where to get the data that will make up the hit list,
An interface consisting of search help parameters that define the exchange of data
between the screen and the selection method and a dialog type that controls how the
hit list will be displayed.

A Collective Search help is a combination of several elementary search helps giving


the user a different search paths. The interface parameters of the elementary search
help are assigned to the parameters of the collective search.

Comments (0) Get FREE daily updates by RSS or e-mail

SAP Report Painter


Written by rajivsharma.sap on Aug 25th, 2008 | Filed under: ABAP

SAP Report Painter (PDF Download) is the main tool for defining reports in the
information system in controlling module.

All of the controlling reports (Cost center accounting, internal orders and profit
center accounting) are created using report painter. You can also create reports in
FI. With Report Painter you can define reports quickly and easily across rows and
columns. You can use standard reports delivered by SAP as a base, copy them and
do minor modifications, so as to suit your requirement. Very often it is felt that the
standard reports delivered by SAP do not meet the user’s requirement. Therefore
you need to create new reports.

Comments (0) Get FREE daily updates by RSS or e-mail

LSMW (Legacy System Migration Workbench)


Written by rajivsharma.sap on Aug 25th, 2008 | Filed under: ABAP

LSMW an abbreviation for Legacy System Migration Workbench is a tool in SAP


which is used to migrate Legacy data into SAP. It is a very important tool and easy
to learn and master it. LSMW has a recording tool which can record the transaction
and the fields to be uploaded. Thus upload of master data and transaction data is
made very simple in this tool. You can use this tools in almost all modules for upload
of master data and too some extent transaction data also.

Thus in FI you can upload the following master data through this: Vendors,
Customers, General Ledger, Asset master, Bank Master. You can upload
Transaction balance through this i.e. an FI document.

In CO you can upload the following master data: Cost element, Cost center, Profit
center, Activity types, Internal orders, Statistical key figures.

In other modules likewise you can upload other sets of master data.

This guide on LSMW covers the creation of a Vendor master data with accounting
view.
Dialog Programming / Module Pool
Written by admin on Aug 8th, 2008 | Filed under: ABAP

Dialog Programming / Module Pool

A Module Pool also called as Dialog Program is a ABAP Program of type “M” that
requires at least one transaction code in order to be executed. The transaction code
usually starts a screen and it’s associated flow logic.

Events in Dialog Programming

Process Before Output – Actions taken before displaying the output.


Process After Input – Actions taken after you input the data or carry some action on
the screen.

Things you need to know in Dialog Programming

Status Icons - Used in screens to indicate visually about the status of the program.
It’s a type of screen element and use the function module ‘ICON_CREATE’ to play
around with it.

Context menu – Content Menu can be created statiscally using SE41 or dynamically
using the class CL_CTMENU.

Screen keywords – Here are some screen keywords which you need to understand.
PROCESS,MODULE,FIELD,ON,LOOP,ENDLOOP,CHAIN,ENDCHAIN,CALL.

MODULE <name> at EXIT-COMMAND – This module is called when the user


presses BACK, EXIT or CANCEL.

GUI Status and Title – Check the syntax for SET PF-STATUS and SET
TITLEBAR ‘XXXX’.
Step loops – This helps in displaying tabular data on the screen,

Table Control – Declare a control variable of type TABLEVIEW using control


statements in the program and use the LOOP … ENDLOOP statement.

Comments (0) Get FREE daily updates by RSS or e-mail

ALV Grid
Written by admin on Aug 7th, 2008 | Filed under: ABAP

ALV Grid Control

There are two things which you need to basically understand when working with the
ALV Grid.

1. You will need a container CL_GUI_CUSTOM_CONAINER class which will hold


the ALV Grid

2. CL_GUI_ALV_GRID class is required to create the ALV Grid Control and place
this GRID in the above container.

You will need to create a reference variable to instantiate the class objects. Here is a
PDF Guide on ALV Grid control teaching you to learn everything about the ALV
Grid Control.

Comments (0) Get FREE daily updates by RSS or e-mail

Types of Internal Table


Written by admin on Aug 6th, 2008 | Filed under: ABAP

Types of Internal table in SAP ABAP

Internal tables can be categoriesed into STANDARD, SORTED and HASHED.

Standard tables have an internal index by default. Records can be accessed by using
the index number or with the any key. The response time always depends on the
volume of data in the standard internal table.

Sorted tables also has an internal index but it is pre-sorted by the key. They also
have an internal index. Records can be accessed by using the index number or with
the any key. The system uses binary search by default to retrieve the data faster.
Hashed tables have no Internal index and should be accessed by a key which must
be specified as unique. The response time totally depends on the Hash Algorithm.

Comments (0) Get FREE daily updates by RSS or e-mail

Enhancement Framework
Written by admin on Aug 5th, 2008 | Filed under: ABAP

Learn the future of how ABAP systems can be enhanced using the new
‘Enhancement Framework’ available in SAP NetWeaver 2004s (and thus, mySAP
ERP 2005 and mySAP Business Suite 2005 applications).

Download Introducing Enhancement Framework.

Update (Feb 26, 2009) : More Information about enhancement framework can be
found here.
LSMW – Legacy System Migration Workbench

The Legacy System Migration Workbench is an SAP-based tool that supports You
when transferring data from non-SAP systems (“Legacy Systems”) to SAP systems1
once or periodically. The tool supports conversion of data of the legacy system in a
convenient way. The data can then be imported into the SAP system via batch input,
direct input, BAPIs or IDocs. Furthermore, the LSM Workbench provides a
recording function that allows to generate a “data migration object” in an entry or
change transaction.

Documents to get you started on LSMW:


Quick Reference Guide on LSWM
Examples:
Processing IDOC (Powerpoint)
Customer Adress via BAPI
Material Master IDOC
Open Items via Direct Input
Customer Master Creation & Some LSMW Exercises.

Comments (0) Get FREE daily updates by RSS or e-mail

Performace Tuning
Written by admin on Jun 30th, 2008 | Filed under: ABAP

SAP R/3 System Design, Analysis and Implementation of


Performance Tuning

The Purpose of this article is to draw attention to a more global view of


performance problems in a complex client/server environment such as an R/3
system. This article was motivated by the observation that a large number of
performance problems are caused by the unreflected use of certain performance
guidelines beyond their range of validity. We want to adress ABAP developers who
have already dealt with performance problems.
Download the document on Performance Tuning, Best Practices in Performance
Tuning & Performance Analyzing tools, Database Access & Internal table
Optimization.

Comments (0) Get FREE daily updates by RSS or e-mail

Find User Exits


Written by admin on Jun 17th, 2008 | Filed under: ABAP, Tips & Tricks

Well, I know we have already talked about finding user exits in the program and
also we have a program to find out the user exits in a given Program/Transaction.
But, how many times have you searched in SPRO for the user exits. Just go to
SPRO –> SAP Reference IMG –> Find (user exits). You will be amazed with the list
of other places containing user exits.

Comments (0) Get FREE daily updates by RSS or e-mail

Ouput ICON in screen


Written by admin on Jun 16th, 2008 | Filed under: ABAP

There are 2 statements which allow to write ICON’s on the report output. We need
to have INCLUDE <ICON> or INCLUDE<LIST> statement in the program.

Eg: WRITE <ICON-NAME> as ICON. ” will give the desired icon on the list
output.

Comments (0) Get FREE daily updates by RSS or e-mail

What is BADI?
Written by admin on Jun 13th, 2008 | Filed under: ABAP, Tips & Tricks

BADI stands for Business Add-in. BADI’s are an enhancement concept which uses
ABAP objects. Totally a object oriented method to enhance classes, interfaces,
methods.

You need to first define a BADI to enhance a SAP application program. The
developer needs to create an interface for the BADI. An Adapter class is created
from this that will implement the interface. Developers need to create an instance of
the adaptor class in the SAP Application program and create method calls as
required.

Archive for the ‘ABAP’ Category

Add Fields to SAP Table


Written by admin on Jun 11th, 2008 | Filed under: ABAP

An Append Structure or a customizing include can be used to add fields to the


Table. Append structures are created by adding fields to the end of a table while
customizing includes are specified by the SAP Developer in advance to allow for the
customer to create new fields.

Comments (0) Get FREE daily updates by RSS or e-mail

Modification Assistant
Written by admin on Jun 6th, 2008 | Filed under: ABAP, Tips & Tricks

The Modification assistant is a tool used to simplify the upgrade process as it relates
to modifications. The Modification assistant can be triggered through the ABAP
Editor and it will assist in logging modifications for any changes that are made to
the system.

The Modification assistant provides support for modification made through the
ABAP Editor, Screen Painter, Menu Painter, Text Element maintenance, Function
Builder and ABAP Dictionary.
Comments (0) Get FREE daily updates by RSS or e-mail

Quick Viewer (SQVI)


Written by admin on May 30th, 2008 | Filed under: ABAP, SAP General

Quick Viewer (SQVI)

Quick Viewer is a comprehensive tool for defining reports in different forms such as
basic lists, statistics, or ranked lists. The Quick viewer is basically used for
generating basic lists and is very userful for beginners who was to analyze data
between two or more different tables.

Here is a PDF file to teach you step by steps instructions for Quick Viewer.

COPYRIGHT: ERPDB.INFO

Comments (0) Get FREE daily updates by RSS or e-mail

Function Module Exit


Written by admin on May 30th, 2008 | Filed under: ABAP, Tips & Tricks

Function Module exits exist in some SAP application programs to allow a customer
to add some functionality to the SAP Program. Search the SAP application program
for the search string “CALL CUSTOMER” to check if any function module exists.

Copyright: SAP Database

Comments (0) Get FREE daily updates by RSS or e-mail

Authorization Object
Written by admin on May 29th, 2008 | Filed under: ABAP, ABAP Keywords

Authorization Object are a group of fields used to check if an particular


transaction/events/steps can be executed or not.

AUTHORITY-CHECK is the statement used in the ABAP program to perform the


authorization check by passing a authorization object. All the relevant fields must
be addressed or you have to use the keyword DUMMY to bypass the check and you
can have a maximum of 10 fields defined in the authorization object.
To create the authorization object use the transaction SU21. Refer the ABAP
Keywords to know more about it.

COPYRIGHT: SAP Database

Archive for the ‘ABAP’ Category

ABAP Memory
Written by admin on May 27th, 2008 | Filed under: ABAP

Ever thought as to how to exchange the data between programs? well, that’s why we
have ABAP Memory for.

EXPORT TO MEMORY ID <memory_id_ name> will copy the data to ABAP Memory
and IMPORT FROM MEMORY ID <memory_id_ name> will copy the data from ABAP
Memory. One import thing to note is that the data declarations and data types
should be declared in both the programs and both of them must contain the same
data type otherwise it will not work.

Comments (0) Get FREE daily updates by RSS or e-mail

Lock Objects
Written by admin on May 23rd, 2008 | Filed under: ABAP

Understanding SAP Lock Object Mechanism

Lock objects are a mechanism to control as to how the update takes place when
more than one user is updating the data in the same table.
To create lock objects you will need two function modules.

1. ENQUEUE_<LOCK_OBJECT_NAME>

This function module is used to generate a lock entry in the table making it only
accessible to only one user. Incase, for any reason if the lock object function module
is not able to lock the table. It will reflect in the return code.

2. DEQUEUE_<LOCK_OBJECT_NAME>

This function module is used to release the locks.

Now, If you want to end up having different programs trying to update the same
database table. To avoid problems code your database updates between 1 & 2.

There are basically two types of lock:

Types of Lock

Shared Lock : Is a read only lock that prevents the data from being changed when
another user is reading it.
Exclusive Lock: Is a write lock that prevents data from being changed when another
user is updating it.

COPYRIGHT SAP Database : Repository of all the freely available information on


SAP.

Comments (0) Get FREE daily updates by RSS or e-mail

ABAP HR Programming
Written by admin on May 21st, 2008 | Filed under: ABAP

SAP ABAP HR Programming

Prerequisites : ABAP Programming, Logical database, Module pool programming


& SAP Scripts.

Course Outline:

• Brief description of modules in SAP-HR


• Concept of Infotypes
• Infotype Structures
• Creation of infotype
• Enhancement of infotype
• HR Macros
• Use of Provide statement
• Cluster reading for Payroll results
• Example of PA letters infotype (Customer defined)

Download from Rapidshare or Mediafire

Comments (34) Get FREE daily updates by RSS or e-mail

Using BAPI Function module


Written by admin on May 20th, 2008 | Filed under: ABAP

Using BAPI_PO_Create as an example. This step by step guide teaches you as to


how to create a Purchase order using BAPI’s through programming.

Download from Rapidshare or Mediafire.

Comments (0) Get FREE daily updates by RSS or e-mail

ABAP Data Dictionary


Written by admin on May 20th, 2008 | Filed under: ABAP

Overview

Data definitions also called as meta data are managed and created in ABAP
Dictionary. It allows to maintain a huge volume of data without data redundancy.
The ABAP Dictionary describes the logical structure of all the dictionary objects
used in Application development. It also provides you with the flexibility of
accessing the data on the screen and allows you to maintain manage and create
without any programmers intervention.
The data dictionaries can be categorized into the following. Continue Reading …

Overview

Data definitions also called as meta data are managed and created in ABAP
Dictionary. It allows to maintain a huge volume of data without data redundancy.
The ABAP Dictionary describes the logical structure of all the dictionary objects
used in Application development. It also provides you with the flexibility of
accessing the data on the screen and allows you to maintain manage and create
without any programmers intervention.

The data dictionaries can be categorized into the following.

• Database table
• Views
• Data types
• Domain
• Search Help
• Lock Objects

Database tables:

Tables can be defined independently in the database in the ABAP Dictionary. The
fields of the table are defined together with their data types and lengths.
A table definition has following components:
Table fields
Foreign keys
Technical settings
Indexes

Views

A View is a logical representation of tables. This is just a way of organizing the data
by combining more than one table by comparing the common fields which is called
a join.
Data types:

It’s an attribute to tell as to what kind of data is it going to hold like numbers,
characters, integers etc. A data type can be an elementary data type or a reference
data type.

Domain:

A domain contains the technical attributes of the data type. Like the length, the
actual data type ( like char, integer), The output characteristics and the value range
which tells us as to what kind of data can be accepted as a valid input.

Search Help:

A search help is simply what you see in SAP when you key in the F4 button. It
provides you with the list/range of values.
A search help can be categorised into three types:
Elementary Search help
Collective Search Help
Append Search Help

Lock Object:

A lock object is virtual link of an sap table which is used to synchronize the data
when more than one user attempts to write to the Database table. These lock objects
are called and handled inside the program based on requirement.

Okay, enough of theory… Lets get into practicals, Here is a step by step guide to
teach you in creating Data dictionary and Search help.
Copyright: SAP Database : SAP Certification, Ebooks, PDF, Articles, News
!!!! DO NOT COPY !!!!

ALV Programs Explained

ALV (ABAP List Viewer) Programs are very easy to write when you know few basic
facts about them. There are many Functions modules provided by SAP to handle
different tasks. Just go to SE37 and use *REUSE*ALV* and this would display all
the function modules related to ALV. Now to analyze and explain ALV, lets use the
simple ALV Grid function module ‘REUSE_ALV_GRID_DISPLAY’ as an
example.

Typically, all the ALV Reporting ends up into two different Categories.

• Create Field catalogue


• Create Events to display Top of Page/End of Page
• Call the relevant ALV Function Module to display the output.
Create Field catalogue

First thing to do is decide all the fields you want to display in the grid. Make a list
and fill all these reporting fields in the internal table IT_FIELDCAT. You need to
add these field to get the minimal working; col_pos,
fieldname,tabname,seltext_m,outputlen & key.

col_pos = Column Position


fieldname = Field Name
tabname = Table name or Internal table Name.
seltext_m = Field Description
outputlen = Output Length
key = Should this is part of key field. can be ‘X’ or space.

Now,keep filling all the data into the intenal table IT_FIELDCAT.

Create Events to display Top of Page/End of Page

If you have a top-of-page or end-of-page include these in the internal table


IT_EVENTS.

Call the relevant ALV Function Module to display the output

Now comes the actual part of calling all the relevant function modules.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = ‘SET_PF_STATUS’ “PF Status
i_callback_user_command = ‘USER_COMMAND’ “Create a routine
USER_COMMAND
i_grid_title = gv_grid_title “Title
it_fieldcat = it_alv_catalog “Created Above
it_events = it_alv_event “Created Above
TABLES
t_outtab = gt_output. “Internal Table with actual data

Additional Sources for ALV Examples:

• One of our Authors Swarna writes a lot of programs using ALVs. Refer his
Posts for some examples on ALV.
• I found a page on web with lots of ALV Programs.
• SAP has included its own demo examples. Refer the below programs for
more examples on ALV.
BCALV_FULLSCREEN_DEMO
BCALV_FULLSCREEN_DEMO_CLASSIC
BCALV_GRID_DEMO
BCALV_TREE_DEMO
BCALV_TREE_SIMPLE_DEMO

Archive for the ‘ABAP’ Category

Webdynpro for ABAPers


Written by admin on Apr 24th, 2008 | Filed under: ABAP

A Presentation Overview on

- Web Dynpro Development


- Meta-model Declarations and Custom Coding
- Model View Controller (MVC)
- Web Dynpro Component Architecture
- Web Dynpro Components
- View, Windows and UI elements
- Defining View Layout
- Dynamic Web Dynpro Programming
- Concepts.. and much more.

Download from rapidshare or Mediafire.


Comments (0) Get FREE daily updates by RSS or e-mail

Learn Everything about Report Painter


Written by admin on Apr 22nd, 2008 | Filed under: ABAP

How to get the most out of Report Painter?

Report Painter is a SAP Standard tool for Developing visual reports.

Covering :

• Report Painter Basics


• Identifying Data Source
• Getting Statistical Key figures
• Working on Currency Translations
• Authorization Groups

Download the PDF file from Rapidshare or Mediafire.

Comments (1) Get FREE daily updates by RSS or e-mail

ABAP Tutorials for Beginners


Written by admin on Apr 18th, 2008 | Filed under: ABAP, ABAP
Keywords, ABAP Programs

ABAP Tutorials for Beginners

Here is a Complete Guide of all the training manuals for SAP ABAP freshers. This
is a organized set of all the documents which you need to learn from start to finish.
The ABAP Tutorials are categorised sequentially from start to finish.

Download the Complete Tutorial from Rapidshare or Mediafire.

SAP ABAP Tutorial Contents

1. ABAP Programming
2. Dictionary
3. Internal Tables
4. ALV Grid Control
5. SAP List Viewer
6. Screen and Menu Painter
7. BDC Concepts
8. BDC Files
9. BDC Recording
10. BAPI Introduction & Programming
11. Object Oriented Programming
12. SAP Scripts/SmartForms
13. Enhancements
14. ALE Introduction/Programming/Steps
15. EDI & IDOC
16. IDOC Book
17. LSMW Introduction & Steps
18. Transport Management Systems
19. Workflow

SAP Tutorials : SAP Database of Certification, Tutorials, Articles.

Comments (17) Get FREE daily updates by RSS or e-mail

ABAP Objects for JAVA Pro’s


Written by rajivsharma.sap on Apr 15th, 2008 | Filed under: ABAP, Java for
SAP

Contains :

• Similarities Between Java and ABAP


• ABAP Special Features

Download from rapidshare or mediafire.

Comments (0) Get FREE daily updates by RSS or e-mail

ALV Drag and Drop


Written by A Swarna S on Apr 15th, 2008 | Filed under: ABAP, ABAP
Programs

ALV report with drag and drop functionality on its rows.

Download the ALV Program.


Report Output

Archive for the ‘ABAP’ Category

Upgrade from 4.6C to SAP ERP 6.0


Written by admin on Apr 3rd, 2008 | Filed under: ABAP

This article speaks about the upgrade from 4.6C to SAP ERP 6.0 from the View
point of ABAP Development team. Talks on tasks and challenges the developers
face, showing program changes needs to be made and also show some of the new
ABAP Features.

Download From rapidshare or Mediafire.


Article is about Modification Adjustments, Unicode enablement and enhancement
Framework with respect to ABAP.

Comments (2) Get FREE daily updates by RSS or e-mail

Abap Knowledge Corner


Written by admin on Apr 3rd, 2008 | Filed under: ABAP

Take some time and have a look at the ABAP Knowledge corner provided by
Richard Harper. Has a lots of Information about Programming Techniques, Tips &
Tricks, Performance Issues and other interesting stuff.

Definetly a must read for every ABAPer out there!


SAP Database is looking for more contributors. If you have any documents to share please Login / Register or mail the documents to
articles@erpdb.info.

Comments (0) Get FREE daily updates by RSS or e-mail

ALV Programs
Written by admin on Apr 2nd, 2008 | Filed under: ABAP, ABAP Programs

ALV Programs Explained

ALV (ABAP List Viewer) Programs are very easy to write when you know few basic
facts about them. There are many Functions modules provided by SAP to handle
different tasks. Just go to SE37 and use *REUSE*ALV* and this would display all
the function modules related to ALV. Now to analyze and explain ALV, lets use the
simple ALV Grid function module ‘REUSE_ALV_GRID_DISPLAY’ as an
example.

Typically, all the ALV Reporting ends up into two different Categories.

• Create Field catalogue


• Create Events to display Top of Page/End of Page
• Call the relevant ALV Function Module to display the output.

Continue Reading …

Comments (1) Get FREE daily updates by RSS or e-mail


SAP Code Inspector
Written by A Swarna S on Mar 28th, 2008 | Filed under: ABAP

SAP Code Inspector

The Code Inspector is a tool for checking Repository objects regarding


performance, security, syntax, and adherence to name conventions. The Code
Inspector is a generic tool that you use to check static objects. The transaction code
is SCI.
The code inspector can be called form the following transactions :

• SE38
• SE80
• SE37
• SE11
• SE24

Continue Reading …

SAP Code Inspector

The Code Inspector is a tool for checking Repository objects regarding


performance, security, syntax, and adherence to name conventions. The Code
Inspector is a generic tool that you use to check static objects. The transaction code
is SCI.
The code inspector can be called form the following transactions :

• SE38
• SE80
• SE37
• SE11
• SE24

In code inspector we go for

• Inspection
• Creating Set of objects
• Check variant

Inspection

Here Individual objects or sets of objects are checked as to whether certain


programming guidelines have been adhered to. The result of an inspection run is a
list of the individual checks made with errors, warnings, or information messages.
There are two types of inspections
1. Persistent inspections where results are stored
2. Ad hoc inspections where results are not stored

Object Set

Using sets of objects, you can group several single objects together for an inspection.
Sets of objects include, for example, programs, function groups, classes, or DDIC
objects. There are global and local sets of objects. Global sets of objects are visible
for all users while local objects are only visible for a single user.

Check variant

When you execute an inspection using the Code Inspector, the system checks the
individual objects of a defined set of objects for certain attributes using the check
variant. There are global and local check variants. Global check variants are
available for all users. In contrast to the global check variants, local check variants
are visible only for one user.
Elements of the code inspector:

The code inspector initial screen looks this way.


The standard checks that come with a code inspector are :

• Syntax checks and program generation


• Security checks
• Performance checks
• Search operations

Syntax checks and program generation

The checks in this category are :

• Normal syntax check


• Extended program check
• Program generation

Normal Syntax check : This is the check we all perform normally in the ABAP
workbench. This is our CTRL + F2 check in the ABAP editor.

Extended program check :


This is the SLIN transaction check . It processes the static checks that are too
complex or too time consuming for the normal syntax check.
These checks include :
1. Reference to program external units (eg ,SUBMIT )
2. Multi language enabling
3. Package check
4. EBCDIC/ASCII Portability
5. Generation limits
6. Statements in wrong context
7. Unnecessary items

Program generation :
This check is very similar to the other two checks but also generates the byte code of
the program. This is useful for removing inconsistencies which occur during an
upgrade.

Security checks

It checks :

1. Statement that is deemed critical.


2. Statement which infers ominous database access.
3. Select statements without a system return code (SY_SUBRC).
Performance checks

The performance checks are carried out to check the following conditions :
1. Database accesses that will lead to high runtimes because of the WHERE clause
does not use an existing database index.
2. Select statements which use bypass buffer increasing database access.
3. CHECK statements inside SELECT and ENDSELECT loops.
4. Nested loops in internal tables.
5. Nested Selects.

Search operations

The code inspector offers search operations for use in ABAP programs
1. Search for tokens(words)
2. Search for complete statements

Code inspector run for abap program in SE38.

Once the code inspector is run a screen like this appears.


The code inspector gives a detailed description of the errors in the program and
double clicking the error it takes to the error in the code for correction.

Download this complete article SAP Code Inspector.

Copyright : ERPDB : This article can be reproduced as long as this line stays.

If you like this post, you may as well like these too:

1. Transaction Code to Access Other Transaction Code with Values Many times
in SAP, you may come across situations where in the users wants to have a separate
transaction codes for some of the tables which can be easily maintained...
Archive for the ‘ABAP’ Category

ABAP and Advanced ABAP


Written by rajivsharma.sap on Mar 14th, 2008 | Filed under: ABAP

Download the complete training set from (rapidshare) or (mediafire)


ABAP and Advanced ABAP Training Material on the Following.

ABAP Basics

• ABAP Overview
• Data Dictionary
• Reports
• Modularisation and BDC
• SAP Scripts
• Module Programming

Advanced Topics

• ABAP Query
• ALE, IDOCS
• Badi
• Logical Database
• LSMW
• ABAP Code Optimisation
• RFC’s & BAPI’s
• SAP Workflow

User Exits

• Field Exits
• Function Exits
• Menu Exits
• Screen Exits
• Text Enhancements
• User Exits

OOABAP

• Events
• Inheritance
• Interfaces
• Object Oriented ABAP – Overview
• Simple Classes and Sub Classes
Comments (0) Get FREE daily updates by RSS or e-mail

How can ABAP Developers survive in this Netweaver era?


Written by admin on Mar 6th, 2008 | Filed under: ABAP, Netweaver

Download the Podcast Here

SAP’s NetWeaver push and SOA (service-oriented architecture) strategy have left
ABAP developers confused about their future. In this podcast we talk with
SearchSAP.com careers expert, and president of jonerp.com, Jon Reed and Thomas
Jung, a NetWeaver product manager with SAP Labs, about how developers can
enhance their skills to keep up.

Source: SearchSAP

Comments (0) Get FREE daily updates by RSS or e-mail

Developing Web Business Applications with ABAP


Written by admin on Mar 4th, 2008 | Filed under: ABAP

Download the PDF Document on Developing Web Business Applications with


ABAP from Rapidshare or Mediafire.

Comments (0) Get FREE daily updates by RSS or e-mail

ABAP & Cross Applications


Written by admin on Feb 28th, 2008 | Filed under: ABAP, Application Linking
and Enabling(ALE), IDOCs, SAP General

One of the readers send me these documents which are available on the esnips
folder. Just visit the below link.

http://www.esnips.com/web/sivaabap

Contains the study material on ABAP and Cross Applications.


Comments (0) Get FREE daily updates by RSS or e-mail

List of Infotypes configured in the SAP system – Simple ALV


report
Written by A Swarna S on Feb 26th, 2008 | Filed under: ABAP, ABAP
Programs
*&-------------------------------------------------------------------
----------------------------------------------------*
1 *& Report ZINFOTYPE *
2 *& Author : Swarna.S *
3 *&-------------------------------------------------------------------
4 ----------------------------------------------------*
5 *& *
6 *& AS: This program lists all the infotypes maintained in SAP system
7 *
8 *&-------------------------------------------------------------------
9 ----------------------------------------------------*
10
11 REPORT zinfotype .
12 TYPE-POOLS : slis.
13
14 *Structure declaration for Infotypes for customer
15 TYPES : BEGIN OF ty_table,
16 infty TYPE infty,
17 pnnnn TYPE pnnnn_d,
18 END OF ty_table.
19
20*Structure for infotype text
21TYPES : BEGIN OF ty_itext,
22infty TYPE infty,
23itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
Continue Reading ...
*&---------------------------------------------------------------------
--------------------------------------------------*
*& Report ZINFOTYPE *
*& Author : Swarna.S *
*&---------------------------------------------------------------------
--------------------------------------------------*
*& *
*& AS: This program lists all the infotypes maintained in SAP system *
*&---------------------------------------------------------------------
--------------------------------------------------*

REPORT zinfotype .
TYPE-POOLS : slis.

*Structure declaration for Infotypes for customer


TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
END OF ty_table.

*Structure for infotype text


TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
<pre>
<span ID="more-815"></span>
<pre lang="abap" line="24">
*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
END OF ty_output.

*internal table and work area declarations


DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.

*Data declarations for ALV

DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container


object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout

INITIALIZATION.

START-OF-SELECTION.

*select the infotypes maintained


SELECT infty
pnnnn
FROM t582a
INTO TABLE it_table.

*Select the infotype texts


IF it_table[] IS NOT INITIAL.

SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.

ENDIF.

*Apppending the data to the internal table of ALV output


LOOP AT it_table INTO wa_table.

wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.

* For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.

APPEND wa_output TO it_output.


CLEAR wa_output.

ENDLOOP.

* Calling the ALV screen wiht custom container

CALL SCREEN 0600.

*On this statement double click it takes you to the screen painter
SE51.Enter the attributes
*Create a Custom container and name it CC_CONT and OK code as OK_CODE.
*Save check and Activate the scren painter.
*NOw a normal screen witn number 600 is created which holds the ALV
grid.

* PBO of the actual screen , Here we can give a title and customized
menuss
*&---------------------------------------------------------------------*
*& Module STATUS_0600 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0600 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0600 OUTPUT

* calling the PBO module ALV_GRID.


*&---------------------------------------------------------------------*
*& Module ALV_GRID OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE alv_grid OUTPUT.
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CC_CONT'.

CREATE OBJECT c_alvgd


EXPORTING
i_parent = c_ccont.

* Set field for ALV


PERFORM alv_build_fieldcat.
* Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.

* Call ALV GRID


CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

ENDMODULE. " ALV_GRID OUTPUT


*&---------------------------------------------------------------------*
*& Form alv_build_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_IT_FCAT text
*----------------------------------------------------------------------*
FORM alv_build_fieldcat.

DATA lv_fldcat TYPE lvc_s_fcat.

CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.
ENDFORM. " alv_build_fieldcat
*&---------------------------------------------------------------------*
*& Form alv_report_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_IT_LAYOUT text
*----------------------------------------------------------------------*
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
* PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes and based on the
user command
*we can do the coding.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0600 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0600 INPUT.

ENDMODULE. " USER_COMMAND_0600 INPUT

Maintenance Views
Maintenance views are used to view and/or modifi tables. A tranaction code can be
generated for the maintenance view.

Usefull transactioncodes:

• SM30 Maintain tabel views


• SE54 Generate Table Maintenance Dialog: Initial table/View Screen
• SE55 Generate Table Maintenance Dialog: generation Environment
• SE93 Maintain Transaction

Follow these steps to create a maintenance view and generate a transaction code for
it:

Create view in SE11

• Goto transcation SE11 ABAP Dictionary


• Select View and type in the name of the view you want to create.
• Press the Create button
• In the dialog box that appears, choose Maintenance View
• Select tables and fields for the view
• Activate the view

Create maintenance screens

Goto transaction SE55 Generate Table Maintenance Dialog: Geneartin Environment

Type in Table/View name, Authorization Group, the name of the function module
for the screen code. Select one or 2 step screen maintenance:
Create tranaction code to call the view

Goto transaction SE93 and craete a new transaction. Select transaction type
Tranaaction with parameters
In the transaction select transaction SM30 Maintain Table Views and insert the
paramerts UPDATE and VIEWNAME in the default values part. Note that the
value for VIEWNAME should be the name of the maintenance view created above.
The value of UPDATE shoul be X.
Comments (0) Get FREE daily updates by RSS or e-mail

SAP Utility Programs


Written by admin on Mar 19th, 2008 | Filed under: ABAP, ABAP Programs

SAP Utility Programs

Gentran IDoc Data Definition File Generation Tool – Gentran’s mapping tool maps
1 structure to another structure. Typically, 1 structure is an EDI standard which is
provided by Sterling Commerce. In this case we assume the other structure to be
SAP’s Idoc structure.
1 click abap tool – This is a tool for quickly selecting last objects used for editing
purposes. Very useful for developers to quickly access their common objects.
EDI Utilities – Contains Workflow Utilities Differences in SWETYPV entries across
environments & Send email to managers of agents who are no longer there.
Contains EDI Utilities Send Email when IDoc hasn’t changed status for a period.
Update IDOC Status, Analyze EDPAR.
Find PO in IDOC – Find Inbound Idocs for a particular PO number.
IDOC Excel Upload – Changing an Idoc’s status with an Excel upload.

Source : ERPGenie.com
Archive for the ‘ABAP’ Category

Methods for modifying SAP Standard Tables


Written by jimstex on Mar 26th, 2010 | Filed under: ABAP

You can modify SAP ‘Standard Tables’ using:

• Append Structures
• Customizing INCLUDES

Comments (0) Get FREE daily updates by RSS or e-mail

What is a Logical Database?


Written by admin on Mar 26th, 2010 | Filed under: ABAP

A Logical Database is a special data-retrieval program delivered by SAP, with its


own dynamic Selection Screens. You need to code only the processing logic (GET,
CHECK, etc., statements). The logical database consists of a read program in which
the structure of the local database is reproduced with a selection screen.

Advantages:

• Check functions to validate that user input is complete and correct.


• Meaningful data selection.
• Central authorization checks for database accesses.
• Excellent read access performance while retaining the hierarchical data view
determined by the application logic.

Comments (0) Get FREE daily updates by RSS or e-mail

SAP ABAP Generic Questions and Answers


Written by admin on Jan 27th, 2010 | Filed under: ABAP

Here is a set of two documents with question and answers for TAW10. It will
definitely help you to improve your ABAP skills.

Download ABAP Basics (1325) & ABAP Objects (767).

Comments (0) Get FREE daily updates by RSS or e-mail

Get Rid of Code Page Errors (CONVT_CODEPAGE)


Written by admin on Dec 11th, 2009 | Filed under: ABAP

You usually get these dumps in ST22 with the runtime error as
CONVT_CODEPAGE and it says that the character set conversion is not possible.
So, how to we get rid of these errors?

These errors are caused when you try to download the file with some special
characters in the unicode system. When SAP system is not able to convert the
special characters, it ends up with this system dump.

Just add the clause IGNORE CONVERSION ERRORS when you try to open the
dataset and all these special characters which cannot be converted into a specific
code page will be skipped. You can also add the clause REPLACEMENT
CHARACTER space, with this addition, all the special non convertible characters
will simply be replaced with space.

Comments (0) Get FREE daily updates by RSS or e-mail

SAP General Function Modules


Written by admin on Aug 19th, 2009 | Filed under: ABAP

ABAP_DOCU_DOWNLOAD – Download ABAP documentation in HTML format.


ARFC_GET_TID – will return the IP address of the terminal in hex.

BAL_* – All function modules used for SAP’s application logging can be found
here.

BP_EVENT_RAISE – Trigger an event from ABAP/4 program

BP_JOBLOG_READ – Fetch job log executions

CLOI_PUT_SIGN_IN_FRONT – Place the negative sign after a number. SAP


default is place the negative sign after the number.

CLPB_EXPORT – Export a text table to the clipboard (on presentation server)

CLPB_IMPORT – Import a Text Table from the Clipboard (on presentation


server)

COMMIT_TEXT – To load long text into SAP


Continue Reading …

ABAP_DOCU_DOWNLOAD – Download ABAP documentation in HTML format.

ARFC_GET_TID – will return the IP address of the terminal in hex.

BAL_* – All function modules used for SAP’s application logging can be found
here.

BP_EVENT_RAISE – Trigger an event from ABAP/4 program

BP_JOBLOG_READ – Fetch job log executions

CLOI_PUT_SIGN_IN_FRONT – Place the negative sign after a number. SAP


default is place the negative sign after the number.

CLPB_EXPORT – Export a text table to the clipboard (on presentation server)

CLPB_IMPORT – Import a Text Table from the Clipboard (on presentation


server)

COMMIT_TEXT – To load long text into SAP

CONVERSION_EXIT_ALPHA_INPUT – converts any number into a string fill


with zeroes-right
example:
input = 123
output = 0000000000000…000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT – converts any number with zeroes-right


into a simple integer
example:
input = 00000000000123
output = 123

CONVERT_OTF – Convert SAP documents (SAPScript) to other types.


example:
CALL FUNCTION ‘CONVERT_OTF’
EXPORTING
FORMAT = ‘PDF’
IMPORTING
BIN_FILESIZE = FILE_LEN
TABLES
OTF = OTFDATA
LINES = PDFDATA
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.

DATE_GET_WEEK – will return the week that a date is in.

DATE_CHECK_PLAUSIBILITY – Check to see if a date is in a valid format for


SAP. Works well when validating dates being passed in from other systems.

DOWNLOAD – download a file to the presentation server (PC)

DYNP_VALUES_READ – Read the values from a dynpro. This function can be


used to read the values from a report’s selection screen too (Another example).

DYNP_VALUES_UPDATE – Similar to DYNP_VALUES_READ, this function will


allow the updating of fields on a dynpro. Very useful when you want to change a
field based on the value entered for another field.

ENQUE_SLEEP – Wait a specified period of time before continuing processing.

ENQUEUE_ESFUNCTION – Lock an abap program so that it cannot be executed.


Set the parameters as follows:
RELID = ‘ZZ’
SRTF2 = 0
SRTF = (your report name)
Please note that you should not use SY-REPID to pass your report name to the
function. The value of SY-REPID will change as it is being passed to the function
module, and will no longer hold the value of the calling report.

EPS_GET_FILE_ATTRIBUTES – Pass in a filename and a path, and will return


attributes for the file

EPS_GET_DIRECTORY_LISTING – return a list of filenames from a local or


network drive

F4_DATE – displays a calendar in a popup window and allows user to choose a


date, or it can be displayed read only.

F4IF_SHLP_EXIT_EXAMPLE – documents the different reasons to use a search


help exit, and shows how it is done.

FILENAME_GET – popup to get a filename from a user, returns blank filename if


user selects cancel

FTP_CONNECT – Open a connection (and log in) to an FTP server

FTP_COMMAND – Execute a command on the FTP server

FTP_DISCONNECT – Close the connection (and log off) the FTP server

FORMAT_MESSAGE – Takes a message id and number, and puts it into a


variable. Works better than WRITE_MESSAGE, since some messages use $ as a
place holder, and WRITE_MESSAGE does not accommadate that, it only replaces
the ampersands (&) in the message.

GET_GLOBAL_SYMBOLS – Returns a list of all tables, select options, texts, etc


for a program. Even includes the text definitions for the selection screen

GET_INCLUDETAB – Returns a list of all INCLUDES in a program

G_SET_GET_ALL_VALUES – Fetch values from a set.


Function Group GRAP is now obsolete. SAP recommends using functions in
function group SFES instead. Below is an overview of the changes.

GUI_CREATE_DIRECTORY – Create a directory on the presentation server

GUI_DELETE_FILE – Replaces WS_FILE_DELETE. Delete a file on the


presentation server
GUI_DOWNLOAD – Replaces WS_DOWNLOAD. Download table from the app
server to presentation server

GUI_EXEC – Replaces WS_EXECUTE. Start a File or Program Asynchronously


with WinExec

GUI_GET_DESKTOP_INFO – Replaces WS_QUERY. Delivers Information About


the Desktop (client)

GUI_REMOVE_DIRECTORY – Delete a directory on the presentation server

GUI_RUN – Start a File or Program Asynchronously with ShellExecute

GUI_UPLOAD – Replaces WS_UPLOAD. Upoad file from presentation server to


the app server

HELP_START – Display help for a field. Useful for doing AT SELECTION


SCREEN ON VALUE REQUEST for those fields that do not provide F4 help at the
DDIC level.

HOLIDAY_GET – Provides a table of all the holidays based upon a Factory


Calendar &/ Holiday Calendar.

HR_DISPLAY_BASIC_LIST – is an HR function, but can be used for any data.


You pass it data, and column headers, and it provides a table control with the ability
to manipulate the data, and send it to Word or Excel. Also see the additional
documentation here.

HR_GET_LEAVE_DATA – Get all leave information (includes leave entitlement,


used holidays/paid out holidays)

INIT_TEXT – To load long text into SAP

K_WERKS_OF_BUKRS_FIND – Return a list of all plants for a given company


code.

LIST_TO_ASCII – convert an ABAP report (displayed on screen) from OTF to


ASCII format LIST_FROM_MEMORY – Retrieves the output of a report from
memory when the report was executed using

SUBMIT… EXPORTING LIST TO MEMORY. See also WRITE_LIST.

MONTH_NAMES_GET – It returns all the month and names in repective


language.
MS_EXCEL_OLE_STANDARD_OLE – will build a file, and automatically start
Excel

OTF_CONVERT – wraps several other function modules. Will convert OTF to


ASCII or PDF

CONVERT_OTFSPOOLJOB_2_PDF – converts a OTF spool to PDF (i.e. Sapscript


document)

CONVERT_ABAPSPOOLJOB_2_PDF – convert abap spool output to PDF

POPUP_TO_CONFIRM_LOSS_OF_DATA – Create a dialog box in which you


make a question whether the user wishes to perform a processing step with loss of
data.

POPUP_TO_CONFIRM_STEP – Create a dialog box in which you make a question


whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE – Create a dialog box in which you


inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE – Create a dialog box in which you make


a question whether the user wishes to perform a processing step with a particular
object.

POPUP_TO_DECIDE – Provide user with several choices as radio buttons

POPUP_TO_DECIDE_WITH_MESSAGE – Create a dialog box in which you


inform the user about a specific decision point via a diagnosis text.

POPUP_TO_DISPLAY_TEXT – Create a dialog box in which you display a two-


line message.

POPUP_TO_SELECT_MONTH – Popup to choose a month

POPUP_WITH_TABLE_DISPLAY – Provide a display of a table for user to select


one, with the value of the table line returned when selected.

PRICING – Return pricing conditions in an internal table. Use structure TCOMK


for parameter COMM_HEAD_1, and structure TCOMP for parameter
COMM_ITEM_1, and set CALCULATION_TYPE to B. The pricing conditions will
be returned in XOMV. You must fill TCOMP, and TCOMK with the appropriate
values before callling the function in order for it to work.

PROFILE_GET – Read an Entry in an INI File on the frontend


PROFILE_SET – Write an Entry in an INI File on the frontend

READ_TEXT – To load long text into SAP

REGISTRY_GET – Read an Entry from the Registry

REGISTRY_SET – Set an entry in the Registry

RFC_ABAP_INSTALL_AND_RUN – Runs an ABAP program that is stored in the


table PROGRAM when the MODE = ‘F’. Table WRITES contains the ouput of the
program. Allows you to run a program without having the source code in the target
system.

RH_GET_ACTIVE_WF_PLVAR – Return the active HR Plan

RH_GET_DATE_DAYNAME – return the day based on the date provied

RH_START_EXCEL_WITH_DATA -starts Excel with the contents of an internal


table. This function finds Excel in the desktop registry. It also uses a local PC
working directory to save the file (that’s what the “W” value for data path flag
does). Very transparent to user!

RH_STRUC_GET – Returns all related org info

RP_CALC_DATE_IN_INTERVAL – Add/subtract years/months/days from a date

RP_LAST_DAY_OF_MONTHS – Determine last day of month

RPY_DYNPRO_READ – Read dynpro, including screen flow

RPY_TRANSACTION_READ – Given a transaction, return the program and


screen or given a program and screen, return the transactions that use the program
and screen.

RS_COVERPAGE_SELECTIONS – Returns an internal table that contains a


formatted list of all the selection parameters entered for a report. Table is ready to
print out.

RS_REFRESH_FROM_SELECTOPTIONS – Get the current contents of selection


screen

RS_SEND_MAIL_FOR_SPOOLLIST – Send message from ABAP/4 program to


SAPoffice.

RS_VARIANT_CONTENTS – Returns the contents of the specified variant in a


table.
RZL_SLEEP – Hang the current application from 1 to 5 seconds.

RZL_SUBMIT – Submit a remote report.

RZL_READ_DIR_LOCAL – Read a directory on the Application Server

RZL_READ_DIR – If the server name is left blank, it reads a directory from local
presentation server, otherwise it reads the directory of the remote server

RZL_READ_FILE – Read a file from the presentation server if no server name is


given, or read file from remote server. Very useful to avoid authority checks that
occur doing an OPEN DATASET. This function using a SAP C program to read the
data.

RZL_WRITE_FILE_LOCAL – Saves table to the presentation server (not PC).


Does not use OPEN DATASET, so it does not suffer from authority checks!

SAPGUI_PROGRESS_INDICATOR – Display a progress bar on the SAP GUI, and


give the user some idea of what is happening

SAVE_TEXT – To load long text into SAP

SCROLLING_IN_TABLE -If you are coding a module pool and using a table-
control, you can use this function SCROLLING_IN_TABLE to handle any
scrolling. (provided by Paul Kjaer)

SD_DATETIME_DIFFERENCE – Give the difference in Days and Time for 2 dates

SO_NEW_DOCUMENT_ATT_SEND_API1 – Send a document as part of an email.


The documentation is better than normal for this function, so please read it.

SO_SPLIT_FILE_AND_PATH – Split a fully pathed filename into a filename and a


path.

SO_SPOOL_READ – Fetch printer spool according to the spool number informed.

SO_WIND_SPOOL_LIST – Browse printer spool numbers according to user


informed.

SX_OBJECT_CONVERT_OTF_PDF – Conversion From OTF to PDF (SAPScript


conversion)

SX_OBJECT_CONVERT_OTF_PRT – Conversion From OTF to Printer Format


(SAPScript conversion)
SX_OBJECT_CONVERT_OTF_RAW – Conversion From OTF to ASCII
(SAPScript conversion)

SXPG_CALL_SYSTEM – you can check the user’s authorization for the specified
command and run the command. The command runs on the host system on which
the function module is executed. The function module is RFC-capable. It can
therefore be run on the host system at which a user happens to be active or on
another designated host system at which an R/3 server is active.

SXPG_COMMAND_LIST_GET – Select a list of external OS command definitions.

SXPG_COMMAND_DEFINITION_GET – Read the definition of a single external


OS command from the R/3 System’s database.

SXPG_COMMAND_CHECK – Check whether the user is authorized to execute the


specified command on the target host system with the specified arguments.

SXPG_COMMAND_EXECUTE – Check a user’s authorization to use a command,


as in SXPG_COMMAND_CHECK. If the authorization check is successful, then
execute the command on the target host system.

TERMINAL_ID_GET – Return the terminal id

TH_DELETE_USER – Logoff a user. Similar results to using SM04.

TH_ENVIRONMENT – Get the UNIX environment

TH_POPUP – Display a popup system message on a specific users screen.

TH_REMOTE_TRANSACTION – Run a transaction on a remote server.


Optionally provide BDC data to be used in the transaction

TH_USER_INFO – Give information about the current user (sessions, workstation


logged in from, etc)

TH_USER_LIST – Show which users are logged into an app server

UNIT_CONVERSION_SIMPLE – convert weights from one UOM to another.

UPLOAD – upload a file to the presentation server (PC)

UPLOAD_FILES – Will load one or more files from app or presentation server

WRITE_LIST -Useful for writing out the list contents that result from the function
LIST_FROM_MEMORY.
WS_DOWNLOAD – Save Internal Table as File on the Presentation Server

WS_EXCEL – Start EXCEL on the PC

WS_EXECUTE – execute a program on a windows PC

WS_FILE_DELETE – Delete File at the Frontend

WS_FILENAME_GET – Call File Selector

WS_MSG – Create a dialog box in which you display an one-line message.

WS_UPLOAD – Load Files from the Presentation Server to Internal ABAP Tables

WS_VOLUME_GET – Get the label from a frontend device.

WWW_LIST_TO_HTML – After running a report, call this function to convert the


list output to HTML.

If you like this post, you may as well like these too:

1. SAP Function Modules SAP Function modules are procedures that are defined in
function groups (special ABAP programs with type F) and can be called from any ABAP
program. Function groups act as containers...
2. Tips : Function Modules Amount and Currency Date and Time Files Mail and SAP
Office Name and Address Messages and Pop-up Screens Reports and Dynpros System
( Logs, Directories, etc) Texts Others...
3. SAP Modules Briefed Here is a brief overview of most of the modules and there
processes in SAP. This should give you a brief outline of what each module is about and
also...
4. What is a Function Group A Function Group is an ABAP program that contains
function modules. Function modules that work with the same data objects can be combined
to form the function group. Each function...
5. SAP General Topics Contains PDF files on the below topics : DBA Cockpit for Oracle
Knowledge Providor SAP Benchmark Tools and Standard Application Benchmarks
Gartner’s Research on SAP’s Enterprise Search Strategy Quickly Access...
Lock objects
Lock objects are created in SE11. The name must start with E.

E. g.: EZHRACTIVITY_DEL

When the lock object is activated 2 function modules are created for
enqueueing and dequeueing the object. They re named ENQUEUE<name> and
DEQUEUE<name>

Example:

ENQUEUE_EZHRACTIVITY_DEL
DEQUEUE_EZHRACTIVITY_DEL

CALL FUNCTION 'ENQUEUE_EZHRACTIVITY_DEL'


EXPORTING
mode_zhr_activity_del = 'E'
mandt = sy-mandt
pernr = l_zhr_activity_del-pernr
ldate = l_zhr_activity_del-ldate
* X_PERNR = ' '
* X_LDATE = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
* EXCEPTIONS
* FOREIGN_LOCK = 1
* SYSTEM_FAILURE = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Parameters

The keys to be locked must be passed here.

Parameter X_<field> that defines the lock behavior when the initial
value is passed exists for every lock field <field>. If the initial
value is assigned to <field> and X_<field>, then a generic lock is
initialized with respect to <field>. If <field> is assigned the initial
value and X_<field> is defined as X, the lock is set with exactly the
initial value of <field>.

Parameter _SCOPE controls how the lock or lock release is passed to the
update program You have the following options:
• _SCOPE = 1: Locks or lock releases are not passed to the
update program. The lock is removed when the transaction is ended.
• _SCOPE = 2: The lock or lock release is passed to the update
program. The update program is responsible for removing the lock. The
interactive program with which the lock was requested no longer has an
influence on the lock behavior. This is the standard setting for the
ENQUEUE function module.
• _SCOPE = 3: The lock or lock release is also passed to the
update program. The lock must be removed in both the interactive
program and in the update program. This is the standard setting for the
DEQUEUE function module.

Parameter _COLLECT controls whether the lock request or lock release


should be performed directly or whether it should first be written to
the local lock container. This parameter can have the following values:
• Initial Value: The lock request or lock release is sent
directly to the lock server.
• X: The lock request or lock release is placed in the local
lock container. The lock requests and lock releases collected in this
lock container can then be sent to the lock server at a later time as a
group by calling the function module FLUSH_ENQUEUE.
Whenever you have lock mode X (extended write lock), locks should not
be written to the local lock container if very many locks refer to the
same lock table. In this case, there will be a considerable loss in
performance in comparison with direct transmission of locks.

parameter _WAIT. This parameter determines the lock behavior when there
is a lock conflict.
You have the following options:
• Initial Value: If a lock attempt fails because there is a
competing lock, the exception FOREIGN_LOCK is triggered.
• X: If a lock attempt fails because there is a competing lock,
the lock attempt is repeated after waiting for a certain time. The
exception FOREIGN_LOCK is triggered only if a certain time limit has
elapsed since the first lock attempt. The waiting time and the time
limit are defined by profile parameters.
CALL FUNCTION 'DEQUEUE_EZHRACTIVITY_DEL'
* EXPORTING
* MODE_ZHR_ACTIVITY_DEL = 'E'
* MANDT = SY-MANDT
* PERNR =
* LDATE =
* X_PERNR = ' '
* X_LDATE = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.

Change database table entry even if it is


not allowed
• Goto SE16 and display the table
• Select the entry
• Type /h in the command line and press enter
• Press the Display button
• The program now goes into debug mode
• Press F7 to leave the first form
• You are now in the code below. Change variable code to ’EDIT’
Free text search in a field in a internal
table
FUNCTION SEARCH_TEXT_IN_TABLE

Inputparametre:

• TABLE (general table with header line)


• FIELDNAME (Name of field that shoul be searched incl. name of table)
• SEARCH (Teaxt that should be searched for

Returparametre:

• RESULT (The text from field tht has been found)


• RESULT_INDEX (Record number. 0, if not found)

field-symbols: <f>
data: txt(500) type c.

assign (FIELDNAME) to <f>.


clear RESULT_INDEX.
translate SEARCH to upper case.
loop at TABLE.
move <f> to txt.
translate txt to upper case.
if <f> cs SEARCH.
move <f> to RESULT.
move sy-tabix to RESULT_INDEX.
exit.
endif.
endloop
Types of Internal Tables

STANDARD table

Key access to a standard table uses a linear search. This means that the time
required for a search is in linear relation to the number of table entries.

You should use index operations to access standard tables.

SORTED table

Defines the table as one that is always saved correctly sorted.

Key access to a sorted table uses a binary key. If the key is not unique, the system
takes the entry with the lowest index. The runtime required for key access is
logarithmically related to the number of table entries.

HASHED table

Defines the table as one that is managed with an internal hash procedure

You can only access a hashed table using the generic key operations or other generic
operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as
LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.

INDEX table

A table that can be accessed using an index.

Index table is only used to specify the type of generic parameters in a FORM or
FUNCTION. That means that you can't create a table of type INDEX.

Standard tables and sorted tables are index tables.


ANY table

Any table is only used to specify the type of generic parameters in a FORM or
FUNCTION. That means that you can't create a table of type ANY.

Standard, sorted and hashed tables belongs to ANY tables.

Working with Internal Tables


This is only an overview of internal table operations. Use the SAP on-line help to
get further details.

1. Append 2 tables with identical structure


2. Check if there are any entries in an internal table
3. Copy an internal table to another internal table
4. Delete lines
5. Delete duplicate entries in internal table after sort
6. Modify line of internal table
7. Summarize data into an internal table

Append 2 tables with identical structure


All rows: append lines of itab1 to itab2

Subset of rows: append lines of itab1 from <rowno> to <rowno> to itab2

Check if there are any entries in an internal table

If you don't need to know the number of entries in the table, but only wants to know
if there are any entries at all
use:

if itab[] is initial.........

instead of using describe table.


Copy an internal table to another internal table
Note: The tabels must have exactly the structure

itab2[] = itab2[]

Delete lines
Deleting a single line

read table itab


with key name = 'My name'
into wa_itab.
if sy-subrc = 0.
delete itab.
endif.

Deleting all lines

refresh itab.

If you also want to free the mamory taken up by the table, use FREE instead of
REFRESH

Deleting a subset

This can be done in a loop, but it is better to do it this way:

delete itab where name = 'My name'.

Remember that you can also use wildcards. E.g. if you want to delete all name
statinmg with 'A':

delete itab where name = 'A*'.

Delete duplicate entries in internal table after sort

To delete all duplicate entries from a sorted internal table (e.g. just after SORT),
you can use the

DELETE ADJACENT DUPLICATES FROM itab

statement.

You can use the COMPARING adition to limit the fields that are used to test for
duplicate entries e.g.
SORT i_tab by matnr werks logort.
DELETE ADJACENT DUPLICATES FROM itab COMPARING matnr werks.

All duplicates withe same combination of matnr and werks will be deleted.

Modify line of internal table


modify itab from wa_itab.

modify itab from wa_itab transporting <field1> <field2>

Summarize data into an internal table


Syntax: COLLECT [wa INTO] itab.

Note: You can only use COLLECT if all of the tables non-key fields are numeric
( Type I, P, F)

The collect command summarizes all numerical fields (Type I, P, F) that are not
part of the key into an internal table. The level of summarization is determined by
the table key which can be both numerical and non numerical. After using the
COLLECT command you will have a table with unique keys

Example:
REPORT zcollect.

TYPES:

BEGIN OF t_mytype,

key_c(10) TYPE c,

key_n(10) TYPE n,

key_i TYPE i,

number TYPE i,

END OF t_mytype.

DATA:

gi_mytable TYPE SORTED TABLE OF t_mytype

WITH NON-UNIQUE KEY key_c key_n key_i,

wa_mytable TYPE t_mytype.


START-OF-SELECTION.

CLEAR wa_mytable.

wa_mytable-key_c = '10'.

wa_mytable-key_n = '25'.

wa_mytable-key_i = 5.

wa_mytable-number = 400.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '10'.

wa_mytable-key_n = '25'.

wa_mytable-key_i = 5.

wa_mytable-number = 500.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 6.

wa_mytable-number = 200.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 6.
wa_mytable-number = 900.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 7.

wa_mytable-number = 100.

COLLECT wa_mytable INTO gi_mytable.

END-OF-SELECTION.

LOOP AT gi_mytable INTO wa_mytable.

WRITE: / wa_mytable-key_c,

wa_mytable-key_n,

wa_mytable-key_i,

wa_mytable-number.

ENDLOOP.

Result:

10 0000000025 5 900

11 0000000030 6 1.100

11 0000000030 7 100
If you remove key_i from the table key the result will be:

10 0000000025 10 900

11 0000000030 19 1.200
Adding Records to a Database Table
Add a single record to a database table

insert into <database table> values <work area>

Example:

tables: mytable.

mytable-number = 1.
mytable-name = 'John'.
insert into mytable values mytable.

Inserting all lines from an internal table into a database table:

insert <database table> from table <internal table>

You can add the option: accepting duplicate keys

If you add accepting duplicate keys you can test if the table was successfully
updated, else a runtime error wil be generated.

Note: accepting duplicate keys does not mean that duplicate keys will be accepted,
only that it is possible to test on sy-subrc if you have tried to insert records with
duplicate keys. All remaining records will be inserted.

After you have inserted the recors the variable sy-dbcnt contains the number of
records that were inserted.

Deleting Records from a Database Table


Delete a single record

Delete from ztsapspec where id > -1.

or

customer-customerno = '155151'.
delete cutsomer.

Delete all records

select * from zmellemtab.


delete zmellemtab.
endselect.

Deleting records using records from an internal table

delete employees from table itab.

Dynamic SQL
• Dynamic where clause
• Using a dynamic table name
• Dynamic retrieval and writing of data
• Dynamic SELECT

Dynamic where clause

You can use an internal table to build a dynamic where clause:

data: where_tab(30) occurs 1 with header line,


where_clause(30) type c.

* Build the where clause. Will look like this when finished
* WHERE ZAFSTMD02 = 'X' AND rbusa = '5145'
* With a constant, result: ZAFSTMD01 = 'X'
concatenate 'ZAFSTMD' zcostcheck-zmaaned ' = ''X''' into
where_clause.

* Append to internal table where_tab


append where_clause to where_tab.

* With a variable, result: AND rbusa = '5145'


concatenate 'AND rbusa = ' '''' i_tab-zgsber ''''
append where_clause to where_tab.

* Select
select * from zcostfreq
where (where_tab).
endselect.

Note that you can combine static and dynamic where clauses:

select * from zcostfreq

where bukrs = '2021' AND


(where_tab).
endselect.

Using a dynamic table name

This report prints the number og entries in a table. The table name is specified by a
parameter.

data:
l_count type i.

parameters:
p_tab type tabname.

start-of-selection.
select count(*) from (p_tab) into l_count.
write: / 'Number of entries in table ', p_tab, l_count.

Dynamic retrieval and writing of data

In this example, data is retrieved from the table selected on the selection screen, and
the contents of the table is written to the screen.

DATA:
* Create variable that can contain referecene to any data
dataref TYPE REF TO data.

FIELD-SYMBOLS:
<row> TYPE ANY,
<component> TYPE ANY.

PARAMETERS:
p_tab TYPE tabname.

START-OF-SELECTION.
* Create a workarea for the tabel selected on the selection screen

CREATE DATA dataref TYPE (p_tab).

* The variable dataref cannot be accessed directly, so a field symbol is


* used
ASSIGN dataref->* TO <row>.

SELECT *
FROM (p_tab) UP TO 10 ROWS
INTO <row>.

NEW-LINE.
DO.
* Write all the fields in the record
ASSIGN COMPONENT sy-index
OF STRUCTURE <row>
TO <component>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE <component>.
ENDDO.
ENDSELECT.

Dynamic SELECT

TYPES:
BEGIN OF st_bseg,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
dmbtr LIKE bseg-dmbtr,
END OF st_bseg.

DATA:
sel_list TYPE STANDARD TABLE OF edpline,
li_bseg TYPE STANDARD TABLE OF st_bseg,
l_bseg TYPE st_bseg.
START-OF-SELECTION.
APPEND 'bukrs belnr dmbtr' TO sel_list.

SELECT (sel_list)
FROM bseg UP TO 100 ROWS
INTO TABLE li_bseg.

LOOP AT li_bseg INTO l_bseg.


WRITE : / l_bseg-bukrs, l_bseg-belnr, l_bseg-dmbtr.

ENDLOOP.

Updating database tables

1. Updating records in the database table from an internal table


2. Updating a single entry
3. Updating multiple entries

Updating records in the database table from an internal table


table: personel.
data: itab like personel.

* Read records from the database table where name is space, into an internal table
select * from personal into table itab
where name = space.

* Update name in the internal table to Unknown


loop at itab.
itab-name = 'Unknown'
endloop.

* Modify records in the database table. Only records with the same key values as
then
* internal table is modified
MODIFY personel from table itab.
Updating a single entry
In this example the entry with the key value Customerno = 1 is changed.

table customer.

customer-customerno = 1.
customer-customnavme = 'John'.

UPDATE customer.
if sy-subrc <> 0.
..... No entry with the customerno = 1, add error handling

endif.

Updating multiple entries


Examlpe updating the field zchecked to 'X'

UPDATE zcostcheck set zchecked = 'X'


WHERE zcostcheck-zaar = zaar and
zcostcheck-zmaaned = zmaaned and
zcostcheck-zbukrs = zbukrs and
zcostcheck-zsaknr = zsaknr2 and
zcostcheck-zgsber = zgsber.

Open SQL syntax examples

1. Working with single entries


2. Reading all entries into an internal table
3. Reading single entries
4. Selecting single fields
5. Append new record
6. Update with where clause
7. For all entries
8. JOINs in open SQL
1. INNER JOIN
2. LEFT OUTER JOIN
3. Example 1
4. Example 2
9. Using IN in logical expressions and sql statements
10. Using aggergate functions
Working with single entries

select * from ska1


where saknr = '77004500'.
* Do something with data
move-corresponding ska1 to itab.
append itab.

endselect.

Reading all entries into an internal table

This is more efficient that example 1

select * from ska1 into table itab


where saknr like '77%'
order by saknr.

Reading single entries

You must specify the full primarykey in the where clause to get a correct result.

tables: zsd00004.
data l_custname like like zsd00004-zcustname.

SELECT SINGLE zcustname into l_custname FROM zsd00004


WHERE zcustno = '1551'.

Selecting single fields

This could improve effciency for database tables with many entries and many fields.

data: l_kunnr like kna1-kunnr,


l_kukla like kna1-kukla.

SELECT kunnr kukla


INTO (l_kunnr,l_kukla)
FROM kna1.

write: / l_kunnr, l_kukla.


ENDSELECT.

Append new record

Tables: zsd00003.

zsd00003-zprogram = g_screen0100-zprogram.
zsd00003-zstep = g_screen0100-zstep.
zsd00003-zenhed = g_screen0100-zenhed.

INSERT INTO zsd00003 VALUES zsd00003.

IF sy-subrc = 4.

SY-SUBRC = 0: Line inserted.


SY-SUBRC = 4: The line could not be inserted. A line with the same key
already existed.

Update with where clause

This statement updates the fields zlogdato and zlogtid for the records that
satisfies the where clause.

update zsd00003 set zlogdato = sy-datum


zlogtid = sy-uzeit
where zdriftscenter = g_screen0100-zdriftscenter.

For all entries

tables: mara, makt.

data: begin of i_material occurs 0,


matnr like mara-matnr,
maktx like makt-maktx,
end of i_material.

start-of-selection.

select matnr
appending corresponding fields of table i_material
from mara.

select matnr maktx


into corresponding fields of table i_material
from makt
for all entries in i_material
where matnr = i_material-matnr and
spras = sy-langu.

end-of-selection.
loop at i_material.
write: / i_material-matnr, i_material-maktx.
endloop.

JOINs in open SQL

INNER JOIN

One or more lines on the right-hand table is linked to a line in the


left-hand table. Lines from the left-handed table
is only selected if they meet the ON criteria.

FROM from vbak as a inner join vbap as b


ON b~vbeln = a~vbeln.

One or more lines from vbap is selected for each line in vbak.

Limits on the ON clause:

LEFT OUTER JOIN

The left outer join read lines from the left-handed table EVEN if there is
no corresponding line in the right hand table.

FROM vbak as a left outer join vbap as b


ON b~vbeln = a~vbeln.

If vbap does not contain any lines that meets the condition, a single line
where the values from vbap is filled with null values.
Example 1

SELECT a~zafstemnr b~zafstemnr b~zsaknr

INTO CORRESPONDING FIELDS OF TABLE i_tab


FROM zcostafstm as a INNER JOIN zcostplan as b
ON b~zafstemnr = a~zafstemnr.

Example 2

SELECT lips~vbeln lips~lfimg likp~wadat


INTO corresponding fields of table ltab_orders
FROM lips JOIN likp on ( lips~vbeln = likp~vbeln )
JOIN vbfa on ( lips~vbeln = vbfa~vbelv )
WHERE lips~matnr = matnr
and lips~vbeln in vbeln

and likp~vbeln in vbeln


and vbfa~vbelv in vbeln
and lips~werks in werks
and likp~wadat in datum
and vbfa~vbtyp_n = 'Q' "WMS transfer order
and vbfa~vbtyp_v = 'J'. "Delivery

From ABAP hints & Tips: http://oasis.fortunecity.com/skegness/110/JOIN.html

Using IN in logical expressions and sql statements


It is possible to use a selection table if together with the IN operator.

Example:

* Selection table
DATA: BEGIN OF it_select_fkart OCCURS 0,
sign(1),
option(2),
low LIKE zsd00010-fkart,
high LIKE zsd00010-fkart,
END OF it_select_fkart.
* Build selection table
SELECT * FROM zsd00010
WHERE zaftaletype = '0/0'.
CLEAR it_select_fkart.

it_select_fkart-sign = 'I'.
it_select_fkart-option = 'EQ'.
it_select_fkart-low = zsd00010-fkart.
* it_select_fkart-high = . "Optional
APPEND it_select_fkart.
ENDSELECT.

* Select statement
SELECT vbeln
zuonr
kunag
fkart
fkdat
INTO CORRESPONDING FIELDS OF TABLE i_indlaes_vbrk
FROM vbrk
WHERE kunag IN s_kunag AND
fkart IN it_select_fkart.

endselect.

Using aggergate functions

SELECT MAX( MSGNR ) FROM T100 INTO C4A


WHERE SPRSL = 'D' AND
ARBGB = '00'.

How to read the short text for a field in a


database table
The short text for fields of database tables can be found in table DD03M "Table
fields with data elements, text, and domains"

Search on TABNAME, FIELDNAME and DDLANGUAGE and read the field


DDTEXT

Conv

Package size in SELECT statements


Package size can be used to retreive a spcific number of records at a time. This can
be used if you for example only want tofinish processing a limited amount of data at
a time due to lack of memory.

The exampel below read 50 records at a time from VBAK into an internal table,
and selects the corresponding entries from vbap into an internal table. Then the two
internal tables can be processed, and the next 50 records from VBAk can be read.
remeber to reinitialize tha tables before the next read.

Note the usage of SELECT - ENDSELECT !

REPORT z_test .

TYPES:
BEGIN OF t_vbak,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
END OF t_vbak,
BEGIN OF t_vbap,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
meins LIKE vbap-meins,
END OF t_vbap,
BEGIN OF t_report,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
meins LIKE vbap-meins,

END OF t_report.

DATA:
li_vbak TYPE t_vbak OCCURS 0,
l_vbak TYPE t_vbak,
li_vbap TYPE t_vbap OCCURS 0,
l_vbap TYPE t_vbap,
li_report TYPE t_report OCCURS 0,
l_report TYPE t_report.

START-OF-SELECTION.

SELECT vbeln erdat


FROM vbak
INTO TABLE li_vbak PACKAGE SIZE 50.
SELECT posnr matnr meins
FROM vbap
INTO TABLE li_vbap
FOR ALL ENTRIES IN li_vbak
WHERE vbeln = li_vbak-vbeln.
IF sy-subrc = 0.

* Now you have the two internal tables li_vbak and liÆ_vbap filled with data.
* Do something with the data - remember to reinitialize internal tables
ENDIF.

ENDSELECT.

Reading and writing to a flatfile

Use transaction AL11 to view the files on the apllication server.

1. Writing to a flatfile
2. Reading a file
3. Authority check

Writing to a flatfile
Note: If the path is not inlcuded in the file name, the file is

qwritten to the default directory on the apllication server (The system

uses the directory defined in the profile parameter DIR_HOME.)

DATA: dsn LIKE authb-filename VALUE 'HFNK.DAT'.

OPEN DATASET dsn FOR OUTPUT IN TEXT MODE.


IF sy-subrc <> 0.

WRITE: 'Error opening :', dsn.

ENDIF.

LOOP AT it_doc INTO wa_doc.

TRANSFER wa_doc TO dsn.

IF sy-subrc <> 0.

WRITE /: 'Error writing'.

ENDIF.

ENDLOOP.

CLOSE DATASET dsn.

Reading a file
DATA: g_delimiter(1) TYPE c VALUE '¤',

dsn LIKE authb-filename VALUE 'HFNK.DAT'.

OPEN DATASET g_dsn FOR INPUT IN TEXT MODE.

IF sy-subrc <> 0.

write 'Error'.

EXIT.

ENDIF.
DO.

READ DATASET g_dsn INTO fline.

IF sy-subrc <> 0.

EXIT.

ELSE.

CLEAR wa_document.

* Split line into fields using the constant delimiter

SPLIT fline AT g_delimiter INTO

wa_document-bukrs

wa_document-gjahr

wa_document-belnr.

APPEND wa_document TO it_document.

ENDIF.

ENDDO.

CLOSE DATASET g_dsn.

Authority check
You can use the function module below to check for the necessary authorization. If
the default value for the PROGRAM parameters is the current program .
CALL FUNCTION 'AUTHORITY_CHECK_DATASET'

EXPORTING

* PROGRAM =
activity = 'WRITE'

filename = dsn

EXCEPTIONS

no_authority = 1

activity_unknown = 2

OTHERS = 3

imple example of how to make a dialog


program
Checklist for simpe dialog program

Create the program


Create a new program in the repository browser (Transaction SE80) .
Name standard for dialog programs is SAPMZ<name of program>

In the attributes window:

- Module pool = M
- Application = Z

Create the screen


Create a new screen.

Add a pushbutton to the screen

In the attributes screen for the pushbutton, enter a function code

in the FctCode field ( In this example: 0020 ).

When you create a screen, SAP automathic creates a field with the type
OK. The function code of the psuhbutton will be placed here when you
push the button. However you have to supply the name of the OK field
( In this example: OK_CODE ).

You must also create a global variable in the program, to store the
value of the OK field ( See below ).

Create global variables


DATA:
* Global variable to store OK code

ok_code(4),
* Temporary store the value of the OK code
save_ok_code(4).

Create code for the screen


PROCESS BEFORE OUTPUT.
MODULE status_0001.

PROCESS AFTER INPUT.


MODULE user_command_0001.

MODULE status_0001 OUTPUT.


SET PF-STATUS '0001'.
SET TITLEBAR '001'.

* Example of how deactivate a field on the screen


* ZCOSTAFSTM-ZAFSTEMNR is the name of the screen field we want to
* deactivate.
LOOP AT SCREEN.
CHECK screen-name = 'ZCOSTAFSTM-ZAFSTEMNR'.
screen-input = '0'.
MODIFY SCREEN.
ENDLOOP.

ENDIF.

ENDMODULE.

MODULE user_command_0001 INPUT.


* Here you can catch when user pushes a pushbutton

* Save the OK code in save_ok_code and clear it


save_ok_code = ok_code.
CLEAR ok_code.

CASE save_ok_code.
WHEN '0010'.
* Afstemninger
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
PERFORM my_list.
WHEN '0020'.
CALL TRANSACTION 'ZCO1'.

WHEN 'RETU'.
LEAVE TO SCREEN '0000'.
ENDCASE.
ENDMODULE.

AT USER-COMMAND.
* Here you can catch when the user psuh a button on the menu bar or
presses a function key

CASE sy-ucomm.
WHEN 'OPRT'.
PERFORM something.
ENDCASE.

Update values in dynpro fields


Data: dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE.

dyfields-fieldname = 'PDPLA-VON_DATE'.
dyfields-fieldvalue = l_datestr.
APPEND dyfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'


EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = dyfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.

Calling Sub Routines from a SapScript


form
This example shows how to to read a customer name from a script using a form in
an abap program
Code in the SapScript form

/:DEFINE &CUST& = '00000021'.


/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.

Dear &NAME&

Code in the ABAP program


IMPORTANT: The structure itcsy must be used for the parameters.

REPORT Z_HENRIKF_SCRIPT_FORM .
tables scustom.
form get_name tables in_tab structure itcsy
out_tab structure itcsy.

read table in_tab index 1.

select single * from scustom


where id = in_tab-value.

if sy-subrc = 0.
read table out_tab index 1.
move 'NAME' to out_tab-name.
move scustom-name to out_tab-value.
modify out_tab index sy-tabix.
else.
read table out_tab index 1.
move 'No name' to out_tab-value.
modify out_tab index sy-tabix.
endif.

** You could also fill the ouput parameter table this way
* READ TABLE out_par WITH KEY 'NAME1'.
* out_par-value = l_name1.
* MODIFY out_par INDEX sy-tabix.

endform.

Note: If you use more than one parameter you must use Using or
Changing before every parameter !

/: PERFORM <form> IN PROGRAM <prog>


/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM

Structure of a print program

1. General Structure
2. Examples of function calls
1. OPEN FORM
2. START_FORM
3. WRITE_FORM
4. END_FORM
5. CLOSE_FORM

General Structure

The print program is used to print forms. The program retieves the necesary data
from datbase tables, defines the order of in which text elements are printed, chooses
a form for printing and selects an output device and print options.

* Open form printing - Must be called before working with any of the other form
function modules.
Must be ended with function module CLOSE FORM
call function 'OPEN_FORM'.....

*To begin several indentical forms containing different data within a single spool
request, begin each form using START_FORM, and end it using END_FORM
call funtion 'START_FORM'.....

* Write text elements to a window of the form


call function 'WRITE_FORM'.....

* Ends form
call funtion 'END_FORM'.....

* Closes form printing


call function 'CLOSE_FORM'....

Examples of function calls

OPEN FORM

* Structure for the OPTIONS parameter


DATA BEGIN OF OPTIONS.
INCLUDE STRUCTURE ITCPO.
DATA END OF OPTIONS.

OPTIONS-TDDEST = '*'.

OPTIONS-TDIMMED = '*'.
OPTIONS-TDDELETE = '*'.
OPTIONS-TDNEWID = 'X'.

CALL FUNCTION 'OPEN_FORM'


EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
* FORM =''
* LANGUAGE = SY-LANGU
OPTIONS = OPTIONS

* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
EXCEPTIONS
CANCELED =1
DEVICE =2
FORM =3
OPTIONS =4

UNCLOSED =5
MAIL_OPTIONS =6
ARCHIVE_ERROR =7
INVALID_FAX_NUMBER =8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10
.
IF sy-subrc <> 0.
...............................
ENDIF.

START_FORM

CALL FUNCTION 'START_FORM'


* EXPORTING
* ARCHIVE_INDEX =
FORM = 'MY_FORM'

* LANGUAGE =''
* STARTPAGE =''
* PROGRAM =''
* MAIL_APPL_OBJECT =
* IMPORTING
* LANGUAGE =
* EXCEPTIONS
FORM =1
FORMAT =2
UNENDED =3
UNOPENED =4
UNUSED =5
OTHERS =6

WRITE_FORM

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT =
FUNCTION =
TYPE =
WINDOW =
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT =1
FUNCTION =2

TYPE =3
UNOPENED =4
UNSTARTED =5
WINDOW =6
BAD_PAGEFORMAT_FOR_PRINT = 7
OTHERS =8
.

Parameters

• ELEMENT Text element to be output. ITEM_LINE, ITEM_HEADER etc.


(Can be seen in the form layout)
• FUNCTION Specifies whether the text is to be appended, replaced or
deleted. APPEND,SET, DELETE
• TYPE Output area of the main window. TOP, BODY, BOTTOM (Default =
TOP)
• WINDOW Window where the text element is output. MAIN....... other
windows (Default = MAIN)

Note: To write lines to the main window, you can also use the
WRITE_FORM_LINES function module.

Examples
Form layout of MAIN window

/E INTRODUCTION
* Dear Customer
...........................

/E ITEM_HEADER
IH Carrier, Departure

/E ITEM_LINE
IL &SBOOK-CARRID&, &SPFLI-DEPTIME&

/E CLOSING_REMARK

Writing introduction

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT = 'INTRODUCTION'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS =8
.

Writing column headers

CALL FUNCTION 'WRITE_FORM'

EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS =8
.

Set column headings into TOP area of main window for subsequent pages

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS =8

Write item lines

LOOP AT .....
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8.

ENDLOOP.

Delete column headings from TOP area of main window

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'DELETE'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS =8

Print closing remark

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT = 'CLOSING_REMARK'

FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS =8
END_FORM

CALL FUNCTION 'END_FORM'

* IMPORTING
* RESULT =
EXCEPTIONS
* UNOPENED =1
* BAD_PAGEFORMAT_FOR_PRINT = 2
OTHERS =3

CLOSE_FORM

* Structure for Print options (return values) - Pages selected for printing, Number
of copies etc.
DATA BEGIN OF RESULT.
INCLUDE STRUCTURE ITCPP.
DATA END OF RESULT.

CALL FUNCTION 'CLOSE_FORM'


IMPORTING
RESULT = RESULT

* RDI_RESULT =
* TABLES
* OTFDATA =
* EXCEPTIONS
* UNOPENED =1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR =3
* OTHERS =4
.

Copy Form from one Client ot Another


Normally you can use the Copy from client function in menu Utillities in SE71

Howver you are not always allowed to use this functionallity to copy forms, so
instead you can use transaction SCC1 Copy as per Transport Request

Here you use the transport where the form is placed to copy the form

Change original language of a SapScript


form

How to change the original language for a form and optionally delete the form that
previously was in the original language:

You have a form in languages EN and ZH. The original language is EN. You want
to change the original language to ZH and delete the EN form

• In SE71 go to the form in language EN in change mode and select menu


Untillities->Convert original language
• After the original language has been changed, you can delete the En form
• To avoid problems ensure to the delete the EN forms in other clients of the
system too

Standard Texts
Overview
Creating a standard text
Copying Standard texts between clients
Transporting a standard text
Using a standard text in a SapScript form

Overview

Standard texts are fixed texts that can be included in scripts. A standard text can be
maintained in severaæ languages.

Texts are stored in tables STXH & STXL (header and item).

Creating a standard text

Standard texts a created in transaction SO10


Copying Standard texts between clients

In SO10 choose menu Utillties->Copy from client

Transporting a standard text

Go transaction SE38 and submit report RSTXTRAN:


In selection field Text key - name type in the name of the standard text (Or a range)

Choose language

Run the report

The standard texts that satisfies the criterias on the selection scren are shown. marj
the texts that you want to transport:

Press enter

The button Trsfr tetxts to corr is shown - press the button


After pressing the button you will nbe prompted for a change request. Select an
existing og create a new.

Using a standard text in a SapScript form

Format the font for one or more words on


a line

I SE71 create a Character Format for then new font (Use the Character Format
button)

Now use the Character Format (In this case CI) to format the word(s) in the script
using the following syntax:

&VBDPR-FKIMG& <CI>&VBDPR-VRKME(C)&</>,,&komvd-kbetr&

Which standard texts are used by a


SapScript form
The following program prints out the standard texts used by a form. Copy the code
and insert it into an ABAP program. The report can show the texts for 2 different
languages. As the report is based on an ALV grid, the standard functions in the
ALV grid can be used to export the report.
Selection Screen

Report

Code
REPORT zform_texts LINE-SIZE 260.

************************************************************************

* Program name : ZFORM_TEXTS

* Description : Prints all standard texts in a SapScript form

* Author : Henrik Frank

* Date : 2006-05-30

************************************************************************

* Change log:
*

************************************************************************

TYPES:

BEGIN OF t_texts,

tdname LIKE thead-tdname, "Name of standard text

tdline TYPE tdline, "Text

tdline2 TYPE tdline, "Text in alternatove language

END OF t_texts.

DATA:

it_lines TYPE STANDARD TABLE OF tline,

wa_lines TYPE tline,

it_texts TYPE STANDARD TABLE OF t_texts,

wa_texts TYPE t_texts,

test(7) TYPE c,

startpos TYPE i,

endpos TYPE i,

len TYPE i,

myline TYPE string.

*----- ALV Grid Declarations

DATA: r_container TYPE REF TO cl_gui_custom_container,

r_grid TYPE REF TO cl_gui_alv_grid.


DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,

alv_layout TYPE slis_layout_alv,

gd_repid LIKE sy-repid.

DATA: l_wa TYPE slis_fieldcat_alv.

*******************************************************

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.

*******************************************************

PARAMETERS:

pform TYPE tdform OBLIGATORY,

plang TYPE tdspras OBLIGATORY DEFAULT 'EN',

plang2 TYPE tdspras.

SELECTION-SCREEN END OF BLOCK 1.

START-OF-SELECTION.

IF plang2 IS INITIAL.

plang2 = plang.

ENDIF.

PERFORM read_form_source.

PERFORM extract_texts_from_source.
END-OF-SELECTION.

PERFORM alv_setup.

PERFORM display_alv.

*&---------------------------------------------------------------------*

*& Form read_form_source

*&---------------------------------------------------------------------*

* Read SapsScript source code

*----------------------------------------------------------------------*

FORM read_form_source.

DATA:

form LIKE thead-tdname.

form = pform.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'TXT '

language = plang

name = form

object = 'FORM'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =
TABLES

lines = it_lines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " read_form

*&---------------------------------------------------------------------*

*& Form extract_texts_from_source

*&---------------------------------------------------------------------*

* Extract standard texts from source code

*----------------------------------------------------------------------*

FORM extract_texts_from_source.

startpos = 8.

LOOP AT it_lines INTO wa_lines.


MOVE wa_lines-tdline TO test.

IF test = 'INCLUDE' AND wa_lines-tdformat <> '/*'.

SEARCH wa_lines-tdline FOR 'OBJECT'.

endpos = sy-fdpos.

IF endpos > 8.

CLEAR wa_texts.

len = endpos - startpos.

MOVE wa_lines-tdline+startpos(len) TO wa_texts-tdname.

SHIFT wa_texts-tdname LEFT DELETING LEADING space.

PERFORM read_standard_texts

USING wa_texts-tdname

plang

CHANGING wa_texts-tdline.

* Read tet in alternative language

IF NOT plang2 IS INITIAL.

PERFORM read_standard_texts

USING wa_texts-tdname

plang2

CHANGING wa_texts-tdline2.

ENDIF.

APPEND wa_texts TO it_texts.


ENDIF.

ENDIF.

ENDLOOP.

SORT it_texts BY tdname.

DELETE ADJACENT DUPLICATES FROM it_texts COMPARING tdname.

ENDFORM. " extract_texts

*&---------------------------------------------------------------------*

*& Form read_standard_texts

*&---------------------------------------------------------------------*

* Read longtext for standard txts

*----------------------------------------------------------------------*

FORM read_standard_texts

USING p_tdname

p_language

CHANGING p_tdline.

DATA: it_line TYPE STANDARD TABLE OF tline,

wa_line TYPE tline,

name LIKE thead-tdname.

MOVE p_tdname TO name.


CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'ST '

language = p_language

name = name

object = 'TEXT'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

lines = it_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8

IF sy-subrc <> 0.

* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.
READ TABLE it_line INDEX 1

INTO wa_line.

IF sy-subrc = 0.

MOVE wa_line-tdline TO p_tdline.

ENDIF.

ENDIF.

ENDFORM. " read_standard_texts

*&---------------------------------------------------------------------*

*& Form alv_setup

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM alv_setup.

DATA tmp TYPE string.

CLEAR l_wa.

REFRESH alv_fieldcat.

l_wa-key = 'X'.

l_wa-fieldname = 'TDNAME'.

l_wa-seltext_s = 'Standard text'.

l_wa-seltext_m = 'Standard text'.


l_wa-seltext_l = 'Standard text'.

APPEND l_wa TO alv_fieldcat.

l_wa-key = ''.

l_wa-fieldname = 'TDLINE'.

CONCATENATE 'Text language: ' plang INTO tmp.

l_wa-seltext_s = tmp.

l_wa-seltext_m = tmp.

l_wa-seltext_l = tmp.

APPEND l_wa TO alv_fieldcat.

l_wa-key = ''.

l_wa-fieldname = 'TDLINE2'.

CONCATENATE 'Text language: ' plang2 INTO tmp.

l_wa-seltext_s = tmp.

l_wa-seltext_m = tmp.

l_wa-seltext_l = tmp.

APPEND l_wa TO alv_fieldcat.

ENDFORM. " alv_setup

*&---------------------------------------------------------------------*

*& Form display_alv

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text
*----------------------------------------------------------------------*

FORM display_alv.

gd_repid = sy-repid.

* Configure layout of screen

alv_layout-colwidth_optimize = 'X'.

alv_layout-zebra = 'X'.

alv_layout-no_min_linesize = 'X'.

* Now call display function

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = alv_layout

it_fieldcat = alv_fieldcat

* i_grid_title = text-005

TABLES

t_outtab = it_texts

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.
ENDFORM. " display_alv

*---------------------------------------------------------------------*

* FORM top_of_page *

*---------------------------------------------------------------------*

* ........ *

*---------------------------------------------------------------------*

FORM top_of_page.

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

l_tmp(50) TYPE c.

* Title

CONCATENATE 'Standard texts used by form : ' pform INTO l_tmp.

wa_header-typ = 'H'.

wa_header-info = l_tmp.

APPEND wa_header TO t_header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_header.

ENDFORM.

SAP Script - Usefull programs


RSTXFCON Converts SAPScript page formats
Save a SAPScript layout set to disk, and load it back
RSTXSCRP
into SAP.
Pass the spool number of a report's output to this
RSTXTPDF4
program to have the output converted to PDF format.
RSWBO052 Change development class of a sapscript

SapScript How to get the total number of


pages that will be printet
&SAPSCRIPT-FORMPAGES& Will rreturn total no. of pages

How find which program is linked to the


sapscript
In table TNAPR you see the connection between SAP script form, message type and
the printprogram.

Define and setup for user developed


IDOC

1. Define segments: WE31


2. Create new basic idoc type: WE30
3. Create message type: WE81
4. Link message type to IDOC basis type: WE82
5. Create RDC destination: SM59
6. Create logical system: SALE
7. Create port: WE21
8. Create partner profile: WE20
9. Set up distribution model (If necessary): BD64

1. WE31: Define segments

Transaction code: WE31

Create segment Z1ACTIV

Own segments should start with Z1..Z2….. instead of E1..E2…..

Segments must be released before they are transported

2. WE30: Create new IDOC

Transaction: WE30

Create new idoc ZHRACT01. The idoc uses segment Z1ACTIV

Note: Same idoc can exist in different versions e.g. ORDERS01, ORDERS02…..
The difference between versions is that tehre are more segments in newer versions.
3. WE81: Create message type

Transaction WE80

Create new message type ZHRACT01

4. WE82: Link message type to IDOC basis type

Link message type ZHRACT01 to idoc baisi type ZHRACT01


5. SM59: Create RDC destination
6. SALE: Create logical system

7. WE21: Create port

8. WE20: Create partner profile


9. BD64: Set up distribution model (If necessary)

Change pointers for a custom message


type
Scenario: We want to crerate a custom message type for idoc type MATMAS03,
activate change pointers for the message type and use a distribution model to filter
and distribute the idoc.

1. WE81 Create new message type ZMATMAS_SIMATIC

2. WE82 make connection between IDOC type MATMAS03 and message


type ZMATMAS_SIMATIC

3. BD59 Create the field that we will use to filter the idoc in the distribution model

We will use plant (WERKS) and material type (MTKLAS) to filter the idocs:

Note: You can take a look at the standard message type MATMAS to find ALE
object type and Segm. type

4. BD64 Create distribution model.

Press button Create model view to create a new distrbution model

Press select the new model and press button Add message type to add the new
message type and the sender and receiver systems

Your distribution model should now look like this


Under the message type ZMATMAS_SIMATIC choose the filter and add the fields
from step 3 and the filter cirterias.
We only want to distribute IDOC where plant = 1002 and material type is HALB or
ROH.

You are now finished with the distribution model

5. BD60 To be able to use changepointers for the new message type, it must have a
reference to the original message type MATMAS. You make this referecne in BD60.

6. BD52 In this transaction you set up the fields that triggers a change. Note that it is
not possible to copy the fields from and existing message type (For example from
MATMAS). However, you can use an existing message type in BD52 to find out
Object and table name for the fields.

In the example below we only wants to trigger a change pointer when the material
text changes.

7. You should now be ready to test that the change pointer works for the new
transaction.
• Make a change to the material text for a material in plant 1002 of material
type HALB or ROH
• Run transaction BD21 or ABAP program RBDMIDOC for message type
ZMATMAS_SIMATIC
• Check that an outboudn IDOC has been created (Transaction WE02)

Generate IDOCs from a report


*&---------------------------------------------------------------------*
*& Report ZHR_PERMITTED_ACT_TO_SCANNERS *
*& *
*&---------------------------------------------------------------------*
*
* This report reads permitted activities from table ZHR_AKTIVITITER,
* generates idocs of basis type ZHRACT01 and message type ZHRACT01
* and sends them to XI.
*
*
* Functionality/program flow:
* ============================
* - Read data from tables ZHR_AKTIVITITER and PRPS
* - Create IDoc control record
* - Create IDoc segments
* - Distribute IDoc using function module MASTER_IDOC_DISTRIBUTE
* - Show report
*
*---------------------------------------------------------------------

REPORT zhr_permitted_act_to_scanners.

TABLES: zhr_aktivititer.

TYPES:
BEGIN OF t_activities,
orgeh LIKE zhr_aktivititer-orgeh,
actid LIKE zhr_aktivititer-actid,
descr LIKE zhr_aktivititer-descr,
posid LIKE prps-posid,
post1 LIKE prps-post1,
END OF t_activities.

DATA:
gt_activities TYPE STANDARD TABLE OF t_activities,
wa_activities TYPE t_activities,
* Number of idoc created
g_num_of_idocs TYPE i,
* IDOC control record
g_idoc_control LIKE edidc,
* Return data from MASTER_IDOC_DISTRIBUTE
gt_comm_idocs TYPE STANDARD TABLE OF edidc,
wa_comm_idocs TYPE edidc,
* IDOC data record
gt_idoc_data TYPE STANDARD TABLE OF edidd,
wa_idoc_data TYPE edidd,
* Structure for idoc segment Z!ACTIV
g_z1activ LIKE z1activ.

*----------------------------------------------------------------------
--------
* SELECTION SCREEN
*----------------------------------------------------------------------
--------

SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE text-001.

* Data selection
SELECT-OPTIONS:
s_orgeh FOR zhr_aktivititer-orgeh.
PARAMETERS:
p_date LIKE sy-datum DEFAULT sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK SELECTION.

* Communication parameters
SELECTION-SCREEN BEGIN OF BLOCK COMMUNICATION WITH FRAME TITLE text-002.
PARAMETERS:
p_idoctp LIKE edidc-idoctp OBLIGATORY DEFAULT 'ZHRACT01', "Idoc type
p_mestyp LIKE edidc-mestyp OBLIGATORY DEFAULT 'ZHRACT01', "Message
type
p_rcvpor LIKE edidc-rcvpor OBLIGATORY DEFAULT 'SAPUXI', "Receiver
port
p_rcvprt LIKE edidc-rcvprt OBLIGATORY DEFAULT 'LS', "Receiver
partner type
p_rcvprn LIKE edidc-rcvprn OBLIGATORY DEFAULT 'UXICLNT100'.
"Receiver partner
SELECTION-SCREEN END OF BLOCK COMMUNICATION.

* Output
SELECTION-SCREEN BEGIN OF BLOCK OUTPUT WITH FRAME TITLE text-010.
PARAMETERS:
p_idoc AS CHECKBOX, "Create
idoc
p_report AS CHECKBOX. "Show
report
SELECTION-SCREEN END OF BLOCK OUTPUT.

*----------------------------------------------------------------------
--------
* SELECTION SCREEN OUTPUT
*----------------------------------------------------------------------
--------
AT SELECTION-SCREEN OUTPUT.
* Protect parameters for idoc type and message type
LOOP AT SCREEN.
IF screen-name = 'P_IDOCTP' OR screen-name = 'P_MESTYP'.
screen-input = '0'.
MODIFY SCREEN.

ENDIF.
ENDLOOP.
*----------------------------------------------------------------------
--------
* START OF SELECTION
*----------------------------------------------------------------------
--------

START-OF-SELECTION.
PERFORM read_data.

*----------------------------------------------------------------------
--------
* END OF SELECTION
*----------------------------------------------------------------------
--------

END-OF-SELECTION.
PERFORM create_control_record.

PERFORM create_data_records.

IF p_idoc = 'X'.
PERFORM distribute_idoc.
ENDIF.

IF p_report = 'X'.
PERFORM show_report.
ENDIF.

*&---------------------------------------------------------------------*
*& Form read_data
*&---------------------------------------------------------------------*
* Read activities from ZHR_AKTIVITITER and the corresponding
* WSB-elements and texts from PRPS
*----------------------------------------------------------------------*
FORM read_data.

REFRESH gt_activities.

SELECT zhr_aktivititer~orgeh
zhr_aktivititer~actid
zhr_aktivititer~descr
prps~posid
prps~post1
INTO CORRESPONDING FIELDS OF TABLE gt_activities
FROM zhr_aktivititer LEFT OUTER JOIN prps
ON prps~pspnr = zhr_aktivititer~pspnr
WHERE zhr_aktivititer~orgeh IN s_orgeh AND
zhr_aktivititer~begda <= p_date AND
zhr_aktivititer~endda >= p_date.

SORT gt_activities BY orgeh actid.

ENDFORM. " read_data


*&---------------------------------------------------------------------*
*& Form create_control_record
*&---------------------------------------------------------------------*
* Create control record for IDOC - The values for the control
* are taken from the selection screen
*
*----------------------------------------------------------------------*
FORM create_control_record.
CLEAR g_idoc_control.

g_idoc_control-mestyp = p_mestyp.
g_idoc_control-idoctp = p_idoctp.
g_idoc_control-rcvpor = p_rcvpor.
g_idoc_control-rcvprt = p_rcvprt.
g_idoc_control-rcvprn = p_rcvprn.

ENDFORM. " create_control_record


*&---------------------------------------------------------------------*
*& Form create_data_records
*&---------------------------------------------------------------------*
* Create segment data records for idoc segment Z1ACTIV
*
*----------------------------------------------------------------------*
FORM create_data_records.
DATA:
l_old_orgeh LIKE zhr_aktivititer-orgeh.

REFRESH gt_idoc_data.

CLEAR:
wa_activities,
l_old_orgeh.

SORT gt_activities BY orgeh.

LOOP AT gt_activities INTO wa_activities.


CLEAR:
wa_idoc_data,
g_z1activ.

wa_idoc_data-segnam = 'Z1ACTIV'.
g_z1activ-orgeh = wa_activities-orgeh.
g_z1activ-actid = wa_activities-actid.
g_z1activ-descr = wa_activities-descr.
g_z1activ-posid = wa_activities-posid.
g_z1activ-post1 = wa_activities-post1.

MOVE g_z1activ TO wa_idoc_data-sdata.

APPEND wa_idoc_data TO gt_idoc_data.


ENDLOOP.

ENDFORM. " create_data_records


*&---------------------------------------------------------------------*
*& Form distribute_idoc
*&---------------------------------------------------------------------*
* Create and distribute idoc
*----------------------------------------------------------------------*
FORM distribute_idoc .

REFRESH gt_comm_idocs.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'


EXPORTING
master_idoc_control = g_idoc_control
* OBJ_TYPE = ''
* CHNUM = ''
TABLES
communication_idoc_control = gt_comm_idocs
master_idoc_data = gt_idoc_data
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
COMMIT WORK.
ENDIF.

ENDFORM. " distribute_idoc


*&---------------------------------------------------------------------*
*& Form show_report
*&---------------------------------------------------------------------*
* Show report
*----------------------------------------------------------------------*
FORM show_report .
IF p_idoc = 'X'.

* Generated IDOCs
WRITE : / text-003 COLOR COL_HEADING INTENSIFIED ON.
LOOP AT gt_comm_idocs INTO wa_comm_idocs.
WRITE : / wa_comm_idocs-docnum.
ENDLOOP.
SKIP 2.
ENDIF.

* Show selected activities


SKIP 1.
FORMAT COLOR COL_HEADING.
WRITE AT 2 text-004. "Team
WRITE AT 12 text-005. "Aktivitets ID'.
WRITE AT 22 text-006. "Aktivitets beskrivelse'.
WRITE AT 59 text-007. "PSP-element'.
WRITE AT 79 text-008. "PSP kort tekst'.
FORMAT RESET.

LOOP AT gt_activities INTO wa_activities.


WRITE: /
wa_activities-orgeh UNDER text-004,
wa_activities-actid UNDER text-005,
wa_activities-descr UNDER text-006,
wa_activities-posid UNDER text-007,
wa_activities-post1 UNDER text-008.
ENDLOOP.

ENDFORM. " show_report

Updating IDoc data in segments


By Kevin Wilson - From ErpGenie.com
STEP 1 - Open document to edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
document_number = t_docnum
IMPORTING
idoc_control = itab_edidc
TABLES
idoc_data = itab_edidd
EXCEPTIONS
document_foreign_lock = 1
document_not_exist = 2
document_not_open = 3
status_is_unable_for_changing = 4
OTHERS = 5.

STEP 2 - Loop at itab_edidd and change data

LOOP AT itab_edidd WHERE segnam = 'E1EDKA1'.


e1edka1 = itab_edidd-sdata.
IF e1edka1-parvw = 'LF'.
e1edka1-partn = t_eikto.
itab_edidd-sdata = e1edka1.
MODIFY itab_edidd.
EXIT.
ENDIF.
ENDLOOP.
STEP 3 - Change data segments

CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'


TABLES
idoc_changed_data_range = itab_edidd
EXCEPTIONS
idoc_not_open = 1
data_record_not_exist = 2
OTHERS = 3.

STEP 3a - Change control record


CALL FUNCTION 'EDI_CHANGE_CONTROL_RECORD'
EXPORTING
idoc_changed_control = itab_edidc
EXCEPTIONS
idoc_not_open = 1
direction_change_not_allowed = 2
OTHERS = 3.

STEP 4 - Close Idoc

* Update IDoc status

CLEAR t_itab_edids40.
t_itab_edids40-docnum = t_docnum.
t_itab_edids40-status = '51'.
t_itab_edids40-repid = sy-repid.
t_itab_edids40-tabnam = 'EDI_DS'.
t_itab_edids40-mandt = sy-mandt.
t_itab_edids40-stamqu = 'SAP'.
t_itab_edids40-stamid = 'B1'.
t_itab_edids40-stamno = '999'.
t_itab_edids40-stapa1 = 'Sold to changed to '.
t_itab_edids40-stapa2 = t_new_kunnr.
t_itab_edids40-logdat = sy-datum.
t_itab_edids40-logtim = sy-uzeit.
APPEND t_itab_edids40.

CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'


EXPORTING
document_number = t_docnum
do_commit = 'X'
do_update = 'X'
write_all_status = 'X'
TABLES
status_records = t_itab_edids40
EXCEPTIONS
idoc_not_open = 1
db_error = 2
OTHERS = 3.

Master data distribution using IDOCs


Transaction codes

• BD21 : Generate idocs from change pointers


• BD50 : Activate and deactivate change pointers for message type
• BD61 : Activate and deactivate change pointers generally
• BD64 : Distribution model
Step by Step example

This example demonstrates how to distribute changes to the material master.

• Sender system: C46 client 30


• Receiver system: C46 client 200
• Idoc message type: MATMAS

Activate change pointers

If not done allready, activate change pointers generally (Transaction BD61) and for
the message type ( Transaction BD50 )

ALE configuration in the sender system

These step should be carried out in client 030

Create RFC destination

Go to transaction SM59, select R/3 Connections create RFC destination that points
to client 200:
Create port

Go to transaction WE21 and create port for client 200. The port should point to the
RFC destination created above
Create partner profile

Go to trsansaction WE20 and create partner profile C46CLNT200. Add outbound


message type messsag type MATMAS:

Use receiver port Z000000002 and idoc basic type MATMAS03:


ALE configuration in the receiver system

As in the sender system a RFC destination, port and partner profile should be
created in the receiver system cielnt 200. In the partner profile add message type
MATMAS:
Set up distribution model

In client C30 set up distribution model to distribute MATMAS idocs to client 200

Go to trsnaction BD64

Create model view My Test

Press the Add message type button and fill out the dialog box:

Your model should now look like this:


Testing the data distrbution

• In the sender system client 030 go to trsnaction MM02 and change a material
• In sender system client 030 Go to transaction BD21 and select message type
MATMAS and execute the program
• In the sender system client 030 go to transaction WE02 and check that an
outbound idoc of basis type MATMAS03 and message type MATMAS has
been sent without errors
• In the receiver system client 200 go to transaction WE02 and check that an
inbound idoc of basis type MATMAS03 and message type MATMAS has
been received without errors
• In the receiver system client 200 go to transaction MM02 and check that the
material has been changed

How to create a function module for an


IDOC
1. Create new function module
2. BD51 ALE Attributes: Add an entry for the function module
3. WE81 Message types: Create a new messagetype
4. WE82 Idoc Type/Message: Create Entry to link the above defined message
type with the IDOC
5. WE57 Message/Application object: Create entry for Functionmodule/IDOC
type/Messagetype/Object
6. WE42 Inbound process code: Create a new code that refers to the function
module
7. WE20 Partner profile: Define the message type in the partner profile

Distributing material master idoc using


changepointers
Note: To create material master idocs without the use change pointers execute
transaction BD10

The step to distribute material master idocs to other systems using change pointers
are:

• Create logical system for the receiver system: BD54


• Create distribution model: BD64
• Activate change pointers for message type MATMAS: Transaction BD50
• Add MATMAS message type to the Outbound parameters for the partner
profile for the receiver system: WE20
• After the a material has been changed - Creater idocs from change pointers:
BD21

Program RBDMIDOC which generates idocs from changepointers, can be schedules


to run automatically

Example of distribution model that distributes MATMAS from logical system


C46CLNT30L to XDTCLNT500:

Inbound IDOC Development


• Create Idoc segments (WE31)
• Create Idoc (WE30)
• Create message type (WE81)
• Assign Message type to Idoc type (WE82)
• Develop posting program.
• Configure the function to handle one or more idocs in the same call (BD51)
• Assign function module to Idoc and message type (WE57)
• Create inbound process code (WE42)
• Add message type to inbound parameters for partner (WE20)

Develop posting program

The posting program is implemented as a function module that handles posting of


the inbound idoc (For eaxmple by suing batch input). Naming convetion:
ZIDOC_INPUT_<message type>

Posting programs have a standard interface for there input, output and table
parameters (See example below).

Note that IDoc status codes can be found in transaction WE47.

Example of posting program:

FUNCTION zidoc_input_zprocord .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*" OTHERS
*"----------------------------------------------------------------------

DATA:
it_edidd TYPE STANDARD TABLE OF edidd,
wa_z1procord LIKE z1procord,
l_return TYPE string,
* lt_return TYPE STANDARD TABLE OF string,
l_subrc LIKE sy-subrc,
l_posting_error(1) TYPE c,
l_posting_ok(1) TYPE c.

in_update_task = ''.

* Check if the function module is called correctly *


READ TABLE idoc_contrl INDEX 1.
IF sy-subrc <> 0.
EXIT.
ELSEIF idoc_contrl-mestyp <> 'ZPROCORD'.
RAISE wrong_function_called.
ENDIF.

*----------------------------------------------------------------------
* Loop through all Idocs
*----------------------------------------------------------------------
LOOP AT idoc_contrl.

*----------------------------------------------------------------------
* Select segments belonging to the Idoc
*----------------------------------------------------------------------
REFRESH: it_edidd.
LOOP AT idoc_data WHERE docnum = idoc_contrl-docnum.
APPEND idoc_data TO it_edidd.
ENDLOOP.

*----------------------------------------------------------------------
* Loop through the segments
*----------------------------------------------------------------------
REFRESH idoc_status.
CLEAR:
l_posting_error,
l_posting_ok.

LOOP AT it_edidd INTO idoc_data.


CASE idoc_data-segnam.
WHEN 'Z1PROCORD'.
CLEAR wa_z1procord.
wa_z1procord = idoc_data-sdata.

CLEAR l_subrc.
PERFORM call_transaction
USING wa_z1procord
CHANGING l_subrc
l_return.

IF l_subrc = 0.
l_posting_ok = 'X'.

ELSE.
l_posting_error = 'X'.
* APPEND l_return TO lt_return.
ENDIF.
ENDCASE.
ENDLOOP.

*----------------------------------------------------------------------
* Set Idoc status code
*----------------------------------------------------------------------
CLEAR idoc_status.
idoc_status-docnum = idoc_contrl-docnum.
IF l_posting_ok = 'X' AND l_posting_error IS INITIAL.
* Application document posted
idoc_status-status = '53'.
ELSEIF l_posting_error = 'X' AND l_posting_ok IS INITIAL.
* Error: Application document not posted
idoc_status-status = '51'.
idoc_status-msgty = 'E'.
idoc_status-msgid = 'ZPP_SIMATIC_INTERFAC'.
idoc_status-msgno = '11'.
* idoc_status-msgv1 = l_return.

ELSEIF l_posting_ok = 'X' AND l_posting_error = 'X'.


* Application document not fully posted
idoc_status-status = '52'.
idoc_status-msgty = 'E'.
idoc_status-msgid = 'ZPP_SIMATIC_INTERFAC'.
idoc_status-msgno = '10'.
* idoc_status-msgv1 = l_return.

ENDIF.
APPEND idoc_status.

ENDLOOP.

ENDFUNCTION.

Master data distribution using IDOCs


Transaction codes

• BD21 : Generate idocs from change pointers


• BD50 : Activate and deactivate change pointers for message type
• BD61 : Activate and deactivate change pointers generally
• BD64 : Distribution model

Step by Step example

This example demonstrates how to distribute changes to the material master.

• Sender system: C46 client 30


• Receiver system: C46 client 200
• Idoc message type: MATMAS

Activate change pointers

If not done allready, activate change pointers generally (Transaction BD61) and for
the message type ( Transaction BD50 )

ALE configuration in the sender system

These step should be carried out in client 030

Create RFC destination

Go to transaction SM59, select R/3 Connections create RFC destination that points
to client 200:
Create port

Go to transaction WE21 and create port for client 200. The port should point to the
RFC destination created above

Create partner profile

Go to trsansaction WE20 and create partner profile C46CLNT200. Add outbound


message type messsag type MATMAS:
Use receiver port Z000000002 and idoc basic type MATMAS03:

ALE configuration in the receiver system

As in the sender system a RFC destination, port and partner profile should be
created in the receiver system cielnt 200. In the partner profile add message type
MATMAS:
Set up distribution model

In client C30 set up distribution model to distribute MATMAS idocs to client 200

Go to trsnaction BD64

Create model view My Test

Press the Add message type button and fill out the dialog box:

Your model should now look like this:


Testing the data distrbution

• In the sender system client 030 go to trsnaction MM02 and change a material
• In sender system client 030 Go to transaction BD21 and select message type
MATMAS and execute the program
• In the sender system client 030 go to transaction WE02 and check that an
outbound idoc of basis type MATMAS03 and message type MATMAS has
been sent without errors
• In the receiver system client 200 go to transaction WE02 and check that an
inbound idoc of basis type MATMAS03 and message type MATMAS has
been received without errors
• In the receiver system client 200 go to transaction MM02 and check that the
material has been changed

How to use a filter in a distribution model


You need to do create a filter for plant in BD64 , You can proceed with following
transactions to do so ..............

Maintain object type for message type (BD59) Client independentThe ALE objects
are used to create links between IDocs and applications objects, to control the
serialisation, to filter messages in the customer model and to use listings. For our
own message type and IDoc you must maintain object types for the links.

If you want to check the serialisation for the message type, then you must maintain
object types for the serialisation. If no serialisation object has been maintained for a
given message type, then the serialisation will not be checked for this message
type.To add an object type to our message type, follow these next few steps:

• Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance ->
Maintain object types)3
• Type in your message type ZINVRV and press enter
• Click on New entries
• Enter your object type, LIFNR (We need to use the vendor as a filter object),
the segment name where LIFNR resides, Z1INVRV, a number 1 for the
sequence followed by the actual field name LIFNR
• Save and exit
• You have now created an object that we’ll use as a filter object in the
customer model to direct the flow of messages to the various logical systems
based on the vendors in the filter of the message type ZINVRV.

We now need to add our new message type to the distribution model.

Configuring the Distribution Model. This task is performed on your ALE reference
client.

Manual Configuration (BD64) Client dependent. To manually configure the


customer distribution model, read the ALE configuration procedure, and follow
these steps:

• Perform the Maintain customer distribution model directly function. (ALE


-> Distribution customer model -> Maintain customer distribution model
directly)
• Specify the customer model you want to maintain and the logical system that
is to be the sender of the messages OR create a new model. (Create model
ALE with logical system ALELS1C400)
• Choose the receiving systems to which the sending system must forward
message type ZINVRV to.
• For each receiving logical system allocate the message type necessary for
communication to the receiving systems as per ALE configuration procedure.
• Create filter objects (in our case LIFNR as the object type with the
associated vendor number, 0000018001 with leading zeros, in the object area)
for the message types.
• Save the entries.

Miscellanous Tips part 1


• How to debug an outbound IDOC
• Usefull function modules
• Usefull standard programs
• Usefull tables

How to debug an outbound IDOC

• Set the appropriate breakpoins


• Go to the tramnsaction from which ypoy generate the IDOC (E.g. ME22 or
VL02)
• Go to the messages for the document you select ( In ME22 use menu Header-
>Messages). In other transactioncodes the mneu for messages may be palced
somewhere else.
• In the Output window choose an existing message and press Repeat output
(Or create a new message)
• Select menu Further data and change the dspatch time to 1 Send with
periodically scheduled job
• Submit pogram RSNAT00. In the selection screen choose transmission
medium 6 EDI and enter any further selection criterias
• Enter debug mode ( Type /H in the command line)
• Execute RSNAT00

Usefull function modules

By Kevin Wilson - From ErpGenie.com

IDOCTYPES_LIST_WITH_MESSAGES Returns a list of all Basis types since release 4.0B,


(IDoc types), Extensions (IDoc Hotpackage 48
types) and all messages related
with their respective IDoc types.

IDOCTYPES_FOR_MESTYPE_READ Reads all IDoc types assigned to a since release 4.0B,


message type (logical message). Hotpackge 42

IDOCTYPE_READ_COMPLETE Reads the structure and attributes since release 4.0B,


(segments), as well as the segment Hotpackge 42
attributes (fields and fixed values),
for an IDoc type. In this case, the
version of the record types and
segments must be sent to the
function module.

SEGMENT_READ_COMPLETE Reads the structure and attributes since release 4.0B,


for a segment. In this case, the Hotpackge 42
version of the record types and the
release for the segments must be
sent to the function module.

IDOC_RECORD_READ Reads the structure of the record since release 4.0B,


types for the specified version. Hotpackge 42

Usefull standard programs

RSNAST00 Processes messages that has not bees sendt (processing <>
immediate)
RSNASTED Program, som kaldes fra Output Message Control ved
"udskrift" af ordrer m.v. Indeholder 2 entry points:
EDI_PROCESSING og ALE_PROCESSING. Herfra kaldes
det function module, som er tildelt via partner profilen og
process koden.
RBDMIDOC Generates IDOC's from change pointers (You can also use
transaction BD21)
RSEOUT00 Processes outbound IDOC's with status 30, ( IDOC's mass
processing)
RBDAPP01 Processes inbound IDOC's.
RSECHK07 Check if partner profiler is valid

Use program RSNAST00 to process the IDOCs

Usefull tables
Table Discription
NAST Message Status
EDIDC Control information for an IDOC
EDID4 Data Records from 4.0 onwards
EDIDS Status of an IDOC

Miscellanous Tips part 2


Getting IDocs linked to Application documents
Displaying and IDoc in a report
Read IDoc from Database
Creating and sending an IDoc
ALE Inbound Pre-Processing
Getting IDocs linked to Application documents
By Kevin Wilson - From ErpGenie.com
REFRESH: t_roles.
* VBRK = Invoice
* LIKP = Delivery
* BUS2032 = Sales Order
* BUS2035 = Scheduling Agreement
* objkey - Application document number appended with line if applicable

t_object-objkey = itab_data-objky.
t_object-objtype = 'VBRK'.
CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'
EXPORTING
object = t_object
TABLES
roles = t_roles
EXCEPTIONS
internal_error = 1
no_logsys = 2
OTHERS = 3.

LOOP AT t_roles WHERE objtype = 'IDOC'.


t_idoc_docnum = t_roles-objkey.
ENDLOOP.

Displaying and IDoc in a report


By Kevin Wilson - From ErpGenie.com
AT LINE-SELECTION.
GET CURSOR FIELD field_name.
CASE field_name.
WHEN 'ITAB_DATA-DOCNUM'. "IDoc number

CALL FUNCTION 'EDI_DOCUMENT_DATA_DISPLAY'


EXPORTING
docnum = itab_data2-docnum
EXCEPTIONS
no_data_record_found = 1
OTHERS = 2.

Read IDoc from Database


By Kevin Wilson - From ErpGenie.com
*** Read the IDoc detail from the database

CALL FUNCTION 'IDOC_READ_COMPLETELY'


EXPORTING
document_number = p_docnum
IMPORTING
idoc_control = s_edidc
TABLES
int_edidd = itab_edidd
EXCEPTIONS
document_not_exist = 1
document_number_invalid = 2
OTHERS = 3.

Creating and sending an IDoc


By Kevin Wilson - From ErpGenie.com
*** STEP 1 - Create IDoc internal table entries

*** STEP 2 - Call the function to distribute the IDoc

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'


EXPORTING
master_idoc_control = s_edidc
obj_type = 'BUS2032'
TABLES
communication_idoc_control = itab_edidc
master_idoc_data = itab_edidd
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.

*** STEP 3 - Update IDoc status - If you wish to send additional status
messages through

REFRESH: itab_edids.

itab_edids-status = c_idoc_status_ok.
itab_edids-msgty = c_info_msg.
itab_edids-msgid = c_msgid.
itab_edids-msgno = c_msgno.
itab_edids-msgv1 = itab_edidc-docnum.
itab_edids-msgv2 = s_edidc-sndprn.

*** Call the function to update the ORDCHG IDoc status

CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'


EXPORTING
idoc_number = s_edidc-docnum
TABLES
idoc_status = itab_edids
EXCEPTIONS
idoc_foreign_lock = 1
idoc_not_found = 2
idoc_status_records_empty = 3
idoc_status_invalid = 4
db_error = 5
OTHERS = 6.

ALE Inbound Pre-Processing


By Kevin Wilson - From ErpGenie.com
Sometimes it's necessary to change an Idoc before it is processed. One
way to achieve this
is to call a function module that updates the IDoc tables before
calling the appropriate function module.
Note that the function module below can be replaced with
EDI_DATA_INCOMING if you are using the EDI File Port
method to load IDocs to SAP.

FUNCTION Z_IDOC_INBOUND_ASYNCHRONOUS.
*"---------------------------------------------------------------------
-
*"*"Local interface:
*" TABLES
*" IDOC_CONTROL_REC_40 STRUCTURE EDI_DC40
*" IDOC_DATA_REC_40 STRUCTURE EDI_DD40
*"---------------------------------------------------------------------
-

data e1edp16 type e1edp16.

loop at idoc_control_rec_40
where mestyp = 'DELINS'.

loop at IDOC_DATA_REC_40
where docnum = idoc_control_rec_40-docnum and

segnam = 'E1EDP16'.
move IDOC_DATA_REC_40-sdata to e1edp16.
IF not E1EDP16-PRGRS CA 'DWMI'.
delete IDOC_DATA_REC_40.
ENDIF.
endloop.

endloop.

CALL FUNCTION 'IDOC_INBOUND_ASYNCHRONOUS'


TABLES
idoc_control_rec_40 = IDOC_CONTROL_REC_40
idoc_data_rec_40 = IDOC_DATA_REC_40.

ENDFUNCTION.

Introduction To BAPI Programming

Programming a BAPI consists of two major tasks:

1. Defining BAPI Data structures in SE11

2. Program a RFC enabled BAPI function module for each method

3. Create a Business object for the BAPI in the BOR

4. Documentation the BAPI

5. Generate ALE interface for aynchronous BAPIs

6. Generate and release

Tip: You can use the BAPi explorer to get a step by step instuction/checklist in how
to create a BAPI. In the BAPI explorer select the Project tab.

BAPI Conventions

Methods
Parameters
Standardized BAPIs
Standardized Parameters
Important things to remember..
BAPI/ALE Integration
Methods

• If the BAPI to be implemented is a standardized BAPI, use the generic


names, for example, GetList, GetDetail.
• The method name must be in English (maximum 30 characters).
• The individual components of a BAPI name are separated by the use of
upper and lower case.Example: GetList
Underscores ("_") are not allowed in BAPI names.
• Each BAPI has a return parameter that is either an export parameter or an
export table.
• So that customers can enhance BAPIs, each BAPI must have an ExtensionIn
and an ExtensionOut parameter.

Parameters

• If standardized parameters are used, you have to use the names specified for
standardized parameters.
• BAPI parameter names should be as meaningful as possible. Poorly chosen
names include abbreviations and technical names (e.g. "flag", table names,
etc.).
The parameter and field names must be in English with a maximum of 30
characters.
• The components of a parameter name in the BOR are separated by upper
and lower case letters to make them easier to read. Example:
CompanyCodeDetail
• Values that belong to each other semantically should be grouped together in
one structured parameter, instead of using several scalar parameters.
• For ISO-relevant fields (country, language, unit of measure, currency),
additional fields for ISO codes are provided.
• Unit of measure fields must accompany all quantity fields and currency
identifiers must accompany currency amount fields.

Standardized BAPIs

Some BAPIs provide basic functions and can be used for most SAP business object
types. These BAPIs should be implemented the same for all business object types.
Standardized BAPIs are easier to use and prevent users having to deal with a
number of different BAPIs. Whenever possible, a standardized BAPI must be used
in preference to an individual BAPI.

The following standardized BAPIs are provided:


Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for
example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business
object type are retrieved and returned to the calling program. The
instance is identified via its key. The BAPI GetDetail() is an instance
method.

BAPIs that can create, change or delete instances of a business object


type

The following BAPIs of the same object type have to be programmed so that they
can be called several times within one transaction. For example, if, after sales order
1 has been created, a second sales order 2 is created in the same transaction, the
second BAPI call must not affect the consistency of the sales order 2. After
completing the transaction with a COMMIT WORK, both the orders are saved
consistently in the database.

Create( ) and The BAPIs Create() and CreateFromData() create an


CreateFromData( ) instance of an SAP business object type, for example, a
purchase order. These BAPIs are class methods.
Change( ) The BAPI Change() changes an existing instance of an
SAP business object type, for example, a purchase order.
The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business
object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These
BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an
instance of a business object type. The instance to be
cancelled remains in the database and an additional
instance is created and this is the one that is actually
canceled. The Cancel() BAPI is an instance method.
The BAPI Add<subobject> adds a subobject to an
Add<subobject> ( ) and existing object instance and the BAPI and
Remove<subobject> ( ) Remove<subobject> removes a subobject from an object
instance. These BAPIs are instance methods.
BAPIs for Mass Data Processing

The BAPIs listed above for creating and changing data can also be used for mass
processing. For more information see BAPIs for Mass Data Transfer [Extern]

BAPIs for Replicating Business Object Instances


Replicate( ) and The BAPIs Replicate() and SaveReplica() are implemented as
SaveReplica( ) methods of replicable business object types. They enable specific
instances of an object type to be copied to one or more different
systems. These BAPIs are used mainly to transfer data between
distributed systems within the context of Application Link
Enabling (ALE). These BAPIs are class methods.

Other Less Used Standardized BAPIs

• Programming GetStatus() BAPIs [Extern]


• Programming ExistenceCheck() BAPIs [Extern]

Standardized Parameters

There are some parameters that can be created for various BAPIs because they
contain the same or the equivalent data in all BAPIs. They should be implemented
the same in all BAPIs.

Address Specific reference structures are defined for address parameters in


parameters BAPIs. You should copy these structures to use in your BAPI,
especially if the underlying object type uses the central address
management (CAM).
Change In BAPIs that cause database changes (for example, Change() and
Parameters Create() BAPIs) you must be able to distinguish between parameter
fields that contain modified values and parameter fields that have
not been modified. This distinction is made through the use of
standardized parameters.
Extension The parameters ExtensionIn and ExtensionOut provides customers
parameters with a mechanism that enables BAPIs to be enhanced without
modifications.
Return Each BAPI must have an export return parameter for returning
Parameters messages to the calling application. To provide application
programmers with a consistent error handling process for BAPI
calls, all return parameters must be implemented in the same,
standardized way.
Selection Standardized selection parameters are used in BAPIs that can be
Parameters used to search for specific instances of a business object type (e.g. in
GetList() ). These parameters enable the BAPI caller to specify the
relevant selection criteria.
Test Run The parameter TestRun is used in write BAPIs (Create() and
Parameters Change() ), to check the entries for the object instance in the
database before actually creating the object instance. The creation
of the object instance is only simulated and data is not updated.
To transfer BAPI documentation texts (e.g. the documentation of a
Text Transfer
business object type), you have to create standardized text transfer
Parameters
parameters.

Important things to remember..

It is important to follow the guidelines below when develop9ng BAPIs:

• BAPIs must not contain CALL TRANSACTIO or SUBMIT REPORT


• BAPIs must not invoke a COMMIT WORK. instead use the BAPI
TransactionCommit to execute the commit after the BAPI has executed.
• BAPI structures must not use includes.
• There should be no functional dependecies between two BAPIs
• BAPIs must perform there own authorization check
• BAPIs should not use dialogs
• BAPIs must not cause the program to abort or terminate. re4levant messages
must be communicated through the return parameter.

BAPI/ALE Integration

When you use the BAPIs for asynchronous messagning, the application in the sendig
systen calls the generated ALE IDoc interface isntead of the BAPI.

Asynchronous BAPIs use the ALE interface this way:

• Creates an IDOC from the BAPI data


• Sends the IDOC to the target system
• Receives the IDOC in trhe target system, crreates the BAPI data from the
IDoc and calls the BAPI

An ALE interface for a BAPi is created in transaction BDBG.


Introduction To BAPI Programming

Programming a BAPI consists of two major tasks:

1. Defining BAPI Data structures in SE11

2. Program a RFC enabled BAPI function module for each method

3. Create a Business object for the BAPI in the BOR

4. Documentation the BAPI

5. Generate ALE interface for aynchronous BAPIs

6. Generate and release

Tip: You can use the BAPi explorer to get a step by step instuction/checklist in how
to create a BAPI. In the BAPI explorer select the Project tab.

STEP 1 - Define a structures for the BAPI

In this step a structures for the parameters and tables of the function module used
for the BAPI are defined.

Use Data type -> Structure

Define the following structures:

ZBAPI_ORDER_STATUS_IMPORT which contains the following fields:

• ORDERID Order number (Keyfield)


• SPRAS Language
• ExcludeInactive - Checkbox - Exclude inactive status

ZBAPISTAT:

OBJNR like JEST-OBJNR


• STAT like JEST-STAT
• INACT like JEST-INACT
• TXT04 like TJ02T-TXT04
• TXT30 likeTJ02T-TXT30

Important note:

You will have to define a structure for every parameter in the BAPI. You cannot use
the same structures used in existing applications because BAPI structures are frozen
when BAPIs are released and then there are restrictions on changing them.
ZBAPI_ORDER_STATUS_IMPORT

ZBAPISTAT
STEP 2 - Write Function Module
Important notes:

• Each BAPI must have its own function group.


• Under the attrbutes tab remember to select Processing Type Remote Enabled
module, otherwise the function module cannot be invoked via RFC and used
as a BAPI
• Import/Export parameters can only be BY VALUE for an RFC enabled
function module
• We are only creating one BAPI in this example, but you can create related
BAPIs in the same function pool, so they will be able to share global data.

Attributes
Import Parameters
Export Parameters
Tables

Code

Notes:

• The subroutine SET_RETURN_MESSAGE is a standard routine used for


BAPIs that use the BAPIRETURN structure
• In form Z_BAPI_GET_ORDER_SYSTEM_STATUS there is a test IF 1 = 2.
If the test is true a mesage is displayed. The condition will obviously never be
true, and we will never want to display a message in a BAPI. The reason why
it is included is, that it create a reference for the message, so that the
WHERE USED funstionallity can be used for the message. This is the SAP
standard way to handle it, copied from the Company Code GetList BAPI.

INCLUDE LZBAPISTATUSUXX

*****************************************************************
* THIS FILE IS GENERATED BY THE FUNCTION LIBRARY. *
* NEVER CHANGE IT MANUALLY, PLEASE! *
*****************************************************************
INCLUDE LZBAPISTATUSU02.
"Z_BAPI_GET_ORDER_SYSTEM_STATUS

INCLUDE LZBAPISTATUSTOP - Global data

FUNCTION-POOL ZBAPISTATUS. "MESSAGE-ID Z3


Types:
begin of Type_tj02t,
istat like tj02t-istat,
txt04 like tj02t-txt04,
txt30 like tj02t-txt30,
end of type_tj02t.

DATA:
* Declarations for TABLE parameter
T_BAPISTAT like ZBAPISTAT occurs 0,
G_BAPISTAT like ZBAPISTAT,
* Table for object texts
t_tj02t type type_tj02t occurs 0,
g_tj02t type type_tj02t.

* Structure for return messages


DATA:
BEGIN OF MESSAGE,
MSGTY LIKE SY-MSGTY,
MSGID LIKE SY-MSGID,
MSGNO LIKE SY-MSGNO,
MSGV1 LIKE SY-MSGV1,
MSGV2 LIKE SY-MSGV2,
MSGV3 LIKE SY-MSGV3,
MSGV4 LIKE SY-MSGV4,
END OF MESSAGE.
INCLUDE LZBAPISTATUSF01 - Subroutines

***INCLUDE LZBAPISTATUSF01 .
*----------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Form SET_RETURN_MESSAGE
*&---------------------------------------------------------------------*
* This routine is used for setting the BAPI return message.
*
* The routine is a standard routine for BAPIs that handles the message
* structure for the BAPIRETURN structure. It has been copied from the
* BAPI Company Code Getlist
*----------------------------------------------------------------------*
* -->P_MESSAGE text
* <--P_RETURN text
*----------------------------------------------------------------------*
form SET_RETURN_MESSAGE USING VALUE(P_MESSAGE) LIKE MESSAGE
CHANGING P_RETURN LIKE BAPIRETURN.

CHECK NOT MESSAGE IS INITIAL.

CALL FUNCTION 'BALW_BAPIRETURN_GET'


EXPORTING
TYPE = P_MESSAGE-MSGTY
CL = P_MESSAGE-MSGID
NUMBER = P_MESSAGE-MSGNO
PAR1 = P_MESSAGE-MSGV1
PAR2 = P_MESSAGE-MSGV2
PAR3 = P_MESSAGE-MSGV3
PAR4 = P_MESSAGE-MSGV4
* LOG_NO = ' '
* LOG_MSG_NO = ' '
IMPORTING
BAPIRETURN = P_RETURN
EXCEPTIONS
OTHERS = 1.

endform. " SET_RETURN_MESSAGE

FUNCTION Z_BAPI_GET_ORDER_STATUS

FUNCTION z_bapi_get_order_system_status.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(I_AUFNR) TYPE AUFNR
*" VALUE(I_SPRAS) TYPE SPRAS DEFAULT SY-LANGU
*" VALUE(I_EXCLUDEINACTIVE) TYPE CHAR1 OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRETURN
*" TABLES
*" T_BAPISTAT STRUCTURE ZBAPISTAT
*"----------------------------------------------------------------------
**
*"Local interface:
*" IMPORTING
*" VALUE(I_AUFNR) TYPE AUFNR
*" VALUE(I_SPRAS) TYPE SPRAS DEFAULT SY-LANGU
*" VALUE(I_EXCLUDEINACTIVE) TYPE CHAR1 OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" T_BAPISTAT STRUCTURE ZBAPISTAT
*"----------------------------------------------------------------------
DATA:
l_aufnr LIKE afko-aufnr,
l_objnr LIKE jest-objnr.

********************************************
* Check if order exists
********************************************
SELECT SINGLE aufnr
FROM afko
INTO l_aufnr
WHERE aufnr = BAPI_ORDER_STATUS_IMPORT-orderid.

IF sy-subrc NE 0.
CLEAR message.
message-msgty = 'E'.
message-msgid = 'Z3'.
message-msgno = '000'.
message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
PERFORM set_return_message USING message
CHANGING return.
IF 1 = 2.
* The only reason to include this statement, that will obviously
* never execute, is that it will create a referecence so that you
* can find out where a particular message is being used. This
* functionality is used by the BAPIs programmed by SAP
MESSAGE e000(z3).
ENDIF.
ENDIF.
CHECK return IS INITIAL.

********************************************
* Read order status
********************************************
CONCATENATE 'OR' BAPI_ORDER_STATUS_IMPORT-orderid INTO l_objnr.

IF BAPI_ORDER_STATUS_IMPORT-i_excludeinactive = 'X'.
SELECT objnr stat inact
FROM jest
INTO TABLE t_bapistat
WHERE objnr = l_objnr AND
inact <> 'X'.
ELSE.
SELECT objnr stat inact
FROM jest
INTO TABLE t_bapistat
WHERE objnr = l_objnr.

ENDIF.
IF sy-subrc <> 0.
* No object status found
CLEAR message.
message-msgty = 'E'.
message-msgid = 'Z3'.
message-msgno = '001'.
message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
PERFORM set_return_message USING message
CHANGING return.
IF 1 = 2.
MESSAGE e001(z3).
ENDIF.
ENDIF.
CHECK return IS INITIAL.

********************************************
* Read order status texts
********************************************
SELECT istat txt04 txt30
FROM tj02t
INTO TABLE t_tj02t
FOR ALL ENTRIES IN t_bapistat
WHERE istat = t_bapistat-stat AND
spras = BAPI_ORDER_STATUS_IMPORT-i_spras.

SORT t_tj02t BY istat.

LOOP AT t_bapistat INTO g_bapistat.


READ TABLE t_tj02t
WITH KEY istat = g_bapistat-stat BINARY SEARCH
INTO g_tj02t.
IF sy-subrc = 0.
MOVE:
g_tj02t-txt04 TO g_bapistat-txt04,
g_tj02t-txt30 TO g_bapistat-txt30.
MODIFY t_bapistat FROM g_bapistat TRANSPORTING txt04 txt30.
ENDIF.

ENDLOOP.

ENDFUNCTION.

STEP 3 - Create the API Method Using


the BAPI WIZARD
The BAPI wizard is used toTo expose the remote function module as a BAPI. The
wizard will generate some additional code, so the function module is a valid method
of the BOR. This allows the BAPi to be called as a workflow method in addition to
be called by an outside program.

Note: Each functionmodule corresponds to a method in the BOR

Go to the Busines Object Builder SWO1.

You can either create the new Object type as a subtype of an existing business object
or create a new business object from scratch. In this example it would be obvious to
create the Object type as a subtype of BUS2005 Production order. However, to
illustrate how to create a new Object type from scratch, we will do this.

In the Object/Interface type field write the name of the new Business Object:
ZORDERSTAT. Press enter and fill in the additional fields necessary to create the
object type.

Supertype: Not relevant because we are creating our object from scratch

Program. This is the name of the program where the wizard generates code for the
Object type, NOT the function module we craeted earlier. The program name must
not be the name of an existinbg program.
Press enter and create the new business object. Note that when you create the
business object a standard interface, an attribute ObjectType and the methods
ExistenceCheck and Display are automatically generated. These cannot be
changed !
The next step is to add the Z_BAPI_GET_ORDER_STATUS method to the
business object. Select Utillities -> API methods -> Add method and write the name of
the functionmodule in the dialogbox. Next the dialogbox show below will be shown.
This is the start screen of the BAPI wizard. Proceed with wizard by pressing the
button.
After you have finished the wizard, tyou will notice that the ZGetOrderStatus has
been added to the business object:
You can doubleclick on the method to see its properties. To use the business object
you must change the Object type status to Implemented. Use menu Edit->Change
releases status->Object type->To implemented. No you can test thge object (Press
F8).

Note that the BAPI wizard has added a wrapper class for the function module so it
can be sued as method in the business object. Choose menu Goto->Program to
display the program:

***** Implementation of object type ZORDERSTAT *****


INCLUDE <OBJECT>.
BEGIN_DATA OBJECT. " Do not change.. DATA is generated
* only private members may be inserted into structure private
DATA:
" begin of private,
" to declare private attributes remove comments and
" insert private attributes here ...
" end of private,
KEY LIKE SWOTOBJID-OBJKEY.
END_DATA OBJECT. " Do not change.. DATA is generated

BEGIN_METHOD ZGETORDERSTATUS CHANGING CONTAINER.


DATA:
BAPIORDERSTATUSIMPORT LIKE ZBAPI_ORDER_STATUS_IMPORT,
RETURN LIKE BAPIRETURN,
TBAPISTAT LIKE ZBAPISTAT OCCURS 0.
SWC_GET_ELEMENT CONTAINER 'BapiOrderStatusImport'
BAPIORDERSTATUSIMPORT.
SWC_GET_TABLE CONTAINER 'TBapistat' TBAPISTAT.
CALL FUNCTION 'Z_BAPI_GET_ORDER_STATUS'
EXPORTING
BAPI_ORDER_STATUS_IMPORT = BAPIORDERSTATUSIMPORT
IMPORTING
RETURN = RETURN
TABLES
T_BAPISTAT = TBAPISTAT
EXCEPTIONS
OTHERS = 01.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN OTHERS. " to be implemented
ENDCASE.
SWC_SET_ELEMENT CONTAINER 'Return' RETURN.
SWC_SET_TABLE CONTAINER 'TBapistat' TBAPISTAT.
END_METHOD.

STEP 4 - Final steps


When the Business object has been checked and the documentation created, the
follwing steps must be carried out:

• Release the BAPI function module (in the Function Builder).

• Release the business object type (in the BOR ObjectType -> Change release
status to -> Implemented ).

• Release the BAPI as a method in the BOR (Release the methods you has
created - Set the cursor on the method then
Edit -> Change release status -> Object type component -> To released )

• For potential write BAPIs: Release the IDoc and its segments

You can now display the BAPI in the BAPI Explorer:


Batch Input and Call Transaction

Recording

With the recording function SAP automatically cazn genererate the BDC table.

• Find the transaction code for the screen that you wan't to record
• Open transaction SM35 - Batch Input
• Push the button Recording
• In the Recording screen, enter then name you want to give the recording,
anmd push the Create button
• You will now be prompted for the transaction code. Enter the transaction
code. Push the enter button. You are now in the screen where you enter the
transactions.
• Enter transactions as normal, and leave the transaction when finished.
• You will now hen se an overview of the recording.
• Save the recording.
• Go back
• Push the Overview ( Mountain) button, to se the recording.
• You can know generate a program (push the Generate program button ) or
create a session ( Push the Create session button ).
• If you have created a session, go back to the initial screen of SM35 and push
the Overview button.
• Select your batch input session, and process it either in back- or
foreground.

Example of program for Batch Input and Call Transaction


This example shows how to use Call Transaction. If Call Transaction
fails,

a batch input session is created.

DATA: BEGIN OF BDC_TAB OCCURS 0.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF BDC_TAB.


FORM Create_Transaction.

* Table for messages from call transaction. The table is automatically

* filled with messags from call transaction.

DATA BEGIN OF messtab OCCURS 10.

INCLUDE STRUCTURE bdcmsgcoll.

DATA END OF messtab.

REFRESH bdc_tab.

* Create new dynpro

PERFORM bdc_newdynpro USING 'SAPML03T' '101'.

* Insert fields

PERFORM bdc_field USING 'LTAK-BWLVS' w_screen1000-io_bwls.

PERFORM bdc_field USING 'LTAP-MATNR' w_screen1000-io_matnr.

PERFORM bdc_field USING 'RL03T-ANFME' w_tmpstr.

PERFORM bdc_field USING 'LTAP-CHARG' w_screen1000-io_charg.

PERFORM bdc_field USING 'BDC_OKCODE' '=TAM'.


................. And much more of the same ..................

**** Use this part if you want to use call transaction

* Call the transaction. Messages from Call Transaction are stored in the

* internal table messtab

CALL TRANSACTION 'LT01' USING bdc_tab MODE 'N' UPDATE 'S'

MESSAGES INTO messtab.

IF sy-subrc = 0.

* Call transaction successfull, get the number of the Transfer Order


that

* was created

LOOP AT messtab.

IF messtab-dynumb = '0104' AND messtab-msgnr = '016'.

w_transportorderno = messtab-msgv1.

ENDIF.

ENDLOOP.

ELSE.

* Call transaction failed, create a batch input session instead.

PERFORM open_group.

PERFORM bdc_insert USING 'LT01'.

PERFORM close_group.

ENDIF.

ENDFORM.
Here are the strandard forms used for call transaction and batch input

*******************************************************************

* Starts a new screen

*******************************************************************

FORM bdc_newdynpro USING program dynpro.

CLEAR bdc_tab.

bdc_tab-program = program.

bdc_tab-dynpro = dynpro.

bdc_tab-dynbegin = 'X'.

APPEND bdc_tab.

ENDFORM.

*******************************************************************

* Inserts a field in bdc_tab

*******************************************************************

FORM bdc_field USING fnam fval.

CLEAR bdc_tab.

bdc_tab-fnam = fnam.

bdc_tab-fval = fval.

APPEND bdc_tab.

ENDFORM.

*******************************************************************
* Opens group

*******************************************************************

FORM open_group.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

* DEST = FILLER8

group = 'ZSM02'

* HOLDDATE = FILLER8

keep = 'X'

user = sy-uname

* RECORD = FILLER1

* IMPORTING

* QID =

EXCEPTIONS

client_invalid = 1

destination_invalid = 2

group_invalid = 3

group_is_locked = 4

holddate_invalid = 5

internal_error = 6

queue_error = 7

running = 8

system_lock_error = 9

user_invalid = 10

OTHERS = 11.
ENDFORM.

*******************************************************************

* Closes group

*******************************************************************

FORM close_group.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

queue_error = 2

OTHERS = 3.

ENDFORM.

*******************************************************************

* BDC_INSERT

*******************************************************************

FORM bdc_insert USING tcode.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = tcode

* POST_LOCAL = NOVBLOCAL

* PRINTING = NOPRINT

TABLES

dynprotab = bdc_tab

EXCEPTIONS
internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

printing_invalid = 5

posting_invalid = 6

OTHERS = 7.

ENDFORM.

Call transaction and Batch input -


Example
This example shows how to use Call Transaction. If Call Transaction
fails,
a batch input session is created.

DATA: BEGIN OF BDC_TAB OCCURS 0.


INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB.

FORM Create_Transaction.
* Table for messages from call transaction. The table is automatically
filled with messags from call transaction.
DATA BEGIN OF messtab OCCURS 10.

INCLUDE STRUCTURE bdcmsgcoll.


DATA END OF messtab.

REFRESH bdc_tab.

* Create new dynpro


PERFORM bdc_newdynpro USING 'SAPML03T' '101'.

* Insert fields
PERFORM bdc_field USING 'LTAK-BWLVS' w_screen1000-io_bwls.

PERFORM bdc_field USING 'LTAP-MATNR' w_screen1000-io_matnr.

PERFORM bdc_field USING 'RL03T-ANFME' w_tmpstr.


PERFORM bdc_field USING 'LTAP-CHARG' w_screen1000-io_charg.

PERFORM bdc_field USING 'BDC_OKCODE' '=TAM'.

................. And much more of the same ..................

**** Use this part if you want to use call transaction


* Call the transaction. Messages from Call Transaction are stored in the
* internal table messtab
CALL TRANSACTION 'LT01' USING bdc_tab MODE 'N' UPDATE 'S'
MESSAGES INTO messtab.

IF sy-subrc = 0.
* Call transaction successfull, get the number of the Transfer Order
that

* was created
LOOP AT messtab.
IF messtab-dynumb = '0104' AND messtab-msgnr = '016'.
w_transportorderno = messtab-msgv1.
ENDIF.
ENDLOOP.
ELSE.
* Call transaction failed, create a batch input session instead.
PERFORM open_group.

PERFORM bdc_insert USING 'LT01'.


PERFORM close_group.
ENDIF.

ENDFORM.

Here are the strandard forms used for call transaction and batch input

*******************************************************************
* Starts a new screen
*******************************************************************
FORM bdc_newdynpro USING program dynpro.
CLEAR bdc_tab.
bdc_tab-program = program.
bdc_tab-dynpro = dynpro.

bdc_tab-dynbegin = 'X'.
APPEND bdc_tab.
ENDFORM.

*******************************************************************
* Inserts a field in bdc_tab
*******************************************************************
FORM bdc_field USING fnam fval.
CLEAR bdc_tab.
bdc_tab-fnam = fnam.
bdc_tab-fval = fval.
APPEND bdc_tab.
ENDFORM.

*******************************************************************
* Opens group
*******************************************************************

FORM open_group.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
* DEST = FILLER8
group = 'ZSM02'
* HOLDDATE = FILLER8
keep = 'X'
user = sy-uname
* RECORD = FILLER1
* IMPORTING
* QID =
EXCEPTIONS
client_invalid = 1
destination_invalid = 2

group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
ENDFORM.

*******************************************************************
* Closes group
*******************************************************************

FORM close_group.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
ENDFORM.

*******************************************************************
* BDC_INSERT
*******************************************************************
FORM bdc_insert USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
TABLES
dynprotab = bdc_tab

EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ENDFORM.

Formatting Amounts, Quantities and


Dates for Batch Input and Call
Transaction

1. Amount
2. Quantities
3. Dates

Amount
The problem with formating of amount arises beceause the decimal point and
thouasnd seperators depends on the user settings.
Use the subroutines below to format the amount correctly.
p_amount = '5.000,25'.

PERFORM format_amount

USING p_amount

CHANGING l_formatted_amount.

If the decimal point is '.' then l_formatted_amount will be:


5000.25

FORM format_amount USING p_amount

CHANGING p_formatted_amount.

DATA: l_thousand_sep(1) TYPE c,

l_decimal_point(1) TYPE c.

PERFORM get_seperators

CHANGING l_thousand_sep

l_decimal_point.

WRITE p_amount TO p_formatted_amount.

* Remove decimals if they are 0, to avoid problems with

* currencies without decimals

IF p_formatted_amount CA l_decimal_point.

SHIFT p_formatted_amount RIGHT DELETING TRAILING space.

SHIFT p_formatted_amount RIGHT DELETING TRAILING '0'.

SHIFT p_formatted_amount RIGHT DELETING TRAILING l_decimal_point.

ENDIF.

* Remove 1000 seperators

DO 5 TIMES.

REPLACE l_thousand_sep WITH ' ' INTO p_formatted_amount.


CONDENSE p_formatted_amount NO-GAPS.

ENDDO.

WRITE p_formatted_amount TO p_formatted_amount RIGHT-JUSTIFIED.

ENDFORM. " format_amount

* Get decimal point and thousand seperator

FORM get_seperators

CHANGING p_thousand_sep

p_decimal_point.

DATA: l_amount LIKE bseg-dmbtr,

l_amount_string(15) TYPE c.

* Find 1000 seperator. If decimal seperator = . then

* 1000 seperator = , else 1000 seperator = .

l_amount = '1.00'.

WRITE l_amount TO l_amount_string.

IF l_amount_string CS ','.

p_thousand_sep = '.'.

p_decimal_point = ','.

ELSE.

p_thousand_sep = ','.

p_decimal_point = '.'.
ENDIF.

ENDFORM.

Quantities
perform format_quantity using MyGsmng

changing menge_string.

form format_quantity using p_gsmng

changing p_gsmng_string.

data: l_thousand_SEPERATOR(1) type c.

perform GET_THOUSAND_SEPERATOR changing l_thousand_SEPERATOR.

* Remove thousand seperator

write p_gsmng to p_gsmng_string.

replace l_thousand_SEPERATOR with ' '

into p_gsmng_string.

condense p_gsmng_string no-gaps.

endform. " format_quantity

form get_thousand_seperator using p_sep.


data: l_amount like bseg-dmbtr,

l_amount_string(15) type c.

* Find 1000 seperator. If decimal seperator = . then

* 1000 seperator = , else 1000 seperator = .

l_amount = '1.00'.

write l_amount to l_amount_string.

if l_amount_string cs ','.

p_sep = '.'.

else.

p_sep = ','.

endif.

endform. " GET_THOUSAND_SEPERATOR

Dates

When you enter a date on line, the SAP


system will verify the user input with
the date format setup. If the date
format is set to
'YYYY/MM/DD', then the system will
reject a user input '1997-09-12'. For
batch input, the date format setup is
not available any more,
what format should we use for a date
field? Should it be 'YYYYMMDD'?

The other thing to remember is that the


batch input uses the user's
default profile as the date it expects.
Make sure the BATCHUSER format is
identical to the one your program is
expecting or it will generate an
error when you are processing updates.

You can get the appropriate date


format by calling the function module
''DATUMSAUFBEREITUNG''. Make
sure that the user who process the
session has the same date format.

CALL FUNCTION
'DATUMSAUFBEREITUNG'
EXPORTING
idate = MyDate
IMPORTING
tdat8 = MyDateString
EXCEPTIONS
datfm_ungueltig = 1
datum_ungueltig = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF. Getting messages from call
transaction
types tt_errtab TYPE STANDARD TABLE OF BDCMSGCOLL.

data: li_errtab type tt_errtab,


l_errtab type BDCMSGCOLL.

The Call transaction stores the messages in internal table li_errtab

CALL TRANSACTION 'MI02' USING gi_bdcdata MODE 'N'


update 'A'
messages into li_errtab.

However the message text is not stored in the table. You have to use
the
fields MSGID and MSGNR in the

table to find the message text. The easiest way is to use MESSAGE ...
INTO:

loop at li_errtab into l_errtab.


MESSAGE ID l_errtab-msgid TYPE l_errtab-MSGTYP NUMBER l_errtab-msgnr
INTO l_errtxt WITH l_errtab-msgv1 l_errtab-msgv2.
...... more code ...
endloop.

The message is stored in the variable l_errtxt


One or more transactions in every batch
inputsession
Whether you have one or more transactions in one batch input session,
depends of
the sequence of the BDC routines.

One transaction

LOOP AT gi_custnr INTO g_custnr.

PERFORM bdc_newdynpro USING 'SAPMF02D' '0108'.

PERFORM bdc_field USING:


'RF02D-KUNNR' g_custnr-kunnr,
'RF02D-VKORG' 'NVE',
'RF02D-VTWEG' '01',
'RF02D-SPART' '01',
'RF02D-D0320' 'X',
'BDC_OKCODE' '/00'.

PERFORM bdc_newdynpro USING 'SAPMF02D' '0320'.

PERFORM bdc_field USING:


'KNVV-KTGRD' 'Z1',
'BDC_OKCODE' '=UPDA'.

PERFORM open_group.
PERFORM bdc_insert USING 'VD02'.
PERFORM close_group.
REFRESH bdc_tab.

ENDLOOP.

More transactions

PERFORM open_group.

LOOP AT gi_custnr INTO g_custnr.

PERFORM bdc_newdynpro USING 'SAPMF02D' '0108'.

PERFORM bdc_field USING:


'RF02D-KUNNR' g_custnr-kunnr,

'RF02D-VKORG' 'NVE',
'RF02D-VTWEG' '01',
'RF02D-SPART' '01',
'RF02D-D0320' 'X',
'BDC_OKCODE' '/00'.
PERFORM bdc_newdynpro USING 'SAPMF02D' '0320'.

PERFORM bdc_field USING:


'KNVV-KTGRD' 'Z1',
'BDC_OKCODE' '=UPDA'.

PERFORM bdc_insert USING 'VD02'.


REFRESH bdc_tab.

ENDLOOP.

PERFORM close_group.

Submitting batch input from ABAP


You have two possibilities (Submit of both programs) :
=> RSBDCSUB which launch btci with btci name
=> RSBDCBTC which launch btci with internal batch number and waits for the end
of the batch-input.

What date format should be used in batch


input?
When you enter a date on line, the SAP system will verify the user
input with the date format setup. If the date format is set to
'YYYY/MM/DD', then the system will reject a user input '1997-09-12'.
For batch input, the date format setup is not available any more,
what format should we use for a date field? Should it be 'YYYYMMDD'?

*
The other thing to remember is that the batch input uses the user's
default profile as the date it expects. Make sure the BATCHUSER format

is identical to the one your program is expecting or it will generate an


error when you are processing updates.

*
You can get the appropriate date format by calling the function module
DATUMSAUFBEREITUNG.
Make sure that the user who process the session has the same date
format.
BADI
SE18 Initial Definition maintenance Screens
SE19 Initial Implementation maintenance Screens

In SE18 you define your badi (If it is not a standard BADI), and in SE19 you
implement the badi. A badi can (If it is defined as Multiple use) have multiple
implementations.

Business Transaction Events

1. What is a BTE
2. How does it work
3. How to find a BTE
4. Implementing a BTE

What is a BTE

• BTE are comparabl to the old enhancements


• BTEs are used mostly within FI
• BTEs can be used both by SAP, third part vensdors and customers. Each
use their own function modules where the logic is placed, so they don't
interfere witj each other

There are 2 types of BTE:

• Publish & Subscribe interfaces. Can not update data. Posiible to have
multiple implementations
• Process interfaces. Can update date. Only one active implementation

How does it work


The BTE is a functionmodule (Implemented by the customer) that has a standard
interface defined by SAP. The BTE is called by the SAP standard program by a call
to function OPEN_FI_PERFORM_<BTE-number> or OUTBOUND_CALL_<BTE-
number>. This function chekcs if there are any active BTEs according to
customizing.

How to find a BTE

• Search the socurce code for for "OPEN_FI_PERFORM" og "


OUTBOUND_CALL_"
• Use transaction FIBF menu Environment->Info System (P/S ). Use the
Documenttion button to see the documentation for the BTE

Implementing a BTE

• Goto transction FIBF menu Environment->Info System (P/S )


• Select the BTE you want to implement.
• Press button Sample function module
• This brings you to SE37 - Copy the sample function module to a Z-function
module (First create a new function group for the function module) . Note:
The name of the Z-functionmodule is not important
• Edit the code in the new function module
• Go back to transaction FIBF - Menu Settings->Products -> Of a customer and
create a new product whicj identifies the new product . Remember to mark
the Active field.
• Go back to FIBF menu Settings->P/S function modules->of a customer -
Create an entry that links the BTE and Product with the new function
module

Example:

We want to implement BTE 00001030. Locate it in trsnaction FIBF


Press button Sample function module . Copy function module in SE37 (First create a
new function group for the function module)

Edit the code in the new function module

Go back to transaction FIBF - Menu Settings->Products->Of a customer and create a


new product whicj identifies the new product
Remember to mark the Active field.

Save

Go back to FIBF menu Settings->P/S function modules->of a customer - Create an


entry that links the BTE and Product with the new function module

Find User Exit for Transaction Code


The steps to find the User Exit for any Tcode is as given below..

1. Find the development class for the TCode..u can find it by executing the Tcode
..then go to System on Menu Bar and click on Status.. a pop up will open up double
click on the TCode ..u will get the development class.

2. Now run the Transaction SMOD ..on the menu bar select Uitilies..then click on
find and then type the development class in the specified input field of development
class.

3. Execute (F8).

You will find all the User Exit for the TCode.

Regards,
Yahoo Group Member.

Report to Find User-Exit for Transaction


Code
Copied from From SapGenie.com

http://www.sapgenie.com/abap/code/abap26.htm
Selection Text: P_TCODE: Transaction Code to Search
Text Symbols: 001 - Enter the Transaction Code that you want to search through for
a User Exit

REPORT z_find_userexit NO STANDARD PAGE HEADING.


*&---------------------------------------------------------------------*
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits exists.
*&
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*

TABLES : tstc, "SAP Transaction Codes


tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts

*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*

DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.


DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.

*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.

*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*

START-OF-SELECTION.

* Validate Transaction Code


SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.

* Find Repository Objects for transaction code


IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.

MOVE : tadir-devclass TO v_devclass.

IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.

IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.

SELECT SINGLE * FROM enlfdir


WHERE funcname = tfdir-funcname.

SELECT SINGLE * FROM tadir


WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.

MOVE : tadir-devclass TO v_devclass.


ENDIF.
ENDIF.

* Find SAP Modifactions


SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.

SELECT SINGLE * FROM tstct


WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.


WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.

LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.

WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.

* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
1. How do you call SAP script in reports & reports in SAP script?
2. What is different between SAP script & reports?
3. What is stack?
4. What is the defination of ALE RFC?
5. Why is BAPI required? How about BDC?
6. What happens if I use control break statement in between select &
endselect?
7. What is lock Object

8. SAP Versions
9. SAP Platforms
10. SAP Processes
11. SAP Modules
12. SAP Table Name Standard
13. SAP Vendors
14. SAP Certification
15. What is SQL Trace, how would you carry out performance
analysis of ABAP code using SQL Trace? Give the steps?
16. What are the transactions we should use in BDC? How do we use
it?
17. How would you use BDC program to transfer material master
record using MM01 transaction? Give me steps.
18. Could we use ME21N transaction, and XK01 transaction, either
which one of the transaction, or could we use both the transactions for
creating purchase information.
19. What is the name of the standard report that gives the deatails of
Customer and sales amount?
20. How can we use XD02 transaction to change the customer data for
updating KNA1 table? Give the steps.
21. How the transaction ME21N is used for to upload the purchase
order in BDC?
22. How many transaction we can used in BDC at a time?
23. How the data get updated in BDC using transaction.
24. Why BAPI need then BDC?
25. What happen if I use controll break statement in between select &
endselect?
26. What is lock Object?
27. Select option works like _____________ on Selection Screen?
28. Which sysgtem variable have current value during execution?
29. What is the main point while using controll bareak in internal
table?
30. Waht is Field sysmbol?
31. Smartform uses wisely then selection screen, why?
32. Which one is not an exit comand? (Exit, cencle, stop, back)
33. Which component gives you better visibility? (pritty Printer)
34. Explain about roll area, Dispatcher, ABAP-Processor.
35. What is the final entry in BDC Table?
36. How can I get output on same page?
37. Why is Transaction Varient needed?
38. If I have table control, what is the same code in PBO and PAI?
39. Who takes care of passing the data to the application server?

Transactions: ABAP
Written by admin on Jan 12th, 2008 | Filed under: ABAP, Transactions

Important transactions Related to ABAP

USMM Pressing 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.
DI02 ABAP/4 Repository Information System: Tables.
LSMW Legacy System Migration Workbench. An addon available from SAP that
can make data converstion a lot easier. Thanks to Serge Desland for this one.
OSS1 SAP Online Service System
OY19 Compare Tables
SM13 Update monitor. Will show update tasks status. Very useful to determine why
an update failed.
S001 ABAP Development Workbench
S001 ABAP/4 Development Weorkbench.
S002 System Administration.
SA38 Execute a program.
SCAT Computer Aided Test Tool
SCU0 Compare Tables
SE01 Old Transport & Corrections screen
SE03 Groups together most of the tools that you need for doing transports. In total,
more than 20 tools can be reached from this one transaction.
SE09 Workbench Organizer
SE10 New Transport & Correction screen
SE11 ABAP/4 Dictionary Maintenance SE12 ABAP/4 Dictionary Display SE13
Maintain Technical Settings (Tables)
SE12 Dictionary: Initial Screen – enter object name.
SE13 Access tables in ABAP/4 Dictionary.
SE14 Utilities for Dictionary Tables
SE15 ABAP/4 Repository Information System
SE16 Data Browser: Initial Screen.
SE16N Table Browser (the N stands for New, it replaces SE16).
SE17 General Table Display
SE24 Class Builder
SE30 ABAP/4 Runtime Analysis
SE32 ABAP/4 Text Element Maintenance
SE35 ABAP/4 Dialog Modules
SE36 ABAP/4: Logical Databases
SE37 ABAP/4 Function Modules
SE38 ABAP Editor
SE39 Splitscreen Editor: Program Compare
SE41 Menu Painter
SE43 Maintain Area Menu
SE48 Show program call hierarchy. Very useful to see the overall structure of a
program.
SE49 Table manipulation. Show what tables are behind a transaction code.
SE51 Screen Painter: Initial Screen.
SE54 Generate View Maintenance Module
SE61 R/3 Documentation
SE62 Industry utilities
SE63 Translation
SE64 Terminology
SE65 R/3 document. short text statistics SE66 R/3 Documentation Statistics (Test!)
SE68 Translation Administration
SE71 SAPscript layout set
SE71 SAPScript Layouts Create/Change
SE72 SAPscript styles
SE73 SAPscript font maintenance (revised)
SE74 SAPscript format conversion
SE75 SAPscript Settings
SE76 SAPscript Translation Layout Sets
SE77 SAPscript Translation Styles
SE80 ABAP/4 Development Workbench
SE81 SAP Application Hierarchy
SE82 Customer Application Hierarchy
SE83 Reuse Library.
SE84 ABAP/4 Repository Information System
SE85 ABAP/4 Dictionary Information System
SE86 ABAP/4 Repository Information System
SE87 Data Modeler Information System
SE88 Development Coordination Info System
SE91 Maintain Messages
SE92 Maintain system log messages
SE93 Maintain Transaction.
SEARCH_SAP_MENU From 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.
SEU Object Browser
SHD0 Transaction variant maintenance
SM04 Overview of Users (cancel/delete sessions)
SM12 Lock table entries (unlock locked tables)
SM21 View the system log, very useful when you get a short dump. Provides much
more info than short dump
SM30 Maintain Table Views.
SM31 Table Maintenance
SM32 Table maintenance
SM35 View Batch Input Sessions
SM37 View background jobs
SM50 Process Overview.
SM51 Delete jobs from system (BDC)
SM62 Display/Maintain events in SAP, also use function BP_EVENT_RAISE
SMEN Display the menu path to get to a transaction
SMOD/CMOD Transactions for processing/editing/activating new customer
enhancements.
SNRO Object browser for number range maintenance.
SPRO Start SAP IMG (Implementation Guide).
SQ00 ABAP/4 Query: Start Queries
SQ01 ABAP/4 Query: Maintain Queries
SQ02 ABAP/4 Query: Maintain Funct. Areas
SQ03 ABAP/4 Query: Maintain User Groups
SQ07 ABAP/4 Query: Language Comparison
ST05 Trace SQL Database Requests.
ST22 ABAP Dump analysis
SU53 Display Authorization Values for User.
WEDI EDI Menu. IDOC and EDI base.
WE02 Display an IDOC
WE07 IDOC Statistics

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.
7. What is an ABAP/4 Query?- ABAP/4 Query is a powerful tool to
generate simple reports without any coding. ABAP/4 Query can
generate the following 3 simple reports: Basic List: It is the simple
reports. Statistics: Reports with statistical functions like Average,
Percentages. Ranked Lists: For analytical reports. – For creating a
ABAP/4 Query, programmer has to create user group and a
functional group. Functional group can be created using with or
without logical database table. Finally, assign user group to functional
group. Finally, create a query on the functional group generated.
8. What is BDC programming?- Transferring of large/external/legacy
data into SAP system using Batch Input programming. Batch input is
a automatic procedure referred to as BDC(Batch Data
Communications).The central component of the transfer is a queue
file which receives the data vie a batch input programs and groups
associated data into “sessions”.
9. What are the functional modules used in sequence in BDC?- These
are the 3 functional modules which are used in a sequence to perform
a data transfer successfully using BDC programming:
BDC_OPEN_GROUP – Parameters like Name of the client, sessions
and user name are specified in this functional modules.
BDC_INSERT – It is used to insert the data for one transaction into a
session. BDC_CLOSE_GROUP – This is used to close the batch input
session.
10. What are internal tables?- Internal tables are 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.
11. What is ITS? What are the merits of ITS?- ITS is a Internet
Transaction Server. ITS forms an interface between HTTP server and
R/3 system, which converts screen provided data by the R/3 system
into HTML documents and vice-versa. Merits of ITS: A complete web
transaction can be developed and tested in R/3 system. All transaction
components, including those used by the ITS outside the R/3 system at
runtime, can be stored in the R/3 system. The advantage of automatic
language processing in the R/3 system can be utilized to language-
dependent HTML documents at runtime.
12. What is DynPro?- DynPro is a Dynamic Programming which is a
combination of screen and the associated flow logic Screen is also
called as DynPro.
13. What are screen painter and menu painter?- Screen painter:
Screen painter is a tool to design and maintain screen and its
elements. It allows user to create GUI screens for the transactions.
Attributes, layout, filed attributes and flow logic are the elements of
Screen painter. Menu painter: Menu painter is a tool to design the
interface components. Status, menu bars, menu lists, F-key settings,
functions and titles are the components of Menu painters. Screen
painter and menu painter both are the graphical interface of an
ABAP/4 applications.
14. What are the components of SAP scripts?- SAP scripts is a word
processing tool of SAP which has the following components: Standard
text. It is like a standard normal documents. Layout sets. – Layout set
consists of the following components: Windows and pages, Paragraph
formats, Character formats. Creating forms in the R/3 system. Every
layout set consists of Header, paragraph, and character string.
ABAP/4 program.
15. What is ALV programming in ABAP? When is this grid used in
ABAP?- ALV is Application List viewer. Sap provides a set of ALV
(ABAP LIST VIEWER) function modules which can be put into use
to embellish the output of a report. This set of ALV functions is used
to enhance the readability and functionality of any report output.
Cases arise in sap when the output of a report contains columns
extending more than 255 characters in length. In such cases, this set of
ALV functions can help choose selected columns and arrange the
different columns from a report output and also save different
variants for report display. This is a very efficient tool for
dynamically sorting and arranging the columns from a report output.
The report output can contain up to 90 columns in the display with
the wide array of display options.
16. What are the events in ABAP/4 language?- 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.
17. What is CTS and what do you know about it?- 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.
18. What are logical databases? What are the advantages/ dis-
advantages of logical databases?- 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. Advantages:
i)check functions which check that user input is complete, correct,and
plausible. ii)Meaningful data selection. iii)central authorization
checks for database accesses. iv)good read access performance while
retaining the hierarchical data view determined by the application
logic. dis advantages: 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).
19. What is a batch input session?- 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.
20. How to upload data using CATT ?- These are the steps to be
followed to Upload data through CATT: Creation of the CATT test
case & recording the sample data input. Download of the source file
template. Modification of the source file. Upload of the data from the
source file.
21. What is Smart Forms?- Smart Forms allows you to create forms
using a graphical design tool with robust functionality, color, and
more. Additionally, all new forms developed at SAP will be created
with the new Smart Form solution.
22. How can I make a differentiation between dependent and
independent data?- Client dependent or independent transfer
requirements include client specific or cross client objects in the
change requests. Workbench objects like SAPscripts are client
specific, some entries in customizing are client independent. If you
display the object list for one change request, and then for each object
the object attributes, you will find the flag client specific. If one object
in the task list has this flag on, then that transport will be client
dependent.
23. What is the difference between macro and subroutine?- Macros
can only be used in the program the are defined in and only after the
definition are expanded at compilation / generation. Subroutines
(FORM) can be called from both the program the are defined in and
other programs . A MACRO is more or less an abbreviation for some
lines of code that are used more than once or twice. A FORM is a local
subroutine (which can be called external). A FUNCTION is (more or
less) a subroutine that is called external. Since debugging a MACRO
is not really possible, prevent the use of them (I’ve never used them,
but seen them in action). If the subroutine is used only local (called
internal) use a FORM. If the subroutine is called external (used by
more than one program) use a FUNCTION.
Source: http://www.techinterviews.com/?p=198
2.

Complete List of all SAP ABAP Keywords.


Alphabetical Overview of all SAP ABAP Commands or Keywords.

A
ADD for single fields
Adds two single fields.
Syntax
ADD TO .
The contents of are added to the contents of and the results are stored in . This is
equivalent to: = + .
More…
ADD for field sequences
Adds sequences of fields in storage.
Syntax
ADD THEN UNTIL GIVING .
ADD THEN UNTIL ACCORDING TO GIVING .
ADD THEN UNTIL TO .
ADD FROM TO GIVING .
If , ,…, is a sequence of fields with the same distance to one another and if they have
the same type and length, these fields are added and the result is stored in .
Different variants allow you to limit fields to a subsequence, to include in the sum,
and to perform the operation on a sequence of fields that directly follow one
another.

ADD-CORRESPONDING
Adds subfields of structures.
Syntax
ADD-CORRESPONDING TO .
All the subfields of the structures and having the same name are added and the
results are stored in .
ALIASES
Defines class-specific alias names for an interface component in ABAP objects.
Syntax
ALIASES FOR .
is defined within a class or interface as synonymous with the interface component .

APPEND
Appends a line or multiple lines to the end of an index table.
Syntax
APPEND |LINES OF TO
[ASSIGNING | REFERENCE INTO ].
A line or multiple lines of an internal table are appended to index table . If you use
ASSIGNING or INTO REFERENCE, field symbol refers to the appended line or
the relevant data reference is stored in after the statement.

ASSIGN
Assigns a field to a field symbol.
Syntax
ASSIGN [INCREMENT ] TO
[CASTING [TYPE |LIKE ] [DECIMALS ]] [RANGE ].
Data object is assigned to field symbol . now points to the data object. After the
addition INCREMENT , the storage area that is offset times by a length of starting
with is assigned to the field symbol. Pointed brackets are part of the syntax for field
symbol names. The CASTING addition permits you to cast data objects when
assigning field symbols. The RANGE addition defines the storage area in which
either offset/length accesses or the INCREMENT addition are allowed. In Unicode
programs, standard access is only allowed within the field limits of , but this can be
extended with RANGE. In non-Unicode programs, standard access is possible up to
the boundary of the data segment and can be limited with RANGE.

Syntax
ASSIGN ->* TO [CASTING ... ].
Dereferencing of the data reference in . The data object to which the data reference
refers is assigned to field symbol .

AT for event blocks


Event keywords for defining event blocks for screen events.
Syntax
AT SELECTION-SCREEN…
AT LINE-SELECTION.
AT USER-COMMAND.
AT PFn.
User actions on a selection screen or on a list trigger certain events in the ABAP
runtime environment. The event keywords define event blocks that are called when
events occur.
AT for group change
Change of group when processing loops of extracts and internal tables.
Syntax
AT NEW .
AT END OF .
AT FIRST.
AT LAST.
AT .
The statements are used to process group levels within a loop using an extract
dataset or an internal table. They introduce statement blocks that must be closed
with ENDAT. The statements between AT and ENDAT are only executed if the
corresponding group change occurred.

AUTHORITY-CHECK
Checks user authorization.
Syntax
AUTHORITY-CHECK OBJECT ID FIELD
ID FIELD

ID FIELD .
There is a check if the program user has all the authorizations defined in
authorization object . ,…, are the authorization fields of the authorization object. ,…
, …, are data objects of the program. The value of the data objects is checked
against the authorization fields.

B
BACK
Relative position of the output in a list.
Syntax
BACK.
Positions the list output either in the first column of the first line following the page
header of the current page or in connection with RESERVE in the first column of
the first line of a line block.

BREAK-POINT
Calls the Debugger.
Syntax
BREAK-POINT.
Interrupts execution of the program and goes to debugging mode. Is used as a test
help. Normal program processing is interrupted when this statement is reached and
the system goes to a debugger.

C
CALL CUSTOMER-FUNCTION
Calls the customer function modules.
Syntax
CALL CUSTOMER-FUNCTION …
Similar to CALL FUNCTION. The function modules must be programmed and
activated within the customer’s modification concept.

CALL FUNCTION
Calls the function modules.
Syntax
CALL FUNCTION [EXPORTING ... fi = a i... ]
[IMPORTING ... fi = a i... ]
[CHANGING ... fi = a i... ]
[TABLES ... fi = a i... ]
[EXCEPTIONS... ei = r i... ]
[DESTINATION ]
[IN UPDATE TASK]
[STARTING NEW TASK]
[IN BACKGOUND TASK].
The program calls either a function module in the same R/3 System, or one from an
external system, depending on the variant of the statement you use. You can call
update modules when processing transactions. You can also call functions
asynchronously. The other additions are used to specify actual parameters for the
parameter interface for the function module, , and to handle exceptions.

CALL DIALOG
Calls a dialog module.
Syntax
CALL DIALOG [AND SKIP FIRST SCREEN]
[EXPORTING... fi = a i... ]
[IMPORTING... fi = a i... ]
[USING itab].
Calls the dialog module . A dialog module is an ABAP program with a sequence of
screens. It does not have to be started using a transaction code, or run in the same
SAP LUW, like the calling program. The additions are used to skip the initial screen
in the sequence and specify actual parameters for the parameter interface of the
dialog module.

CALL METHOD
Calls a method in ABAP Objects.
Syntax
CALL METHOD [EXPORTING ... =.... ]
[IMPORTING ... =.... ]
[CHANGING ... =.... ]
[RECEIVING r = h ]
[EXCEPTIONS... = r i... ]
[PARAMETER-TABLE ]
[EXCEPTION-TABLE ].
[CALL METHOD]( … ).
Calls a method . The additions are used to specify actual parameters for the
parameter interface for the function module and to handle exceptions. The last two
additions pass parameters dynamically in a dynamic method call. Alternatively, if
the method is called statically, the parameters can be specified using parenthesis
notation (as you can when specifying parameters in a CALL METHOD statement).
You can also use functional methods with this syntax in operand positions.

CALL METHOD OF
Calls a method in OLE2 Automation.
Syntax
CALL METHOD OF .
Calls the method, , of the OLE2 Automation Object, .

CALL SCREEN
Calls a screen sequence.
Syntax
CALL SCREEN
[STARTING AT ]
[ENDING AT ].
Calls the sequence of screens that begins with the screen . All the screens in the
screen sequence belong to the current ABAP program. The screen sequence ends
when the program reaches the screen numbered 0. The additions let you call a single
screen in a new window.
CALL SELECTION-SCREEN
Calls a selection screen.
Syntax
CALL SELECTION-SCREEN
[STARTING AT ]
[ENDING AT ].
Calls a selection screen defined in an ABAP program. The selection screen is
processed in the program in the AT SELECTION-SCREEN event. The additions let
you call a selection screen in a new window.
CALL TRANSACTION
Call a transaction.
Syntax
CALL TRANSACTION
[AND SKIP FIRST SCREEN]
[USING ].
Calls the transaction after having received data from the calling program. At the
end of the transaction that has been called, the system returns to the statement
following the call in the calling report. The additions are used to skip the initial
screen in the sequence or to pass a batch input table to the transaction.

CASE
Conditional branch.
Syntax
CASE .
Opens a CASE control structure that ends with an ENDCASE statement. The
CASE control structure allows you to control which statement blocks (introduced
by WHEN) are processed, based on the contents of a data object.

CATCH
Catches a class-based exception.
CATCH … [INTO ].
You can only use this statement in a TRY-ENDTRY block, where you define a
handler for one or more class-based exceptions. You can use INTO to place a
reference to the exception object into the reference variable .

CATCH SYSTEM-EXCEPTIONS
Catches a catchable runtime error.
Syntax
CATCH SYSTEM-EXCEPTIONS = … = .
Introduces a CATCH area, which ends with an ENDCATCH statement. If a
catchable runtime error , occurs between CATCH and ENDCATCH, the current
processing block is interrupted. The system jumps to the appropriate ENDCATCH
statement and fills SY-SUBRC with .

CHECK
Conditionally leaves a loop or processing block.
Syntax
CHECK .
If the logical expression is true, the system continues with the next statement. If it is
false, processing within the loop is interrupted at the current loop pass, and the next
loop pass is performed. Otherwise the system leaves the current processing block. In
conjunction with selection tables, and inside GET events, you can use an extra
variant of the CHECK statement.

CLASS Declaration
Declares a class in ABAP Objects.
Syntax
CLASS DEFINITION [PUBLIC]
[INHERITING FROM ]
[ABSTRACT]
[FINAL]
[CREATE PUBLIC|PROTECTED|PRIVATE]
[FRIENDS ...]
[DEFERRED]
[LOAD].
Introduces the declaration part of a class, . The declaration part ends with
ENDCLASS and contains the declaration of all the components of the class. The
PUBLIC addition is generated only by the Class Builder. It defines a global class in
the Class Library. The INHERITING FROM addition lets you derive the class, ,
from a superclass, . The ABSTRACT addition defines an abstract class, which
cannot be instantiated. The FINAL addition defines a class that cannot have any
subclasses. The CREATE addition specifies who can instantiate the class. FRIENDS
allows you to specify other classes or interfaces, that can access the private
components of the class and instantiate objects of the class, independently of the
CREATE addition. The DEFERRED addition makes the class known to the
program before it is declared. The LOAD addition loads a class explicitly from the
Class Library.

CLASS – Implementation
Implements a class in ABAP Objects.
Syntax
CLASS IMPLEMENTATION.
Introduces the implementation part of a class, . The implementation part ends with
ENDCLASS and contains the implementation of all the components of the class.

CLASS-DATA
Declares static attributes of a class or interface.
Syntax
CLASS-DATA …
Like DATA. However, the attribute is declared as a static attribute. Static attributes
are not instance-specific. Their content is shared by all instances.

CLASS-METHODS
Declares static methods of a class or interface.
Syntax
CLASS-METHODS …
Like METHODS, except that the method is declared as a static method. A static
method can access static attributes and can only trigger static events.

CLASS-EVENTS
Declares static events of a class or interface.
Syntax
CLASS-EVENTS …
Like EVENTS, except that the event is declared as a static attribute. Static events
are the only type of event that can be triggered in a static method.

CLEANUP
Tidies up after class-based exceptions.
CLEANUP.
Can only be used within a TRY-ENDTRY block, where it defines a control block. If
a class-based exception is not caught with a CATCH statement, the system executes
the statements between CLEANUP and ENDTRY, before passing the exception
along the call hierarchy.
CLEAR
Sets a variable to its initial value.
Syntax
CLEAR .
The variable , which can have any data type, is set to an initial value appropriate to
its type.

CLOSE DATASET
Closes a file.
Syntax
CLOSE DATASET .
Closes a file opened with OPEN DATASET on the application server.

CLOSE CURSOR
Closes a database cursor.
Syntax
CLOSE CURSOR .
Closes a cursor opened with OPEN CURSOR.

COLLECT
Aggregates lines and then adds them to an internal table.
Syntax
COLLECT INTO
[ASSIGNING | REFERENCE INTO ].
The system checks whether there is already a table entry that matches the key. If
there is no corresponding entry already in the table, the COLLECT statement has
the same effect as INSERT. 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 fields in the existing entry. If
you use ASSIGNING or INTO REFERENCE, field symbol refers to the inserted
line or the relevant data reference is stored in after the statement.

COMMIT
Closes a SAP LUW.
Syntax
COMMIT WORK [AND WAIT]
Writes all the database changes and releases all the database locks. Triggers
updating. The AND WAIT addition forces the program to wait until the system has
finished updating the database. Otherwise, updating is asynchronous.

COMMUNICATION
Enables two programs to communicate with each other.
Syntax
COMMUNICATION INIT DESTINATION ID [additions].
COMMUNICATION ALLOCATE ID [additions].
COMMUNICATION ACCEPT ID [additions].
COMMUNICATION SEND ID BUFFER [additions].
COMMUNICATION RECEIVE ID [additions].
COMMUNICATION DEALLOCATE ID [additions].
The statement initializes, creates, and accepts communication between two
programs; lets these two programs send and receive data; and then closes the
connection.

COMPUTE
Performs numeric operations.
Syntax
COMPUTE = .
The result of the mathematical operation specified in is assigned to the field . The
keyword COMPUTE is optional.

CONDENSE
Removes spaces from a string
Syntax
CONDENSE [NO-GAPS].
This statement removes any leading blanks from the field and replaces other
sequences of blanks by exactly one blank. If the addition NO-GAPS is specified, all
blanks are removed.

CONSTANTS
Declares constant data objects.
Syntax
CONSTANTS … VALUE [ | IS INITIAL]…
The syntax is similar to DATA, except that the VALUE addition is required, and
that internal tables and deep structures cannot be declared as constants The start
value specified in the VALUE addition cannot be changed during the execution of
the program.

CONTINUE
Ends a loop pass.
Syntax
CONTINUE.
Only possible within loops. This statement terminates the current loop pass and
starts the next

CONTEXTS
Declares a context.
Syntax
CONTEXTS .
Generates an implicit data type CONTEXT_, which you can use to create context
instances
CONTROLS
Defines a control.
Syntax
CONTROLS TYPE .
Defines an ABAP runtime object . This displays data in a particular format on a
screen, depending on the type Currently, may be a table control or tabstrip control

CONVERT für Dates


Converts a data into an inverted date form.
Syntax
CONVERT DATE INTO INVERTED-DATE .
CONVERT INVERTED-DATE INTO DATE .
If and are date fields in the internal form YYYYMMDD, the nines complement of is
placed in field and vice versa. In inverted date format, the most recent date has the
smaller numerical value

CONVERT for Timestamps


Converts a timestamp into the correct date and time for the current time zone
Syntax
CONVERT TIME STAMP TIME ZONE INTO DATE TIME .
CONVERT DATE TIME INTO TIME STAMP TIME ZONE .
As long as has type P(8) or P(11) with 7 decimal placed, and has type C(6), the time
stamp will be converted to the correct date and time for the time zone .

CONVERT for Text


Converts a text into a format that can be sorted alphabetically.
Syntax
CONVERT TEXT INTO SORTABLE CODE .
must have type C and must have type X. The string is then converted so that the
relative order of the characters allows them to be sorted alphabetically in the
current text environment

CREATE DATA
Creates a dynamic data object.
Syntax
CREATE DATA TYPE |LIKE .
CREATE DATA TYPE LINE OF |LIKE LINE OF .
CREATE DATA TYPE REF TO DATA|.
CREATE DATA TYPE TYPE|LIKE OF WITH .
If is a data reference variable, a data object of the specified type is created. The
reference in points to this object. You can omit the TYPE declaration in fully-typed
reference variables.

CREATE OBJECT in ABAP Objects


Instantiates an object in ABAP Objects.
Syntax
CREATE OBJECT [TYPE ] [EXPORTING ... =.... ].
must be a reference variable, defined with reference to a class. CREATE OBJECT
then creates an object of that class, to which the reference in then points The
reference in points to this object. If is a typed class reference variable with reference
to a subclass of , or if is an interface reference variable, whose interface is
implemented in the class , you can specify the class of the instantiated object
explicitly in a TYPE addition, to establish the dynamic type of the reference
variables. The EXPORTING addition specifies the non-optional IMPORTING
parameters of the instance constructor of the class of the instantiated object.

CREATE OBJECT in OLE2 Automation


Instantiates an external object in OLE2 Automation.
Syntax
CREATE OBJECT .
If is a class assigned to an automation server, an initial object of this class is created

D
DATA with Reference to Known Data Types
Declares variables with a previously-declared data type
Syntax
DATA … [TYPE |LIKE ]… [VALUE ].
Declares a variable with the fully-defined data type or the same data type as another
data object . The data type can be D, F, I, T, a type defined locally in the program
using the TYPES statement, or a type from the ABAP Dictionary. The data object is
a data object or line of an internal table that has already been defined. The VALUE
addition specifies a starting value.

DATA with Reference to Generic Data Types


Declares variables by completing the description of a generic type
Syntax
DATA [()] TYPE [DECIMALS ]… [VALUE ].
DATA TYPE .
The data type can be C, N, P, X, STRING or XSTRING. The option sets the field
length. If you omit it, the field length is set to the appropriate initial value. If is P,
you can specify the number of decimal places using the DECIMALS addition. If you
omit this, the number of decimal places is set to 0. If you do not use the TYPE
addition, the system uses the default predefined generic type C.
Syntax
DATA TYPE .
The data type is a standard internal table with generic key. The default key is
automatically used in the DATA statement.

DATA, Creating an Associated Data Type


Declares variables with data types that only exist as an attribute of the variable.
Syntax
DATA TYPE REF TO |.
The variable is defined as an object reference variable for the class or interface .
Syntax
DATA TYPE REF TO DATA|.
Declares the variable as a data reference variable for a data object.
Syntax
DATA: BEGIN OF ,

…,

END OF .
Combines the variables to form the structure . The individual variables within a
structure are addressed in the program with a hyphen between the structure name
and component name as follows: -.
Syntax
DATA TYPE|LIKE OF WITH .
The variable is declared as an internal table with the table kind , line type , and key .
Syntax
DATA TYPE|LIKE RANGE OF |.
Declares the variable as a RANGES table. A RANGES table has the same data type
as a selection table, but is not linked to input fields on a selection screen.

DATA statement for Shared Data Areas


Declares shared data areas in a program.
Syntax
DATA: BEGIN OF COMMON PART ,
. ..
END OF COMMON PART.
The variables are assigned to a data area , which can be defined in more than one
program. These data areas use the same memory addresses for all programs that
are loaded into the same internal session.

DEFINE
Defines a macro.
Syntax
DEFINE .
Introduces the definition of the macro . Each macro must consist of complete ABAP
statement and be concluded with the END-OF-DEFINITION statement.

DELETE for Files


Deletes files on the application server
Syntax
DELETE DATASET .
Deletes the file from the file system of the application server.

DELETE for Database Table Entries


Deletes entries from database tables.
Syntax
DELETE FROM WHERE .
All of the lines in the database table that satisfy the conditions in the WHERE clause
are deleted.
Syntax
DELETE FROM .
DELETE FROM TABLE .
This deletes the line that has the same primary key as the work area , or deletes all
the lines in the database that have the same primary key as a line in the internal
table . The work area or the lines of the internal table must have at least the same
length as the work area of the database table.

DELETE for Cluster Databases


Deletes data clusters from cluster database tables.
Syntax
DELETE FROM DATABASE () ID .
Deletes the entire cluster in area with the name from the cluster database table .

DELETE for the Cross-Transaction Application Buffer


Deletes data clusters from the cross-transaction application buffer.
Syntax
DELETE FROM SHARED BUFFER () ID .
Deletes the data cluster for the area with the name stored in the cross-transaction
application buffer for the table .

DELETE for Lines from an Internal Table


Deletes lines from internal tables of any type.
Syntax
DELETE TABLE FROM .
DELETE TABLE WITH TABLE KEY = … = .
Deletes using the table key. All lines with the same key are deleted. The key values
are taken either from a compatible work area or specified explicitly.
Syntax
DELETE WHERE .
Deletes using conditions. Deletes all table entries that satisfy the logical expression .
The logical condition can consist of more than one comparison. In each comparison,
the first operand must be a component of the line structure.
Syntax
DELETE ADJACENT DUPLICATE ENTRIES FROM [COMPARING... ].
Deletes adjacent duplicate entries, either by comparing the key fields or the
comparison fields specified explicitly in the COMPARING addition.

DELETE for Lines from Index Tables


Deletes entries from index tables.
Syntax
DELETE [INDEX ].
If you use the INDEX addition, the line with index is deleted from the table .
Without the INDEX addition, you can only use the above statement within a LOOP.
In this case, you delete the current line.
Syntax
DELETE [FROM ] [TO ] [WHERE ].
The system deletes all of the lines of whose index lies between and and who meet the
conditions specified in the WHERE clause. If you do not specify a FROM addition,
the system deletes lines from the first line onwards. If you do not specify a TO
addition, the system deletes lines up to the last line. The logical condition can consist
of more than one comparison. In each comparison, the first operand must be a
component of the line structure.

DEMAND
Retrieves values from a context instance.
Syntax
DEMAND = … = FROM CONTEXT
[MESSAGES INTO ].
Fills the fields with the values from the context instance . You can handle these
messages in your programs by using the MESSAGES addition.

DESCRIBE DISTANCE
Gets the distance between two fields.
Syntax
DESCRIBE DISTANCE BETWEEN AND INTO [IN BYTE|CHARACTER
MODE].
Writes the number of bytes between data objects and into the variable . The length
of the first field in memory is always included. In Unicode programs, you must
specify either the IN BYTE MODE or IN CHARACTER MODE addition. In non-
Unicode programs, the distance is returned in bytes.

DESCRIBE FIELD
Describes the attributes of a field.
Syntax
DESCRIBE FIELD [LENGTH [IN BYTE|CHARACTER MODE]]
[TYPE [COMPONENTS ]]
[OUTPUT-LENGTH ] [DECIMALS ]
[EDIT MASK ] [HELP-ID ].
The attributes of the data object specified by the parameters of the statement are
written to the variables following the parameters. You can use any number of the
additions in the same statement. In Unicode programs, you must specify either the
IN BYTE MODE or IN CHARACTER MODE addition for LENGTH. In non-
Unicode programs, the length is returned in bytes.

DESCRIBE LIST
Describes the attributes of a list.
Syntax
DESCRIBE LIST NUMBER OF LINES [INDEX ].
DESCRIBE LIST NUMBER OF PAGES [INDEX ].
DESCRIBE LIST LINE PAGE [INDEX ].
DESCRIBE LIST PAGE [INDEX ]…
Depending on the variant of the statement that you use, writes the number of lines,
number of pages, a line of a list on a given page, or various attributes of a page to
variables.

DESCRIBE TABLE
Describes the attributes of an internal table.
Syntax
DESCRIBE TABLE [LINES ] [OCCURS] [KIND ].
Depending on the additions you use, writes the number of lines occupied, the value
specified for the INITIAL SIZE of the table, or the table type into a corresponding
variable.

DIVIDE
Divides one field by another.
Syntax
DIVIDE BY .
Divides the content of by , and places the result in . This is equivalent to: n=n/m.

DIVIDE-CORRESPONDING
Divides matching components of structures.
Syntax
DIVIDE-CORRESPONDING BY .
All the identically-named subfields of the structures and are divided and the results
are stored these subfields of .

DO
Introduces a loop.
Syntax
DO [ TIMES] [VARYING FROM NEXT ].
Introduces a statement block that ends with ENDDO. If you omit the TIMES
addition, the statement block is repeated until it reaches a termination statement
such as EXIT or CHECK. Use the TIMES addition to restrict the number of loop
passes to . The VARYING addition allows you to process fields the same distance
apart in memory.

E
EDITOR-CALL
Loads an ABAP program or internal table into a text editor.
Syntax
EDITOR-CALL FOR …
EDITOR-CALL FOR REPORT …
Loads the internal table or the program into a text editor, where you can edit it
using standard editor functions.

ELSE
Introduces a statement block in an IF control structure.
Syntax
ELSE.
If the logical expression in an IF statement is false, ELSE introduces the statement
block to be executed instead.

ELSEIF
Introduces a statement block in an IF control structure.
Syntax
ELSEIF .
If the logical expression in an IF statement is false and is true, ELSE introduces the
statement block to be executed instead.

END-OF-DEFINITION
Closes a macro definition.
Syntax
END-OF-DEFINITION.
This statement concludes a macro definition introduced with DEFINITION.

END-OF-PAGE
Event keywords for defining event blocks for list events.
Syntax
END-OF-PAGE.
Whenever the page footer is reached while a list is being created, the runtime
environment triggers the END-OF-PAGE event, and the corresponding event block
is executed.

END-OF-SELECTION
Event keywords for defining event blocks for reporting events.
Syntax
END-OF-SELECTION.
Once a logical database has read all of the required lines and passed them to the
executable program, the runtime environment triggers the END-OF-SELECTION
event, and the corresponding event block is executed.

ENDAT
Closes a statement block in control level processing.
Syntax
ENDAT.
This statement concludes a control level processing block introduced with AT.
ENDCASE
Closes a CASE control structure.
Syntax
ENDCASE.
This statement concludes a control structure introduced with CASE.

ENDCATCH
Closes a CATCH area.
Syntax
ENDCATCH.
This statement concludes an exception handling block introduced with CATCH
SYSTEM-EXCEPTIONS.

ENDCLASS
Closes a class definition.
Syntax
ENDCLASS.
This statement concludes a class declaration or implementation introduced with
CLASS.

ENDDO
Closes a DO loop.
Syntax
ENDDO.
This statement concludes a loop introduced with DO.

ENDEXEC
Closes a Native SQL statement.
Syntax
ENDEXEC.
This statement ends a Native SQL statement introduced with EXEC SQL.

ENDFORM
Closes a subroutine.
Syntax
ENDFORM.
This statement concludes a subroutine definition introduced with FORM.

ENDFUNCTION
Closes a function module.
Syntax
ENDFUNCTION.
This statement concludes a function module introduced with FUNCTION.

ENDIF
Closes an IF control structure.
Syntax
ENDIF.
This statement concludes a control structure introduced with IF.

ENDINTERFACE
Closes a interface definition.
Syntax
ENDINTERFACE.
This statement concludes an interface definition introduced with INTERFACE.

ENDLOOP
Closes a LOOP.
Syntax
ENDLOOP.
This statement concludes a loop introduced with LOOP.

ENDMETHOD
Closes a method.
Syntax
ENDMETHOD.
This statement concludes a method implementation introduced with METHOD.

ENDMODULE
Closes a dialog module.
Syntax
ENDMODULE.
This statement concludes a dialog module introduced with MODULE.

ENDON
Closes a conditional statement block.
Syntax
ENDON.
This statement ends a conditional statement block introduced with ON CHANGE.

ENDPROVIDE
Closes a PROVIDE loop.
Syntax
ENDPROVIDE.
This statement concludes a loop introduced with PROVIDE.

ENDSELECT
Closes a SELECT loop.
Syntax
ENDSELECT.
This statement concludes a loop introduced with SELECT.
ENDTRY
Closes a TRY area.
Syntax
ENDTRY.
This statement concludes a control structure introduced with TRY.

ENDWHILE
Closes a WHILE loop.
Syntax
ENDWHILE.
This statement concludes a loop introduced with WHILE.

EVENTS
Defines events in classes or interfaces.
Syntax
EVENTS EXPORTING.. VALUE() TYPE type [OPTIONAL]…
The event can be declared in the declaration part of a class or within an interface
definition, and may have EXPORTING parameters that are passed to the event
handler. The parameters are always passed by value.

EXEC SQL
Introduces a Native SQL statement.
Syntax
EXEC SQL [PERFORMING
].
Between EXEC SQL and the ENDEXEC statement, you can include a database-
specific Native SQL statement. The PERFORMING addition allows you to pass a
multiple-line selection line by line to a subroutine.

EXIT
Leaves a loop or processing block.
Syntax
EXIT.
Within a loop: The entire loop is terminated, and processing continues with the first
statement following the loop. Outside a loop: Terminates the current processing
block. In a reporting event: Jumps directly to the output list.

EXIT FROM STEP-LOOP


Ends a step loop.
Syntax
EXIT FROM STEP-LOOP.
Terminates step loop processing. A step loop is ais a way of displaying a table on a
screen.

EXIT FROM SQL


Ends Native SQL processing.
Syntax
EXIT FROM SQL.
This statement may occur within a subroutine called using the PERFORMING
addition in the EXEC SQL statement. The entire subroutine is processed, but no
more subsequent lines of the selection are processed.

EXPORT
Exports data clusters.
Syntax
EXPORT… [FROM ]… | ()
TO MEMORY
| DATABASE () ID()
| SHARED BUFFER () ID().
The data objects or , or the data objects in the internal table are stored as a data
cluster in the cross-program ABAP memory of the current internal session, in a
cluster database table , or in the cross-transaction application buffer of the table .

EXTRACT
Creates an extract dataset and adds lines to it.
Syntax
EXTRACT .
With the first EXTRACT statement of a program, the system creates the extract
dataset and adds the first extract record. In each subsequent EXTRACT statement,
the new extract record is added to the dataset. Each extract record contains exactly
those fields that are contained in the field group , plus the fields of the field group
HEADER (if one exists).

F
FETCH
Uses a cursor to read entries from a database table.
Syntax
FETCH NEXT CURSOR INTO .
If the cursor is linked with a selection in a database table, FETCH writes the next
line of the selection into the flat target area .

FIELD-GROUPS
Declares a field group for an extract dataset.
Syntax
FIELD-GROUPS .
This statement defines a field group . Field groups define the line structure of an
extract dataset. You can also define a special field group called HEADER: When
filling the extract dataset, the system automatically prefixes any other field groups
with this field group.

FIELD-SYMBOLS
Declares field symbols.
Syntax
FIELD-SYMBOLS [|STRUCTURE DEFAULT ].
Field symbols are placeholders or symbolic names for other fields. Pointed brackets
are part of the syntax for field symbol names. The addition allows you to specify the
type of a field symbol. The STRUCTURE addition forces a structured view of the
data objects that you assign to the field symbol.

FIND
Searches for patterns.
Syntax
FIND

IN [SECTION OFFSET LENGTH OF]


[IGNORING CASE|RESPECTING CASE]
[IN BYTE MODE|IN CHARACTER MODE]
[MATCH OFFSET ] [MATCH LENGTH ].
The system searches the field for the pattern

. The SECTION OFFSET LENGTH OF addition tells the system to search only
from the position in the length . IGNORING CASE or RESPECTING CASE
(default) specifies whether the search is to be case-sensitive. In Unicode programs,
you must specify whether the statement is a character or byte operation, using the
IN BYTE MODE or IN CHARACTER MODE (default) additions. The MATCH
OFFSET and MATCH LENGTH additions set the offset of the first occurrence and
length of the search string in the fields

and .
FORM
Defines a subroutine.
Syntax
FORM [USING ... [VALUE(] [)] [TYPE |LIKE ]… ]
[CHANGING... [VALUE(] [)] [TYPE |LIKE ]… ].
Introduces a subroutine
. The USING and CHANGING additions define the subroutine’s parameter
interface. The subroutine end with ENDFORM.

FORMAT
Sets formatting options for list output.
Syntax
FORMAT… [ON|OFF]…
The formatting options (such as color) set in the FORMAT statement, apply to all
subsequent output until they are turned off using the OFF option.

FREE
Release space in memory.
Syntax
FREE .
FREE MEMORY ID().
FREE OBJECT .
This statement deletes an internal table, a data cluster in ABAP memory, or an
external object in OLE2 Automation, depending on the variant of the statement
used.

FUNCTION
Defines a function module.
Syntax
FUNCTION .
Introduces the function module . This statement is not entered in the ABAP Editor,
but is automatically generated by the Function Builder in the ABAP Workbench.
The function module definition ends with the ENDFUNCTION statement

FUNCTION-POOL
Introduces a function group.
Syntax
FUNCTION-POOL.
The first statement in a function group. This statement is not entered in the ABAP
Editor, but is automatically generated by the Function Builder in the ABAP
Workbench. A function group is an ABAP program that contains function modules.

G
GET
Event keyword for defining event blocks for reporting events.
Syntax
GET [FIELDS ...].
Only occurs in executable programs. When the logical database has passed a line of
the node to the program, the runtime environment triggers the GET event, and the
corresponding event block is executed. You can use the FIELDS option to specify
explicitly the columns of a node that the logical database should read.

GET BIT
Reads an individual bit.
Syntax
GET BIT OF INTO .
Reads the bit at position of the hexadecimal field into the field .

GET CURSOR
Gets the cursor position on a screen or in an interactive list event.
Syntax
GET CURSOR FIELD [OFFSET ] [LINE ]
[VALUE ] [LENGTH ].
GET CURSOR LINE [OFFSET ] [VALUE ] [LENGTH ].
At a user action on a list or screen, the statement writes the position, value, and
displayed length of a field or line into the corresponding variables.

GET DATASET
Syntax
GET DATASET [POSITIONS ]
[ATTRIBUTE ].
Gets the attributes of a file opened using OPEN DATASET. The POSITIONS
additions writes the current read/write position to the field . The ATTRIBUTE
addition writes the attributes to a structure, , of the type DSET_ATTRIBUTES.

GET LOCALE LANGUAGE


Gets the current text environment.
Syntax
GET LOCALE LANGUAGE COUNTY MODIFIER .
Returns the current language, country ID and any modifier into the corresponding
variables

GET PARAMETER
Gets an SPA/GPA parameters
Syntax
GET PARAMETER ID FIELD .
Writes the value of the SPA/GPA parameter from the user-specific SAP memory
into the variable .

GET PF-STATUS
Gets the current GUI status.
Syntax
GET PF-STATUS [PROGRAM ] [EXCLUDING ].
Returns the name of the current GUI status (the same as SY-PFKEY) into the
variable . The PROGRAM addition writes the name of the ABAP program to which
the status belongs into the variable . The EXCLUDING addition returns a list of all
currently inactive function codes into the internal table .

GET PROPERTY
Gets a property of an OLE2 Automation object.
Syntax
GET PROPERTY OF

=.
Writes the property

of an external OLE2 Automation object to the variable .

GET REFERENCE
Gets a data reference.
Syntax
GET REFERENCE OF INTO .
Writes a data reference to an existing data object to the data reference variable .

GET RUN TIME FIELD


Measures the runtime in microseconds.
Syntax
GET RUN TIME FIELD .
The first time the statement is executed, the variable is set to zero. In each
subsequent call, the runtime since the first call is written to .

GET TIME
Synchronizes the time.
Syntax
GET TIME [FIELD ].
Refreshes the system fields SY-UZEIT, SY-DATUM, SY-TIMLO, SY-DATLO, and
SY-ZONLO. The FIELD addition fills the variable with the current time.

GET TIME STAMP FIELD


Returns a time stamp.
Syntax
GET TIME STAMP FIELD .
Returns the short or long form of the current date and time, depending on whether
the variable has the type P(8) or P(11). The long form returns the time correct to
seven decimal places.

H
HIDE
Stores information about list lines.
Syntax
HIDE .
While the list is being created, this statement stores the contents of the field and the
current line number in the internal HIDE area When the cursor is positioned on a
line in an interactive list event, the stored value is returned to the field .

I
IF
Conditional branch.
Introduces a new branch.
Syntax
IF .
Opens an IF control structure that ends with an ENDIF statement. The system
evaluates the logical expression , and processes different statement blocks depending
on the result.
IMPORT
Imports data clusters.
Syntax
IMPORT… [TO ]… | ()
FROM MEMORY
| DATABASE () ID()
| SHARED BUFFER () ID().
The data objects or , or the data objects in the internal table are read from data
clusters, either in the cross-program ABAP memory of the current internal session;
in a cluster database table ; or in the cross-transaction application buffer of the
table and written to the variables and .
IMPORT DIRECTORY
Creates the directory of a data cluster from a cluster database.
Syntax
IMPORT DIRECTORY INTO
FROM DATABASE ()
Id .
Writes a directory of the data objects belonging to a data cluster in the cluster
database to the internal table .
In the third variant, the table contains a directory of the objects stored using
EXPORT TO DATABASE.

INCLUDE
Inserts an include program in another program.
Syntax
INCLUDE .
Has the same effect as copying the source code of the include program into the
program. Include programs are not loaded at runtime, but are expanded when the
program is generated. Include programs must have the program type I.

INCLUDE TYPE|STRUCTURE
Includes a structure within another.
Syntax
INCLUDE TYPE |STRUCTURE [AS [RENAMING WITH SUFFIX ]].
Within a structure declared using TYPES|DATA BEGIN OF, copies a structured
datatype , or a structure already available as a data object, as part of the structure
declaration. The AS addition lets you address the individual components using the
name . The RENAMING addition lets you append a suffix, , to , so that you can
copy the same structure several times.

INITIALIZATION
Event keywords for defining event blocks for reporting events.
Syntax
INITIALIZATION.
Only occurs in executable programs. The ABAP runtime environment triggers the
INITIALIZATION event before the selection screen is processed, at which point the
corresponding event block is processed.

INSERT for Database Tables


Inserts entries from database tables.
Syntax
INSERT FROM .
INSERT FROM TABLE [ACCEPTING DUPLICATE KEYS].
Inserts one line from the work area or several lines from the internal table into the
database table . The ACCEPTING DUPLICATE KEYS addition prevents a
runtime error from occurring if two entries have the same primary key. Instead, it
merely discards the duplicate

INSERT for Field Groups


Defines the structure of field groups for extract datasets.
Syntax
INSERT … INTO .
Includes the fields in the field group , thus defining a line structure for an extract
dataset.

INSERT for any Internal Table


Inserts lines from internal tables of any type.
Syntax
INSERT |LINES OF [FROM ] [TO ]
INTO TABLE
[ASSIGNING | REFERENCE INTO ].
Inserts a line or a set of lines from the internal table into the internal table . If is an
index table, you can use the FROM and TO additions to restrict the lines inserted. If
you use ASSIGNING or INTO REFERENCE, field symbol refers to the inserted
line or the relevant data reference is stored in after the statement.

INSERT for Index Tables


Inserts entries in index tables.
Syntax
INSERT |LINES OF [FROM ] [TO ]
INTO [INDEX ]
[ASSIGNING | REFERENCE INTO ].

Inserts a line or a set of lines from the internal table into the internal table before
the line with the index . If is an index table, you can use the FROM and TO
additions to restrict the lines inserted. If you omit the INDEX addition, you can only
use the statement within a LOOP. A new line containing values is inserted before
the current line. If you use ASSIGNING or INTO REFERENCE, field symbol refers
to the inserted line or the relevant data reference is stored in after the statement.
INSERT for Programs
Inserts ABAP programs into the program library.
Syntax
INSERT REPORT FROM .
The lines of the internal table are added to the program library as the program .

INTERFACE
Declares a interface in ABAP Objects.
Syntax
INTERFACE [DEFERRED]
[LOAD].
Introduces an interface . The definition ends with ENDINTERFACE and contains
the declaration of all the components of the interface. The DEFERRED addition
makes the interface known to the program before it is defined. The LOAD addition
loads an interface explicitly from the Class Library.

INTERFACES
Implementation or nesting of an interface in ABAP Objects.
Syntax
INTERFACES
[ABSTRACT|FINAL METHODS | ALL METHODS ABSTRACT|FINAL ]
[DATA VALUES = = ...]
.
Used in a class declaration: This statement adds the components of the interface to
the existing class definition. Used in an interface definition: Forms a compound
interface. Use the additions to characterize methods in interfaces as abstract or
final. Their attributes can be filled with initial values.

L
LEAVE for Screens
Leaves a screen.
Syntax
LEAVE SCREEN.
Stops processing the current screen and calls the subsequent screen. The next screen
can either be defined statically in the screen attributes or set dynamically using the
SET SCREEN statement.
Syntax
LEAVE TO SCREEN .
Stops processing the current screen and calls the dynamically-defined subsequent
screen *.

LEAVE for Lists During Screen Processing


Switches between screen and list processing.
Syntax
LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN ].
Allows you to create and display a list while processing a series of screens. The
addition allows you to specify the next screen (to which you return after the list has
been displayed). If you do not use the addition, screen processing resumes with the
PBO of the current screen
Syntax
LEAVE LIST-PROCESSING.
Allows you to switch back explicitly from list processing to screen processing.

LEAVE for Programs


Leaves an ABAP program.
Syntax
LEAVE [PROGRAM].
Stops processing the current program and returns to the point from which it was
called.
Syntax
LEAVE TO TRANSACTION [AND SKIP FIRST SCREEN].
This statement ends processing of the current program and starts a new transaction,
. The addition allows you to skip the initial screen of the transaction.

LOAD-OF-PROGRAM
Event keywords for defining event blocks for a program constructor.
Syntax
LOAD-OF-PROGRAM.
When an ABAP program is loaded in an internal session, the runtime environment
triggers the LOAD-OF-PROGRAM event, and the corresponding event block is
executed.

LOCAL
Protects global data against changes.
Syntax
LOCAL .
Only occurs in subroutines. When the subroutine starts, the value of is stored
temporarily, and restored to the variable at the end of the subroutine.

LOOP Through Extracts


Introduces a loop through an extract dataset.
Syntax
LOOP.
Loops through an extract dataset. The loop ends with an ENDLOOP statement.
When the LOOP statement is executed, the system stops creating the extract dataset
of the program, and starts a loop through the entries in the dataset. One record
from the extract dataset is read in each loop pass. The values of the extracted fields
are placed in the corresponding output fields of the field group within the loop.

LOOP THROUGH internal tables


Starts a loop through an extract dataset.
Syntax
LOOP AT INTO WHERE .
LOOP AT ASSIGNING WHERE .
LOOP AT REFERENCE INTO WHERE .
LOOP AT TRANSPORTING NO FIELDS WHERE .
Loop through any Internal Table The loop ends with an ENDLOOP statement. If
the logical expression is true, each loop pass either assigns the current line content
to the work area ; assigns the current line to a field symbol ; creates a reference to
the current line by ; or does not assign the line content at all. The first operand in
each part of must be a component of the internal table. Pointed brackets are part of
the syntax for field symbol names.
With index tables, you can use the additions FROM and TO to restrict the lines that
are read by specifying an index range.

LOOP Through Screen Fields


Starts a loop through the table SCREEN.
Syntax
LOOP AT SCREEN…
Similar to a loop through an internal table. The system table SCREEN contains the
names and attributes of all of the fields on the current screen.

M
MESSAGE
Displays a message.
Syntax
MESSAGE [WITH ... ] [RAISING ].
MESSAGE ID TYPE NUMBER .
MESSAGE ().
Displays the message of message class as message type . The message type specifies
how the message is displayed, and how the program reacts. The WITH addition
allows you to fill placeholders in the message text. The RAISING addition in
function modules and methods allows you to terminate the procedure and trigger
the exception .
MESSAGE TYPE
This variant display a string, , directly as a message of the type .

METHOD
Introduces the implementation of a method in a class.
Syntax
METHOD .
Only occurs in the implementation part of classes. Introduces a statement block that
ends with ENDMETHOD. You do not have to specify any interface parameters,
since these are defined in the method declaration.

METHODS
Declares methods in classes and interfaces.
Syntax
METHODS [FOR EVENT OF ]
IMPORTING… [VALUE(][)] TYPE [OPTIONAL]…
EXPORTING… [VALUE(][)] TYPE [OPTIONAL]…
CHANGING … [VALUE(][)] TYPE [OPTIONAL]…
RETURNING VALUE()
EXCEPTIONS … …
[ABSTRACT]
[FINAL]
[REDEFINITION].
You declare a method in the definition part of a class or in the definition of an
interface: The IMPORTING, EXPORTING, CHANGING, RETURNING, and
EXCEPTIONS additions define the parameter interface and exceptions of the
method. The ABSTRACT addition defines an abstract class, which cannot be
implemented in the same class. The function of a non-abstract method must be
implemented using METHOD. The FINAL addition prevents you from redefining
the method in subclasses. The REDEFINITION addition redefines a method of a
superclass. The FOR EVENT addition declares an event handler method for the
event of a class or interface.

MODIFY for Database Tables


Inserts or changes lines in database tables.
Syntax
MODIFY FROM .
MODIFY FROM TABLE .
Works like INSERT for database tables, if there is not yet a line in the table with the
same primary key. Works like UPDATE if a line already exists with the same
primary key.

MODIFY for any Internal Table


Changes the content of lines in internal tables of any type.
Syntax
MODIFY TABLE FROM [TRANSPORTING ...]
[ASSIGNING | REFERENCE INTO ].

Copies the work area into the line of the internal table with the same table key as . If
you use ASSIGNING or INTO REFERENCE, field symbol refers to the modified
line or the relevant data reference is stored in after the statement. You can use the
TRANSPORTING addition to specify the exact components that you want to
change.
MODIFY FROM TRANSPORTING … WHERE .
Copies the work area into the line of the internal table for which the logical
expression is true. In each comparison of the logical expression, the first operand
must be a component of the line structure.

MODIFY for Index Tables


Changes the content of lines in index tables.
Syntax
MODIFY FROM [INDEX ] [TRANSPORTING ...]
[ASSIGNING | REFERENCE INTO ].
Copies the work area into the line of the internal table with the index . If you omit
the INDEX addition, you can only use the statement within a LOOP. In this case,
you change the current loop line If you use ASSIGNING or INTO REFERENCE,
field symbol refers to the modified line or the relevant data reference is stored in
after the statement.

MODIFY for Lists


Changes a list line.
Syntax
MODIFY LINE [INDEX ] [OF CURRENT PAGE|OF PAGE

]
|CURRENT LINE
LINE FORMAT …
FIELD VALUE [FROM ] [FROM ]…
FIELD FORMAT .
Changes either line on the current or specified list (or page), or the last line to be
chosen. The exact nature of the change is specified in the additions

MODIFY SCREEN
Changes the SCREEN table.
Syntax
MODIFY SCREEN…
Like changing an internal table. The system table SCREEN contains the names and
attributes of all of the fields on the current screen.

MODULE
Introduces a dialog module.
Syntax
MODULE OUTPUT |[INPUT].
Introduces the dialog module . The OUTPUT and INPUT additions designate the
module as a PBO or PAI module respectively. Each dialog module ends with
ENDMODULE.

MOVE
Assigns values.
Syntax
MOVE TO .
Assigns the contents of the data object to the variable , with automatic type
conversion if necessary. Equivalent to = .

MOVE-CORRESPONDING
Assigns values between identically-named components of structures.
Syntax
MOVE-CORRESPONDING TO .
Moves the contents of the components of structure to the components of that have
identical names.

MULTIPLY
Multiplies two single fields.
Syntax
MULTIPLY BY .
Multiplies the content of by , and stores the result in . This is equivalent to: m=m*n.

MULTIPLY-CORRESPONDING
Multiplies components of structures.
Syntax
MULTIPLY-CORRESPONDING BY .
All the identically-named subfields of the structures and are multiplied and the
results are stored these subfields of .
N
NEW-LINE
Inserts a line break in a list.
Syntax
NEW-LINE [NO-SCROLLING|SCROLLING].
Positions the list display after the page header. The NO-SCROLLING addition
prevents the new line from scrolling horizontally. SCROLLING resets the NO-
SCROLLING addition.

NEW-PAGE
Inserts a page break in a list.
Syntax
NEW-PAGE [NO-TITLE|WITH-TITLE]
[NO-HEADING|WITH-HEADING]
[LINE-COUNT]
[LINE-SIZE]
[PRINT ON|OFF].
Generates a new page and positions the list output after the page header. The
additions control how the page header is displayed, the length and width of the
page, and the print output.

NODES
Declares an interface work area.
Syntax
NODES .
Declares a variable with the same data type and the same name as a data type from
the ABAP Dictionary. Structures in main programs and subroutines declared using
NODES use a common data area. This statement is used in conjunction with logical
databases.
O
ON CHANGE
Introduces a new branch.
Syntax
ON CHANGE OF [OR OR ...].
Opens an ON control structure, which ends with ENDON. The statement block is
executed whenever the contents of the field or one of the other fields has changed
since the statement was last executed.

OPEN CURSOR
Opens a database cursor.
Syntax
OPEN CURSOR [WITH HOLD] FOR SELECT
FROM
[WHERE ]
[GROUP BY ]
[HAVING ]
[ORDER BY ].
Opens a cursor with type CURSOR for a SELECT statement. You can use all the
clauses of the SELECT statement apart from the INTO clause. The INTO clause is
set in the FETCH statement. If you use the WITH HOLD addition, the cursor is not
closed when a database commit occurs.

OPEN DATASET
Opens a file.
Syntax
OPEN DATASET
[FOR INPUT|OUTPUT|APPENDING|UPDATE]
[IN BINARY MODE
|IN TEXT MODE [ENCODING (DEFAULT|UTF-8|NON-UNICODE)]
|IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE ]
|IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE ]]
[REPLACEMENT CHARACTER ]
[IGNORING CONVERSION ERRORS]
[AT POSITION ]
[TYPE ]
[MESSAGE ]
[FILTER ].
Opens a file on the application server. The additions after FOR specify how the file
is read or written. The MODE additions specifies how content is interpreted (as
characters or in binary form). The ENCODING addition specifies the character
representation in the file. The LEGACY MODE allows you to read files that were
written before Release 6.10. REPLACEMENT CHARACTERS and CONVERSION
ERRORS are used to handle errors during character set conversion. AT POSITION
specifies the position in the file. MESSAGE specifies where system messages are
stored. FILTER lets you specify operating system commands.
OVERLAY
Overlays one string with another:
Syntax
OVERLAY WITH [ONLY ].
This statement overlays all positions in field containing letters which occur in with
the contents of . remains unchanged. If you omit ONLY , all positions of containing
spaces are overwritten.

P
PACK
Converts type C variables to type P.
Syntax
PACK TO .
Packs the string and places it in the field . This can be reversed with the UNPACK
statement.

PARAMETERS
Declares parameters for a selection screen.
Syntax
PARAMETERS

[()] [TYPE |LIKE ] [DECIMALS ]


[DEFAULT ]
[MEMORY ID ]
[LOWER CASE]
[OBLIGATORY]
[VALUE CHECK]
[AS CHECKBOX]
[RADIOBUTTON GROUP ]
[NO-DISPLAY]
[MODIF ID ].
Declares a variable

, as in the DATA statement. For

, an input field appears on the corresponding selection screen. The additions allow
you to define default values, accept lowercase input, define the field as required,
check values, define a checkbox or radio button, prevent the field from being
displayed on the selection screen, or modify the field

PERFORM
Calls a subroutine.
Syntax
PERFORM
| ( ) [IF FOUND]
|()[IN PROGRAM ()][IF FOUND]
[USING ... ... ]
[CHANGING... ... ]
[ON COMMIT].
Calls an internal or external subroutine or the subroutine whose name occurs in the
field. The external program is or the name contained in . The IF FOUND addition
prevents a runtime error from occurring if the subroutine does not exist. The
USING and CHANGING additions fill the subroutine’s parameter interface. The
ON COMMIT addition delays the execution of the subroutine until the next
COMMIT WORK statement.

POSITION
Absolute position of the display in a list.
Syntax
POSITION .
Positions the list display in the column .

PRINT-CONTROL for Print Format


Specifies the print format.
Syntax
PRINT-CONTROL
[LINE ] [POSITION ].
Sets the print format starting either at the current list position or at line and column
.

PRINT-CONTROL for Index Lines


Creates index lines in the spool file.
Syntax
PRINT-CONTROL INDEX-LINE .
Writes the contents of field into an index line after finishing the current print line.
The index line is not printed. During optical archiving, the spool system divides the
list into a data file and a description file containing the index lines.

PRIVATE
Defines the private section of a class.
Syntax
PRIVATE SECTION.
Introduces the declaration of all of the components of a class that are only visible in
the class itself.

PROGRAM
Introduces a program.
Syntax
PROGRAM …
The first statement in some ABAP programs. Equivalent to: REPORT.
PROTECTED
Defines the protected section of a class.
Syntax
PROTECTED SECTION.
Introduces the declaration of all of the components of a class that are only visible in
the class and its subclasses.

PROVIDE
Loops through internal tables at given intervals.
Syntax
PROVIDE … FROM
… FROM
… FROM
… BETWEEN AND .
The contents of the specified fields of the internal tables … are placed in their
header lines. The processing block between PROVIDE and ENDPROVIDE is then
executed for each interval.

PUBLIC
Defines the public section of a class.
Syntax
PUBLIC SECTION.
Introduces the declaration of all of the components of a class that are visible in the
class, its subclasses, and all users.

PUT
Triggers a GET event.
Syntax
PUT .
Only occurs in logical databases. Directs the program flow according to the
structure of the logical database.

R
RAISE for Class-Based Exceptions
Raises an exception.
Syntax
RAISE EXCEPTION TYPE | .
Terminates processing and raises an exception of the exception class . If the
reference variable points to an object of an exception class, can be specified instead
of TYPE.

RAISE for Exceptions of Function Modules and Methods


Raises exceptions.
Syntax
RAISE .
Only occurs in function modules and methods. Terminates processing and raises an
exception defined in the interface.

RAISE for Events


Triggers events in ABAP Objects.
Syntax
RAISE EVENT .
Only occurs in methods. Triggers the event and calls all registered handler methods.

RANGES
Declares a RANGES table.
Syntax
RANGES FOR .
Declares a RANGES table for the field . A RANGES table has the same data type as
a selection table, but is not linked to input fields on a selection screen.

READ for Files


Reads a file.
Syntax
READ DATASET INTO
[MAXIMUM LENGTH ]
[ACTUAL LENGTH ].
Reads the contents of the file on the application server to the variable . The amount
of data can be specified using MAXIMUM LENGTH. The number of bytes
transferred can be written to using ACTUAL LENGTH.

READ for any Internal Table


Reads a line of an internal table.
Syntax
READ TABLE FROM
|WITH TABLE KEY = … =
|WITH KEY =
|WITH KEY = … =
INTO [COMPARING ... |ALL FIELDS]
[TRANSPORTING ... |ALL FIELDS|NO FIELDS]
|ASSIGNING
|REFERENCE INTO .
This statement reads either the line of the internal table with the same key as
specified in the work area , the line with the key specified in the TABLE KEY
addition, the line that corresponds fully to , or the one corresponding to the freely-
defined key in the KEY addition. The contents of the line are either written to the
work area , or the line is assigned to the field symbol . If you assign the line to a
work area, you can compare field contents and specify the fields that you want to
transport.
READ for Index Tables
Reads a line of an internal table.
Syntax
READ TABLE INDEX INTO …
| ASSIGNING
| REFERENCE INTO .
The line with index 7 is read. The result is specified as with any internal table.

READ for Lists


Reads the contents of a line from a list.
Syntax
READ LINE [INDEX ] [OF CURRENT PAGE|OF PAGE

]
|CURRENT LINE
[FIELD VALUE [INTO ]… [INTO ]].
Reads either the line on the current or specified list or page, or the last line to have
been selected by the user. The addition specifies the fields that you want to read, and
the target fields into which they should be placed. The entire line is always placed in
the system field SY-LISEL, and the HIDE area is filled for the line.

READ for Programs


Reads ABAP programs into the program library.
Syntax
READ REPORT INTO .
Copies the lines of the program into the internal table .

RECEIVE
Receives results from an asynchronous function module call.
Syntax
RECEIVE RESULTS FROM FUNCTION [KEEPING TASK]
[IMPORTING ... fi = a i... ]
[TABLES ... fi = a i... ]
[EXCEPTIONS... ei = r i... ]
Occurs in special subroutines to receive IMPORTING and TABLES parameters
from function modules called using the STARTING NEW TASK addition

REFRESH
Initializes an internal table.
Syntax
REFRESH .
Resets the internal table to its initial value, that is, deletes all of its lines.

REFRESH CONTROL
Initializes a control.
Syntax
REFRESH CONTROL FROM SCREEN .
The control defined in the CONTROLS statement is reset with the initial values
specified for screen .

REJECT
Leaves an GET processing block.
Syntax
REJECT [].
Terminates the processing of the current line of the node of the logical database. If
you use the optional , the logical database reads the next line of the node .

REPLACE by Pattern
Replaces strings in fields with other strings using a pattern.
Syntax
REPLACE [ FIRST OCCURENCE OF | ALL OCCURENCES OF ] IN [ SECTION
OFFSET LENGTH OF ] WITH
[IGNORING CASE|RESPECTING CASE]
[IN BYTE MODE|IN CHARACTER MODE]
[REPLACEMENT COUNT ]
[REPLACEMENT OFFSET ]
[REPLACEMENT LENGTH ].
In the string , the search pattern is replaced by the content of . By default, the first
occurrence of is replaced. ALL OCCURENCES specifies that all occurrences be
replaced. In the fields and , trailing spaces in C fields are ignored, but included in .
The SECTION OFFSET LENGTH OF addition tells the system to search and
replace only from the position in the length . IGNORING CASE or RESPECTING
CASE (default) specifies whether the search is to be case-sensitive. In Unicode
programs, you must specify whether the statement is a character or byte operation,
using the IN BYTE MODE or IN CHARACTER MODE (default) additions. The
REPLACEMENT additions write the number of replacements, the offset of the last
replacement, and the length of the last replaced string to the fields , , and .

REPLACE by Position
Replaces strings in fields with other strings by position.
Syntax
REPLACE WITH INTO [LENGTH ].
[IN BYTE MODE|IN CHARACTER MODE].
ABAP searches the field for the first occurrence of the first characters in the pattern
and replaces them with the string . In Unicode programs, you must specify whether
the statement is a character or byte operation, using the IN BYTE MODE or IN
CHARACTER MODE (default) additions.

REPORT
Introduces a program.
Syntax
REPORT [MESSAGE-ID ]
[NO STANDARD PAGE HEADING]
[LINE-SIZE ]
[LINE-COUNT ()]
[DEFINING DATABASE ].
The first statement in executable ABAP programs. can be any name you choose.
The addition MESSAGE-ID specifies a message class to be used in the program.
The DEFINING DATABASE addition defines the program as the database
program of the logical database . The other additions are formatting specifications
for the default list of the program.

RESERVE
Inserts a conditional page break in a list.
Syntax
RESERVE LINES.
Executes a page break on the current page if less than lines are free between the
current line and the page footer.

RETURN
Leaves a processing block.
Syntax
RETURN.
Leaves the current processing block. In a reporting event: Jumps directly to the
output list.

ROLLBACK
Undoes the changes in a SAP LUW.
Syntax
ROLLBACK WORK.
ROLLBACK WORK always undoes all changes back to the start of the database
LUW. The update modules are not called, and the log entry is deleted from table
VBLOG.

S
SCROLL
Scrolls through lists
Syntax
SCROLL LIST FORWARD|BACKWARD [INDEX ].
SCROLL LIST TO FIRST PAGE|LAST PAGE|PAGE [INDEX ] [LINE ].
SCROLL LIST LEFT|RIGHT [BY PLACES] [INDEX ].
SCROLL LIST TO COLUMN [INDEX ].
Positions the current list or the list level in accordance with the additions specified.
You can scroll by window, page, columns, or to the left- or right-hand edge of the
list.

SEARCH
Searches for strings.
Syntax
SEARCH | FOR [ABBREVIATED]
[STARTING AT ]
[ENDING AT ]
[AND MARK]
[IN BYTE MODE|IN CHARACTER MODE].
Searches the field or table for the string in the field . The result is stored in SY-
FDPOS. The additions let you hide intermediate characters, search from and to a
particular position, and convert the found string into uppercase. In Unicode
programs, you must specify whether the statement is a character or byte operation,
using the IN BYTE MODE or IN CHARACTER MODE (default) additions.

SELECT
Reads data from the database.
Syntax
SELECT
INTO
FROM
[WHERE ]
[GROUP BY ]
[HAVING ]
[ORDER BY ].
The SELECT statement consists of a series of clauses, each of which fulfils a certain
task:
SELECT clause
Defines the structure of the selection.
Syntax
SELECT [SINGLE]|[DISTINCT]
* | [AS ]… ( [DISTINCT] ) [AS ]…
The selection can be one line, SINGLE, or several lines. You can eliminate duplicate
lines using the DISTINCT addition. To select the entire line, use *, otherwise, you
can specify individual columns . For individual columns, you can use aggregate
functions , and assign alternative column names .
INTO clause
Defines the target area into which the selection from the SELECT clause is written.
Syntax
… INTO [CORRESPONDING FIELDS OF]
| INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE
[PACKAGE SIZE ]
| INTO (, ,…)
The target area can be a flat work area , an internal table , or a list of fields . If you
use the CORRESPONDING FIELDS addition, data is only selected if there is an
identically-named field in the target area. If you use APPENDING instead of INTO,
the data is appended to an internal table instead of overwriting the existing
contents. PACKAGE SIZE allows you to overwrite or extend the internal table in a
series of packages.The data type of the target area must be appropriate for the
selection in the SELECT clause.
FROM clause
The FROM clause determines the database tables from which the data specified in
the SELECT clause is read.
Syntax
… FROM [ [INNER]|LEFT [OUTER] JOIN] [AS ]
[ON ]
[CLIENT SPECIFIED]
[BYPASSING BUFFER]
[UP TO ROWS]
You can read both single fields and groups of fields. You link several tables using
inner and outer joins to link tables with conditions , where is a single table or itself a
join condition. The names of database tables may be specified statically or
dynamically, and you can use alias names. You can bypass automatic client
handling with the CLIENT SPECIFIED addition, and SAP buffering with
BYPASSING BUFFER. You can also restrict the number of lines read from the
table using the UP TO ROWS addition.
WHERE clause
Restricts the number of lines selected.
Syntax
… [FOR ALL ENTRIES IN ] WHERE
The condition may contain one or more comparisons, tests for belonging to
intervals, value list checks, subqueries, selection table queries or null value checks,
all linked with AND, OR, and NOT. If you use the FOR ALL ENTRIES addition,
the condition is checked for each line of the internal table as long as contains a field
of the internal table as an operand. For each line of the internal table, the system
selects the lines from the database table that satisfy the condition. The result set is
the union of the individual selections resulting from each line.
GROUP BY clause
Groups lines in the selection.
Syntax
… GROUP BY
Groups lines with the same contents in the specified columns. Uses aggregate
functions for all other columns in each group. All columns of the SELECT clause
that are not listed in the GROUP BY clause must be included in aggregate
functions.
HAVING clause
Restricts the number of line groups selected.
Syntax
… HAVING
Like the WHERE clause, but can only be used in conjunction with a GROUP BY
clause. The HAVING clause uses conditions to restrict the number of groups
selected.
ORDER BY clause
Sorts the lines of the selection.
Syntax
… ORDER BY PRIMARY KEY |… [ASCENDING|DESCENDING]…
Sorts the selection in ascending or descending order according to the primary key or
the contents of the fields listed.

SELECT-OPTIONS
Declares selection criteria for a selection screen.
Syntax
SELECT-OPTIONS FOR
[DEFAULT [to ] [OPTION ] SIGN ]
[MEMORY ID ]
[LOWER CASE]
[OBLIGATORY]
[NO-DISPLAY]
[MODIF ID ]
[NO-EXTENSION]
[NO INTERVALS]
[NO DATABASE SELECTION].
Declares a selection table for the field . For , places input fields on the corresponding
selection screen. The additions allow you to set a default value, accept input in
lowercase, define a required field, suppress or modify the display on the selection
screen, restrict the selection table to a line or a selection to a single field, or prevent
input from being passed to a logical database.

SELECTION-SCREEN for Selection Screen Formatting


Formats selection screens
Syntax
SELECTION-SCREEN SKIP [].
SELECTION-SCREEN ULINE [[/] ] [MODIF ID ].
SELECTION-SCREEN COMMENT [/] [FOR FIELD ]
[MODIF ID ].
SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK
[WITH FRAME [TITLE ]]
[NO INTERVALS].

SELECTION-SCREEN END OF BLOCK .
SELECTION-SCREEN FUNCTION KEY .
SELECTION SCREEN PUSHBUTTON [/] USER-COMMAND [MODIF ID ].
Allows you to insert blank lines, lines and comments, group input fields together in
lines and blocks, and create pushbuttons.

SELECTION-SCREEN for Selection Screen Definition


Defines selection screens.
Syntax
SELECTION-SCREEN BEGIN OF [TITLE ] [AS WINDOW].

SELECTION-SCREEN END OF .
Defines a selection screen with screen number . All PARAMETERS, SELECT-
OPTIONS, and SELECTION-SCREEN statements that occur between these two
statements define the input fields and the formatting of this selection screen. The
TITLE

SELECTION-SCREEN for Selection Screen Versions


Defines selection screen versions.
Syntax
SELECTION-SCREEN BEGIN OF VERSION

SELECTION-SCREEN EXCLUDE .

SELECTION-SCREEN BEGIN OF VERSION .
Only occurs in logical databases. Hides fields that otherwise appear on the standard
selection screen.

SELECTION-SCREEN for Logical Databases


Provides special functions.
Syntax
SELECTION-SCREEN DYNAMIC SELECTIONS | FIELD SELECTION
FOR NODE|TABLE .
Only occurs in logical databases. Declares a node as accepting dynamic selections or
field selections.

SET BIT
Sets individual bits.
Syntax
SET BIT OF [TO ].
This statement sets the bit at position of the hexadecimal field to 1 (or to the value of
field ). The field must contain the value 0 or 1.

SET BLANK LINES


Allows blank lines in lists.
Syntax
SET BLANK LINES ON|OFF.
Prevents blank lines created in WRITE statements from being suppressed in list
output.

SET COUNTRY
Sets output Formats
Syntax
SET COUNTRY .
Sets the output formats for numeric and date fields for the country with the ID .
SET CURSOR
Sets the cursor on the screen.
Syntax
SET CURSOR FIELD [OFFSET ]
[LINE ].
SET CURSOR LINE [OFFSET ].
SET CURSOR .
Sets the cursor either to a particular position in a field, line, or column of a line.

SET DATASET
Syntax
SET DATASET [POSITIONS | END-OF_FILE]
[ATTRIBUTE ].
Changes the attributes of a file opened using OPEN DATASET. The POSITIONS
addition sets the current read/write position to the value in the field or to the end of
the file. The ATTRIBUTE addition passes the attributes to the file in a structure, ,
of the type DSET_ATTRIBUTES.

SET EXTENDED CHECK


Affects the extended program check.
Syntax
SET EXTENDED CHECK ON|OFF.
Switches the extended program check (SLIN) on or off, suppressing the
corresponding messages.

SET HANDLER
Registers event handlers in ABAP Objects.
Syntax
SET HANDLER… … [FOR |FOR ALL INSTANCES].
If you do not use the FOR addition, the handler is set for all static events. Use the
FOR addition to register handlers for instance events.

SET HOLD DATA


Sets a screen attribute.
Syntax
SET HOLD DATA ON|OFF.
Sets the screen attribute “Hold data” from the program.

SET LANGUAGE
Sets the display language.
Syntax
SET LANGUAGE .
All text symbols are refreshed with the contents of the text pool in language .

SET LEFT SCROLL BOUNDARY


Sets the left boundary for horizontal scrolling.
Syntax
SET LEFT SCROLL-BOUNDARY [COLUMN ].
Sets the current output position or the position as the left-hand edge of the
scrollable area on the current list page.

SET LOCALE LANGUAGE


Sets the current text environment.
Syntax
SET LOCALE LANGUAGE [COUNTRY ] [MODIFIER ].
Sets the text environment for alphabetical sorting according to the language ,
country , and any further modifier .

SET MARGIN
Sets the margin of a print page.
SET MARGIN [].
Sends the current list page to the spool system with a margin of columns from the
left-hand edge and rows from the top edge of the page.

SET PARAMETER
Sets an SPA/GPA parameters
Syntax
SET PARAMETER ID FIELD .
Writes the value of the field to the SPA/GPA parameter in the user-specific SAP
memory.

SET PF-STATUS
Sets the GUI status
Syntax
SET PF-STATUS [EXCLUDING |]
[IMMEDIATELY] [OF PROGRAM ].
Sets the GUI status for the subsequent screens. The EXCLUDING addition allows
you to deactivate functions dynamically. The IMMEDIATELY addition sets the
GUI status of the list currently displayed. The OF PROGRAM addition allows you
to use a GUI status from another program.

SET PROPERTY
Sets a property of an OLE2 Automation object.
Syntax
GET PROPERTY OF

=.
Sets the property

of an external OLE2 Automation object to .


SET RUN TIME ANALYZER
Controls runtime analysis.
Syntax
SET RUN TIME ANALYZER ON|OFF.
The runtime analysis only measures the runtime of the statements in the block
between SET RUN TIME ANALYZER ON and OFF.

SET RUN TIME CLOCK


Controls runtime analysis.
Syntax
SET RUN TIME CLOCK RESOLUTION HIGH|LOW.
Sets the accuracy of the runtime to low accuracy with long measurement interval or
high accuracy with shorter measurement interval.

SET SCREEN
Sets the next screen.
Syntax
SET SCREEN .
Temporarily overwrites the statically-defined next screen with . is processed after
the current screen.

SET TITLEBAR
Sets the screen title.
Syntax
SET TITLEBAR [OF PROGRAM ] [WITH ... ].
Sets the title for the subsequent screens. The OF PROGRAM addition allows you to
use a title from another program. The WITH addition fills any placeholders in the
title.

SET UPDATE TASK LOCAL


Switches on local update.
Syntax
SET UPDATE TASK LOCAL.
Updates are processed in the current work process.

SET USER-COMMAND
Triggers a list event.
Syntax
SET USER-COMMAND .
Triggers a list event with the function code and calls the corresponding event block.

SHIFT
Shifts strings.
Syntax
SHIFT [BY PLACES] [LEFT|RIGHT|CIRCULAR]
[IN BYTE MODE|IN CHARACTER MODE].
Shifts the field by one or places. The additions allow you to specify the direction,
and how the empty spaces are dealt with. In Unicode programs, you must specify
whether the statement is a character or byte operation, using the IN BYTE MODE
or IN CHARACTER MODE (default) additions.

SKIP for Blank Lines


Generates blank lines in the display list.
Syntax
SKIP [].
The system writes blank lines into the current list, starting at the current line. If no
value is specified for , one blank line is output.

SKIP for Positioning


Absolute position of the display in a list.
Syntax
SKIP TO LINE .
Positions the list display in the line .

SORT for Extracts


Sorts an extract dataset.
Syntax
SORT [ASCENDING|DESCENDING] [AS TEXT] [STABLE]
… BY [ASCENDING|DESCENDING] [AS TEXT]…
Ends the creation of the extract dataset of a program and, at the same time, sorts its
records. Without the BY option, the system sorts the dataset by the key specified in
the HEADER field group. You can define a different sort key by using the BY
addition. The other additions specify whether you want to sort in ascending or
descending order, and whether strings should be sorted alphabetically.

SORT for Internal Tables


Sorts internal tables.
Syntax
SORT [ASCENDING|DESCENDING] [AS TEXT] [STABLE]
… BY [ASCENDING|DESCENDING] [AS TEXT]…
Sorts the internal table . If you omit the BY addition, the table is sorted by its key.
You can define a different sort key by using the BY addition. The other additions
specify whether you want to sort in ascending or descending order, and whether
strings should be sorted alphabetically.

SPLIT
Splits a string.
Syntax
SPLIT AT INTO … INTO TABLE
[IN BYTE MODE|IN CHARACTER MODE].
This statement searches the character field for delimiter strings and the parts before
and after the delimiters are placed in the target fields …> … , or into a new line of
the internal table . In Unicode programs, you must specify whether the statement is
a character or byte operation, using the IN BYTE MODE or IN CHARACTER
MODE (default) additions.

START-OF-SELECTION
Event keywords for defining event blocks for reporting events.
Syntax
START-OF-SELECTION.
After the selection screen has been processed, the runtime environment triggers the
LOAD-OF-PROGRAM event, and the corresponding event block is executed.

STATICS
Defines static variables.
Syntax
STATICS …
Like DATA. Retains the value of a local variable beyond the runtime of the
procedure in which it occurs.

STOP
Leaves a reporting event.
Syntax
STOP.
Only occurs in event blocks for reporting events. Leaves the event block and goes to
the END-OF-SELECTION block.

SUBMIT
Calls an executable program of type 1.
Syntax
SUBMIT [AND RETURN] [VIA SELECTION-SCREEN]
[USING SELECTION-SET ]
[WITH ]
[WITH FREE SELECTIONS ]
[WITH SELECTION-TABLE ]
[LINE-SIZE ]
[LINE-COUNT ].
Calls the program . If you omit the AND RETURN addition, the current program is
terminated. Otherwise, the data from the current program is retained, and
processing returns to the calling program when has finished running. The other
additions control the selection screen and set attributes of the default list in the
called program.

SUBTRACT for single fields


Subtracts two single fields.
Syntax
SUBTRACT FROM .
The contents of are subtracted from the contents of and the results are stored in .
This is equivalent to: = – .

SUBTRACT-CORRESPONDING
Subtracts components of structures.
Syntax
SUBTRACT-CORRESPONDING FROM .
All the subfields of the structures and having the same name are subtracted and the
results are stored in .

SUM
Calculates sums of groups.
Syntax
SUM.
Only occurs in loops through internal tables. Calculates the sums of the numeric
fields in all lines of the current control level and writes the results to the
corresponding fields in the work area.

SUPPLY
Fills context instances with values.
Syntax
SUPPLY = … = TO CONTEXT .
Fills the key fields of the context instance with the values .

SUPPRESS DIALOG
Prevents the current screen from being displayed.
Syntax
SUPPRESS DIALOG.
Can only occur in a PBO dialog module. The screen is not displayed, but its flow
logic is still processed.

T
TABLES
Declares an interface work area.
Syntax
TABLES .
Declares a structure with the same data type and the same name as a database table,
a view, or a structure from the ABAP Dictionary. Structures in main programs and
subroutines declared using TABLES use a common data area.

TOP-OF-PAGE
Event keywords for defining event blocks for list events.
Syntax
TOP-OF-PAGE [DURING LINE-SELECTION].
Whenever a new page begins while a standard list is being created, the runtime
environment triggers the TOP-OF-PAGE event and the corresponding event block
is executed. The addition DURING LINE-SELECTION has the same function, but
for detail lists.

TRANSFER
Writes to a file.
Syntax
TRANSFER TO [LENGTH ].
Writes the field to the file on the application server. You can specify the length of
the data you want to transfer using the LENGTH addition.

TRANSLATE
Converts characters to strings.
Syntax
TRANSLATE TO UPPER|LOWER CASE
|USING .
The characters of the string are converted into upper- or lowercase, or according to
a substitution rule specified in .

TRY
Introduces a TRY block.
Syntax
TRY.
Class-based exceptions can be handled using the CATCH statement, within the
block ended with ENDTRY.

TYPE-POOL
Introduces a type group.
Syntax
TYPE-POOL .
The first statement in a type group. This statement is not entered in the ABAP
Editor, but is automatically generated by the Dictionary in the ABAP Workbench.
A type group is an ABAP program that contains type definitions and constant
declarations that can be used in several programs.

TYPE-POOLS
Declares the types and constants of a type group to a program.
Syntax
TYPE-POOLS .
This statement allows you to use all the data types and constants defined in the type
group in your program.

TYPES for Single Field Types


Defines a single field type.
Syntax
TYPES [()] [TYPE |LIKE ] [DECIMALS ].
Defines the internal data type in the program with length , reference to the ABAP
Dictionary type or a data object , and, where appropriate, with decimal places.
Syntax
TYPES TYPE REF TO |.
Defines the internal data type in the program with reference to the class or the
interface .
Syntax
TYPES TYPE REF TO DATA|.
Defines the internal data type as a data reference to a data object.

TYPES for Complex Types


Defines complex types.
Syntax
TYPES: BEGIN OF ,

…,

END OF .
Combines the data types to form the structure . You can address the individual
components of a structure in a program using a hyphen between the structure name
and the component name as follows: -.
Syntax
TYPES TYPE|LIKE OF [WITH ].
Defines the local data type in the program as an internal table with the access type ,
the line type , and the key .
Syntax
TYPES TYPE|LIKE RANGE OF |.
Defines the internal data type as a RANGES table. A RANGES table has the same
data type as a selection table, but is not linked to input fields on a selection screen.

U
ULINE
Places horizontal lines in the display list.
Syntax
ULINE [AT [/][ ][()]].
Without additions, creates a new line on the current list and fills it with a horizontal
line. The additions allow you to insert a line break and specify the starting position
and length of the line.

UNPACK
Converts type P variables to type C.
Syntax
UNPACK TO .
Unpacks the packed field and places it in the string with leading zeros. This can be
reversed with the PACK statement.
UPDATE
Changes entries in database tables.
Syntax
UPDATE SET =
|=+
| = – [WHERE ].
The value in the column is set to the value , increases it by , or decreases it by for all
lines selected. The WHERE clause specifies the lines that are changed. If you omit
the WHERE clause, all lines are changed.
Syntax
UPDATE FROM .
UPDATE FROM TABLE .
This deletes the line that has the same primary key as the work area , or deletes all
the lines in the database that have the same primary key as a line in the internal
table . The work area or the lines of the internal table must have at least the same
length and alignment as the lines of the database table.

W
WHEN
Introduces a statement block in a CASE control structure.
Syntax
WHEN [OR OR...] | OTHERS.
The statement block following a WHEN statement is executed if the contents of the
field in the CASE statement are the same as those of one of the fields . Afterwards,
the program carries on processing after the ENDCASE statement. The statement
block after WHEN OTHERS statement is executed if the contents of does not equal
any of the contents.

WHILE
Introduces a loop.
Syntax
WHILE [VARY FROM NEXT ].
Introduces a statement block that ends with ENDWHILE. The statement block
between WHILE and ENDWHILE is repeated as long as the logical expression is
true, or until a termination statement such as EXIT or CHECK occurs. The VARY
addition allows you to process fields the same distance apart in memory.

WINDOW
Displays a list as a modal dialog box.
Syntax
WINDOW STARTING AT [ENDING AT ].
Only occurs in list processing. The current detail list is displayed as a modal dialog
box. The top left-hand corner of the window is positioned at column and line . The
bottom right-hand corner is positioned at column and line (if specified).
WRITE
Displays lists.
Syntax
WRITE [AT [/][ ][()]] [AS CHECKBOX|SYMBOL|ICON|LINE]
[QUICKINFO ].
[
]
The contents of the field are formatted according to their data type and displayed in
the current list. . The additions before the field allow you to specify a line break, the
starting position, and the length of the field. The additions after the field allow you
to display checkboxes, symbols, icons, and lines. The
addition can contain various other formatting options. The QUICKINFO addition
allows you to assign a tool tip to the field.

WRITE TO
Assigns string values.
Syntax
WRITE TO [
].
Converts the contents of a data object to type C, and assigns the resulting string to
the variable . You can use the same formatting options available in the WRITE
statement
Important ABAP Tables
Written by admin on Nov 28th, 2007 | Filed under: ABAP

Table Name = Table Description


ADCP = Person/Address assignment (central address administration)
ADIRACCESS = Table to store keys for TADIR objects
ADR2 = Telephone numbers (central address admin.)
ADRP = Persons (central address administration)
APQD = DATA DEFINITION Queue
APQI = Queue info definition

D010SINF = ABAP- Information about ABAP program source code


E071 = Change and Transport System- Object Entries of Requests/Tasks
E07T = Change and Transport System- Short Texts for Requests/Tasks
ENLFDIR = Additional Attributes for Function Modules
INDX = System table INDX
NAST = Message Status
STXH = STXD SAPscript text file header
T005 = Countries
T005S = Taxes- Region (Province) Key
T005U = Taxes- Region Key- Texts
T006 = Units of Measurement
T015M = Names of the months
T247 = Month name and short text
T777A = Building Addresses
TADIR = Directory of Repository Objects
TBTCO = Job status overview table
TBTCP = Batch job step overview
TFDIR = Function Module
TFTIT = Function Module Short Text
TSP03L = Spool- Long device names
TSTC = SAP Transaction Codes
TSTCT = Transaction Code Texts
TUTYP = User Types in Current Price List in SAP System
TUZUS = Special versions
TVARV = Table of variables in selection criteria
TVDIR = View Directory
US930 = Data Relevant to Measurement for User Master Record
USR01 = User master record (runtime data)
USR02 = Logon data
USR04 = User master authorizations
USR06 = Additional Data per User
USR14 = Surchargeable Language Versions per User
USR21 = Assign user name address key
ARCH_OBJ = Objects for archiving and reorganization
BTCUED = Description of user event IDs for background processing
BTXSUPB = BSI- Upgrade-Information
CCCFLOW = Client Copy Control Flow
DBSTATC = DB Optimizer Control (Statistics Creation)
DEVACCESS = Table for development users
DEVL = OBSOLETE- Do not use (See TCETRAL)
E070 = Change and Transport System- Header of Requests/Tasks
E070L = CTS- Index for Assigning Numbers to Requests/Tasks
INSTVERS = Documentation for installation Status and History
PAT03 = Patch Directory
SDBAC = DBA Action Table
T100 = Messages
TAPLT = Program Application Long Texts
TASYS = OBSOLETE- Do not use, see TCEDELI
TDEVC = Development Classes
TEMSE = Temp Sequential table.
TLOCK = Change and Transport System- Lock Table
TNAPR = Processing programs for output. Can be very handy to find the print
program for a SAPScript.
TNAST = Printed output control table
TPFET = Table of profile parameters
TPFHT = Profile header, administration data for profiles in DB
TPROT = Table contains all DD tables to be logged
TRBAT = Communication Table for Transport Control
TRDIRT = Title texts for programs in TRDIR
TRESN = Table of Naming Conventions in ABAP Workbench
TRJOB = Job ID for Coordinating Batch-ABAP/UNIX for Transports
TSP03C = Spool- Device Description Extension
TST03 = TemSe data
TSYST = OBSOLETE- Do not use (see TCESYST)
TWSYS = OBSOLETE- Do not use (See TCETRAL)
USOBT = Relation transaction – authorization object
USR03 = User address data
USR05 = User Master Parameter ID
USR12 = User master authorization values
USR40 = Table for illegal passwords
USR41 = User master- Additional data
UST04 = User masters
VARIT = Variant texts
VARID = Variant directory
D010TAB = Table for Use Report—Tables
DD02L = SAP tables
DD02T = R/3 DD- SAP table texts
DD03L = Table Fields
DD03T = DD- Texts for fields (language dependent)
EDIDC = IDOC Control Records
EDIDOT = Short description of IDoc types
EDID2 = IDOC segments (version 3.1)
EDID4 = IDOC segments (version 4.6)
EDSEA = EDI- Table of all segments of current release
VRSX2 = Central Table for Version Management (Report Source)
TSE05 = Can add parameters to the INSERT COMMAND (IC). Then, when you
insert command, your info appears in the editor. Useful for comment blocks,
common section of code, etc.
CDPOS = Change document items
CDHDR = Change document header
T529A = governs the foreground sequence of infotypes the system will use to prompt
the user during online and batch processing. You will have to code your BDC to
follow that sequence of creating infotypes.
T588Z = governs the dynamic event processing that will only take place during
online user inputs. For BDC’s you will have to create separate BDC’s to handle any
infotypes that are inserted dynamically by this table.
T588M = Infotype Screen Control
Report Template

Note that this report uses tables without headerlines

REPORT ZRAPTEMP.
* NO STANDARD PAGE HEADING
* LINE-SIZE <XX> LINE-COUNT <YY>
* MESSAGE-ID <ZC>.

**********************************************************************
*
* Description:
*
* Log:
*
* Date Init Description of change
* ------------------ ----- -----------------------------------------------------
* dd-mm-yyyy xxxx
*
**********************************************************************

*----------------------------------------------------------------------
*TABLES
*----------------------------------------------------------------------
TABLES:

*----------------------------------------------------------------------
*CONSTANTS
*----------------------------------------------------------------------
constants: xxx type i value 1.
*----------------------------------------------------------------------
*STANDARDTYPES
*----------------------------------------------------------------------
TYPES:
begin of st_xyz,
end of st_xyz.

*----------------------------------------------------------------------
*TABLETYPES
*----------------------------------------------------------------------
TYPES:
tt_xyz type standard table of st_xyz.

*----------------------------------------------------------------------
*INTERNALTABLES
*----------------------------------------------------------------------

DATA:
gi_xyz type tt_xyz.

*----------------------------------------------------------------------
*GLOBALVARIABLES
*----------------------------------------------------------------------
DATA:
* Working area for for table gi_xyz
g_xyz type st_xyz.

***************************************************************
*SELECTIONSCREEN
***************************************************************

*SELECTION-SCREEN BEGIN OF BLOCK 1


* WITH FRAME TITLE TEXT-XXX.
*
* SELECT-OPTIONS: <SELFIELD1> FOR <TABLE1-FILED1>
* OBLIGATORY
* DEFAULT <XXX>.
* PARAMETER: <P_RB01> RADIOBUTTON GROUP <G1> DEFAULT 'X',
* <P_RB02> RADIOBUTTON GROUP <G1>,
* <CHK_BOX1> AS CHECKBOX DEFAULT 'X'.
*
*SELECTION-SCREEN END OF BLOCK 1.

***************************************************************
*EVENTS
***************************************************************
*--------------------------------------------------------------
*ATSELECTION-SCREENOUTPUT
*--------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.
PERFORM ATSELOUT_MODIFY_SCREEN.

*--------------------------------------------------------------
*INITIALIZATION
* Executed before the selection screen is displayed.
* Initialize fields on the selection screen,
* variables and internal tables
*--------------------------------------------------------------
INITIALIZATION.
PERFORM INIT_VARIABLES.

*---------------------------------------------------------------
* This event is assigned to the selection screen fields
* corresponding to the report parameter or selection criterion selfield1.
* If the report starts an error dialog at this point, precisely this field
* become ready for input.
*---------------------------------------------------------------
*at selection-screen on selfield1.
* if selfield1 <logical expression>.
* message E002 with text-003.
* endif.

*--------------------------------------------------------------
*START-OF-SELECTION
*--------------------------------------------------------------
START-OF-SELECTION.
* SET PF-STATUS <'XXXX'>.
* <AUTHORITY-CHECK OBJECT OBJECT NAME>

* CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'


* EXPORTING
* TEXT = T2
* EXCEPTIONS
* OTHERS = 1.

PERFORM READ_DATA.

*--------------------------------------------------------------
*END-OF-SELECTION
*--------------------------------------------------------------
END-OF-SELECTION.
PERFORM WRITE_REPORT.
* CLEAR <ITAB1-FIELD1>. "Used by interactive reports when drilling down

*--------------------------------------------------------------
*TOP-OF-PAGE
*--------------------------------------------------------------
TOP-OF-PAGE.
PERFORM WRITE_REPORT_HEADER.

*--------------------------------------------------------------
*END-OF-PAGE
*--------------------------------------------------------------
END-OF-PAGE.
PERFORM WRITE_REPORT_FOOTER.

*--------------------------------------------------------------
*ATUSER-COMMAND
* Fires when the user pushes a pushbutton
*--------------------------------------------------------------
* AT USER-COMMAND.
* CASE SY-UCOMM.
* WHEN 'XXX'.
* PERFORM <XXX>.
* WHEN 'YYY'.
* PERFORM <YYY>.
* ENDCASE.

*--------------------------------------------------------------
*ATLINE-SELECTION
* Fires when user click on a line
* in the report
*--------------------------------------------------------------

AT LINE-SELECTION.
* CHECK NOT <ITAB1-FIELD1> IS INITIAL.
* PERFORM <ZZZZ>.
* CLEAR <ITAB1-FIELD1>.

***************************************************************
*FORMS
***************************************************************

*--------------------------------------------------------------
*FORMATSELOUT_MODIFY_SCREEN
* Modification of the selection screen
*--------------------------------------------------------------

FORM ATSELOUT_MODIFY_SCREEN.

ENDFORM.

*--------------------------------------------------------------
*FORMINIT_VARIABLES
* Initialisation of variables
*--------------------------------------------------------------
FORM INIT_VARIABLES.

*Initialization of selection screen fields ( Select options fields )

*DATA: year(4) TYPE c,


* month(2) TYPE c,
* day(2) TYPE c.

* MOVE sy-datum+0(4) TO year.


* MOVE sy-datum+4(2) TO month.

* MOVE: 'I' TO s_year-sign,


* 'EQ' TO s_year-option,
* year TO s_year-low.

* APPEND s_year.

* MOVE: 'I' TO s_month-sign,


* 'EQ' TO s_month-option,
* month TO s_month-low.
*APPEND s_md.

* Initialization of internal tables and variables


* REFRESH gi_xyz.
* CLEAR g_xyz.
ENDFORM.

*--------------------------------------------------------------
*FORMREAD_DATA
* Read data from datbase table into
* internal table
*--------------------------------------------------------------
FORM READ_DATA.
* SELECT zzz yyy
* FROM databasetable1
* INTO table gi_xyz
* WHERE zzz in zselfield1>.

ENDFORM.

*--------------------------------------------------------------
*FORMWRITE_REPORT_HEADER
*--------------------------------------------------------------
FORM WRITE_REPORT_HEADER.
* FORMAT COLOR COL_HEADING.
* WRITE AT (10) <TEXT1>.
* WRITE AT (25) <TEXT2>.
* ULINE.
ENDFORM.

*--------------------------------------------------------------
*FORMWRITE_REPORT_FOOTER
*--------------------------------------------------------------

FORM WRITE_REPORT_FOOTER.
* WRITE: / <TEXT4>.
ENDFORM.

*--------------------------------------------------------------
*FORMWRITE_RAPPORT
* Udskrift af rapport
*--------------------------------------------------------------
FORM WRITE_RAPPORT.
* LOOP at gi_xyz into g_xyz.
* WRITE : / AT 10 <ITAB1-FIELD1> COLOR COL_KEY INTENSIFIED.
* FORMAT RESET.
* FORMAT COLOR COL_NORMAL.
* WRITE : / AT 25 gi_xyz-field1.
* WRITE : / AT 40 gi_xyz_filed2.
* HIDE <ITAB1-FIELD1>. "USed for interactive reporting
* NEW-LINE.
* ENDLOOP.
ENDFORM.

Calling another report from your own


report

Calling a SAP standard report

In this example is used transaction FB03 for the standard report that should
becalled.

• Go into the standard report


• Place the cursor in the selection fields one by one and press F1
• Select Technical info for the field
• The parameter-ID is the name of the parameter you can use
• FB03 has the parameters BLN, BUK and GJR. Call the transaction from
your report using the following syntax ( We don't use the åparameter GJR ):
o set parameter id 'BLN' field prttab-belnr.
o set parameter id 'BUK' field prttab-bukrs.
o call transaction 'FB03' and skip first screen.
o prttab is a filed from an internal table in your own report.

Calling one of your own reports

You call one of your own reports the same way as you call a SAP standard report,
but you will have to define parameter IDs for the fields on the selection screen.

To do this you must edit the selection screen in the Object Browser. Select the screen
and add a parameterId in the attributes screen for each field.

Important: If you later change your report and save it, the paramter ID's will be
lost, and you will have to define them again.
Calling a dialog screen from a report and
passing data
Make a report

• Add a pf-status with a botton to call the dialog screen


• Make the dialog screen.
• For every field in the dialog screen you want to pass to the report, mark the
SET parameter checkbox, and apply a ParameterID in the attrubutes
window of the screen.
• Create a transaction code for the dialog screen

Place the following code in the report:

* p_rc is for receiving data from the dialog screen


data: p_rc type i.

at user-command.
* Call the dialog screen. ZRE1 is the transaction code of the screen
call transaction 'ZRE1'.

* Get parameter from the dialog screen. ZRZ is the parameterID for the field in the
dialog
* screen you want to pass to the report.
get parameter id 'ZRC' field p_rc.

Call dialog screen from report - Example


2
Select a line in the report and display a dialog screen with some of the values from
the screen. The values Sort1, Sort2 and Sort3 can be cahnged in the dialog screen.
When the user clicks the OK button, the database table ZPLUKSORT is updated
and the report re-displayed.

1 report ZDKFRAHEN_TEST001.
2
*----------------------------------------------------------------------
*
3 *
4 * This program demonstrates:
5 * - How to select a line in a report,
6 * - Show a custom dialog screen populated with values from the
selected
7 * line in the report
8 * - Change the vakue in the dialog screen and re-display the
report
9 * with the changed values
10 *
11 * Programmer: Henrik Frank
12 * Date : 07-08-2007
13
*----------------------------------------------------------------------
*
14
15
16
***********************************************************************
17 * DECLARATIONS
18
***********************************************************************
19 TABLES: mara,
20 makt,
21 zpluksortlist.
22
23
24 DATA: BEGIN OF tab OCCURS 1,
25 matnr LIKE mara-matnr,
26 mtart LIKE mara-mtart,
27 matkl LIKE mara-matkl,
28 maktx LIKE makt-maktx,
29 plant TYPE werks_d,
30 sortlistno LIKE zpluksort-sortlistno,
31 atwrt LIKE zpluksort-atwrt,
32 sort1 LIKE zpluksort-sort1,
33 sort2 LIKE zpluksort-sort2,
34 sort3 LIKE zpluksort-sort3,
35 END OF tab.
36
37 DATA:
38 g_screen2000 LIKE zpluksort, "Data for screen 2000
39 g_okcode2000(6) TYPE c, "OK code screen 2000
40 g_tabix LIKE sy-tabix,
41 g_sortkey(30) TYPE c,
42 g_text TYPE string,
43 g_sortlistno LIKE zpluksort-sortlistno.
44
45
***********************************************************************
46 * SELECTION SCREEN
47
***********************************************************************
48
49 SELECTION-SCREEN BEGIN OF BLOCK grp1 WITH FRAME TITLE text-100.
50 SELECT-OPTIONS: matnr FOR mara-matnr.
51 SELECT-OPTIONS: mtart FOR mara-mtart DEFAULT 'FERT'.
52 SELECT-OPTIONS: matkl FOR mara-matkl.
53 SELECT-OPTIONS: p_plant FOR zpluksortlist-plant DEFAULT '0000'.
54
55 PARAMETERS: show1 AS CHECKBOX.
56 PARAMETERS: sort1 RADIOBUTTON GROUP type.
57 PARAMETERS: sort2 RADIOBUTTON GROUP type.
58 SELECTION-SCREEN END OF BLOCK grp1.
59
60
61
62
***********************************************************************
63 * LIST EVENTS
64
***********************************************************************
65 START-OF-SELECTION.
66 * Read data and display list
67 PERFORM display_list.
"BC2058
68
69
70
*----------------------------------------------------------------------
*
71 * TOP-OF-PAGE
*
72
*----------------------------------------------------------------------
*
73 * Write title
*
74
*----------------------------------------------------------------------
*
75 TOP-OF-PAGE.
76 PERFORM write_title.
"BC2058
77
78
*----------------------------------------------------------------------
*
79 * TOP-OF-PAGE DURING LINE-SELECTION
*
80
*----------------------------------------------------------------------
*
81 * Write title when program returns sfrom screen 2000
82 *
83
*----------------------------------------------------------------------
*
84 TOP-OF-PAGE DURING LINE-SELECTION.
85 PERFORM write_title.
86
87
88
*----------------------------------------------------------------------
*
89 * AT LINE-SELECTION.
90
*----------------------------------------------------------------------
*
91 * User has choosen a line in the report
92 * Move key fields from report to screen 2000 and display the
screen
93
*----------------------------------------------------------------------
*
94
95 AT LINE-SELECTION.
96
97 CLEAR:
98 g_screen2000,
99 g_okcode2000.
100
101
102 * Move fields from report line to screen 2000
103 MOVE:
104 tab-sortlistno TO g_screen2000-sortlistno,
105 tab-atwrt TO g_screen2000-atwrt,
106 tab-sort1 TO g_screen2000-sort1,
107 tab-sort2 TO g_screen2000-sort2,
108 tab-sort3 TO g_screen2000-sort3.
109
110 * Call screen 2000 to edit values
111 CALL SCREEN 2000 STARTING AT 40 10 ENDING AT 100 20.
112
113
114
*----------------------------------------------------------------------
*
115 * AT USER-COMMAND.
116
*----------------------------------------------------------------------
*
117 * Dummy user command - Necessary to re-display list with
changes
118 * after return from screen 2000
119
*----------------------------------------------------------------------
*
120 AT USER-COMMAND.
121 IF sy-ucomm = 'DUMMY'.
122 sy-lsind = sy-lsind - 1.
123 PERFORM display_list.
124 ENDIF.
125
126
***********************************************************************
127 * SCREEN LOGIC FOR SCREEN 2000
128
***********************************************************************
129
130
131
*&---------------------------------------------------------------------
*
132 *& Module STATUS_2000 OUTPUT
133
*&---------------------------------------------------------------------
*
134 * PF status for screen 2000
135
*----------------------------------------------------------------------
*
136 MODULE status_2000 OUTPUT.
137 SET PF-STATUS 'STATUS_2000'.
138 ENDMODULE. " STATUS_2000 OUTPUT
139
140
*&---------------------------------------------------------------------
*
141 *& Module USER_COMMAND_2000 INPUT
142
*&---------------------------------------------------------------------
*
143 * User command screen 2000
144
*----------------------------------------------------------------------
*
145 MODULE user_command_2000 INPUT.
146 CASE g_okcode2000.
147 WHEN 'BUTOK'.
148 * OK button - update
149 PERFORM update_zpluksort.
150
151 * If update OK, then g_okcode2000 still = BUTOK
152 IF g_okcode2000 = 'BUTOK'.
153 * Execute dummy command to re-display the list
154 SET USER-COMMAND 'DUMMY'.
155 sy-ucomm = 'DUMMY'.
156 ENDIF.
157 SET SCREEN 0.
158
159 WHEN 'BUTCAN'.
160 * Cancel button - no update
161 SET SCREEN 0.
162 ENDCASE.
163
164
165 ENDMODULE. " USER_COMMAND_2000 INPUT
166
167
168
*&---------------------------------------------------------------------
*
169 *& Form write_title
170
*&---------------------------------------------------------------------
*
171 * Write list header
172
*----------------------------------------------------------------------
*
173 FORM write_title.
174 FORMAT COLOR 4.
175 WRITE: /1 'Carlsberg'.
176 WRITE: 40 'Sort of picking for selected materials'.
177 WRITE: 111(5) 'Page:'.
178 WRITE: 117(4) sy-pagno.
179
180 WRITE: /91 'Printet:'.
181 WRITE: 100 sy-datum DD/MM/YYYY.
182 WRITE: 111 'Time:'.
183 WRITE: 119 sy-uzeit USING EDIT MASK '__:__'.
184 FORMAT COLOR OFF.
185 ULINE.
186
187 WRITE AT 1 text-001. "Matnr
188 WRITE AT 10 text-002. "Description
189 WRITE AT 51 text-003. "Mtyp
190 WRITE AT 56 text-004. "Mat group
191 WRITE AT 66 text-005. "Sort1
192 WRITE AT 72 text-006. "Sort2
193 WRITE AT 78 text-007. "Sort3
194 WRITE AT 84 text-008. "Sort rule
195 WRITE AT 95 text-009. "Charac
196 WRITE AT 110 text-010. "Plant
197
198
199 NEW-LINE.
200
201 WRITE '-------' UNDER text-001.
202 WRITE '---------------------------------------' UNDER text-
002.
203 WRITE '----' UNDER text-003.
204 WRITE '---------' UNDER text-004.
205 WRITE '----' UNDER text-005.
206 WRITE '----' UNDER text-006.
207 WRITE '----' UNDER text-007.
208 WRITE '---------' UNDER text-008.
209 WRITE '------' UNDER text-009.
210 WRITE '----' UNDER text-010.
211
212
213
214
215 ENDFORM. " write_title
216
217
*&---------------------------------------------------------------------
*
218 *& Form display_list
219
*&---------------------------------------------------------------------
*
220 * Display list
221
*----------------------------------------------------------------------
*
222 FORM display_list.
223
224
225 CLEAR tab. REFRESH tab.
226 SELECT matnr mtart matkl INTO CORRESPONDING FIELDS OF TABLE
tab
227 FROM mara
228 WHERE matnr IN matnr
229 AND mtart IN mtart
230 AND matkl IN matkl.
231
232
233
234
235 LOOP AT tab.
236
237 CLEAR:
238 g_sortkey,
239 tab-sort1,
240 tab-sort2,
241 tab-sort3.
242
243
244 CALL FUNCTION 'Z_GET_SORT_FIELD'
245 EXPORTING
246 i_matnr = tab-matnr
247 i_plant = tab-plant
"BC2058
248 IMPORTING
249 e_sortlistno = tab-sortlistno
250 e_atwrt = tab-atwrt
251 e_sort1 = tab-sort1
252 e_sort2 = tab-sort2
253 e_sort3 = tab-sort3
254 EXCEPTIONS
255 no_sortfield = 1
256 no_material = 2
257 OTHERS = 3. .
258 IF sy-subrc <> 0.
259 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
260 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
261 ENDIF.
262
263 CLEAR makt.
264 SELECT SINGLE * FROM makt
265 WHERE matnr = tab-matnr
266 AND spras = 'E'.
267 IF sy-subrc NE 0.
268 SELECT SINGLE * FROM makt
269 WHERE matnr = tab-matnr
270 AND spras = 'K'.
271 ENDIF.
272 IF sy-subrc = 0.
273 tab-maktx = makt-maktx.
274 ELSE.
275 tab-maktx = ' '.
276 ENDIF.
277
278 MODIFY tab.
279 ENDLOOP.
280
281 IF show1 = 'X'.
282 LOOP AT tab.
283 IF tab-sort1 = ' ' AND
284 tab-sort2 = ' ' AND
285 tab-sort3 = ' '.
286 DELETE tab.
287 ENDIF.
288 ENDLOOP.
289 ENDIF.
290
291 IF sort1 = 'X'.
292 SORT tab BY matnr plant.
293 ENDIF.
294
295 IF sort2 = 'X'.
296 SORT tab BY sort1 sort2 sort3 matnr.
297 ENDIF.
298
299
300 LOOP AT tab.
301
302 NEW-LINE.
303 WRITE tab-matnr UNDER text-001.
304 WRITE tab-maktx UNDER text-002.
305 WRITE tab-mtart UNDER text-003.
306 WRITE tab-matkl UNDER text-004.
307 WRITE tab-sort1 UNDER text-005.
308 WRITE tab-sort2 UNDER text-006.
309 WRITE tab-sort3 UNDER text-007.
310 WRITE tab-sortlistno UNDER text-008.
311 WRITE tab-atwrt UNDER text-009.
312 WRITE tab-plant UNDER text-010.
313
314 HIDE:
315 tab-sortlistno,
316 tab-atwrt,
317 tab-sort1,
318 tab-sort2,
319 tab-sort3.
320
321
322 ENDLOOP.
323
324 ENDFORM. " display_list
325
*&---------------------------------------------------------------------
*
326 *& Form update_zpluksort
327
*&---------------------------------------------------------------------
*
328 * Update table ZPLUKSORT with changes to sort rule
329
*----------------------------------------------------------------------
*
330 FORM update_zpluksort.
331 DATA: l_answer TYPE string.
332
333 * Confirm update
334 CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
335 EXPORTING
336 textline1 = 'Do you want to update sort
rule ?'
337 titel = 'Update sort rule'
338 cancel_display = ''
339 IMPORTING
340 answer = l_answer.
341 IF l_answer <> 'J'.
342 g_okcode2000 = 'BUTCAN'.
343 EXIT.
344 ENDIF.
345
346 * Update
347 UPDATE zpluksort FROM g_screen2000.
348
349 IF sy-subrc = 0.
350 * Update OK - Show message
351 CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
352 EXPORTING
353 titel = 'Update'
354 textline1 = 'Sort rule updated'.
355 g_okcode2000 = 'BUTOK'.
356
357 ELSE.
358 * Update failed - Show message
359 CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
360 EXPORTING
361 titel = 'Error '
362 textline1 = 'Error in update of sort rule'.
363 g_okcode2000 = 'BUTCAN'.
364 ENDIF.
365
366
367
368 ENDFORM. " update_zpluksort

Control Level Reporting


Overview

When using control levels with an internal table, remember to sort the internal table
in accordance with the control levels, and the fields in the table must occur in the
same order as you sort the table.
In the example below, carrid must be the first field in the table

When you use control levels the SUM statement can be used to generate totals.

Every control level statement end with ENDAT

Important: The fields in the internal table must be in the same order as the sort
order.

Remember to place the control levels in the following order:

• at new xxxx
• write detail line
• at end of xxxx

Control levels

• AT NEW xxx
• AT END OF xxx
• AT FIRST
• AT LAST

Example
sort itab by bukrs.

loop at itab.
* Heading for every bukrs
at new bukrs.
write: / itab-bukrs.
endat.

* Detail line
write: / itab-bukrs.

* Totals per bukrs


at end of bukrs
* Sum all variables of type P and I
sum.
uline.
write: / 'Total bukrs', itab-bukrs.
uline.
endat.

* Grand totals
at last.
sum.
write: / 'Grand total', itab-bukrs.
endat.
endloop.

Interactive Reporting (Dril Down


Reporting) - Example

In this example you have a mainreport REPORT1. From REPORT1 you


can drill down to REPORT2 and from REPORT2 you can drill down
to REPORT3.

Tip: Use hotspots to fire the AT LINE-SELECTION event.


When the cursor is over the hotspot, it cganges to a hand,
and you just have to click on the hostspot, instead of
double clicking.

Note: To see how to recognize if the user has selected a valid line,
take a look at

How to check if a valid line is selected before drill down.

START-OF-SELECTION.
* Read data for REPORT1 into itab1

END-OF-SELECTION.
PERFORM write_report1.

TOP-OF-PAGE.
* Write list header for REPORT1

AT USER-COMMAND.
* Respond when the user presses a function key
CASE sy-ucomm.
WHEN 'REPORT2'.
PERFORM write_reprt2.
WHEN 'REPORT3'.

PERFORM write_reprt3.
ENDCASE.

AT LINE-SELECTION.
* Istead of pressing a button can perform the same actions
* as i AT USER-COMMAND, by double clicking a line
* sy-lsind contains the list level.
* Each time an interactive list event occurs, sy-lsind is
* automatically increased by 1.
* At REPORT1 sy-lsin = 0

CASE sy-lsind.
WHEN 1.

PERFORM write_reprt2.
WHEN 2.
PERFORM write_reprt3.
ENDCASE.

TOP-OF-PAGE.
* Write report header for report1 ( sy-lsind = 0 )

TOP-OF-PAGE DURING LINE-SELECTION.


* Write report header for sub reports
CASE sy-lsind.
WHEN 1.
* Write report header for REPORT2.

WHEN 2.
* Write report header for REPORT3.
ENDCASE.
FORM WRITE_REPORT1.
LOOP at itab1.
* write report1.......

* Hide keyfields used for the select statement of


* report2
HIDE: itab1_year, itab1_month.

ENDLOOP.
ENDFORM.

FORM WRITE_REPORT2.

SELECT * FROM databasetable2 into itab2


WHERE year = itab1_year AND

month = itab1_month.

LOOP at itab2.

* write report2 .......

* Hide keyfields used for the select statement of


* report3
HIDE: itab2_carrid.

ENDLOOP.
ENDFORM.

FORM WRITE_REPORT3.

SELECT * FROM databasetable3 into itab3


WHERE carrid = itab2_carrid.

LOOP at itab3.

* write report3 .......


* No need to hide keyfields, as further drill down is not
* possible

ENDLOOP.
ENDFORM.

Dynamic line-size

his tip has been copied from


SearchSap.com
Tip submitted by: Ben Meijs

Sometimes you want to define a


dynamic line-size in your report
because you do not know beforehand
the number of columns to WRITE.

With NEW-PAGE LINE-SIZE


TP_LINESIZE you can do this. But
then there is always the problem that
you want to be able to use the very last
position of your list, f.e. to write a
vertical line or a page number.

Code

* This writes a vertical line

WRITE AT sy-linsz sy-vline.


* If you want your FORMAT COLOR
to last to end of line use this:
WRITE AT SY-LINSZ ''.

* This writes page-number to utmost


right
data: lo_offset type i.
lo_offset = sy-linsz - 5.
WRITE AT lo_offset(5) sy-pagno
NO-SIGN. Positioned Write in Report
WRITE UNDER
Syntax: WRITE <f> under <g>

Field f is outputted under field <g>

Example:

WRITE AT 10 text-001.

WRITE AT 20 text-002.

new-line.

LOOP AT gi_rapport into g_rapport.

WRITE g_rapport-field1 under text-001.


WRITE g_rapport-field2 under text-002.

ENDLOOP.

RESERVE...BACK
The rapport should look like this:

2030 John Dowe This is

Myroad 12 a text

Mytown for

John Dowe

LOOP AT mytable.

RESERVE 10 LINES.

WRITE: / '2030'.

WRITE: / 'John Dowe'.

WRITE: / 'Myroad 12'.

WRITE: / 'Mytown'.

* Go back to the top

BACK.

WRITE: / 'This is'.

WRITE: / 'a text'.

WRITE: / 'for'.

WRITE: / 'John Dowe'.

ENDLOOP.
Note: That you have to fill up with empty rows in the last column
untill there is

at least as many rows as in column 2

Horizontal and vertical positioning


Horizontal position: POSITION <col>

col = Column no. Retrieve curretn column number witj SY-COLNO

Vertical positioning:

SKIP TO LINE <n>

Retrieve the current linenumber with SY-LINNO

Example:

SKIP TO LINE 10.

POSITION 20.

WRITE 'Test'

Managing Output

1. Sending a report directly to the printer


2. Sending output to the spool
3. Submitting a report in the background and send the list to spool
Sending a report directly to the printer
NEW-PAGE PRINT ON
destination 'p190'
COPIES 1
LIST NAME 'Test liste'
COVER TEXT 'Cover text'
SAP COVER PAGE 'X'

DATASET EXPIRATION 3
NO DIALOG.

LOOP AT ITAB.
WRITE: / ITAB-ZZREVLOGPR.
ENDLOOP.

NEW-PAGE PRINT OFF.

Sending output to the spool


NEW-PAGE PRINT ON
COPIES 1
LIST NAME 'Test liste'
COVER TEXT 'zzspec01 Log for overførsel af revlogdata fra host'
SAP COVER PAGE ' '
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
DATASET EXPIRATION 3.

Submitting a report in the background and send the list to spool

* If the program is run in the background the


* difference report is send to spool.
SUBMIT rm07idif WITH SELECTION-TABLE li_selection
EXPORTING LIST TO MEMORY AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'


TABLES
listobject = li_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
CHECK sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES
listobject = li_listobject
EXCEPTIONS
empty_list = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.

Reading mulitiple selected lines in a list


Scenario: List with checkboxes. You want to read all lines in the list
where the checkboxes are cheked into an internal table.

* Define checkbox
data: markfield(1) type c value space.

* Write list

loop at itab.
write: / markfield as checkbox, itab1-myfield.
endloop.

When you are ready to read the list igain:

* Holds the number of the current line


lineno type i.

lineno = 0.

*Read the report line by line


do.
lineno = lineno + 1.

* Read markfield
read line lineno field value markfield.

* Check that you haven't reached the end of the report


if sy-subrc ne 0.
exit.
endif.
* If markfield = X then read the report line again and append it to
another internal

* table
if markfield = 'X'.
* read the line igain to retrieve all fields of the line
read current line
field value itab1-myfield
into itab2-myfield.
append itab2.
endif.

enddo.

Example by Henrik Frank

Using a checkbox in a report


In a report you can use a checkbox to select one ore more records.

* Define field for the checkbox


data markfield(1) type c value space.
* Define filed for counting line numbers
data lineno type i.

* Writing the report with a checkbox


write: / markfield as checkbox,
i_ejitabel-zzbukrs,
i_ejitabel-zzsaknr.

* Reading the lines and cehcking if the line has been checked

lineno = 0.
do.
* Counting the line numbers
lineno = lineno + 1.

* Read the value of markfield


read line lineno field value markfield.

* Test for end of report


if sy-subrc ne 0. exit. endif.

* If the value of the checkbox is X ( The checkbox is checked)


the read
* the rest of the fields of the report line into the internal
table itab.
if markfield = 'X'.
read current line field value i_ejitabel-zzbukrs into
itab
i_ejitabel-zzsaknr into itab.
endif.

enddo.

Modifying a Line in a Report


You can loop through the lines of a report and modify the contents and formatting
of single lines and/or single fields in a line.

Example:

data: lineno type i, new_contents(10) type c.

clear lineno.
new_contents = 'Changed'.

do.
* Count linenumber
lineno = lineno + 1.

* Make the line the current line


read line lineno.

* Test for end of report

if sy-subrc ne 0. exit. endif.

* Change the value of the field itab-zzrevomr in the current line to the value
* of the variable new_contents
modify current line field value itab-zzrevomr from new_contents.

* Change format of the current line. In this example the firts field in the line is a
checkbox,
* and we want to prevent the user form changing the contents ( Input off )
modify current line
line format color col_negative intensified on

field format markfield input off.

enddo.
NEW-LINE in Report

Addition:

1. ... NO-
SCROLLING

2. ...
SCROLLING

Generates a new line during list


processing.

Terminates the current list line and


moves the cursor to the
next list line. If there has been no
output (with WRITE or
SKIP) since the last NEW-LINE, the
NEW-LINE is ignored, i.e. no
new line is
started.

You can also generate a new line with


WRITE AT /....

The following key words implicitly


generate a new line:
NEW-PAGE, CALL
SCREEN.

... NO-
SCROLLING

Flags the list line following the line feed


as "not movable"
(i.e. horizontal scrolling has no effect).
This allows you to

keep title lines and indented comment


lines or areas visible in
How to
write pageno of totalpages in report
Below are two examples of how to write Page xx of xx in the top of a report

I have testet example 1 and it works. I have note testet example 2

Example 1
I have found this example at The SAP Fan Club

Click here to go directly to the topic

REPORT Y_PAGE_NUMBER_EXERCISE NO STANDARD PAGE HEADING LINE-SIZE 80


LINE-COUNT 55.

TABLES: VBAP.

SELECT-OPTIONS: ORDER FOR VBAP-VBELN.

DATA: IVBAP TYPE STANDARD TABLE OF VBAP WITH HEADER LINE,


TAB_ENTRIES TYPE I,
TOTAL_PAGES TYPE P DECIMALS 3,
TOTAL_NUMBER_OF_PAGES TYPE P DECIMALS 0,
HEADER_LINE_COUNT TYPE I VALUE 3.

SELECT * FROM VBAP INTO TABLE IVBAP WHERE VBELN IN ORDER.

DESCRIBE TABLE IVBAP LINES TAB_ENTRIES.

TOTAL_PAGES = ( TAB_ENTRIES / SY-LINCT ).

TOTAL_PAGES = ( ( ( TOTAL_PAGES * HEADER_LINE_COUNT )


+ TAB_ENTRIES ) / SY-LINCT ).
TOTAL_NUMBER_OF_PAGES = CEIL( TOTAL_PAGES ).

LOOP AT IVBAP.
WRITE:/ IVBAP-VBELN,
IVBAP-POSNR.

ENDLOOP.

TOP-OF-PAGE.

WRITE:/ 'LIST OF SALES ORDERS',


45 'Page',
SY-PAGNO,
'of' NO-GAP,
TOTAL_NUMBER_OF_PAGES.
ULINE.
SKIP.

Example 2

REPORT ZLTEST3 NO STANDARD PAGE HEADING LINE-COUNT 65LINE-SIZE 80.

DATA: NUM_PAGES_C(10) TYPE C.


PERFORM WRITE.
PERFORM GET_TOTAL_PAGENO.
TOP-OF-PAGE.

WRITE:/(SY-LINCT) 'TEST - TEST' CENTERED.


WRITE: / SY-DATUM, 60 SY-PAGNO,'of', '*****'.
SKIP.
*&---------------------------------------------------------------------*
*& Form WRITE
*&---------------------------------------------------------------------*
FORM WRITE.
DO 200 TIMES.
WRITE:/ 'TEST', SY-LINNO.
ENDDO.
ENDFORM. " WRITE
*&---------------------------------------------------------------------*
*& Form GET_TOTAL_PAGENO
*&---------------------------------------------------------------------*
FORM GET_TOTAL_PAGENO.
WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.
DO SY-PAGNO TIMES.
READ LINE 2 OF PAGE SY-INDEX.
REPLACE '*****' WITH NUM_PAGES_C INTO SY-LISEL.
MODIFY LINE 2 OF PAGE SY-INDEX.
ENDDO.
ENDFORM. " GET_TOTAL_PAGENO Reporting - Tips and
Tricks

1. AT-LINE-SELECTION does not work together with custom PF-STATUS


2. GUI-Status - Default codes for standard buttons

AT-LINE-SELECTION does not work together with custom PF-


STATUS
To make AT-LINE-SELECTION to work together with custom PF-STATUS, set
F2 and F9 to PICK in the GUI Status under Function keys.

GUI-Status - Default codes for standard buttons

If you use the codes below, the buttons will work automatically:

BACK = BACK
Exit = %EX
Cancel = RW

Returning to report and refresh data


after call to selection screen
The scenario:

You have a report, and call a dialog screen where you modify data in the reports
underlying table. After modifying the data you want to return to the report screen,
and have it refreshed so that i displays the changes in the underlying table.

report zrev03 no standard page heading.

start-of-selection.
* Initial display of report
perform write_report.

* You have to display your own report headings that called from both the main
report and the
* sub report ( The second display )

top-of-page.
perform page_header.

top-of-page during line-selection.


perform page_header.

case sy-ucomm.
when 'CHG'.
* Call dialog screen where data chenages are input. The code could be something
like:
set parameter id 'ZR1' field itab-zzrevomr.
call transaction 'ZRE3'.

* After you return from the dialog screen you want to remove the old report so
you
* don't redisplay it when you use the back button
sy-lsind = 0.
* Write the report again with new data
perform write_report.

form write_report.
*Here goes code that retrieves data for the report and write it, it could be something
like:
select * from zrevomr into table itab.
loop at itab.
write: / itab-zzrevomr, itab-zzrevomrtx.

endloop.
endform.

form page_header.
* .... Code for page header
endform.

Creating F1 or F4 help

1. Example 1: F1 Help
2. Example 2: F4 Help

Example 1: F1 Help

This tip has been copied from SearchSap.com


Tip submitted by: Rajeev Dev

Create F1 help for custom ABAP programs at field level. This method can help
companies to eliminate the off-line documentation for custom programs. On top of
that, users are not required to search for help documentation for a custom program.
Logo is: "Press F1 for help anywhere in SAP".

This is done by using "help-request" events.

Sample code:

at selection-screen on help-request for <Field-Name>

message xxxx (ZZ)

You can maintain messages with varied degree of details here. You can also specify
examples in messages long text to clarify the contents of program to your valued
users.
Example 2: F4 Help

To control F4 help in a selection screen use the

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>


event.

Note that for ranges both the low and high value of the field
must have there own ON VALUE-REQUEST

Example:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-low.


PERFORM f4_help_prctr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-high.


PERFORM f4_help_prctr.

REPORT f4help.

PARAMETERS:
p_auart LIKE vbak-auart.

START-OF-SELECTION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_auart.


PERFORM f4_help_aaurt.

*---------------------------------------------------------------------*
* FORM f4_help_auart *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*

FORM f4_help_auart.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'VBAK'
fieldname = 'AUART'
* SEARCHHELP =''
* SHLPPARAM =''
* DYNPPROG =''
* DYNPNR =''
* DYNPROFIELD =''
* STEPL =0
* VALUE =''
* MULTIPLE_CHOICE =''
* DISPLAY =''

* SUPPRESS_RECORDLIST =''
* CALLBACK_PROGRAM =''
* CALLBACK_FORM =''
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND =1
* NO_HELP_FOR_FIELD =2
* INCONSISTENT_HELP =3
* NO_VALUES_FOUND =4
* OTHERS =5
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

Clearing selection screen input


> After executing a report, the green arrow back key will takes us back to
> the selection screen with the original input on it.
>
> However, my client would like to see the selection screen without any
> previous input on it, so he could start entering new input without
> deleting/overwriting the old ones. Is it possible to do that?
>
> Any hints will be greatly appreciated.
>

Use this part of code:

DATA: EXECUTED TYPE N.

your data definitions starts here

AT SELECTION-SCREEN OUTPUT.
IF EXECUTED = 1.
EXECUTED = 0.
CLEAR: var1, var2, etc.
REFRESH: selop1.
here you have to clear all your parameters, select options etc.
ENDIF.

START-OF-SELECTION.
EXECUTED = 1.
your main coding starts here.
END-OF-SELECTION.

Kind regards, Ingo-Willy Raddatz.


Disable Parameters in Report Selection
Screen
Q:

Dear all,
I have parameters in my ABAP/4 reporting program:
parameters: date like sy-datum,
division (1) type c.
parameters: r1 radiobutton group rad1,
r2 radiobutton group rad2.

How to change below code into ABAP/4 language


if r1 ne space.
division = invisible.
elseif r2 ne space.
divisio = visible.
endif.

thank you

A:

Try something like this in the even AT SELECTION-SCREEN or AT


SELECTION-SCREEN

OUTPUT (whichever makes sense for what you are doing...)

LOOP AT SCREEN.

If screen-name = division.
if r1 ne space.
screen-invisible = 1.
elseif r2 ne space.
screen-invisible = 0.
endif.
modify screen.
endif.

ENDLOOP.

You may also try adding a statement for screen-input and/or screen output
instead. That way they are still visible, but you can't change them.
ips and Tricks for Selection Screen
1. Using select options to select records
2. Select options with more than one default value or range
3. Making a frame around groups of fields on the selection screen.
4. Making a checkbox
5. Making a radiobutton group
6. How to add an option after the user has finished the selection screen
7. Selection screen events
8. Making an option invisible
9. Selection screen - Parameters on a single line
10. Setting the title text of a selection screen dynamically
11. Using a custom toolbar in a selection screen
12. Skip line on selection screen
13. Using a matchcode

Using select options to select records

SELECT-OPTIONS: S_CPUDT FOR BKPF-CPUDT DEFAULT SY-DATUM,


S_USNAM FOR BKPF-USNAM.

SELECT * FROM BKPF


WHERE CPUDT IN S_CPUDT AND

USNAM IN S_USNAM.

Select options with more than one default value or range

If you want to use more than one default value or default range, you add the values
to the internal table selection table.

Note: You don't have to declare the table, it is created automatically. The table has
the same name as the select variable ( In the example below s_hkont ).

SELECT-OPTIONS: S_HKONT FOR ZTSAPSPEC-HKONT.

INITIALIZATION.
MOVE: 'I' to s_hkont-sign,
'BT' TO S_HKONT-OPTION,
'87111100' TO S_HKONT-LOW,
'87111124' TO S_HKONT-HIGH.
APPEND S_HKONT.
MOVE: 'I' to s_hkont-sign,
'EQ' TO S_HKONT-OPTION,
'87111300' TO S_HKONT-LOW,
APPEND S_HKONT.

Making a frame around groups of fields on the selection screen.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: S_CPUDT FOR BKPF-CPUDT OBLIGATORY


DEFAULT SY-DATUM.
SELECTION-SCREEN END OF BLOCK 1.

You can add further blocks (block2.......)

Making a checkbox

parameters: x_afstem as checkbox default 'X'.

Making a radiobutton group

PARAMETERS: <Name of button> RADIOBUTTON GROUP <name of group >,


<Name of button> RADIOBUTTON GROUP <name of group>.

Example:

PARAMETERS: BUTTON1 RADIOBUTTON GROUP RAPT,


BUTTON2 RADIOBUTTON GROUP RAPT.

In the program you test for the radiobuttons like this:

if button1 = 'X' then.


< Here comes some code>
elseif button2 = 'X' then.
< Here comes some code>
endif.

How to add an option after the user has finished the selection screen

Use the at selection-screen event to add options as showed above in example 2.

Selection screen events

Initialization Before processing the selection screen


at selection-screen
Before the contents of selections screen is displayed
output
Processed after the suer has specified the Parameter p or
at selection-screen on p/s
Select option s
at selection-screen After the user has specified all selection criteria

Making an option invisible

If you don't want the user to be able to see the option you want to add, define it as
No-DISPLAY.

SELECT-OPTIONS: S_HKONT FOR ZTSAPSPEC-HKONT NO-DISPLAY,


S_BUKRS FOR ZTSAPSPEC-BUKRS,

Selection screen - Parameters on a single line

SELECTION-SCREEN BEGIN OF LINE.


* The system does not output selection texts for parameters.
* Set your own
SELECTION-SCREEN COMMENT 1(15) text-001.
* Parameters

PARAMETERS: p1(3) TYPE c,


p2(5) TYPE c.
SELECTION-SCREEN COMMENT 55(10) p_wmunit.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.
MOVE 'Unit' TO p_wmunit.

Setting the title text of a selection screen dynamically

Define GUI titles for the report. In this example the GUI titles COLLILABEL
and PALLETLABEL has been defined. In the INITIALIZATION event,
dynamically
set which GUI title to show with the SET TITELBAR statement.

INITIALIZATION.
IF p_colli = 'X'.
SET TITLEBAR 'COLLILABEL'.

ELSEIF p_pallet = 'X'.


SET TITLEBAR 'PALLETLABEL'.
ENDIF.

Using a custom toolbar in a selection screen

When you use your own custom toolbar in a selection screen, the flow of the
report changes. Below is an example of how to use the events in such a
report.

Important! To be abel to submit your report, the submit button on the custom
toolbar of the selection screen must be named
'ONLI' (= Execute) or 'PRIN' (= Execute and Print).

INITIALIZATION.
* Your custom toolbar for the selection screen
SET PF-STATUS '0002'.

AT SELECTION-SCREEN.
* Handle sy-ucomm from your custom toolbar on the selection screen. Note
that it is not necessary explicitly to handle 'ONLI' or 'PRIN'
CASE sy-ucomm.
WHEN 'GETDATA'.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.

START-OF-SELECTION.
..... retreieve data for the ereport.....

END-OF-SELECTION.
* PF status for the report
SET PF-STATUS '0001'.
..... write report ......

Skip line on selection screen

Selection-screen skip 1.

Using a matchcode

Parameters:
matnr like mara-matnr matchcode object mat1.

Note: Matchcode objects can be found in SE11

Submitting another report using select-


options or ranges

1. Example 1: Submitting a report using ranges for select-options


2. Example 2: Submitting a report from ABAP with selection criterias
Example 1: Submitting a report using ranges for select-options

* Define range for ltak-tanum


RANGES: r_tanum FOR ltak-tanum.

* Read values from database tabel into the range


* These values are later used for select-options in the report

SELECT * FROM ltak


WHERE lgnum = w_lgnum AND "Warehouse number/complex
vbeln = w_screen1000-io_vbeln. "Transfer order number

MOVE ltak-tanum TO r_tanum-low.


MOVE 'I' TO r_tanum-sign.
MOVE 'EQ' TO r_tanum-option.
APPEND r_tanum.
ENDSELECT.

* Submit report with range

SUBMIT zmm00100 WITH p_tanum IN r_tanum.

Example 2: Submitting a report from ABAP with selection criterias

TYPES: tt_selection TYPE STANDARD TABLE OF rsparams.

DATA: l_iblnr TYPE st_iblnr,


* Define internal table and work area for select-options
l_selection TYPE rsparams,
li_selection TYPE tt_selection.

* Create selectIon table


LOOP AT gi_iblnr INTO l_iblnr.
CLEAR l_selection.
l_selection-selname = 'IM_IBLNR'. "Option name
l_selection-kind = 'S'. "S= select options P=Parameters

l_selection-sign = 'I'. "Sign


l_selection-option = 'EQ'. "Option
l_selection-low = l_iblnr-iblnr. "Value
APPEND l_selection TO li_selection.
ENDLOOP.

* Submit report
SUBMIT rm07idif WITH SELECTION-TABLE li_selection AND RETURN.

Validation of selection screens


Validation of selection screen can be performed in the AT SELECTION SCREEN
event.

Example:

***********************************************************************
*
* AT SELECTION SCREEN *
***********************************************************************
*
at selection-screen.
perform validate_selection_screen using g_returkode.
if g_returkode = c_returkode_error.

exit.
endif.

*&---------------------------------------------------------------------*
*& Form validate_selection_screen
*&---------------------------------------------------------------------*
* Validation of selection screen
*----------------------------------------------------------------------*
* -->P_G_RETURKODE text
*----------------------------------------------------------------------*
form validate_selection_screen using p_returkode.

if s_framd > 12 or s_framd < 1 or s_tilmd > 12 or s_tilmd < 1.


message e998.
p_returkode = c_returkode_error.
exit.
endif.
if s_framd > s_tilmd.
message e997.
p_returkode = c_returkode_error.
exit.
endif.
if s_fraaar < s_tilaar.
message e996.
p_returkode = c_returkode_error.
exit.
endif.

ENDFORM.

Writing Select-Options in report


Sometimes you may want to write the selection criterieas from the report selection-
screen to the report. here are 2 examples of how this can be done.

1. Example 1 Using a Function module


1. Code
2. Selection screen
3. Resulting report
2. Example 2 Doing it yourself

Example 1 Using a Function module


This exampel uses a standard function module RS_COVERPAGE_SELECTIONS.

Code
REPORT z_hfnk_slam1 .

DATA: BEGIN OF info OCCURS 0,


flag,
olength TYPE x,
line LIKE rsvar-infoline,
END OF info,
delete_index LIKE sy-tabix.

PARAMETER:
p_name(10) TYPE c,
p_test(2) TYPE n.
START-OF-SELECTION.
PERFORM front_page.

END-OF-SELECTION.

*&---------------------------------------------------------------------*
*& Form FRONT_PAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM front_page.
CALL FUNCTION 'RS_COVERPAGE_SELECTIONS'
EXPORTING
report = sy-cprog
variant ='' "sy-slset
no_import =''
TABLES
infotab = info
EXCEPTIONS
error_message = 1
variant_not_found = 3
OTHERS = 2.
* others = 4.

LOOP AT info.
* Clean up blank lines and "No selections"
IF info-line CS 'No selections'
OR info-line+1(77) IS INITIAL.
delete_index = sy-tabix - 1.
DELETE info INDEX sy-tabix.
READ TABLE info INDEX delete_index.
IF NOT info-line+2(1) IS INITIAL.
DELETE info INDEX delete_index.
ENDIF.
CONTINUE.

ENDIF.
ENDLOOP.
PERFORM write_cover.
ENDFORM. "FRONT_PAGE

*&---------------------------------------------------------------------*
*& Form WRITE_COVER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM write_cover.
LOOP AT info.
IF info-line CS 'Invisible'.
info-line = sy-uline.
WRITE: / info-line.
EXIT.
ENDIF.
WRITE: / info-line.
ENDLOOP.
NEW-PAGE.
ENDFORM. "WRITE_COVER

Selection screen

Resulting report
Example 2 Doing it yourself

Structure of select options:

• LOW Low value


• HIGH High value
• SIGN E = Excluding, I = Including
• OPTION BT = Between EQ = Equal

Code:

ata:
l_sign(2) type c,
l_option(3) type c.

WRITE AT 3 'Printdoc:' INTENSIFIED ON.


loop at s_prtdoc.
if s_prtdoc-sign = 'E'.
l_sign = '<>'.
else.
l_sign = '='.
endif.
if s_prtdoc-option = 'EQ'.
clear l_option.

else.
l_option = 'to'.
endif.

write at 35 l_sign.
write at 39 s_prtdoc-low.
write at 55 l_option.
write at 59 s_prtdoc-high.
new-line.
endloop.

Result in the report:

Printdoc: = 800000000501 to 800000000501


<> 800000000502
= 800000000503
Call F4 help from selection-screen

1 report ZDKFRAHEN_TEST001.
2
***********************************************************************
*
3 * This program demonstrates how to call custom F4 help for a
4 * field on the selection screen of a report
5 *
6 * The selection screen contains a select-options for PLANT.
validt
7 * values for plant can be found in custom table zpluksortlist.
8 * Besides the values from zpluksortlist it should also be
possible to
9 * select an empty value
10 *
11 * Programmer: Henrik Frank
12 * Date : 07-08-2007
13 *
14
***********************************************************************
*
15
16 tables: zpluksortlist.
17
18 SELECT-OPTIONS: p_plant FOR zpluksortlist-plant.
19
20 *-------------------------------------------------------------
21 * Call F4 help for plant
22 *-------------------------------------------------------------
23 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plant-low.
24 PERFORM show_f4_help.
25
26 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plant-high.
27 PERFORM show_f4_help.
28
29
*&---------------------------------------------------------------------
*
30 *& Form show_f4_help
31
*&---------------------------------------------------------------------
*
32 * Display F4 help for select-options P_PLANT
33
*----------------------------------------------------------------------
*
34 FORM show_f4_help.
35 DATA:
36 BEGIN OF it_plants OCCURS 0,
37 plant LIKE zpluksortlist-plant,
38 END OF it_plants.
39
40 DATA: t_return LIKE ddshretval OCCURS 0 WITH HEADER LINE.
41
42 * Read plants from table ZPLUKSORTLIST
43 SELECT plant FROM zpluksortlist INTO TABLE it_plants.
44
45 CLEAR it_plants.
46
47 * Add defalut plant '0000'
48 it_plants-plant = '0000'.
49 APPEND it_plants.
50
51 * Add empty plant
52 it_plants-plant = ' '.
53 APPEND it_plants.
54
55
56 SORT it_plants BY plant.
57
58 CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
59 EXPORTING
60 retfield = 'PLANT' "Key field from
it_plants
61 dynpprog = sy-cprog "Program
62 dynpnr = sy-dynnr "Dynpro number
63 dynprofield = 'P_PLANT' "Select-options field
64 value_org = 'S' "Value return: C: cell
by cell,
65 "S: structured
66 display = 'F' "Override readiness
for input
67 TABLES
68 value_tab = it_plants "table with selection
values
69 return_tab = t_return "Return value
70 EXCEPTIONS
71 parameter_error = 1
72 no_values_found = 2
73 OTHERS = 3
74 .
75 IF sy-subrc <> 0.
76 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
77 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
78 ENDIF.
79
80
81 ENDFORM. " show_f4_help

ALV Grid Using Function Modules


This simple example shows how to create an ALV grid report using function
modules.

Click here to see how to make an ALV grid using ABAP Objects (ALV grid control)
REPORT zhfnk_alvtest.

TYPES:

BEGIN OF t_makt,

matnr LIKE makt-matnr,

maktx LIKE makt-maktx,

END OF t_makt.

DATA:

it_makt TYPE STANDARD TABLE OF t_makt,

wa_makt TYPE t_makt.

******************************************************************'

* Data declarations for the ALV grid

******************************************************************'

DATA: r_grid TYPE REF TO cl_gui_alv_grid.


DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,

wa_alv_fieldcat TYPE slis_fieldcat_alv,

alv_layout TYPE slis_layout_alv,

gd_repid LIKE sy-repid.

******************************************************************'

START-OF-SELECTION.

PERFORM alv_setup.

PERFORM read_data.

END-OF-SELECTION.

PERFORM display_alv.

*&---------------------------------------------------------------------*

*& Form read_data

*&---------------------------------------------------------------------*

FORM read_data.

SELECT matnr maktx


FROM makt

INTO TABLE it_makt

WHERE spras = 'E'.

ENDFORM. " read_data

*&---------------------------------------------------------------------*

*& Form alv_setup

*&---------------------------------------------------------------------*

* Setup of the columns in the ALV grid

*----------------------------------------------------------------------*

FORM alv_setup.

CLEAR wa_alv_fieldcat.

REFRESH alv_fieldcat.

* Matnr field

wa_alv_fieldcat-key = 'X'. "This is a key column

wa_alv_fieldcat-fieldname = 'MATNR'. "Name of the table


field

wa_alv_fieldcat-seltext_s = 'Matnr'. "Short column heading

wa_alv_fieldcat-seltext_m = 'Material nr.'. "Medium column heading

wa_alv_fieldcat-seltext_l = 'Material number'. "Long column heading

APPEND wa_alv_fieldcat TO alv_fieldcat.

* Mat text field


wa_alv_fieldcat-key = ''. "This is not a key
column

wa_alv_fieldcat-fieldname = 'MAKTX'.

wa_alv_fieldcat-seltext_s = 'Mat. txt'.

wa_alv_fieldcat-seltext_m = 'Material txt'.

wa_alv_fieldcat-seltext_l = 'Material text'.

APPEND wa_alv_fieldcat TO alv_fieldcat.

ENDFORM. " alv_setup

*&---------------------------------------------------------------------*

*& Form display_alv

*&---------------------------------------------------------------------*

* Display data in the ALV grid

*----------------------------------------------------------------------*

FORM display_alv.

gd_repid = sy-repid.

* Configure layout of screen

alv_layout-colwidth_optimize = 'X'.

alv_layout-zebra = 'X'.

alv_layout-no_min_linesize = 'X'.

* Now call display function

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE_SETUP' "Ref to form

is_layout = alv_layout

it_fieldcat = alv_fieldcat

* i_grid_title = text-005

TABLES

t_outtab = it_makt

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " display_alv

*&---------------------------------------------------------------------*

*& Form top_of_page_setup

*&---------------------------------------------------------------------*

* Set-up what to display at the top of the ALV pages

* Note that the link to this form is in the

* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' parameter

* i_callback_top_of_page = 'TOP_OF_PAGE' in form display_alv


*----------------------------------------------------------------------*

FORM top_of_page_setup.

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader.

wa_header-typ = 'H'.

wa_header-info = 'This is a test of the ALV grid'.

APPEND wa_header TO t_header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_header.

ENDFORM. " top_of_page_setup


The resulting report:

ALV Grid using Objects - Simple example


This example shows a simple example of how to create an ALV grid using ABAP
Objects

Insert the code below in a report


Create screen 0100 and place a Custom contol on the screen. Name the control
MY_CONTAINER
In PROCESS BEFORE OUTPUT for screen 0100 insert: MODULE
create_objects.
Run the report
Double click on a row in the grid
Result

Code
REPORT zalv_test.

*---------------------------------------------------------------------*

* CLASS lcl_event_handler DEFINITION

*---------------------------------------------------------------------*

*---------------------------------------------------------------------*

CLASS lcl_event_handler DEFINITION.


PUBLIC SECTION.

METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING

es_row_no

e_column.

ENDCLASS. "lcl_event_handler DEFINITION

*---------------------------------------------------------------------*

* CLASS lcl_event_handler IMPLEMENTATION

*---------------------------------------------------------------------*

*---------------------------------------------------------------------*

CLASS lcl_event_handler IMPLEMENTATION.

METHOD on_double_click.

DATA: msg_string TYPE string,

row_string TYPE string.

row_string = es_row_no-row_id.

CONCATENATE 'Row: ' row_string ' Column: ' e_column-fieldname

INTO msg_string.

MESSAGE msg_string TYPE 'I'.

ENDMETHOD. "on_double_click

ENDCLASS. "lcl_event_handler IMPLEMENTATION

DATA:

r_cont TYPE REF TO cl_gui_custom_container,

r_grid TYPE REF TO cl_gui_alv_grid,

itab TYPE TABLE OF spfli,


r_handler TYPE REF TO lcl_event_handler.

START-OF-SELECTION.

SELECT * FROM spfli

INTO TABLE itab.

CALL SCREEN 100.

*&---------------------------------------------------------------------*

*& Module create_objects OUTPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE create_objects OUTPUT.

CHECK r_cont IS INITIAL.

CREATE OBJECT r_cont EXPORTING container_name = 'MY_CONTAINER'.

CREATE OBJECT r_grid EXPORTING i_parent = r_cont.

r_grid->set_table_for_first_display(

EXPORTING i_structure_name = 'SPFLI'

CHANGING it_outtab = itab ).

CREATE OBJECT r_handler.

SET HANDLER r_handler->on_double_click FOR r_grid.

ENDMODULE. " create_objects OUTPUT

ALV Grid - Page Numbering Problem


Problem: When you prints an ALV report, you want the pagenumber and the total
number of pages in the heading (E.g. Page xxx of yyy).
The total number of pages are usually calculated from the number of lines in the
report table, number of lines in the report header and the number of lines
on each report page, and should not cause any problems.

However, the standard print dialog screen for the ALV grid has an option "ALV
statistics". When this option ís chosen, a page with ALV statistics will be
printed before the ALV report and the total number of pages will be wrong as an
extra page has been added to the report.

The solution is to use the ALV events Top Of Page, Top Of List and End Of List as
demonstrated in the enclosed example.

REPORT zhfnk_alvtest.

*--------------------------------------------------------------------

* This example demonstrates a solution to a problem

* that arises when you want to include the number of pages in

* an ALV report (E.g. Pageno xxx of yyy), and choses to include

* ALV statistics when you print the report.

* When you count the total number of pages it is usually

* calculated from the number of lines in the report table,

* number of lines in the report header and the number of lines

* on each report page. However, if you include the ALV statistics when

* you print the report, this page will not be included in the total

* number of pages.

* The solution demonstrated below, is to use the ALV events

* Top Of Page, Top Of List and End Of List.

*
* 2006-10-05 Henrik Frank NNIT A/S

*--------------------------------------------------------------------

TYPE-POOLS: slis.

TYPES:

BEGIN OF t_makt,

matnr LIKE makt-matnr,

maktx LIKE makt-maktx,

END OF t_makt.

DATA:

it_makt TYPE STANDARD TABLE OF t_makt,

wa_makt TYPE t_makt.

******************************************************************'

* Data declarations for the ALV grid

******************************************************************'

DATA:

r_grid TYPE REF TO cl_gui_alv_grid,

alv_fieldcat TYPE slis_t_fieldcat_alv,

wa_alv_fieldcat TYPE slis_fieldcat_alv,

alv_layout TYPE slis_layout_alv,

gt_events TYPE slis_t_event.


******************************************************************'

* Other data declarations

******************************************************************'

DATA:

gd_repid LIKE sy-repid,

g_first_top_of_page(1) TYPE c, "Flag for first top of page event

g_totpages(3) TYPE n,

g_pageno(3) TYPE n,

g_start_of_list(1) TYPE c.

START-OF-SELECTION.

g_first_top_of_page = 'X'.

CLEAR g_start_of_list.

PERFORM alv_setup.

PERFORM build_events.

PERFORM read_data.

END-OF-SELECTION.
PERFORM display_alv.

*&---------------------------------------------------------------------*

*& Form read_data

*&---------------------------------------------------------------------*

FORM read_data.

SELECT matnr maktx

FROM makt

INTO TABLE it_makt

WHERE spras = 'E'.

ENDFORM. " read_data

*&---------------------------------------------------------------------*

*& Form alv_setup

*&---------------------------------------------------------------------*

* Setup of the columns in the ALV grid

*----------------------------------------------------------------------*

FORM alv_setup.

CLEAR wa_alv_fieldcat.

REFRESH alv_fieldcat.

* Matnr field

wa_alv_fieldcat-key = 'X'. "This is a key column


wa_alv_fieldcat-fieldname = 'MATNR'. "Name of the table eld

wa_alv_fieldcat-seltext_s = 'Matnr'. "Short column heading

wa_alv_fieldcat-seltext_m = 'Material nr.'. "Medium column heading

wa_alv_fieldcat-seltext_l = 'Material number'. "Long column heading

APPEND wa_alv_fieldcat TO alv_fieldcat.

* Mat text field

wa_alv_fieldcat-key = ''. "This is not a key column

wa_alv_fieldcat-fieldname = 'MAKTX'.

wa_alv_fieldcat-seltext_s = 'Mat. txt'.

wa_alv_fieldcat-seltext_m = 'Material txt'.

wa_alv_fieldcat-seltext_l = 'Material text'.

APPEND wa_alv_fieldcat TO alv_fieldcat.

ENDFORM. " alv_setup

*&------------------------------------------------------------------*

*& Form BUILD_EVENTS

*&------------------------------------------------------------------*

* Build events tabel for function module

* REUSE_ALV_GRID_DISPLAY. The events that we are interested in are:

* Note that each event is assigned to a sub routine that is

* executed when the event is triggered

* - Top Of List - Subroutine TOP_OF_LIST

* - End Of List - END_OF_LIST


*

*-------------------------------------------------------------------*

FORM build_events.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = gt_events[].

READ TABLE gt_events WITH KEY name = slis_ev_top_of_list

INTO ls_event.

IF sy-subrc = 0.

MOVE 'TOP_OF_LIST' TO ls_event-form.

MODIFY gt_events INDEX sy-tabix FROM ls_event.

ENDIF.

READ TABLE gt_events WITH KEY name = slis_ev_end_of_list

INTO ls_event.

IF sy-subrc = 0.

MOVE 'END_OF_LIST' TO ls_event-form.

MODIFY gt_events INDEX sy-tabix FROM ls_event.

ENDIF.
ENDFORM. " BUILD_EVENTS

*&---------------------------------------------------------------------*

*& Form display_alv

*&---------------------------------------------------------------------*

* Display data in the ALV grid using function module

*----------------------------------------------------------------------*

FORM display_alv.

gd_repid = sy-repid.

* Configure layout of screen

alv_layout-colwidth_optimize = 'X'.

alv_layout-zebra = 'X'.

alv_layout-no_min_linesize = 'X'.

* Call ALV function module

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE' "Ref to form

is_layout = alv_layout
it_fieldcat = alv_fieldcat

it_events = gt_events

* is_print = gd_prntparams

TABLES

t_outtab = it_makt

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " display_alv

*------------------------------------------------------------------*

* Form TOP_OF_LIST

*------------------------------------------------------------------*

* This event is triggerede once at top of the actual list,

* BUT NOT at the top of the ALV Statistics page

*------------------------------------------------------------------*

FORM top_of_list.

* Set flag that indicates that print of the ALV list has begun

g_start_of_list = 'X'.

ENDFORM. "TOP_OF_LIST
*---------------------------------------------------------------------*

* Form TOP_OF_PAGE

*---------------------------------------------------------------------*

* This event is triggered at every top of page including top of

* page inclduing the top of the ALV statistics page

*----------------------------------------------------------------------*

FORM top_of_page.

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

pagno(3) TYPE n.

*---------------------------------------------------------------------

* If the list is being printed (Not didslayed) and this is the first

* time the Top Of Page event is triggered, then caculate number

* of pages for the ALV list

*---------------------------------------------------------------------

IF sy-ucomm EQ 'PRIN' AND g_first_top_of_page = 'X'.

PERFORM get_total_number_of_pages CHANGING g_totpages.

CLEAR g_first_top_of_page.

ENDIF.
* If this is a printed list

IF sy-ucomm EQ 'PRIN'.

*---------------------------------------------------------------------

* The Start Of List event has not yet been triggered. Thsi means that

* we are at the top of an ALV statistics page. Add the

* ALV statistics page to total number of pages

*---------------------------------------------------------------------

IF g_start_of_list = ' '.

g_totpages = g_totpages + 1.

ENDIF.

* Create ALV header

wa_header-typ = 'H'.

g_pageno = sy-pagno.

CONCATENATE 'Mylist page' g_pageno 'of' g_totpages

space INTO wa_header-info SEPARATED BY space.

APPEND wa_header TO t_header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'


EXPORTING

it_list_commentary = t_header.

ENDIF.

ENDFORM. " top_of_page_setup

*-------------------------------------------------------------------

* Form END_OF_LIST

* Clear flags in case the user choses to reprint the report

*-------------------------------------------------------------------

FORM end_of_list.

g_first_top_of_page = 'X'.

CLEAR g_pageno.

CLEAR g_start_of_list.

ENDFORM. "END_OF_LIST

*---------------------------------------------------------------------*

* Form get_total_number_of_pages

*---------------------------------------------------------------------*

* Calcualtes the total page numbers from the number of lines in

* the header of the report and the number of entries in the

* input table

*----------------------------------------------------------------------*

FORM get_total_number_of_pages CHANGING p_total_number_of_pages.


DATA: l_tot_pages TYPE f ,

l_tot_lines TYPE i,

l_lines_per_page TYPE i,

l_number_of_header_lines TYPE i VALUE 13.

* Find number of lines in report table

DESCRIBE TABLE it_makt LINES l_tot_lines.

* Number of lines per pages excl. page header (13 lines)

l_lines_per_page = sy-linct - l_number_of_header_lines.

* Total number ofpages

* Round up the the page number to nearest integer

l_tot_pages = CEIL( l_tot_lines / l_lines_per_page ).

p_total_number_of_pages = l_tot_pages.

* In case that there are no data in the report

IF p_total_number_of_pages = '0'.

p_total_number_of_pages = '1'.

ENDIF.
ENDFORM. " get_total_number_of_pages

Change documents and change pointers


Tables

• CDHDR Change document header


• CDPOS Change document items
• JCDS Change documents for System/User statuses (Changes to table JEST)

Function modules

Tables CDHDR and CDPOS can be read with functionmodules

• CHANGEDOCUMENT_READ_POSITIONS
• CHANGEDOCUMENT_READ_HEADERS

Transaction codes related to Change Pointers

• BD21 Create IDOCs from change documents


• BD50 Activate Change Ptrs for Mess. Type
• BD54 Maintaining Logical Systems
• BD61 Activate Change Pointers - Generally

Programs

RSDMIDOC: Generates IDOCS from chage pointers

Strings

1. Replace and condense


2. Concatenating
3. Substrings and Formatted Write and Move
4. Removing leading/trailing characters.
5. Search for a string within a string
6. Word wrapping/Split
7. Splitting delimited string

Replace and condense

Replace replaces characters within a string. If a character is substituted with a


space, you can use Condense to remove the space.

REPLACE '.' WITH ',' INTO w_tmpstr

Example:

w_matnr = '3617203-100'
REPLACE '-' WITH '' INTO w_matnr.
CONDENSE w_matnr NO-GAPS.

w_matnr will now contain: 3617203100

Concatenating

CONCATENATE f1 ... fn INTO g.

Addition:

... SEPARATED BY h

Example:

CONCATENATE 'Der er sket en fejl i opdateringen'


ITAB-ID ITAB-HKONT ITAB-DMBTR INTO ERRTXT
SEPARATED BY SPACE.

SPACE is an ABAP keyword.

Substrings and Formatted Write and Move

You can use either WRITE or MOVE.


Using WRITE the format of the target field will be the same as when you write to a
list. That means that the settings in the user's master record for decimal point and
date are taking into account.

If you use MOVE, the decimal point is always a periode.

Syntax:

move t1+offset(length) to t2

write t1+offset(length) to t2

Example:

data: t1(10) type c, t2(10) type c.

t1 = '0123456789'.

move t1+3(5) to t2.

t2 will contain 34567

Instead of move you could have used write. In this example the result would have
been the same.

Removing leading/trailing characters.

SHIFT myvar left deleting leading '0'.


SHIFT myvar right deleting trailing '0

Search for a string within a string

String1 = 'This is a string'.


SEARCH String1 for 'is'.

If the search string is found SY-SUBRC = 0


SY-FDPOS = 5 because the strinmg "is" starts at offset 5.

You can also use the Relational Operators for Character-Like Fields
CO, CN, CA, NA .... see the ABAP documentation for further informat
Word wrapping/Split

You can use the fucntion module SWA_STRING_SPLIT to split a tring into
smaller strings or use function module SWA_STRING_SPLIT

-----

>Does someone know how to word wrap fields from one internal table to
>a field in another internal table, when the fields have a different
>lengths ?

>E.g.

>Table 1 has a field with a line length of 50 characters, and I want


>to place each line in table one in one or more lines in table 2 that
>has a field length of 10:

>table1-field1 = 'This is a very long line that should be wrapped'

>should be

>table2-Field1:
>sy-tabix = 1: This is a

>sy-tabix = 2: very long


>sy-tabix = 3: line that
>sy-tabix = 4: should be
>sy-tabix = 5: wrapped

This example shows how to split the text in a field of one internal
table and place it into a field in another internal table that has
a shorter size

REPORT z_hfa_test .

DATA:
* Table containing texts that has to be split
BEGIN OF it_longstrings OCCURS 0,
line TYPE string,
END OF it_longstrings,

* Output table from function SWA_STRING_SPLIT


it_string_components LIKE swastrtab OCCURS 0 WITH HEADER LINE,

* Table containg the resukting strings


BEGIN OF it_shortstrings OCCURS 0,
line(10) TYPE c,
END OF it_shortstrings,

start-of-selection.
* Add some lines to it_longstrings
it_longstrings-line = '123456789012345 Hallo this is a very long'.
APPEND it_longstrings.
it_longstrings-line = 'line, that has to be split.'.
APPEND it_longstrings.
it_longstrings-line = 'The line has to be split into lines of 10

characters'.
APPEND it_longstrings.

* Split each line of it_longstrings into lines with length 10


* The resuklting lines are palced in table it_string_components
LOOP AT it_longstrings.
CLEAR it_string_components. REFRESH it_string_components.

CALL FUNCTION 'SWA_STRING_SPLIT'


EXPORTING
input_string = it_longstrings-line
max_component_length = 10
* TERMINATING_SEPARATORS =
* OPENING_SEPARATORS =

TABLES
string_components = it_string_components

* EXCEPTIONS
* MAX_COMPONENT_LENGTH_INVALID =1
* OTHERS =2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

* Add the lines to table


LOOP AT it_string_components.
it_shortstrings-line = it_string_components-str.
APPEND it_shortstrings.

ENDLOOP.

ENDLOOP.

END-OF-SELECTION.
LOOP AT it_shortstrings.
WRITE: / it_shortstrings-line.

ENDLOOP.

7. Using CA - Contains any (CO, CN, NA)

belob = '300120.00'.

if belob CA '.'.
l_pos = sy-fdpos.

move mystring+l_pos to mydec.


if mydec CO '.0'.
move mystring+0(l_pos) to mystring2.
endif.
endif.

Splitting delimited string

Instead of placing the substring ind l_output, it could be palced in an

internal
table using this syntax:

SPLIT f AT g INTO TABLE itab.

Each substring will be placed in its own table row. In the example below, the table
would have 5 rows.
Note that all output fields must be of type char or string
REPORT YDK8HENFR_TEST1 line-size 80.

data: l_string(132) type c.

data: begin of l_output,


name(40) type c,
age(10) type c,
address(40) type c,
city(40) type c,
zipcode(4) type c,

end of l_output.

start-of-selection.

l_string = 'John;28;My street;My city;3000'.

split l_string at ';' into l_output-name


l_output-age
l_output-address
l_output-city
l_output-zipcode.

write: / l_output-name.
write: / l_output-age.
write: / l_output-address.
write: / l_output-city.
write: / l_output-zipc

System Variables
A complete list of the names of the SY variables can be found in the table SYST.

SY-DATUM System date


SY-UNAME User name
SY-REPID Name of program
SY-TITLE Title of program
SY-DYNNR Dynpro number of active screen
SY-PFKEY Name of the current pf status
SY-LANGU Logon language

SY-ULINE Horizontal lines in list


SY-VLINE Vertical lines in a list ( You kan use | instead )
Returns the code for the GUI status button pushed (Only only used in In dialog program
OKCODE)

CASE SY-UCOMM.
SY-UCOMM WHEN 'RW'.
LEAVE PROGRAM.
WHEN OTHERS.

ENDCASE.
SY-LSIND This field contains the number of the current list in the list hierarchy
SY-PAGENO Page number of current page

Trouble Shooting ABAP Programs

Tools for Troubæleshooting ABAP


Programs

Problem Type Tool


Starting point for analyzing a crashed
SM21 - System Log
ABAP program
Runtime Error ST22 - ABAP dump analysis
Unexpected program behaviour SE30 - ABAP runtime analysis
Finding specific statment, function, SE30 - ABAP runtime analysis
method etc.
SE30 - ABAP runtime analysis
Performance problem
ST05 - SQL trace
Problem with batch input or screen
ST20 - Screen trace
processing
Detailed error analysisi of the ABAP
ABAP debugger
source code
Investigating which parts of a program
including DDIC structures which has Run program RSDEPEND
been changed recently

Table with all transaction codes


Tip fromhttp://www.sap-img.com/general/find-the-list-of-sap-transaction-codes.htm

Where I can find the list of transaction codes and their usage, I heard that there is
some table which contains all the transaction codes with their descriptions.

Does anyone know about the Table that consist all the T-Code?

Listed here are the various ways you can find the list of transaction codes and their
usage:

Use transaction SE11 - ABAP Dictionary:

Fill in the Database table name and click the Display button.
- TSTC table will contain all the Tcodes and
- TSTCT table will contain all the Tcodes with Texts.

Once you entered the screen, click in Top Menu - Utilities - Table contents - Display

If you want to display all the transaction code (total - 57,048) you have to change the
Fields: Maximum number of hits to 99999 (default 500).

or

Simply goto transaction SM01, although this tcode is to Lock/Unlock any


transaction code, you can also view all the tcode available in the R/3 system from
here.

or
Goto transaction SE93

There are two ways where you can find the list of transaction codes in SE93.

Method 1:
You must be familiar with the starting characters strings for each of the R/3
application modules.

Assuming you know that most Materials Management transaction codes start with
MM.

In the Fields: Transaction code, type in MM* and press the function key F4

The list of transaction code starting with MM will be displayed.

Method 2:
On the Top Menu, click Utilities - Find - Execute and the first 500 transaction will
be display.

If want to display all the tcodes, make sure you remembered to change the Fields:
Maximum no. of hits right at the bottom of the screen

Locking a program so it can only ne


executed once at a time
Set the lock:

CALL FUNCTION 'ENQUEUE_EZHR_INTER_IO'


EXPORTING
prgname = sy-cprog
bukrs = ''
affiliate = ''
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.

* Terminated program execution


IF sy-subrc EQ 1.
MESSAGE e004 WITH sy-cprog.
ENDIF.

Free lock:
CALL FUNCTION 'DEQUEUE_EZHR_INTER_IO'
EXPORTING
prgname = sy-cprog
bukrs = ''
affiliate = ''.

Program to find out all the User Exits


Available for any Tcode
Hi frineds,

here iam posting the code, using this program u can find out the
avialble userexits for any Transaction if you want.

I have collected this program from othre groups, Mohan is posted this
in SDN.
thanks to mohan to provide such a helpfull program.
'''''

REPORT ZUSEREXIT NO STANDARD PAGE HEADING.

TABLES : TSTC, TADIR, MODSAPT, MODACT, TRDIR, TFDIR, ENLFDIR.


TABLES : TSTCT.

DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.


DATA : FIELD1(30).

DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.


PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.

SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.


IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR' AND
OBJECT = 'PROG' AND
OBJ_NAME = TSTC-PGMNA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.


IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.
SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR' AND
OBJECT = 'FUGR' AND
OBJ_NAME EQ ENLFDIR-AREA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.

SELECT * FROM TADIR INTO TABLE JTAB


WHERE PGMID = 'R3TR' AND
OBJECT = 'SMOD' AND
DEVCLASS = V_DEVCLASS.
SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU AND
TCODE EQ P_TCODE.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',


20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(95) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 'Exit Name',
21 SY-VLINE ,
22 'Description',
95 SY-VLINE.
WRITE:/(95) SY-ULINE.
LOOP AT JTAB.
SELECT SINGLE * FROM MODSAPT
WHERE SPRSL = SY-LANGU AND
NAME = JTAB-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 SY-VLINE,
2 JTAB-OBJ_NAME HOTSPOT ON,
21 SY-VLINE ,
22 MODSAPT-MODTEXT,
95 SY-VLINE.
ENDLOOP.

WRITE:/(95) SY-ULINE.
DESCRIBE TABLE JTAB.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , SY-TFILL.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
AT LINE-SELECTION.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

''''''

RFC function module to check user id


and password

RFC function module SUSR_LOGIN_CHEC_RFC can be sued to check userid and


password in SAP system

Assign Variable Type at Runtime


Dynamic programing can save a lot of 'superfluous' coding.

To assign a variable a type at runtime, use the ABAP statement ASSIGN with the
option TYPE. For instance:

DATA: D_TYPE,
D_FIELD(35).
DATA: D_TEST TYPE P.
FIELD-SYMBOLS: <F>.
D_FIELD = 'D_TEST'.
D_TYPE = 'P'.
ASSIGN (D_FIELD) TO <F> TYPE D_TYPE.

Additionally you can use the option DECIMALS of the ASSIGN statement if your
type is 'P'. You can even change the type at runtime of previously assigned field
symbol like

ASSIGN <F> TO <F> TYPE 'C'.

One more thing for dynamic programing. With the following coding you can access
every DDIC table with the key you want:

SELECT SINGLE * FROM (DF_TNAME) INTO S_TMP WHERE (IF_KEY).


It is very powerful, isn't it !!!
[ Ingo-Willy Raddatz, posted to SAP listserver]

Example 1: Print page "n of x pages" on reports

The following code is just a function to loop total pages. To use from the beginning
of your report, you will have to loop through your report once before display. ABAP
does not provide
an easy "read-ahead" method of doing this, so this is the "cludgy" way of making it
work if needed.
FORM GET_TOTAL_PAGENO.

WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.

DO SY-PAGNO TIMES.
READ LINE 2 OF PAGE SY-INDEX.
REPLACE '*****' WITH NUM_PAGES_C INTO SY-LISEL.
MODIFY LINE 2 OF PAGE SY-INDEX.
ENDDO.

ENDFORM. " GET_TOTAL_PAGENO


[found on the Web at http://homepages.tcp.co.uk/~bob866/how_to.html]

Dynamic SQL
• Dynamic where clause
• Using a dynamic table name
• Dynamic retrieval and writing of data
• Dynamic SELECT

Dynamic where clause

You can use an internal table to build a dynamic where clause:

data: where_tab(30) occurs 1 with header line,


where_clause(30) type c.

* Build the where clause. Will look like this when finished
* WHERE ZAFSTMD02 = 'X' AND rbusa = '5145'

* With a constant, result: ZAFSTMD01 = 'X'


concatenate 'ZAFSTMD' zcostcheck-zmaaned ' = ''X''' into
where_clause.

* Append to internal table where_tab


append where_clause to where_tab.

* With a variable, result: AND rbusa = '5145'


concatenate 'AND rbusa = ' '''' i_tab-zgsber ''''
append where_clause to where_tab.

* Select
select * from zcostfreq
where (where_tab).
endselect.

Note that you can combine static and dynamic where clauses:

select * from zcostfreq

where bukrs = '2021' AND


(where_tab).
endselect.
Using a dynamic table name

This report prints the number og entries in a table. The table name is specified by a
parameter.

data:
l_count type i.

parameters:
p_tab type tabname.

start-of-selection.
select count(*) from (p_tab) into l_count.
write: / 'Number of entries in table ', p_tab, l_count.

Dynamic retrieval and writing of data

In this example, data is retrieved from the table selected on the selection screen, and
the contents of the table is written to the screen.

DATA:
* Create variable that can contain referecene to any data
dataref TYPE REF TO data.

FIELD-SYMBOLS:
<row> TYPE ANY,
<component> TYPE ANY.

PARAMETERS:
p_tab TYPE tabname.

START-OF-SELECTION.
* Create a workarea for the tabel selected on the selection screen

CREATE DATA dataref TYPE (p_tab).

* The variable dataref cannot be accessed directly, so a field symbol is


* used
ASSIGN dataref->* TO <row>.

SELECT *
FROM (p_tab) UP TO 10 ROWS
INTO <row>.

NEW-LINE.
DO.
* Write all the fields in the record
ASSIGN COMPONENT sy-index
OF STRUCTURE <row>
TO <component>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE <component>.
ENDDO.
ENDSELECT.

Dynamic SELECT

TYPES:
BEGIN OF st_bseg,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
dmbtr LIKE bseg-dmbtr,
END OF st_bseg.

DATA:
sel_list TYPE STANDARD TABLE OF edpline,
li_bseg TYPE STANDARD TABLE OF st_bseg,
l_bseg TYPE st_bseg.

START-OF-SELECTION.
APPEND 'bukrs belnr dmbtr' TO sel_list.

SELECT (sel_list)
FROM bseg UP TO 100 ROWS
INTO TABLE li_bseg.

LOOP AT li_bseg INTO l_bseg.


WRITE : / l_bseg-bukrs, l_bseg-belnr, l_bseg-dmbtr.

ENDLOOP.

Dynamic program generation


This report generates a dynamic program with a form routine called
MY_SUBPOOL. Subroutine polls can not be called directly, you have to call form
routine in the program.
REPORT z_test.

TYPES:
source_line(72).
DATA:
gi_source TYPE STANDARD TABLE OF source_line,
l_prog_name(30) TYPE c,
l_msg(120) TYPE c,
l_line(10) TYPE c,
l_word(10) TYPE c,
l_off(3) TYPE c.

APPEND 'PROGRAM MY_SUBPOOL.' TO gi_source.

APPEND 'FORM WRITE_HALLO.' TO gi_source.


APPEND ' DO 10 TIMES.' TO gi_source.
APPEND ' WRITE: / ''Hello world''.' TO gi_source.
APPEND ' ENDDO.' TO gi_source.
APPEND 'ENDFORM.' TO gi_source.

GENERATE SUBROUTINE POOL gi_source


NAME l_prog_name MESSAGE l_msg LINE l_line
WORD l_word OFFSET l_off.

IF sy-subrc <> 0.
WRITE : / 'Error', l_msg.
ELSE.
PERFORM write_hallo IN PROGRAM (l_prog_name).

ENDIF.

Dynamic Tokens
Example:

name = 'AGE'
sort itab by (name)

Field symbols
You can use field symbols to make the program more dynamic.

Example 1

In this exanmple the name of a table control isd substituted by a field symbol. Thus
you cal call the form with any internal table, using the name of the tablæe control as
a parameter.

form insert_row
using p_tc_name.

field-symbols <tc> type cxtab_control. "Table control

assign (p_tc_name) to <tc>.

* insert 100 lines in table control


<tc>-lines = 100.

Example 2
TYPES:
BEGIN OF st_mytable,
name1 TYPE string,
name2 TYPE string,
age TYPE i,
END OF st_mytable.

DATA:
gi_mytable TYPE STANDARD TABLE OF st_mytable,
g_mytable TYPE st_mytable.

*------------------------------
* Define field symbols
*------------------------------
FIELD-SYMBOLS:
<myfield1> TYPE ANY,
<myfield2> TYPE ANY,
<myfield3> TYPE ANY,
<myline> TYPE ANY.

*------------------------------

* Fill table with data


*------------------------------
g_mytable-name1 = 'John'.
g_mytable-name2 = 'Johnson'.
g_mytable-age = 25.
APPEND g_mytable TO gi_mytable.

g_mytable-name1 = 'Claudio'.
g_mytable-name2 = 'Jensen'.
g_mytable-age = 45.
APPEND g_mytable TO gi_mytable.

*------------------------------
* The normal way to do it
*------------------------------
LOOP AT gi_mytable INTO g_mytable.
WRITE: / g_mytable-name1, g_mytable-name2 ,g_mytable-age.

ENDLOOP.

SKIP 2.
*------------------------------
* Do it with field symbols
*------------------------------
LOOP AT gi_mytable ASSIGNING <myline>.
ASSIGN COMPONENT 1 OF STRUCTURE <myline> TO <myfield1>.
ASSIGN COMPONENT 2 OF STRUCTURE <myline> TO <myfield2>.
ASSIGN component 3 OF STRUCTURE <myline> TO <myfield3>.
WRITE: / <myfield1>,<myfield2>,<myfield3>.
ENDLOOP.

*------------------------------
* Unassign field symbols
*------------------------------

UNASSIGN <myfield1>.
UNASSIGN <myfield2>.
UNASSIGN <myfield3>.
UNASSIGN <myline>.

Dynamically read fields, fieldnames and


fieldcontents
FIELD-SYMBOLS:
<fieldname> TYPE ANY, "Name of field
<line> TYPE ANY, "Line structure for table
<fieldvalue> TYPE ANY. "Value of field

DATA: l_shorttext LIKE dd03m-ddtext.

DATA: wa_dd03l LIKE dd03l.

SELECT * FROM dd03l INTO wa_dd03l

WHERE tabname = 'ZHR_INTER_PA1_DL'.


* Assign name of field
ASSIGN COMPONENT 2 OF STRUCTURE wa_dd03l TO <fieldname>.

* Assign structure for internal table


ASSIGN wa_pa1_delta TO <line>.

* Assign field value from structure


ASSIGN COMPONENT <fieldname> OF STRUCTURE <line> TO <fieldvalue>.

* Find DD text for field


SELECT SINGLE ddtext
FROM dd03m
INTO l_shorttext
WHERE tabname = 'ZHR_INTER_PA1_DL' AND
fieldname = <fieldname> AND
ddlanguage = 'EN'.

WRITE: / <fieldname>, l_shorttext, ' : ', <fieldvalue>.

ENDSELECT.

Dynamic assignment of fields in a


structure
In this example we reads info type 0027 which contains the fields
KST01, KST02…..KST25

We want to write the contents of KST01, KST02…..KST25 to the screen

REPORT zznfl_test2
NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA:
it_p0027 TYPE STANDARD TABLE OF p0027,
wa_p0027 TYPE p0027.

DATA: l_kst TYPE string, l_count(2) TYPE n.

FIELD-SYMBOLS <fs> TYPE any.

START-OF-SELECTION.

CALL FUNCTION 'HR_READ_INFOTYPE'


EXPORTING
pernr = '995'
infty = '0027'
begda = '20070131'
endda = '20070131'
TABLES
infty_tab = it_p0027
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
LOOP at it_p0027 into wa_p0027.
DO 25 TIMES.
CLEAR l_kst.
l_count = l_count + 1. ”Counter 01-25
CONCATENATE 'KST' l_count INTO l_kst. ”KST<counter>

assign component l_kst of structure wa_p0027 to <fs>.


write: / <fs>.
ENDDO.
ENDLOOP.

Select with Variable


Q.

> -----------------------------------------------
> > > Hi all,
> > > Can somebody help me with this (little) problem.
> > > -----------------------------------------------
> > > IS:
> > > DATA Z0051 LIKE T005 OCCURS 0 WITH HEADER LINE.
> > > DATA Z0052 LIKE T005 OCCURS 0 WITH HEADER LINE.
>>>
> > > SELECT * INTO TABLE Z0051 FROM T005.
> > > SELECT * INTO TABLE Z0052 FROM T005.
> > > =====
> > > -----------------------------------------------

> > > DEBIT:


> > > Instead of these two SELECT specification I would
> > > like to write a SELECT specification with a variable
> > > internal table.
>>>
> > > SELECT * INTO TABLE variable FROM T005.
> > > ========
> > > -----------------------------------------------
> > > Is that possible?
> > > I hope you understand what I wrote.
> > > I am improving my english but it isn't perfect.

A1:

There are a lot of ways you can use dynamically internal table assignments.
The best way, for my attitude, is to use the following code:

PROGRAM ZXXXXXX.
DATA: Z0051 LIKE T005 OCCURS 0 WITH HEADER LINE.
DATA: Z0052 LIKE T005 OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.
PERFORM ADD-DYNAMIC TABLES Z0051.
PERFORM ADD-DYNAMIC TABLES Z0052.
END-OF-SELECTION.

FORM ADD-DYNAMIC TABLES F_TAB.


SELECT * FROM T005 INTO TABLE F_TAB.
ENDFORM.

Kind regards, Ingo-Willy Raddatz.

A2:

Hi Roland,

I believe, here is an example that could help you. Worked perfectly.

DATA: Z001 LIKE T005 OCCURS 0 .


DATA: Z002 LIKE T005 OCCURS 0 .
DATA: ITAB_NAME(10).
FIELD-SYMBOLS: <ITAB> TYPE TABLE.

MOVE 'Z001' TO ITAB_NAME.

ASSIGN (ITAB_NAME) TO <ITAB>.


SELECT * FROM T005 INTO TABLE <ITAB>.

MOVE 'Z002' TO ITAB_NAME.

ASSIGN (ITAB_NAME) TO <ITAB>.


SELECT * FROM T005 INTO TABLE <ITAB>.

Note, Z001 .... can only be interanl tables WITHOUT header line,
otherwise ASSIGN won't work. Is there a problem for you? I'm on 3.1H.

Regards,

Siarhei
ABAP FAQs
Q: Is ABAP program client dependent or independent?
A: Independent.

Q: What is the diffference between modifications and enhancements?


A: Modification, we are modifying which is already exists, In enhancement we are
adding additional functionality.
Q: What type of objects exist in the data dictionary?
A: Data in data dictionary is not the actual data like emp.name.name or
emp.address but rather a type data whose function
is to define the properties of the data, such as type, length, and relationship.

Q: Explain the concept of asynchronous update?

A: When you change data of one table the sy-subrc is returned. And then updation
of other affected tables takes place.
So if system fails to update other tables still sy-subrc returned is 0 (ie, Whwn first
table gets updated).

Q:What components does a dynpro consists of?


A: Number of screen. Length(4)

Q: What is the difference between data elements and domain?


A: Data element
ABAP/4 Development Workbench (BC-DWB)
A data element describes the contents of a field. For example, a data element
contains the F1 help texts and the key
word texts (field texts) for displaying the field on the screen.
Several table fields with identical contents can refer to the same data element.
Domain
ABAP/4 Development Workbench (BC-DWB)
A domain describes the technical attributes of a table field.
These technical attributes include the data type and the field length.
Several fields with the same technical attributes can refer to the same domain. In
this case, each of these fields has
the technical attributes specified in this domain.

Q:What are the main elements of a status?


A: 1. Usage data
2. SAP data
3. Host data
4. SAP system data
5. Database data.

Q: How many lists can exist in parallel in an interactive reporting?


A: In the interactive reports, we can create as many as 21 lists.
The first list is called ‘Basic list’ and all the successive lists are called ‘Secondary
lists’.
Each list is again an interactive.

Q:What are the 3 main events in interactive reporting?


A: 1. Top-of-page during line selection.
2. At line-selection
3. At user-command

Q: What is IDOC and when, how to use it ?


A: IDOC is one of the EDI(Electronic data interface). It is used as a format
modifier.

Q: Is there any standard SAP report which gives a count of the number of times a
program is executed ?
A: Try transaction STAT

Q: When we create a customer the information is updated in structure RF02D and


the some tables like KNA1 are
updated. How can we find the tables for master data transactions?
A: Go to ABAP Workbench -> Overview -> application hierarchy – SAP -> follow
the customizing based tree for your
application. Double click on a lowest hierarchy level to get for the correct marked
development class. Here you can
find all the tables, views, logical databases etc. used for a system operation.

Q: How can we use CAD with SAP ?


A: Third party tools from Eigner + Partner provide interfaces to SAP. Another
third party software – Fastlook Plus from
Kamel Software enables you to view all of the Autocad formats.

Q: How can I access SAP through Internet?


A: SAP has its own Internet transaction Server (ITS) . Other products include Haht,
WebObjects, NetDynamics etc. Each
product has its’ own architecture.
However to access the database, access paths SAP GUI or RFC Channel have to be
used.

Q: How can we transport the standard text?


A: Refer note 3355 in OSS for a complete explanation. The SAPscript objects that
should be transported must be written in a
transport request.
The entries are as follows:
R3TR FORM NAME (NAME = Name of the layout set)
R3TR STYL NAME (NAME = Name of the style)
R3TR TEXT OBJECT,NAME,ID,L
(OBJECT = Text object, NAME = Text name, ID = Text ID, L = Text language)
If you want to transport a number of texts, you can use report RSTXTRAN to insert
the individual text keys into a
correction.
The transport request must be entered and released via the transport system.
Q: How to find what transactions a particular user was running for a given period
in the past (Eg: from 1st of a month )
A: You may use the transaction – STAT.

Q: We want protect/lock a field so that only selected people can change the value
while others can only read. How to set
the authorizations?
A: Create an authorization object for change mode. Loop at screen in the user exit
and set input to 0. Check the user based
on sy-uname and the authorization. Decide whether input should be 0 or 1.

Q: How to lock an user defined transaction for some time during which no user can
access the same?
A: Use transaction SM01. Scroll through the transactions and check against the
transaction to be locked. And after the
maintenance is over, go back to SM01 and uncheck the same to unlock.

BDC
Q: Our ABAP program is working properly in Foreground. Can I schedule it for
background processing on the weekend?
A: SAP standard program RSBDCSUB helps you to schedule the job. Create a
variant for RSBDCSUB with the BDC
session name.

Q: How can we send a mail to the user intimating him that his report/BDC is
completed in background?
A: You can use FUNCTION RS_SEND_MAIL_FOR_SPOOLLIST
If Unix is being used, you may send a report to any internet mail with the following:

REPORT ZSNDMAIL .
DATA: COMND(200) type c.
DATA: RESULT(200) type c occurs 100 with header line.
PARAMETERS: FILE(60) type c lower case default
‘/sapdata/sd_outbound/testmail.dat’.
PARAMETERS: SUBJECT(60) type c lower case.
PARAMETERS: EMAIL(60) type c lower case.
INITIALIZATION.
TRANSLATE EMAIL TO LOWER CASE.
START-OF-SELECTION.
TRANSLATE EMAIL TO LOWER CASE.
CONCATENATE ‘cat’ FILE ‘| elm -s “‘ subject ‘”‘ email into comnd seperated by
space.
CALL ‘SYSTEM’ ID ‘COMMAND’ FIELD comnd ‘TAB’ FIELD
UNIX_RESULTS-*SYS*.
Loop at Results.
write: /1 results.
endloop
end-of-selection.

SAPScript
Q: We get the total number of pages as expected by using ‘SAPSCRIPT-
FORMPAGES’ in a duplex layout. In our case
duplex case is always ‘Terms & Conditions’. We do not want the number of pages
as in duplex printing. What is the best
possible solution?
A: On the Terms & Conditions page, Change the Page counter mode to ‘HOLD’ to
keep the page counter from incrementing
when you print the Term & Conditions.

Q: Can I Print a logo on an Invoice?


A: Save a Logo using Paintshop Pro or Corel Draw as Tiff file. Use RSTXLDMC to
convert the logo to standard text in
SapScript. When the program is executed, the path and file name have to be
correctly specified.

Process could be like the following:


Run RSTXLDMC
Enter file name C:\MAIL\COMPLOGO.TIF
Resolution for Tiff file
Absolute X-position
Absolute Y-position
Absolute positioning
Reserved height
Shift to right
UOM = CM
Text title
Line width for text = 132
Text name ZHEX-MACRO-COMPLOGO
Text ID ST
Text language = E
Postscript scaling
Width & Height according to PS scaling
Number of Tiff gray levels (2,4,9) 2
Then Create a new window ‘COMP’ with attributes;
Window COMP description Company Logo
Window type CONST
Left margin 7.00 CH window width 10.00 CH
Upper margin LN window height 8.00 LN
Finally in the text element , mention
/: INCLUDE ‘ZHEX-MACRO-COMPLOGO’ OBJECT TEXT ID ST LANGUAGE
‘E’.
Please note that if object name is not indicated as ‘ZHEX…’, the logo may not be
printed!
You will not be able to see the logo in a test print. The same will be printed in actual
printout.
If you are using two logos in the same layout, the names of the logos should be
unique. Say ‘ZHEX-MACRO-LOGO1′ and
‘ZHEX-MACRO-LOGO2′. Else all the information will be overwritten.
If the logo is not EXACTLY TIFF 6.0 , the same will not be printed.
See OSS notes 5995, 18045, 39031 for some inputs.

RFC
Q: We want to move a SAP table to an Access table using
TABLE_EXPORT_TO_MSACCESS_RFC
Importing parameters are
DBNAME
DEST
FLG_APPEND
FLG_POPUP
LANGU
The table has three columns:
TABNAM
MANDT
SDATA
We have no Exporting parameters.
How shall we set the parameters?
A: Install the PS utilities, which are part of SAPGUI install CD. You may run
report RIACCESS from SE38.
Go to SALE -> Communication -> Define RFC Destination. Setup two RFC
destinations PS_ACCESS_1
and PS_ACCESS_2 and will have to get them to point to wdpsastr.exe and
wdpsatab.exe respectively. Then
execute RIACCESS and choose PS_ACCESS_1 to generate access tables. Please
note that Access only supports
tables with up 255 fields.

Q: We want an RFC do the following transactions – MB1A, MB1C,>MB01 (goods


receipt/issue).
A: Call the RFC INBOUND_IDOC_PROCESS with IDOC_CONTROL and
IDOC_DATA. The structure in the
field sdata in the IDOC_DATA are e1mbxyh and e1mbxyi.

Transports
Q: In a Dev instance, we want to transport a modification to a layout set from one
client to another. What is the best way?
A: use transaction SE71. Choose Utilities->Copy from Client. Layout sets need not
be transported between clients ,
via transport requests DEVKxxxxxx.
Q: We need to keep track of the transports that need to flow through to other
systems (ie, DEV, TST, TRN, PRD etc).
Is there a way do this?
A: SAPCRAFT enables you to control the CTS from DEV system. This keeps track
of all transports at all stages and
enables you to allocate Import, export and Authorization functions to specific user.

Tables
Q: We specify the logical database. And we want a field that is not present in any of
the tables defaulted in logical
database. How can we want to add this additional field from a different table?
A: . Presume you have a logical database
table 1
table 2
table 3
Define the required field as additional field say fld of table 1, table 2 or table 3
and then in the code section define.
Perform get_f1d(zxxxxxxx) using f1d.
Form zxxxxxxx could be like;
Form get_f1d using f.
Select * from where ‘conditions’
f = table4 – f1d.

Q: We need to download an internal table to the Presentation Server(local


workstation). Whenever we run the program, the
same file has to be saved as a separate file in sequential order. Ex: 0001.txt, 0002.txt
etc. Where can we store the last file
number?

A: SAP has a table TVARV for storing the variants.


A record may be created in TVARV for all the programs that require this kind of
incremental records.
For Ex: the record could be 100Zmm10001 MM sequence rec where first part
consists of client code and the program being
run. Client code is required because TVARV does not has a field for client code. The
second part is the description indicating
the purpose what the record is created. This entire string may be posted in the
Name field (char – 30).
The Type field ( char- 1) may be populated with P or S (Parameter or Selection)
Low field (char- 45) may be populated with ’0001′ when run first time and
increment it by one in your program for
downloading of the internal table.

Batch input / Direct input


Q: We are calling transaction VL01 in batch input to create deliveries using a
program for delivery due list. How ever we
are unable to create deliveries for transport stock orders. Why?
A: Batch-inputs can not be used to fill the “delivery due list” screen because it is not
a dynpro. This is a standard SAP report.
A SAP report (check with “System -> Status”) may be called using SUBMIT
sentence with the appropriate options .
It is preferred to call a report than create a Batch-input program.

Q: What are some sample Direct input data transfer programs?


A: In MM for Material Master data – RMDATIND
FI – for Accounting Documents – RFBIBL00
PP – for Independent requirements – RM06IN00
CA – for Classification data – RCCLBI03

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

Comments (0) Get FREE daily updates by RSS or e-mail

ABAP Keyword a day : ADD


Written by admin on Oct 29th, 2007 | Filed under: ABAP, ABAP Keywords

ADD
Variants:
1. ADD n TO m.
2. ADD n1 THEN n2 UNTIL nz GIVING m.
3. ADD n1 THEN n2 UNTIL nz TO m.
4. ADD n1 THEN n2 UNTIL nz
…ACCORDING TO sel …GIVING m.
5. ADD n1 FROM m1 TO mz GIVING m.

Variant 1 ADD n TO m.

Effect Adds the contents of n to the contents of M and stores the result in m.
This is equivalent to: m = m + n.

Example
DATA: NUMBER TYPE I VALUE 3,

SUM TYPE I VALUE 5.


ADD NUMBER TO SUM.
The field SUM now contains 8, whilst the contents of the field NUMBER remains
unchanged at 3.

Note The details about conversions and performance described under

COMPUTE are identical for ADD.

Note Runtime errors:


- BCD_BADDATA: P field contains incorrect BCD format.
- BCD_FIELD_OVERFLOW: Result field too small (type P).
– BCD_OVERFLOW: Overflow with arithmetic operation (type P.
- COMPUTE_INT_PLUS_OVERFLOW: Integer overflow when adding.

Related COMPUTE, ADD-CORRESPONDING.

Variant 2 ADD n1 THEN n2 UNTIL nz GIVING m.

Effect Adds the contents of the fields n1, n2, …, nz together and stores the result in
m, where n1 is the first, n2 the second and nz the last of a sequence of fields the
same distance apart. They can be either database fields or internal fields, but they
must all have the same type and length.
This is equivalent to: m = n1 + n2 + … + nz.

Example

DATA: BEGIN OF NUMBERS,


ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
SIX TYPE P VALUE 60,
END OF NUMBERS,

SUM TYPE I VALUE 1000.


ADD NUMBERS-ONE THEN NUMBERS-TWO
UNTIL NUMBERS-FIVE GIVING SUM.

The field SUM now contains 150 but its initial value is unimportant. The fields
within the field string NUMBERS remain unchanged.

Variant 3 ADD n1 THEN n2 UNTIL nz TO m.

Effect Calculates the total as in variant 2 but then adds it to the contents of the field
m.
This is equivalent to: m = m + n1 + n2 + … + nz
Example
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,

SUM TYPE I VALUE 1000.

ADD NUMBERS-ONE THEN NUMBERS-TWO UNTIL NUMBERS-FIVE TO


SUM.

The field SUM now contains 1150.

Variant 4 ADD n1 THEN n2 UNTIL nz


…ACCORDING TO sel …GIVING m.

Parts marked with ” …” are interchangeable


Effect Calculates the total as in variants 2 and 3. In this case, however, the operands
from a sequence of fields of the same type are restricted to a partial sequence by the
selection
specification sel generated by SELECT-OPTIONS or RANGES. The partial
sequence results from the indexes that satisfy the condition IN sel (see IF).

Example
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,
SUM TYPE I VALUE 1000,

INDEX TYPE I.
RANGES SELECTION FOR INDEX.

SELECTION-SIGN = ‘I’.
SELECTION-OPTION = ‘BT’.

SELECTION-LOW = 2.
SELECTION-HIGH = 4.

APPEND SELECTION.
ADD NUMBERS-ONE THEN NUMBERS-TWO

UNTIL NUMBERS-FIVE
ACCORDING TO SELECTION

GIVING SUM.
SUM now contains 90. Only the component fields TWO to FOUR were selected
from the field string NUMBERS and added together.

Variant 5 ADD n1 FROM m1 TO mz GIVING m.

Effect The field n1 must be the first in a sequence of consecutive fields of the same
type. m1 and mz should contain the numbers of the first and last fields in this
sequence to be added together (whether fixed or variable). The total is stored in m.

Example
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,
START TYPE I VALUE 2,
SUM TYPE I VALUE 1000.

ADD NUMBERS-ONE FROM START TO 4 GIVING SUM.

The field SUM now contains 90.


Note Performance:
The details for conversion and performance specified for COMPUTE are equally
valid for ADD.
The runtime required for adding two numbers of type I or F is about 2 msn
(standardized microseconds), for type P it is roughly 8 msn.

Note Runtime errors:


Besides the runtime errors listed in variant 1, the error ADDF_INT_OVERFLOW
can occur instead of COMPUTE_INT_PLUS_OVERFLOW in other variants.
ADD-CONDITIONAL is not an ABAP/4 key word (in R/3).

Archive for the ‘ABAP’ Category

Print to PDF SAP Script


Written by admin on Oct 22nd, 2007 | Filed under: ABAP, ABAP Programs,
Articles
*----------------Database Declaration-----------------------------
*TABLES: LFA1,ADR6.*-----------------Internal Table
Declaration----------------------*

*----------------Work VAriables
----------------------------------*DATA: S_DOC_CHNG LIKE
SODOCCHGI1.DATA: L_TAB_LINES LIKE SY-TABIX.DATA: COUNT1 TYPE I.DATA:
COUNT2(4) TYPE N.DATA: W_ITCPO LIKE ITCPO,W_DIALOG,W_ITCPP LIKE
ITCPP.DATA: W_BIN_FILESIZE(10) TYPE C.DATA: L_FILENAME LIKE RLGRAP-
FILENAME .DATA: OK_CODE LIKE SY-UCOMM.

DATA: SAV_OK_CODE LIKE SY-UCOMM.


DATA: LINE_COUNT TYPE I.
DATA: FLAG(1) VALUE ‘X’.
DATA: WRK_LINES LIKE SY-TABIX.
DATA: WRK_REMNO LIKE ZDUNNING_EMAIL-REMNO.
DATA: T_OTFDATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
DATA: T_ASCII LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: T_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: T_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: T_TEXT1 LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: WRK_DAT LIKE SY-DATUM.
CONTROLS: TBCTL_EMAIL TYPE TABLEVIEW USING SCREEN 9000.

CALL FUNCTION ‘OPEN_FORM’


EXPORTING
APPLICATION = ‘DS’
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
DIALOG = W_DIALOG
FORM = ‘ZRP_DUNNING1′
LANGUAGE = SY-LANGU
OPTIONS = W_ITCPO
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = ‘*’
IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. ” OPEN_SCRIPT

*&———————————————————————*
*& Form DOWNLOAD_IN_TXT_MODE
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <-- p2 text
*———————————————————————-*
FORM DOWNLOAD_IN_TXT_MODE.
REFRESH T_PDF.
CALL FUNCTION ‘CONVERT_OTF’
EXPORTING
FORMAT = ‘PDF’
MAX_LINEWIDTH = 255
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
TABLES
OTF = T_OTFDATA
LINES = T_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
ENDFORM. ” DOWNLOAD_IN_TXT_MODE

*&———————————————————————*
*& Form DOWNLOAD_TO_PRES_SERV
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <-- p2 text
*———————————————————————-*
FORM DOWNLOAD_TO_PRES_SERV.
COUNT2 = IT_REQ1-COUNT.
CONCATENATE ‘C:\RFQ_’ COUNT2 ‘.PDF’ INTO L_FILENAME .
CALL FUNCTION ‘DOWNLOAD’
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = L_FILENAME
FILETYPE = ‘BIN’
TABLES
DATA_TAB = T_PDF
EXCEPTIONS
INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
CUSTOMER_ERROR = 7
OTHERS = 8.
CLEAR COUNT2.
ENDFORM. ” DOWNLOAD_TO_PRES_SERV

*&———————————————————————*
*& Form SEND_MAIL_INSUR
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <-- p2 text
*———————————————————————-*
FORM SEND_MAIL_INSUR.
DATA : L_CHRLEN TYPE I,
L_FILENAME LIKE RLGRAP-FILENAME ,
L_LENGTH LIKE T_OBJPACK-DOC_SIZE .
CLEAR :
T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST,S_DOC_CHNG.
REFRESH : T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST.
S_DOC_CHNG-OBJ_NAME = ‘RFQ Referrals’.
S_DOC_CHNG-OBJ_DESCR = ‘RFQ Referrals’.
DESCRIBE TABLE T_OBJTXT LINES L_TAB_LINES.
READ TABLE T_OBJTXT INDEX L_TAB_LINES.
S_DOC_CHNG-DOC_SIZE = ( L_TAB_LINES – 1 ) * 255 + STRLEN( T_OBJTXT
).
CLEAR T_OBJPACK-TRANSF_BIN.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = ‘RAW’.
APPEND T_OBJPACK.
PERFORM CONVERT_TABLE.
DESCRIBE TABLE T_OBJBIN LINES L_TAB_LINES.
T_OBJHEAD = L_FILENAME.
APPEND T_OBJHEAD.
T_OBJPACK-TRANSF_BIN = ‘X’.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 1.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = ‘PDF’.
T_OBJPACK-OBJ_NAME = ‘RFQ REFERRAL’.
T_OBJPACK-OBJ_DESCR = ‘RFQ REFERRALS : PDF Format’.
T_OBJPACK-DOC_SIZE = L_TAB_LINES * 255.
W_BIN_FILESIZE = L_TAB_LINES * 255.
MOVE W_BIN_FILESIZE TO L_LENGTH+3(9).
TRANSLATE L_LENGTH USING ‘ 0′.
T_OBJPACK-DOC_SIZE = L_LENGTH .
APPEND T_OBJPACK.
T_RECLIST-RECEIVER = IT_REQ-EMAIL.
T_RECLIST-REC_TYPE = ‘U’.
APPEND T_RECLIST.

CALL FUNCTION ‘SO_NEW_DOCUMENT_ATT_SEND_API1′


EXPORTING
DOCUMENT_DATA = S_DOC_CHNG
PUT_IN_OUTBOX = ‘X’
TABLES
PACKING_LIST = T_OBJPACK
OBJECT_HEADER = T_OBJHEAD
CONTENTS_BIN = T_OBJBIN
CONTENTS_TXT = T_OBJTXT
RECEIVERS = T_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC EQ 0.
MESSAGE S501(ZF).
CLEAR IT_REQ2. REFRESH IT_REQ2.
LOOP AT IT_REQ WHERE SEL = ‘X’.
MOVE-CORRESPONDING IT_REQ TO IT_REQ2.
APPEND IT_REQ2.
DELETE IT_REQ WHERE SEL = ‘X’.
CLEAR IT_REQ.
ENDLOOP.
FLAG = ‘ ‘.
ELSE.
MESSAGE E502(ZF).
ENDIF.
ENDFORM. ” SEND_MAIL_INSUR

*&———————————————————————*
*& Form CONVERT_TABLE
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <-- p2 text
*———————————————————————-*
FORM CONVERT_TABLE.
DATA: HLTLINES TYPE I.
DATA: FLE1(2) TYPE P.
DATA: FLE2(2) TYPE P.
DATA: HFELD(500) TYPE C.
DATA: OFF1 TYPE P.
DATA: HTABIX LIKE SY-TABIX.
DESCRIBE TABLE T_PDF LINES HLTLINES.
DESCRIBE FIELD T_PDF LENGTH FLE1.
DESCRIBE FIELD T_OBJBIN LENGTH FLE2.
CLEAR T_OBJBIN. REFRESH T_OBJBIN.
CLEAR OFF1. CLEAR HFELD.
LOOP AT T_PDF.
HTABIX = SY-TABIX.
MOVE T_PDF TO HFELD+OFF1.
IF HTABIX = HLTLINES.
FLE1 = STRLEN( T_PDF ).
ENDIF.
OFF1 = OFF1 + FLE1.
IF OFF1 GE FLE2.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(FLE2).
APPEND T_OBJBIN.
SHIFT HFELD BY FLE2 PLACES.
OFF1 = OFF1 – FLE2.
ENDIF.
IF HTABIX = HLTLINES.
IF OFF1 GT 0.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(OFF1).
APPEND T_OBJBIN.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. ” CONVERT_TABLE

*&———————————————————————*
*& Form OPEN_SCRIPT1
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <-- p2 text
*———————————————————————-*
FORM OPEN_SCRIPT1.
IF W_ITCPP IS INITIAL.
W_DIALOG = ‘X’.
IF SAV_OK_CODE = ‘PRNPRV’.
W_ITCPO-TDGETOTF = ‘ ‘.
ENDIF.
IF SAV_OK_CODE = ‘PDFD’ OR SAV_OK_CODE = ‘PDFM’.
W_DIALOG = ‘X’.
W_ITCPO-TDGETOTF = ‘X’.
ENDIF.
ELSE. ” if w_itcpp is initial.
CLEAR W_DIALOG.
MOVE-CORRESPONDING W_ITCPP TO W_ITCPO.
ENDIF. ” if w_itcpp is initial.
IF SAV_OK_CODE = ‘PRNPRV’.
W_DIALOG = ‘X’.
ENDIF.
*changed
CALL FUNCTION ‘OPEN_FORM’
EXPORTING
* APPLICATION = ‘DS’
* DIALOG = W_DIALOG
FORM = ‘ZRP_DUNNING1′
LANGUAGE = SY-LANGU
* OPTIONS = W_ITCPO
* IMPORTING
* RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. ” OPEN_SCRIPT1
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info

Comments (0) Get FREE daily updates by RSS or e-mail

How to find OK Codes


Written by admin on Oct 22nd, 2007 | Filed under: ABAP, ABAP Programs,
Articles

Goto menu bar in that System –> Status click Gui Status Expand all the nodes
inside u will get all Function Code/ ok code for icons inside the in GUI menu Bar.

Comments (0) Get FREE daily updates by RSS or e-mail

FTP from ABAP


Written by admin on Oct 22nd, 2007 | Filed under: ABAP, ABAP Programs,
Articles
CALL FUNCTION 'FTP_CONNECT' DESTINATIONRFC_DESTINATIONEXPORTING USER =
USER PWD = PASSWORD ACCT =ACCOUNT HOST = HOSTTRACE = FTP_TRACE GUSER =
GATEWAY_USER

GPWD = GATEWAY_PASSWORD GHOST =GATEWAY_HOSTIMPORTING HANDLE = HANDLE


ERROR = CERROR

EXCEPTIONS SYSTEM_FAILURE = 1COMMUNICATION_FAILURE = 2.


Archive for the ‘ASAP Methodology’ Category

ASAP Business One Templates


Written by rajivsharma.sap on Jul 11th, 2008 | Filed under: ASAP
Methodology, Business One

ASAP Business One Templates contains templates on BMPL, Business Blue Print,
Change Management Communication guide, Cutover Checklist, Go-Live Checklist,
Handover from sales checklist, Issue log, Meeting Agenda Template, Meeting
minutes template, Post Go-Live Questionaire, Project Kick-off Presentation, Project
Phase Sign-Off, Project Plan, Request for change, Risk assessment, Software
Delivery Receipt, Test case template, Test Strategy Guide and Training Plan.

Comments (1) Get FREE daily updates by RSS or e-mail

ASAP Methodology
Written by rajivsharma.sap on Jul 11th, 2008 | Filed under: ASAP
Methodology

SAP Business One – ASAP Methodology

Accelerated SAP methodology is a proven, repeatable and successful approach to


implementing SAP solutions across industries and customer environments. It
provides content, tools, and expertise from numerous implementations. The “SAP
Business One Accelerated Implementation Program” has been developed
specifically to support the implementation of SAP Business One in small and
midsize enterprises. This implementation guide will use the ASAP framework as a
guideline for SAP Business One implementations and apply ASAP concepts and
information were beneficial.
Archive for the ‘Application Linking and Enabling(ALE)’
Category

What is ALE?
Written by admin on Apr 4th, 2010 | Filed under: Application Linking and
Enabling(ALE)

ALE (Application Link Enabling) is used to support the construction and operation
of distributed applications, through the exchange of data messages ensuring data
consistency across loosely coupled SAP applications, using both synchronous and
asynchronous communications without the need for a central database.

ALE is comprised of three layers:

• Application services
• Distribution services
• Communication services

ALE helps to:

• Distribute applications across several SAP systems, such that


centralized/decentralized functions can operate in the same company area.
• Maintain and distribute master data elements from a central system.
• Maintain and distribute control data objects from a central system with the
synchronized configuration data (important to decentralize functions yet
keep them integrated).
• Link R/2 and R/3 systems.
• Link SAP and external systems, via IDocs (Intermediate Documents).

Comments (0) Get FREE daily updates by RSS or e-mail

Guide to Implementing SAP ALE


Written by admin on Nov 17th, 2009 | Filed under: Application Linking and
Enabling(ALE)

The purpose of this guide on implementing SAP ALE whitepaper is to provide you
with a methodology on implementing SAP R/3′s ALE technology. For the executive
who is looking into deploying ALE the first chapter will be of benefit as well as the
summary for each of the remaining chapters which will give a good indication as to
the level of effort that will be required in order to implement ALE.

It highlights the areas to look at; it gives example documentation and describes the
implementation process in detail. It is not an idiot’s guide to implementing ALE.
Detailed knowledge of the ALE functionality together with project management
skills will ensure a smooth ALE implementation.

The Guide is divided into the following chapters:

1. Introduction to ALE. What is ALE? Why ALE?


2. ALE Assessment. Putting a project team together. Deliverables of the team.
Setting standards. Investigation and position papers.
3. ALE Design. Design phase. Design document. Performance and technical
implications.
4. ALE Configuration. Configuration & related procedures.
5. ALE Development. Describing ALE development. Development example.
6. ALE Operations Support and Production support procedures. Production
support planning. Monitoring and archiving. Disaster recovery.
7. ALE general issues. ALE transaction codes, tables, programs… Glossary.

Download the ALE Guide (1696).

Comments (0) Get FREE daily updates by RSS or e-mail

ALE Optimization and Sucessfully Leveraging IDOCS


Written by admin on Jul 21st, 2009 | Filed under: Application Linking and
Enabling(ALE), IDOCs

Rules for ALE Optimization

• Review of ALE Integration Scenarios


• Understanding ALE Technology
• Optimizing ALE by understanding top 10 ALE Performance hits
• Optimizing / Sizing ALE interfaces during design phase

Download/view the presentation on ALE Optimization (999).

Sucessfully Leveraging IDOCS

• Understand and follow the evolution of SAP Integration technology


• Examine and review ALE/IDOC interfacing technology
• Using ALE/IDOC for Application for technology and cool tools
• Apply ALE/IDOCS with R/3 and mySAP
• Q&A

Download/view the presentaion of Leveraging IDOCS (1103)


Comments (0) Get FREE daily updates by RSS or e-mail

SAP ALE Distribution Setup in One client


Written by admin on Jul 21st, 2009 | Filed under: Application Linking and
Enabling(ALE)

The Following Instructions walk you through how to set up an ALE Distribution
scenario on one client, so that the same client serves as both the sender and the
receiver system.

This kind of setup will help you to achieve a more economical testing environment
and is also an elegant distribution technique for certain production environment
scenarios, like to enable data distribution in cross-company business processes that
are not supported by standard interfaces.

Read more Here (399).


Archive for the ‘Tips & Tricks’ Category

Transaction Code to Access Other Transaction Code with


Values
Written by admin on Aug 6th, 2009 | Filed under: Tips & Tricks

Many times in SAP, you may come across situations where in the users wants to
have a separate transaction codes for some of the tables which can be easily
maintained or displayed in SM30. There are many reason why someone would need
like this? reasons may be to have a easy to remember transaction code then to
remember the lengthy and complicated table name and so on.. so how do we achieve
this.

Go to SE93 – Click on create and then select either Transaction with Variant or
Transaction with parameters.

I-choose transaction with parameters and now enter in the transaction ‘SM30′, and
in the end you will see a small table control, click on the first line in “Name on
Screen Field” and press F4 and select “viewname” and in the corresponding field
value enter the table name and now go to the second line and press F4 again and
select either show/update (depends either you want to display or maintain it) and
now in the corresponding field value enter ‘X’ then save. Refer the screenshot below
if you are lost. Continue Reading …
Comments (0) Get FREE daily updates by RSS or e-mail

Disable “Import All” in STMS Queue


Written by admin on Oct 3rd, 2008 | Filed under: Basis, Tips & Tricks

Login to your Transport Domain Controller.


Run STMS –> Overview –> System
Choose the system you want to disable “Import All” button. Goto transport tool tab.
Add/Create Parameter “NO_IMPORT_ALL” set it’s value to 1.

Comments (0) Get FREE daily updates by RSS or e-mail

SAP Transactions
Written by admin on Aug 8th, 2008 | Filed under: Tips & Tricks

Easy way to Get SAP transactions?

Want to have the list of SAP transactions handy? Well you don’t have you
download SAP transactions from any website. The SAP table TSTC itself contains
the list of all the SAP Transactions.

So anytime you forget a SAP transaction, just go to the table TSTC and you can get
the entire list of sap transactions or how about using the SEARCH_SAP_MENU?
even that also helps you to find any SAP transaction easily.
Archive for the ‘Material Management (MM)’ Category

Vendor Returns
Written by amandeep.sandhu on Jul 14th, 2009 | Filed under: Material
Management (MM)

In our day-day business practise we come across various reasons where we need to
return back certain stock to vendor due to damages,excess stock, expiry goods ..etc

This process of ‘RETURNS TO VENDOR’ starts with Returns PO and ends with
creation of Credit memo in SAP.

Who are involved in this process:


Site/DC
Vendor

Needed data:
Vendor code
Article code
Required quantity of stock availability
Condition details(Gross price)
tax data

Download the document with screenshots (2622) which helps you on working with
vendor returns.

Posted on behalf of Aman

Comments (1) Get FREE daily updates by RSS or e-mail

The Concept of Movement Types


Written by amandeep.sandhu on Jul 14th, 2009 | Filed under: Material
Management (MM)

When you enter a goods movement in the system, you must enter a movement type
to differentiate between the various goods movements. A movement type is a three
digit identification key for a goods movement. The following table contains
examples
of movement types.
Download the document on movement types (3511) which describes all the
movement types used in SAP.

Posted on behalf of Aman

Comments (0) Get FREE daily updates by RSS or e-mail

Vendor Management Quick Reference


Written by admin on Jun 5th, 2009 | Filed under: Material Management (MM)

The Quick reference on Vendor Management will provide you all the steps in:

• Create a Vendor Master Record– XK01


• Change a Vendor Master Record – XK02
• Display Vendor Master Record – XK03
• Block a Vendor Master Record– XK05
• Flag Vendor Master Record For Deletion – XK06
• Unblock a Vendor Master Record– XK05

Download the quick reference on Vendor Management (2015)

Comments (0) Get FREE daily updates by RSS or e-mail

Purchase Requisition Quick Reference


Written by admin on Jun 5th, 2009 | Filed under: Material Management (MM)

The Quick reference on Purchase Requisition will provide you all the steps in:

• Create Purchase Requisition for Non-Stock Materials- ME51N


• Create a Purchase Requisition for Services – ME51N
• Change a Purchase Requisition – ME52N
• Display a Purchase Requisition – ME53N
• List Purchase Requisitions- General Display – ME5A
• List Purchase Requisitions- General Display – ME5K
• List Purchase Requisitions- By Service – MSRV2
• Display a Purchase Requisition – ME53N
• Reject a Purchase Requisition – ME54N
• Change a Purchase Requisition – ME52N
• Release a Purchase Requisition – ME54N

Download the Quick Reference on Purchase Requisiton (2736).


Comments (0) Get FREE daily updates by RSS or e-mail

Invoice Verification Quick Reference


Written by admin on Jun 5th, 2009 | Filed under: Material Management (MM)

The Quick reference on Invoice Verification will provide you all the steps on:

• Enter Incoming Invoice referencing a PO – MIRO


• Display Invoice Document – MIR4
• Display List of Invoice Documents – MIR5
• Release Blocked Invoices – MRBR
• Cancel Invoice Document – MR8M

Download the Quick Reference on Invoice Verification (2147)

Archive for the ‘Master Data Management(MDM)’ Category

Material Master – Master data Configuration and PR


Written by admin on Apr 6th, 2009 | Filed under: Master Data
Management(MDM), Material Management (MM)

Understand about :

• MM Module data flow


• MM Module Master Data
• Requisition
• RFQ Quotation
• Release Strategy

Download the document on MM - Master Data & PR (2723)

Comments (0) Get FREE daily updates by RSS or e-mail


SAP Master Data Management (FAQs)
Written by amandeep.sandhu on Aug 15th, 2008 | Filed under: Master Data
Management(MDM)

SAP MDM FAQ’s

Q: What is SAP Master Data Management?


A: SAP Master Data Management (SAP MDM) enables information integrity across
the business network, in a heterogeneous IT landscape. SAP MDM helps to define
the business network environment based on generic and industry specific business
elements and related attributes – called master data. Master data, for example,
cover business partner information, product masters,
product structures, or technical asset information. SAP MDM enables the sharing o
f harmonized master data, formerly trapped in multiple systems, and ensures cross
system data consistency –
regardless of physical system location and vendor. It helps to align master data by
providing services that recognize identical master data objects and keep them
consistent. In addition, it
enables the federation of business processes, by providing consistent distribution
mechanisms of master data objects into other systems, within the company and
across company boundaries.

Continue Reading …

SAP MDM FAQ’s

Q: What is SAP Master Data Management?


A: SAP Master Data Management (SAP MDM) enables information integrity across
the business network, in a heterogeneous IT landscape. SAP MDM helps to define
the business network environment based on generic and industry specific business
elements and related attributes – called master data. Master data, for example,
cover business partner information, product masters,
product structures, or technical asset information. SAP MDM enables the sharing o
f harmonized master data, formerly trapped in multiple systems, and ensures cross
system data consistency –
regardless of physical system location and vendor. It helps to align master data by
providing services that recognize identical master data objects and keep them
consistent. In addition, it
enables the federation of business processes, by providing consistent distribution
mechanisms of master data objects into other systems, within the company and
across company boundaries.

Q: What are SAP MDM’s major benefits?


A: SAP MDM:
Helps companies leverage already committed IT investments since it complements
and integrates into their existing IT landscape. Reduces overall data maintenance
costs by preventing multiple processing in different systems. Accelerates process
execution by providing sophisticated data distribution mechanisms to connected
applications. Ensures information consistency and accuracy, and therefore reduces
error-processing costs that arise from inconsistent master data. Improves corporate
decision-making processes in strategic sales and purchasing by providing up-to-date
information to all people.

Q: Can’t you achieve all this by using today’s EAI and/or ETL applications?
A: EAI tools provide the connection between different systems on the technical layer
to ensure message handling, semantic mapping, routing and queuing of data. ETL
tools provide similar functionality but are typically deployed less as a message
handling layer and more as a batch-oriented, massive volume integration
mechanism. As a building block of the SAP NetWeaver platform, SAP MDM
leverages the process integration capabilities of SAP’s Exchange Infrastructure
(SAP XI), but, in addition, also provides services for content consolidation, data
harmonization, central maintenance and controlled data distribution according to
the business process semantics.

Q: How will companies actually use SAP MDM?


A: We distinguish 3 main scenarios.
Content Consolidation: This is the scenario of choice when it is necessary to
consolidate data and objects from different systems.
Features:
Cleanse, normalize data
Aggregate, search, and cross reference data from connected systems
Find duplicates
Example: Business-wide analyses (e.g., global spend analysis), creation of central
catalogs (e.g., of supplier products)

Master Data Harmonization: It is often necessary also to enable the maintenance and
consistent distribution of global attributes and to process and distribute information
centrally. This ensures
that all systems are supplied with the same global attributes after distribution, and
that business processes can be processed securely. The distributed objects can be
provided with additional
attribute values in the target systems.
Features:
All of the Content Consolidation scenario
PLUS
Central management and distribution of global attributes Post-distribution editing
in client systems Controlled distribution of local changes Example: Business partner
administration; central provision of sales articles; definition and administration of
non-variable parts.

Central Data Maintenance: Maintaining a subset of objects or attributes is


sometimes not sufficient. Objects that logically belong together must be changed
and distributed together.
Features:
All of the Content Consolidation scenario PLUS
All of the Master Data Harmonization scenario PLUS
Central control and management of master data information
One-stop data maintenance
Example: Definition of synergy parts; central product data pool supplying product
data to
multiple locations for production, assembly, sales and distribution

Q: Is SAP MDM an xAPP?


A: No. SAP MDM is a building block of the SAP NetWeaver platform. SAP MDM
can be licensed and used stand-alone in heterogeneous environments as well as in
conjunction with other
mySAP.com solutions or xApps in future.

Q: Is SAP MDM an extension of mySAP PLM?


A: No. SAP MDM can be used in conjunction with mySAP solutions including
mySAP PLM or non-SAP solutions.

Q: Why is SAP MDM part of SAP NetWeaver?


A: SAP NetWeaver is an integration and application platform that helps unify and
align people, information and business processes across technologies and
organizations. SAP Master Data
Management (MDM) is a building block of SAP NetWeaver to enable information
integrity across the business network and to facilitate a better communication of
information across a
heterogeneous IT landscape.

Q: What prompted SAP to begin development of SAP MDM?


A: Integration is the key to success in business. And since heterogeneous system
landscapes are commonplace today, only companies with continuous processes and
optimal access to
consistent information can secure themselves a decisive competitive advantage. The
basic principle behind this is the availability of reliable and consistent master data.

Q: Is SAP late to this market?


A: No. There are a few applications announced in the market today, which are
addressing parts of the solution. However those solutions are typically limited to
business partner information only and do not address the process integration needs
to maintain and distribute the harmonized master data. SAP is the only provider
that offers a broad and diverse connectivity and business content
developed by SAP and its partner network, based on SAP’s intimate, longstanding
knowledge of comprehensive business processes in more than 20 industries. This
business content shortens the
development cycle for customers and drives down the cost of integration projects.
Q: SAP has been talking about integration and its ability to provide integrated
business solutions for some time now. However, now you are saying that this will be
the first truly integrated solution available on the market. Are you saying that your
other solutions were not integrated?
A: We are talking about process and data integration in heterogeneous
environments here. So far everybody has been speaking about the integration of
platforms and applications. The
compatibility of data has been implied always. But as efforts and costs to replace
legacy systems are increasing, and companies are paying more attention as to
whether IT solutions offer them
additional value and fast return on investments, SAP Master Data Management
offers customers new opportunities to gain further benefits from existing
implementations and to further secure
their investments. In addition, SAP MDM views consistent information as the key
building block for end-to-end business processes to positively affect process
execution, costs-of-business, and
total cost-of-ownership for business-class IT systems.

Q: Who are the members of the Customer Advisory Council and how were they
selected?
A: Driven by our Industry Business Sectors for Manufacturing and Service
Industries, the Customer Advisory Council formation was a process of identifying
customers that are leaders in the area, with significant expertise in master data
management. Right now customers such as Dow Chemicals, Motorola
Semiconductor Products Sector, Nokia, and German Postbank have agreed to
participate. More candidates from the consumer products and retail industry are
expected.

Q: What is the contribution of these companies to the project and how does SAP
collaborate with them to meet future market requirements?
A: SAP is collaborating with those companies in order to verify the implementation
concepts and to jointly identify the development priorities. All participating
companies have significant
expertise in master data management topics already and are looking for standard
solutions to become available on the market. There is not yet a decision from those
companies to actually use this new solution, however SAP’s goal is to win those
customers to implement and run SAP MDM.

Q: When will SAP MDM become available? How will it be priced?


A: Customer ramp-up is scheduled to begin in September 2003. It will be priced
separately as an engine, based on the number of managed data objects in the
connected systems.

Q: How will SAP MDM be implemented?


A: Implementation services will be provided by SAP’s Global Professional Services
Organization as well as together with selected system integrators.
Q: Will this solution replace the existing master data distribution techniques
between mySAP CRM and SAP R/3 (SAP BC, CRM middleware) or SAP R/3 and
mySAP SCM (CIF interface)?
A: Those interfaces including ALE will continue to be used in parallel to process
operational data. It is not planned to replace those interfaces with SAP MDM.

Q: Will it be possible to use SAP MDM only with SAP Exchange Infrastructure or
can a company also use other EAI tools?
A: The use of the SAP Exchange Infrastructure is the foundation for SAP MDM.
SAP solutions are powered by the SAP NetWeaver platform with high emphasis on
interoperability to :NET and
J2EE/Java.

Q: For which 3rd party products will SAP provide the adaptors?
A: In the first phase the adaptors to 3rd party products will be provided on a
project basis. SAP plans to make selected adaptors to 3rd party systems to a part of
the standard solution in future.

Q: Will the solution provide the adaptors to all SAP solutions?


A: SAP MDM will provide adaptors for mySAP CRM, mySAP SRM and SAP R/3
in the first phase. MySAP SCM will be supported via SAP R/3 in the first phase. In
the next phase, a direct
adaptor will also provided for mySAP SCM.

Q: What objects will be supported by SAP MDM? What services will be offered?
A: The initial release of SAP MDM will support the following master data objects:
business partner, product master, product structures, document links, technical
assets and change masters.
Services provided depend on the type of objects and will include maintenance of
objects, search for objects, workflow, mass changes, change notifications, duplicate
checking, and notifications
for object creation and discontinuation.

If you like this post, you may as well like these too:

1. SAP Controlling FAQs – Master Data 1. List the five types of master data in cost
center accounting (CCA). • Cost centers • Cost elements • Activity types • Statistical
key figures • Resources 2. What...
2. SAP Asset Accounting FAQs – Master Data 1. Describe the function of
depreciation areas. Depreciation area 01, which can be set up as the book depreciation, can
make automatic postings to the general ledger. Other depreciation areas...
3. SAP Asset Accounting FAQs – Old Assets Data Master 1. Base on quantity,
what are the three methods of old asset data transfer? In what status does the company code
have to be so that the transfer is possible?...
4. Difference between Master Data, Transaction Data and Customizing Data
Customizing Data refers to the customized information for a particular Client. This includes
data such as payment terms, discounts, pricing, tolerance limits, etc., which you do not
normally change on...
5. Material Master – Master data Configuration and PR Understand about : MM
Module data flow MM Module Master Data Requisition RFQ Quotation Release Strategy
Download the document on...

Archive for the ‘IDOCs’ Category

SAP IDOC Development Transactions


Written by admin on Aug 14th, 2009 | Filed under: IDOCs

Useful SAP IDOC Development Transactions

1. BD55 Conversion rule user exit. Link conversion rule user exit to the
different system \ partner combination.
2. WE19 EDI test tool. Use to test inbound Function module changes.
3. WE31 Segment create
4. WE30 Create IDoc extension type
5. WE82 Link Release detail to Extension IDoc Type
6. WE57 Assign function module to logical message and IDoc type

Comments (0) Get FREE daily updates by RSS or e-mail

SAP IDOC Administration Transactions


Written by admin on Aug 14th, 2009 | Filed under: IDOCs

Useful SAP IDOC related transactions

1. WE09 / WE02 IDoc lists according to content. View IDocs via specific IDoc
number or business application detail contained within the contents of a
segment.
2. WE05 View IDocs
3. WE60 IDoc type documentation tool
4. WE20 Partner profile configuration. Add partner detail together with
inbound and outbound relationships. We also incorporate message control
on the outbound IDocs. Utilize the organizational units to trap functional
errors for further processing.
5. BD87 Reprocess IDocs in error or waiting for action. (Both inbound and
outbound in 4.6. Use BD88 in prior versions)
Comments (0) Get FREE daily updates by RSS or e-mail

ALE Optimization and Sucessfully Leveraging IDOCS


Written by admin on Jul 21st, 2009 | Filed under: Application Linking and
Enabling(ALE), IDOCs

Rules for ALE Optimization

• Review of ALE Integration Scenarios


• Understanding ALE Technology
• Optimizing ALE by understanding top 10 ALE Performance hits
• Optimizing / Sizing ALE interfaces during design phase

Download/view the presentation on ALE Optimization (999).

Sucessfully Leveraging IDOCS

• Understand and follow the evolution of SAP Integration technology


• Examine and review ALE/IDOC interfacing technology
• Using ALE/IDOC for Application for technology and cool tools
• Apply ALE/IDOCS with R/3 and mySAP
• Q&A

Download/view the presentaion of Leveraging IDOCS (1103)

Comments (0) Get FREE daily updates by RSS or e-mail

SAP for BEA WebLogic User’s Guide


Written by admin on Jul 17th, 2009 | Filed under: Application Linking and
Enabling(ALE), IDOCs

This document is written for system integrators who develop client interfaces
between SAP and other applications. It describes how to use the iWay Application
Adapter for SAP integrate SAP IDocs, RFC, BAPI and BEA WebLogic Server. It is
assumed that readers understand Web technologies and have a general
understanding of Microsoft Windows and UNIX systems.

• Provides an overview of the iWay Application Adapter for SAP. Discusses


key features and functionality of the adapter.
• Describes how to configure your SAP system for inbound (client) processing
• Describes how to create XML schemas for SAP business objects using the
iWay Servlet Application Explorer (iAE).
• Describes how to use iWay Servlet Application Explorer (iAE) to connect to
SAP and listen for events.
• Describes how to create and publish an iWay Business Service using the
iWay Servlet Application Explorer (iAE).
• Describes how to configure and test your SAP system for event processing.
• Describes how to use the iWay Java Swing Application Explorer in BEA
WebLogic Workshop to create XML schemas for SAP BAPIs, RFCs, and
IDOCs.
• Describes how to access Web services created for an SAP Business
Application Programming Interface (BAPI) and an SAP Remote Function
Call (RFC) using WebLogic Workshop.

View/Download the ebook (874)

Comments (0) Get FREE daily updates by RSS or e-mail

IDOC Overview
Written by admin on Jul 17th, 2009 | Filed under: IDOCs

A simple overview of an IDOC. IDOC through Inbound and Outbound Processing

Good document on working with Idocs.


Covers:

• Understand the basics of IDOC, Basic Type, Message Type.


• Quick Reference transactions (SALE, WEDI, WE02, PFAL, BD21, BD22,
WE19, BD73, WE60, BD53)
• Partner Profiles
• Creating Reduced Message Type using BD53
• Maintain distribution model
• How to read an IDOC
• Testing Inbound/Outbound IDOC
• Useful Function Modules

Download the document on IDOC Overview (2218)


1. What is full form of BDC Session?
Batch Data Communication Session.
2. What are the steps in a BDC session?
The first step in a BDC session is to identify the screens of the transaction that the
program will process. Next step is to write a program to build the BDC table that will
be used to submit the data to SAP. The final step is to submit the BDC table to the
system in the batch mode or as a single transaction by the CALL TRANSACTION
command.
3. How do you find the information on the current screen?
The information on the current screen can be found by SYSTEM à STATUS command
from any menu.
4. How do you save data in BDC tables?
The data in BDC tables is saved by using the field name ‘BDC_OKCODE’ and field
value of ‘/11’.
5. What is the last entry in all BDC tables?
In all BDC tables the last entry is to save the data by using the field name
BDC_OKCODE and a field value of ‘/11’.
6. What is a multiple line field?
A multiple line field is a special kind of field which allows the user to enter multiple
lines of data into it.
7. How do you populate data into a multiple line field?
To populate data into a multiple line field, an index is added to the field name to
indicate which line is to be populated by the BDC session (Line index).
8. Write the BDC table structure.
BDC table structure
FIELD TYPE DESCRIPTION
Program CHAR (8) Program name of transaction.
DynPro CHAR (4) Screen number of transaction.
DynBegin CHAR (1) Indicator for new screen.
Fnam CHAR (35) Name of database field from screen.
Fval CHAR (80) Value to submit to field.
9. Does the CALL TRANSACTION method allow multiple transactions to be processed
by SAP?
No. The CALL TRANSACTION method allows only a single transaction to be
processed by SAP.
10. Does the BDC-INSERT function allow multiple transactions to be processed by
SAP?
Yes.
11. What is the syntax for ‘CALL TRANSACTION’?
CALL TRANSACTION trans [using bdctab MODE mode].
Three possible entries are there for MODE.
A - Show all screens.
E - Show only screens with errors.

N - Show no screens.

Das könnte Ihnen auch gefallen