Beruflich Dokumente
Kultur Dokumente
com SAPtipsJournal
Page 1
ABAP Programming In BW
By Arthur "Pat" Pesa, arthurpesa, inc.
Editor's Note: With all the talk mine the what’s, where’s and targets. Therefore, we will need to
about NetWeaver and SAP® Java how’s of ABAP programming in be specifically aware of how we
Connector and other hot tools, BW. These "tips" on ABAP and proceed with our data or record
you'd think ABAP was a thing of BW are written with BW version updates and where we decide to
the past. But not so, as BW 3.0 and R/3 4.6C in mind, but place ABAP programming that
expert Pat Pesa can attest. In most of them will apply to any will manage these updates. Hav-
this excellent "best of" article, versions of R/3 from 4.x and up, ing said that, we can now exam-
Pat shares the most valuable and any versions of BW from 2.0 ine what possibilities exist for
ABAP techniques he has used on and up. using ABAP to customize our BW
BW projects. He starts by environment.
addressing the key questions:
What are the uses of ABAP in What Can We Do With
BW? How is programming in In order to ABAP in BW?
BW different than programming As with anything, in SAP the
in R/3? What ABAP tools are understand how words and phrase "ABAP pro-
available in BW? Then, Pat digs gramming" routinely surface as
into some technical examples of topics and questions during
ABAP-BW in action. This arti- ABAP is used in BW, implementation. However,
cle provides technical managers between SAP R/3 and BW, there
with a handy overview of Pat's we should have a are distinct differences between
February/March 2004 Volume II Issue 1
correct business processes within areas without impacting other will NOT be doing on a general
BW. During the design and blue- functionality. Our examples for basis in BW is building screens
print stage, a core functional this article will include R/3 data- and multiple user exits in ABAP
process is the determination of the source modifications and the cre- to gain additional functionality.1
corresponding business logic ation of generic extractors in R/3 This is the distinct difference in
found in R/3 or legacy data sys- for use with BW. BW as it relates to R/3. So if we're
tems and how to accomplish the not using ABAP for user exits and
same logic in BW. Fortunately To get the ball rolling, I would screens, then how will we use
SAP® has provided several struc- like to start off with the following ABAP? In BW, we will use ABAP
tured paths to follow in order to considerations. Remember that in to transform our data as require-
implement this business logic. In SAP BW, most everything is inter- ments dictate, as well as provide
this article, I will lay the ground- connected, and we share a great additional processing during
work from which we can deter- deal of data amongst several data extraction and updates.
1 One thing to note: we are provided with one user exit in SAP R/3 that will enable the management of data being extracted and one user exit in BW that will enable the
management of data being queried.
time to time in order to create the beginning of a BW project in BW, thus gaining a great deal of
what our requirements dictate. revolves around how much ABAP functionality, without writing an
For the purposes of this article, programming will be necessary. array of user exits as found in R/3.
we will assume that the reader Following the construct of a typi-
already has a grounding in these cal R/3-BW integration, one Let’s take a look at where we
basic ABAP concepts, including would assume that all ABAP are able to augment our BW
the ABAP Workbench. would be done by a team of pro- development with ABAP and
grammers and that the BW con- what that may mean to the sys-
Our approach to ABAP develop- sultants would furnish documen- tem performance. Generally,
ment in BW will follow the simple tation around the changes to be when adding code, we can
guidelines found in Figure 1. made. However, in BW, the line assume some type of run time
overhead in the form of process-
• Requirements ing time or memory impact.
However, when programmed in
o Programming actions in the form of pseudo-code or a high level flow of data
SAPtipsJournal
ers 99 percent of the Option 1 • Add fields to append structure for an existing extract structure.
examples of ABAP
development in BW. I • Add corresponding ABAP logic to fill these fields.
say that because Option 2 • Create a table or view that represents our data set.
there is always that • Use Transaction RSO2 to create a generic extractor.
one exception in
which a customiza- • Add code to function module or user exit to fill fields or modify data in
tion has been done structure during extraction.
outside this matrix.
Now that we have Figure 3: ABAP Programming Options in R/3 for BW
covered the what’s
and where’s of ABAP
programming in BW,
we can have a look at
User Exit Description
the how’s.
SAPLRSAU_001 Transactional data user exit
How Do We
SAPLRSAU_002 Master Data User exit
Manage Our
Programming SAPLRSAU_003 Optional
During the
Development SAPLRSAU_004 Optional
Phase?
Let’s start at the Figure 4: R/3 User Exit Examples in BW
February/March 2004 Volume II Issue 1
beginning. By the
beginning, I mean
the point on our BW
project where we first start look- A commonly overlooked step user exit we want to use. Using
ing in R/3 and figuring out what in adding fields to extract struc- transaction code CMOD, go to
we can modify prior to or during tures and filling them with data your BW project, i.e., "Z_BW".
extraction. As a rule of thumb, is actually making the newly This project will be found with-
the concept here will be as fol- added fields visible to the BW in the customer namespace.
lows. In R/3, we have access to target system. Once the fields are Once you have found the correct
the raw transactional data set we added to the extract structure project, choose "display compo-
will want to modify. We have sev- and you have saved and activat- nents" and hit F7. This will dis-
eral options here, but primarily, ed both the append structure play the BW user exit compo-
we can either modify an existing and the extract structure, you nents. You should find four user
data extractor or create a new will need to go to transaction exits. The configuration of these
SAPtipsJournal
customized extractor from the code RSA6 -> Post Processing user exits may differ from sys-
ground-up. Let’s look at the two Datasources and find the data- tem to system. Figure 4 con-
options in the table in Figure 3. source you modified. Double tains the descriptions of the
click on that datasource and four user exits found in a
Option 1 make sure you uncheck the CMOD BW Project.
This is the most straightforward "hide" check box for the added
modification in ABAP and is com- fields. Otherwise, these fields To provide an example, let's
monly employed to add data will not show up in the newly consider a standard-delivered
requirements that do not exist in replicated datasource in BW. data extractor found within
the standard extractor. We do this Logistics Cockpit. This extrac-
using the basic concept of append At this point, we can look at tor is responsible for extracting
structures for our additional how we can populate these purchase order item data found
fields. Once we have added our fields with data in the R/3-to- in R/3. For our example, let’s
fields and activated our extract BW user exit in R/3. To provide assume you have added several
structure, we will be able to see some background, I will briefly fields to the 2LIS_02_ITM
these fields in the user exit. mention how to navigate to the extract structure.
1. When using multiple tables, 1. Calling transaction SE11 and definition as a unit test. This
you will have to provide the setting the radio button to will give you a preliminary
joins for the tables based on View, we input the Z****** fitness test for the generic
the keys found in each table. name for our view and click datasource.
If you don’t, then the system Create.
will make each field within Now let's consider the second
your view a key for the view. 2. When prompted for a devel- option in creating a generic data-
This will impact view per- opment class, input the cor- source. First, you will need to
formance during runtime. rect development class and define a structure that will serve
click save. This will bring us as an extract structure for your
2. You will have to include unit to the initial view definition program. In creating an extract
references for quantity and screen. structure please refer to the fol-
price data elements. You lowing rules:
should use the same reference 3. Begin by adding the fields
SAPtipsJournal
field found within the data ele- you need, supplying the base • Make sure you include units
ment itself. This reference field table names as well. You will for quantities and price data.
is simply added to the view. need to complete all the steps
required to finish the view. • Make sure you include the
3. You should consider using appropriate keys for the data
the top-level tables within 4. Once done and active, check you will be working with,
your view even in the event to see how many records your such as document numbers
you will not use fields from view returns and compare and/or item numbers.
these tables. For example, that number to the number
when creating a view from of records found in the base As for the extract function
"Material Plant data", table(s). module, you should plan on cre-
MARD, you should join the ating a simple function module
"Material Master general 5. Once you have your view and following the guidelines
data", MARA, document completely finished, you can found in the example function
number with the MARD doc- go to transaction RSO2. module RSAX_BIW_GET_DATA.
The information in our publications and on our Website is the copyrighted work of Klee Associates, Inc. and is owned by Klee Associates, Inc. NO WARRANTY:
This documentation is delivered as is, and Klee Associates, Inc. makes no warranty as to its accuracy or use. Any use of this documentation is at the risk of the user.
Although we make every good faith effort to ensure accuracy, this document may include technical or other inaccuracies or typographical errors. Klee Associates, Inc.
reserves the right to make changes without prior notice. NO AFFILIATION: Klee Associates, Inc. and this publication are not affiliated with or endorsed by SAP AG.
SAP AG software referenced on this site is furnished under license agreements between SAP AG and its customers and can be used only within the terms of such
agreements. SAP AG and mySAP are registered trademarks of SAP AG. All other product names used herein are trademarks or registered trademarks of their
respective owners.
February/March 2004 Volume II Issue 1
SAPtipsJournal