You are on page 1of 37

0

SAP AG 1999
BAPI Basics
Test Data for the Asset Master
Transfer of Assets Using BAPIs
Contents:
BAPIs
SAP AG BC420 11-1

0.2
SAP AG 1999
Describe external data transfer using BAPIs
Transfer asset aster data into !"# using BAPIs
At the conclusion of this unit $ou %ill be able to:
BAPIs: Unit &b'ecti(es
SAP AG BC420 11-2

0.#
SAP AG 1999
Course &(er(ie% Diagra
Daten)bernahe
D* +or,bench
-.M +or,bench
Princi/les of .tandard
Data Tansfer
D
i
r
e
c
t

I
n
/
u
t
BAPI
T
A

!
e
c
o
r
d
e
r
Course &(er(ie%
B
a
t
c
h

I
n
/
u
t
C
a
l
l

T
r
a
n
s
a
c
t
i
o
n
#
0DI
Basics
1
2
3
4 50
6
50
6
55
53
52
55
52
5
2
5555
5#
SAP AG BC420 11-3

0.3
SAP AG 1999
BAPIs
BAPI Basics
BAPI Basics
Test Data for the Asset Master
Test Data for the Asset Master
Transfer of Assets Using BAPIs
Transfer of Assets Using BAPIs
SAP AG BC420 11-4

0.1
SAP AG 1999
&(er(ie% of .tandard Transfer Using BAPIs
Flat SAP
Structure
SAP Record
Layout
Structure
SAP IDoc
Structure
BAPI
This unit deals with the transfer of legacy data using BAPIs.
SAP AG BC420 11-5

0.7
SAP AG 1999
Interfaces for .tandard Transfer Using BAPIs
SAP System
8! 8!
9I 9I
MM MM
SAP IDoc
Structure
BAPI
BAPI
BAPI
External data in the IDoc format is required for calling BAPIs from the DX-B. !a""ing tools#
such as the $egacy %ystem !igration or&'ench ($%!)# must therefore 'e used to con*ert the
external data to the IDoc format.
SAP AG BC420 11-6

0.2
SAP AG 1999
Business A//lication Prograing Interface
Business A//lication Prograing Interface
A BAPI is a /recisel$:defined interface for /rocesses
and data of a business a//lication s$ste and is
i/leented as a ethod
of an ob'ect in the Business &b'ect !e/ositor$ ;B&!<.
Each BAPI that creates an o'+ect instance or changes the data 'elonging to an o'+ect lea*es the
data'ase consistent. All data'ase changes are carried out com"letely or not at all.
The ,-.!!IT ./01 command to sa*e the data'ase changes are not called 'y the BAPI itself.
They ha*e to 'e called 'y the calling "rogram.
BAPIs are non-dialog methods that do not ha*e any screen dialogs with the user.
SAP AG BC420 11-7

0.4
SAP AG 1999
Characteristics of BAPIs
&b'ect:oriented
I/leented as ob'ect ethods of the B&!
.table interface
The interface of a BAPI is =fro>en?
Can be used internall$ and externall$
BAPIs can be used in !"# and fro external s$stes
@o /resentation la$er
Callers ha(e to dis/la$ the results thesel(es
.uccess and error essages in ex/ort /araeter
!0TU!@
.tructure or internal table ;de/ending on BAPI <
BAPIs can also 'e called 'y external clients as methods of o'+ects that are instantiated in the client
itself.
%AP guarantees that the interface of an %AP BAPI will not 'e changed.
Also within /23 BAPIs can 'e used locally to access 'usiness data. This ma&es customer and "artner
enhancements of /23 functionality easier.
The calling "rogram must "resent the data that is "assed to or from a BAPI.
The return parameter RETURN contains success and error messages of the BAPI and de"ending
on the /23 /elease it has the Dictionary structure BAPI/ET4/5# BAPI/ET4/56# BAPI/ET6#
BAPI/ET7 or BAPI/ET789IX. The (common) rele*ant fields of these structures are:
T;PE (message ty"e: %(uccess)# E(rror)# (arning)# I(nformation) ) <
ID (message class) < 54!BE/ (message num'er) < !E%%A=E (message text) <
!E%%A=E8>6 # !E%%A=E8>7 # !E%%A=E8>3 # !E%%A=E8>? (message *aria'les)
If the message transfer is successful# /ET4/5 is either em"ty (all fields ha*e their initial *alue) or
the field T;PE contains the *alue @%@. /efer to the documentation on the BAPI in question to find
out which o"tion a""lies.

SAP AG BC420 11-8



0.6
SAP AG 2001
The Business &b'ect =AssetA
BU.5022 : Asset accounting ; fixed asset <
Asset
9ixed asset
co/onent
Tangible
asset
9inancial
asset
Intangible
asset
5#002
5#005
5#00#
5#003
5#001
8
.
B&
In this exam"le of using a BAPI fixed assets are to 'e transferred. The 'usiness o'+ect B4%6A77 can
'e shown in the B. data model. Bere you will also find documentation on the to"ic 1fixed assets,
here. Path: Tools -> ABAP Workbench -> Development -> Business Object Builder; Display
B!"#$$ ; then "ress the BO% data model 'utton< then choose menu "ath tilities -> &raphic'
The 'usiness o'+ect 1asset, is an o'+ect# a right or another item owned 'y the enter"rise that is
intended for long-term use# and can 'e indi*idually identified in the 'alance sheet. The de*elo"ment
of the *alues of an asset can 'e *iewed for the asset as a whole# or can 'e *iewed for the asset@s
com"onent "arts (su'-num'ers). Exam"le: 9ixed asset ,"rinting "ress, with asset com"onents
,rollers" and ,re"lacement s"indle.,
SAP AG BC420 11-9

0.50
SAP AG 1999
The BAPI ACreateInclBaluesA
BAPI
9ixedAsset.CreateInclBalues
Create fixed asset with values ( initial data load)
Tools Business Frameor! BAP" Broser
9inancial accounting
Asset accounting
9ixedAsset
Com#an$Co%e
Asse&
Su'(um'er
C)an*e
+++
CreateInclBalues
,
,
,
,
-
-
+++ +++
-e&)o% Crea&e"n.l/alues
01 'usiness o'2e.& Fi3e%Asse&
S)or& %es.ri#&ion Asse&s i&) 4alues++
9unction odule BAPIC9I*0DATA..0T...
F"567ASS6T8C96AT6++
A:6 messa*e &$#e
+++
+++
+++
.ne of the methods of the 'usiness o'+ect B4%6A77 is CreateInclValues and it is used to transfer
assets into /23.
The function module# BAPI89IXEDA%%ET8.>/TA0E8-/EATE# descri'ed earlier that con*erts
the BAPI can 'e dis"layed in the BAPI Explorer or the Business Obect Builder.
Path: Tools -> Business (rame)ork -> BAP* +,plorer; (inancial Accountin- -> Asset Accountin-
-> (i,ed Asset; !elect (i,edAsset'
SAP AG BC420 11-10

0.55
SAP AG 1999
BAPI Processing in the D*:+B
SAP IDoc
structure
C&MMIT
+&!D
U/date
+rite
.tart
log
BAPI
If a BAPI is to 'e used to transfer external data# the DX-B is used.
The DX-B needs to ha*e the external data in an IDoc format file. The indi*idual ste"s within the
DX-B are:
/ead the external data in "ac&ets
9orward the "ac&et to A$E in'ound "rocessing.
In A$E in'ound "rocessing the data is "assed in records to the BAPI.
The return "arameters from the BAPI are collected together and returned to the DX-B.
The DX-B e*aluates the status records in the returned.
A log is written.
If there is an error# either an error file is created or IDocs are created directly in /23. (;ou can set
these o"tions when you create the tas& in the DX-B).
Then the DX-B transmits a -.!!IT ./0 to com"lete the whole "rocess consistently.
SAP AG BC420 11-11

0.52
SAP AG 1999
Co/arison of the -.M+ and the D*+B
DB
BAPI
BAPI
A-0inbound /rocessing
IDoc:
9orat
Data transfer in the
LS! %ith a BAPI
Data transfer in the
D"#!$ %ith a BAPI
Create
IDoc
Call
9I
asset
5
#
2
!ead
IDoc
Create 3
call 5
creates 2
9I
asset
Con(ert data
The file in IDoc format could 'e "rocessed either in the $%! or in the DX-B.
As the gra"hic shows# in the left-hand case ($%!) an IDoc is first created in the /23 data'ase#
read# and then "assed to the BAPI.
In the DX-B the file in IDoc format is "assed directly to the BAPI. 5o IDoc is created in the
data'ase which s"eeds u" the transfer "rocedure.
SAP AG BC420 11-12

0.5#
SAP AG 1999
BAPIs
BAPI Basics
BAPI Basics
Test Data for the Asset Master
Test Data for the Asset Master
Transfer of Assets Using BAPIs
Transfer of Assets Using BAPIs
SAP AG BC420 11-13

0.53
SAP AG 1999
Create data record online
Eenerate test data
-ogical s$ste
Dis/la$ " change test data
Progra
9I
asset
5
2
#
3
1
Creating Test Data
9or some o'+ects# you can create test data for BAPIs using the DX-B. The file you create contains
the data in IDoc format.
To do this# create a data record in the %AP %ystem using the online transaction (6).
=enerate a file containing test data. 4se the .reate /ile )ith data function in the DX-B tools. The
system calls a "rogram in the a""lication# in which you s"ecify the data record you ha*e created (for
exam"le# 'y com"any code and document num'er).
This "rogram reads the rele*ant data record from the data'ase (7) and generates an out'ound IDoc
on the data'ase (3). The DX-B triggers the A$E out'ound "rocessing. This generates a file in IDoc
format to 'e sent to the external system# according to the "artner "rofile (?). The DX-B co"ies this
file (C) and changes the sender and recei*er# so that this file can 'e used for A$E in'ound "rocessing.
This file can 'e used 'oth for testing and as a tem"late that s"ecifies how the data from the external
system are to 'e "re"ared.
Important: %o that the file can 'e generated# the DX-B requires a logical system that is
automatically created 'y the DX-B in /elease ?.D-. In /eleases ?.DA2B the user has to create this
logical system and associated "artner "rofile in the %AP %ystem.
SAP AG BC420 11-14

0.51
SAP AG 1999
&nline: Creating a Behicle
Asse& .lass #500
Com#an$ .o%e 5000
;uan&i&$ 5
-as&er %a&a
Eeneral 0ri*in
Time-%e#en%en&
Allo.a&ions (e& or&) &a3 "nsuran.e
Selection
Descri/tion
Chevrolet Corvette
Ca/itali>ed on
01.01.1998
Cost center
1000
:i.ense #la&e num'er
<o#&ional=
603-EFD (CT)
%ehicles
To dis"lay asset master data# choose Accountin- -> (inancial Accountin- -> Assets -> Asset
This slide descri'es the creation of an asset (a *ehicle) in asset class 36AA (*ehicles). The "arameters
Description and .ost center are required.
Description: Descri"tion of asset
.apitali0ed on: The system fills this field with the asset *alue date (the first "osting that acti*ated the
asset). The acti*ation date is the *alue data of an asset# and can 'e manually set when creating an
asset master record. The manually set date does not acti*ate the asset# 'ut is used as a suggested asset
*alue date for the first acquisition "osting (required for data transfer).
.ost center: The %AP system uses the cost center assignment in the asset master record to determine
the cost center affected 'y later asset "ostings.
Im"ortant to note: After you sa*e the asset# the Asset number a""ears in the status 'ar. rite this
num'er down and you can use it later to create an asset test data record from the DX-B.
SAP AG BC420 11-15

0.57
SAP AG 1999
Eenerating Test Data in IDoc 9orat
Go&o
Anal$se 1iles an% %a&a s&ru.&ures
0'2e.& &$#e
Data Transfer Progra
BU.5022
Tas! &$#e -oad data into !"#
Pro*ram &$#e BAPI
Pro*ram > me&)o% C!0AT0I@C-BA-U0.
File &$#e
In/ut file
P
File name
TestCasset.txt
Crea&e 1ile i&) %a&a Maintain logical sste!
To create test data in the IDoc format in the DX-B# choose &oto -> Tools -> (iles and data
structures. -hoose .reate /ile )ith data. The system then as&s for a logical system:
Definition of ,logical system,:
The distri'ution of data 'etween systems requires that e*ery system in a networ& is uniquely
identified# thus the ,logical system,. A logical system is an a""lication system in which the
a""lications all access the same data'ase. In %AP terms# a logical system is a client. In an A$E
en*ironment# clients are assigned to logical systems.
SAP AG BC420 11-16

0.52
SAP AG 2001
Logical system ?
0nter /artner s$ste
&ou must enter a lo'ical
system
Create logical s$ste
Define a logical s$ste ;for exa/leF D*+B< in Custoi>ing
;transaction .A-0<
Create a /artner /rofile for this s$ste
A /artner /rofile ;transaction A+020A< ust be created for the
logical s$ste D*+B 'ust defined.
The outbound /araeters ust be defined for this /rofile. The
essage t$/e is i/ortant here.
./ecif$ing the -ogical .$ste
$ogical systems are defined in -ustomiEing (transaction %A$E). The logical system DXB is used
in this exam"le.
Path: Basis -> Distribution 1A2+3 -> !endin- and %eceivin- !ystems -> 2o-ical !ystems -> De/ine
2o-ical !ystems
.nly one "artner "rofile has to 'e defined for this logical system.
A "artner "rofile is defined in transaction E7A for the logical system.
The new "artner num'er is defined under the "artner ty"e ,$%,.
The out'ound "arameters of the logical system must 'e set. (Press the ,F1 icon# o"en the tem"late
with the out'ound "rocessing "arameters). !essage ty"es a""ro"riate for the BAPI are entered
here.
The message t!pe is the most im"ortant field here. !essage ty"es are assigned to BAPIs in the
transaction BDB=.
;ou ha*e to select .ollect *Docs under out'ound "arameter !ode.
SAP AG BC420 11-17

0.54
SAP AG 1999
Creating Test Data
7is#la$ 1ile
S&ru.&ure Con&en&s
+++
(he a))lication data starts here*
(he +e'innin' of the
record contains the
se'ment information*
7ou'le-.li.! re.or% 4
EDI_DD40 Ctrl.Rec. EDI_DC40 40000000146A 24 FIXEDASSET..
EDI_DD40 Ctrl.Rec. E2FIXEDASSET_CREATEINCLVALU000400..
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG011X000 400 00000600000102XXX
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG002X000 400 00000800000102XX X
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG00X000 400 00001000000102 XXXXXXX...
EDI_DD40 Ctrl.Rec. E2BP1022_!E"000 400 000002000001021000
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG001000 400 00000000001020000100B#$
EDI_DD40 D%t% rec. E2BP1022_FEGLG011000 400 00000&000001020000000
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG001X000 400 00000400000102 XX XXXXX
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG0020000 400 00000'000001021((80&0100...
EDI_DD40 Ctrl.Rec. E2BP1022_FEGLG000000 400 00000(000001021(000101(((..
The slide shows a file in IDoc format with a sam"le asset from asset class 36AA (*ehicles).
SAP AG BC420 11-18

0.56
SAP AG 1999
Detail Dis/la$ of Test Data
Field ,ame Short Descri)tion Field Contents
.egent
-A(7T Client
70C(@-
S6G(A-
IDoc nuber
.egent nuber
PSG(@- @o. of /arent segent
A::6/6:
S6G(@-
02
.DATA A//lication data 00003100Chevrolet Corvette 30000000...
(o dis)lay a))lication data
details- clic. this icon
3100
ASS6TC:ASS
Chevrolet Corvette
76SC9"PT
76SC9"PT2
+++
The a""lication data of the fourth segment contains# for exam"le# the descri"tion of the assets. The
segment contents can 'e examined in detail 'y selecting the magnifying glass icon.
SAP AG BC420 11-19

0.20
SAP AG 1999
BAPIs
BAPI Basics
BAPI Basics
Test Data for the Asset Master
Test Data for the Asset Master
Transfer of Assets Using BAPIs
Transfer of Assets Using BAPIs
SAP AG BC420 11-20

0.25
SAP AG 2001
Ma//ing Progra ;-.M+<
Con(ersion
B .tructure !elationshi/s
B 9ield Assignents
B Con(ersion !ules
B .ource .tructure Definitions
BAPI
hen transferring data using BAPIs# the $%! should only 'e used as a ma""ing tool. The file
created contains the data in the required IDoc format. The DX-B can then transfer this data to the
%AP %ystem 'y calling the BAPI.
SAP AG BC420 11-21

0.22
SAP AG 1999
Maintain ob'ect attributes
Maintain source structures and source fields
Maintain structure relationshi/s
Maintain field a//ing and con(ersion rules
!ead data
Con(ert data
.tart creating IDocs
.tart IDoc /rocessing
Create IDoc o(er(ie%
.tart IDoc /ost:/rocessing
SAP IDoc
Structure
BAPI
Main .te/s for Data Transfer %ith BAPI
The wor& ste"s for transferring IDocs are the same as for transferring data using BAPIs.
The data is con*erted into the IDoc format in the $%!. This results in a file that is transferred to a
BAPI using the DX-B.
SAP AG BC420 11-22

0.2#
SAP AG 1999
.tandard Batch " Direct In/ut
Batch In/ut !ecording
BAPI
IDoc
0'2e.& &$#e > "m#or& &e.)niCue
Basi. &$#e
B@S1022
BAPI
Business o'2e.& me&)o% <BAP"=
Business o'2e.&
-e&)o% C96AT6"(C:/A:@6S
F"5678ASS6T8C96AT6"+++
-essa*e &$#e
F"5678ASS6T8C96AT6"+++
Maintain &b'ect T$/e Attributes : BAPI
SAP AG BC420 11-23

0.23
SAP AG 1999
Source fields
LEGACY_ASSETS
Compan code C!00"# Compan code
Class C!00"# Class
Cost center C!00"# Cost center
$usiness area C!00"# $usiness area
%ate %%&Y !00'# %ate
Asset C!0(0# Asset
)ehicle re*istration
C!010# re*. num+er
Sequential file with external asset data
5000 250A500660005.05.64BM+ ... 71#:*AD ;CT<
5000 220A500660005.05.64Ben> ... 421:AGG ;CT<
...
0xa/le: .tructure of 0xternal Data
In the exam"le the external asset data should ha*e the following structure:
Exam"le of external data records:
-om"any code: 6AAA
Asset class: 76A or 77A
-ost center: A6AA
Business area: GGAA
Date: A6.A6.GH
>ehicle registration: DC3-XA0 (-T) ...
SAP AG BC420 11-24

0.21
SAP AG 2001
Asset Class (translation" lea#ing $eroes)
210 -D 00003100
220 -D 00003100
Cost Center (translation)
A100 -D 1000
Co/an$ Code (!ove)
Ca/itali>ation Date (!ove)
Business Area (!ove)
9ill * .egents (constant % &'()
(hese fields indicate field chan'es*
0000#500 Che(rolet Cor(ette #0000000...
* * * * C ..
Chan'e which fields/
1 ) 3 * +
Ma//ing !ules for -egac$ Asset Data
The IDoc num'er must 'e a sequential num'er.
The code for num'ering is "ro*ided in the $%! and must 'e chec&ed (see next slide).
;ou must define translations for the Asset class and .ost center fields.
9or the .ompany code# .apitali0ation date# and Business area fields# you +ust ha*e to set transfers
(!.>E).
%"ecial fields:
After e*ery segment with a""lication data comes a segment with change indicators for this
a""lication data. 9or exam"le# if the third field of an a""lication segment is to 'e changed# the
corres"onding third field of the following X segment must 'e mar&ed with IXJ.
SAP AG BC420 11-25

0.27
SAP AG 1999
-.M+: 9illing * .tructures
if not E1$,10((_-EGLG001.ASSETCLASS is initial.
E1$,10((_-EGLG001/.ASSETCLASS 0 1/1.
else.
E1$,10((_-EGLG001/.ASSETCLASS 0 1 1.
endif.
Fiel% -a##in* 6%i& +++ 0xtras +++ @&ili&ies S$s&em
+++
9ill * structures
Is target field
filled %ith dataH
Ies
*
@o
0xa/le
Chec, s$ntax
%ome BAPIs ha*e X structures ( X segments). The X field of this structure must 'e filled# if the
corres"onding a""lication data target field is filled and is to 'e used for data transfer.
The $%! hel"s you to fill these structures. ith the function (ill 4 structures# the a'o*e ABAP
code is generated in each field of an X structure.
If a rule has already 'een defined in an X structure field# ABAP code is not generated for this field.
The X structures are filled automatically for the field name of the corres"onding X structure. If#
howe*er# this field is not identical with the name of the corres"onding data structure# the syntax of
the code generated is not correct.
;ou can chec& this 'y using the .heck !ynta, function in the wor& ste" 5aintainin- (ield 5appin-
and .onversion %ule' The con*ersion "rogram will 'e generated and chec&ed. If there is an error# the
con*ersion "rogram will 'e dis"layed. Then you should carry out the syntax chec& again to dis"lay
the exact location of the error.
5ote: ;ou ha*e to correct the error in field ma""ing and not in the generated "rogram.
SAP AG BC420 11-26

0.22
SAP AG 1999
Creating !uns Using BAPIs
Assets
Ma/ data
9I
Transfer %ith BAPI
Project
F"
Subproject
Asse&s
Run definition Crea&e
Task
:oa%
Description
Trans1er %a&a
Task type
:0A
Program type
BAP"
aintenance of run attri+utes
-oad data
In the DX-B with the "rogram ty"e BAPI# a BAPI can 'e used for the data transfer. %"ecial
attri'utes need to 'e defined for this (see next slide).
SAP AG BC420 11-27

0.24
SAP AG 1999
Defining Processing Attributes
Method
C96AT6"(C:/A:@6S
Packet size
1
Errors before term.
1
Input file
Type
Name
Deete fie
Objects that could not be transferred
!rite "Doc to fie
Type
BC420-008ASS6TS8BAP"+err Name
Sa#e "Doc in R$%
BC420-008ASS6TS8BAP"+lsm+.on4
P
P
,um+er of o+0ects that
are transferred in one
L1! to the $API
Data records with
errrors can +e stored
in a file or as
individual IDocs
File with the converted
data from the LS!
The "rocessing attri'utes for transferring data using BAPIs are:
Packet si0e. This s"ecifies the num'er of o'+ects that are "assed to a BAPI in each $4.
+rrors be/ore terminatin- the trans/er6 hen executing the tas&# if the s"ecified num'er of errors
occur# the tas& is terminated. If this is not s"ecified or set to Eero# the tas& will not terminate
regardless of how many errors are encountered.
*nput /ile6 %"ecification of the transfer file with in"ut data.
Delete /ile6 After the data from this file has 'een transferred once# this file is deleted.
Objects that could not be trans/erred: %elect whether o'+ects containing errors are to 'e sa*ed in a
file or directly in an IDoc.

SAP AG BC420 11-28



0.26
SAP AG 1999
Transferring Test Data
9un 00001 s&ar&e%
Tas! Create s&ar&e%
Su..ess1ul %a&a &rans1er 1or 1 "7o.s
Tas! Create e3e.u&e% i&)ou& errors
9un 00001 e3e.u&e% i&)ou& errors
T$/e Message text
7is#la$ lo*
S&ar& run
Process: (ransferrin' usin' $APIs
Project
F"
Subproject Asse&s
Run definition BAP"
A log is created for each run.
SAP AG BC420 11-29

0.#0
SAP AG 1999
0rror 8andling
BAPI
9ile or IDoc
Collect
records %ith
errors in a
file
If the run has endedF
the in/ut file is
o(er%ritten %ith the
error file
5
2
3
#
Post
.tart run
DB
9ehler
Create IDoc on
database for records
%ith errors
1
0rror file deleted
0rror file
In/ut file %ith the
con(erted data
If BAPIs are used to transfer data# the DX-B "ro*ides two ways of "rocessing errors.
Error "andling using an error #ile$
The o"tion Write *Doc to /ile must 'e selected in the DX-B
During a run# the source file with the con*erted data is read (6). The BAPI "osts all error-free
records to the data'ase (7). All records with errors are collected in the error file (3). hen the run
has com"letely ended (all records ha*e 'een read from the source file# or a run containing errors
has 'een terminated)# the error file is co"ied to the in"ut file (?). The in"ut file is deleted and then
the error file is co"ied. After it has 'een successfully co"ied# the error file is deleted (C).
Tip: There is no "oint in selecting the flag Delete /ile# 'ecause# if you do# the in"ut file containing
the records with errors will 'e deleted.
Error "andling b! creating I%ocs:
The o"tion !ave *Doc in %78 must 'e selected in the DX-B
During a run# the source file with the con*erted data is read (6). The BAPI "osts all error-free
records to the data'ase (7). IDocs are created from any records containing errors (3). During a
run the source file is read with the con*erted data (6). hen the run has com"letely ended# the
source file is read and IDocs must 'e further "rocessed with A$E ser*ices.
The function Delete /ile can 'e selected here 'ecause with com"leted runs all the data records
from the in"ut file are "rocessed.
SAP AG BC420 11-30

0.#5
SAP AG 2001
0rror 8andling Using an 0rror 9ile
0rror in Custoi>ing
5. Change Custoi>ing
2. !estart run
5.< Change file in editor
2.< !estart run
0rror in the data
0rror /rocessing
9e%
5. Deterine data records ;e.g. fro /lant 5<
2. 0xtract data fro the external s$ste
again
#.< Transfer data again
+hen the run endsF the in/ut file is
o(er%ritten %ith the error file :
@uber of errors
Man$
If errors occurred during the data transfer and the records with the errors ha*e 'een collected in an
error file# the su'sequent error handling "rocedure de"ends on the ty"e of error.
If the error is in -ustomiEing# it should 'e corrected and the run restarted with the function .ontinue
run' The in"ut file contains only the records with errors that ha*e not yet 'een "rocessed and only
these will 'e "rocessed again'
If the data contains an error# the "rocedure is de"endent on the num'er of errors.
If only a few data records ha*e errors# you can change the data using the DX-B editor (the in"ut
file contains only the records with errors that ha*e not yet 'een "rocessed). Then restart the run
with the function .ontinue run'
If a lot of data records ha*e errors# using the editor would ta&e too long. If the errors are
systematic# for exam"le# all records from "lant 6 or com"any code 6AA# it is 'etter to start a new
run. An extract must 'e created again of the data containing errors. Then the data must 'e
con*erted and the errors remo*ed. Then the run is restarted with this file.
SAP AG BC420 11-31

0.#2
SAP AG 2001
0rror 8andling Using IDocs
IDocs %ith errors
stored in database
5. Change Custoi>ing
2. !e/ost IDocs
5. Correct IDocs indi(iduall$
2. !e/ost IDocs
0rror in Custoi>ing
0rror in the data
9e%
@uber of errors
Man$
5. Deterine data records ;e.g. fro /lant 5<
2.< Archi(e IDocs %ith errors
#.< Create data extract fro the external s$ste
again
3.< Transfer data again
If errors occurred during the data transfer and the records with the errors ha*e 'een stored in IDocs
in the data'ase# the su'sequent error handling "rocedure de"ends on the ty"e of error.
If the error is in -ustomiEing# it should 'e corrected and the IDocs re"osted'
If the data contains an error# the "rocedure is de"endent on the num'er of errors.
If only a few data records ha*e errors# you can change the IDocs using the IDoc editor. Then
re"ost the IDocs'
If a lot of data records ha*e errors# using the IDoc editor would ta&e too long. If the errors are
systematic# for exam"le# all records from "lant 6 or com"any code 6AA# it is 'etter to start a new
run. An extract must 'e created again of the data containing errors. Then the data must 'e
con*erted and the errors remo*ed. Then the run is restarted with this file.
SAP AG BC420 11-32

0.##
SAP AG 1999
Iou are no% able to:
BAPIs: Unit .uar$
Describe external data transfer using BAPIs
Transfer asset aster data into !"# using BAPIs
SAP AG BC420 11-33

Exercises
Unit$ BAPIs
Topic$ Trans#er o# Asset &aster %ata Using BAPIs
Basics of BAPI technology
=enerate installation test data
Data transfer of installation data
Transfer the legacy 9I installation data in /23 using a BAPI. The
tools you should use are the $%! and the DX-B.
'ile (it" assets in legac! #ormat$ BC)*+,A--ET./E0
Test asset #ile$ BC)*+,11,TE-T,A--ET
5ote: ;ou will find the rele*ant information for this exercise in the training course slides.
6 -reate asset master data onlineK
Transaction: A%G6
Asset class: 36AA
-om"any code: 6AAA
Descri"tion: /acing car
-a"italiEed on: A6.A6.6GGH
-ost center: 6AAA
$icense "late num'er: BA-PI AAL
rite down the asset num'er: 88888888888888
SAP AG BC420 11-34

7 =enerate asset test data using DX-B.
B./ o'+ect: B4%6A77
Program ty"e: BAPI
!ethod: -/EATEI5-$>A$4E%
9ile ty"e: P
9ile name: B-?7A8MM8TE%T8A%%ET
4se the log. system DXB8MM to create test data.
To generate an IDoc data record# you ha*e to add the following:
-om"any code: 6AAA
Asset class: 36AA
Asset num'er: see the num'er you wrote down
=o 'ac& to the DX-B Tools
Dis"lay the file you generated.
3 -reate the su'"ro+ect A%%ET-MM in the DX-B "ro+ect 9I-MM using the
B./ o'+ect B4%6A77.
3-6 -reate the run BAPI8TE%T-MM with descri"tion 1Test Asset BAPIN.
3-7 -reate the tas& $.AD-MM 1$oad the dataN.
Tas& ty"e: $.A
Program ty"e: BAPI
!ethod: -/EATEI5-$>A$4E%
Pac&age siEe: 6
In"ut file: B-?7A8MM8TE%T8A%%ET
Do not delete the file after the runK rite all faulty IDocs into the file
A!!+T9+%%O%9::.
3-3 AnalyEe the log after you ha*e started the test data run.
? ith the course material you will find a ma""ing "lan for the transfer of legacy asset
data. Transfer the following data from the legacy system:
The file B.;$#9A!!+T'2+& with asset data from the legacy system has the structure
shown 'elow. Ta&e a loo& at the file in the file monitor (TA:A$66).
9ield name 9ield ty"e $ength 5ame
-.DE - ? -om"any code
-$A%% - ? Asset class
-.%T-E5TE/ - ? -ost center
A/EA - ? Business area
DATE DD!; H -a"italiEation date
A%%ET - 7A Asset name
P$ATE5. - 6A $icense "late num'er
SAP AG BC420 11-35

C Assign the asset data to the IDoc structure in $%!.
C-6 -reate the su'"ro+ect A%%ET-MM with the name ,Assets, in the $%! "ro+ect
B-?7A-MM.
In this "ro+ect create the o'+ect BAPI-MM with the name ,Assets with BAPI,.
C-7 !aintain the o'+ect attri'utes for BAPI:
Business o'+ect: B4%6A77
!ethod: -/EATEI5-$>A$4E%
C-3 -reate the source structure A!!+T9:: and maintain the corres"onding fields (see
ta'le a'o*e).
C-? Assign the following structures to the source structure:
E69IXEDA%%ET8-/EATEI5-$>A$4
E6BP6A7780E;
E6BP6A7789E=$=AA6
E6BP6A7789E=$=AA6X
E6BP6A7789E=$=AA7
E6BP6A7789E=$=AA7X
E6BP6A7789E=$=AA3
E6BP6A7789E=$=AA3X
C-C 9ield !a""ing:
C-C-6 Do the ma""ing according to your ma""ing "lan. -onsider the s"ecial
features of the asset transfer using BAPIs (see training course material)
C-C-7 To fill the X structures# the $%! ena'les them to 'e filled automatically
for a com"lete structure. This wor&s automatically for the field name of
the corres"onding X structure. Bowe*er# if this is not identical to the
corres"onding data structure# the syntax of the generated code cannot 'e
correct.
;ou can chec& this 'y using the syntax chec& in the field ma""ing wor&
ste". The con*ersion "rogram will 'e generated and chec&ed. If there is an
error# the con*ersion "rogram will 'e dis"layed. ;ou should carry out the
syntax chec& again to dis"lay the exact location of the error.
Ti": ;ou ha*e to correct the error in field ma""ing and not in the
generated "rogram.
The field name in the I9 condition (if not Ofield nameP is initial) must 'e
changed
Bow many field names were not identicalQ 88888888888
D !aintain file name under ,%"ecify 9iles,:
%ource file: B-?7A8A%%ET.$E=.
L Assign files :
A%%ET: ......... B-?7A8A%%ET.$E=
H 5ow im"ort the legacy data and chec& the resultK
G -on*ert the data and chec& the resultK
SAP AG BC420 11-36

6A -reate the run in the DX-B "ro+ect 9I-MM under the su'"ro+ect A%%ET-MM.
6A-6 -reate the run BAPI-MM with descri"tion 1Assets with BAPIN.
6A-7 -reate tas& !AP-MM 1-on*erting DataN an.
- Tas&: !AP-MM
- 5ame: -on*erting Data
- Tas& ty"e: !AP
- Program ty"e: $%!
%elect the following $%! o'+ect:
$%! "ro+ect: B-?7A-MM
$%! su'"ro+ect: A%%ET-MM
$%! o'+ect: BAPI-MM
6A-3 -reate the tas& $.AD-MM 1$oading DataN.
Tas& ty"e: $.A
Program ty"e: BAPI
!ethod: -/EATEI5-$>A$4E%
Pac&age siEe: 6
In"ut file: -on*erted data from $%!# use the file name from
$%!
Do not delete the file after the run K rite all faulty IDocs into the file
A!!+T9+%%O%9::.
6A-? /emem'er that you ha*e to correct the sequence of the tas&s.
4se the 'uttons 2
6A-C %tart the run.
6A-D AnalyEe the log after you ha*e started the test data run.
6A-L !a&e a note of the num'ers of the assets created:
888888888888 888888888888 888888888888 888888888888
888888888888 888888888888 888888888888 888888888888
SAP AG BC420 11-37

You might also like