practical guide to idoc development for sap

253
Sabine Maisel Practical Guide to IDoc Development for SAP ® Bonn Boston www.sap-press.com

Upload: vikash-vijay

Post on 15-Oct-2015

700 views

Category:

Documents


87 download

DESCRIPTION

IDOC

TRANSCRIPT

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    1/253

    Sabine Maisel

    Practical Guide to IDoc

    Development for SAP

    Bonn Boston

    www.sap-press.com

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    2/253

    Contents at a Glance

    1 Introduction ................................................................ 15

    2 Generating IDocs ........................................................ 29

    3 Test Tools ..................................................................... 51

    4 Changes to IDocs ....................................................... 67

    5 Conrmations .............................................................. 187

    6 Serializing IDocs ......................................................... 193

    7 Administration ............................................................ 211

    8 IDocs in Conjunction with SAP NetWeaver

    Process Integration ..................................................... 243

    www.sap-press.com

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    3/253

    7

    Contents

    Preface ......................................................................................... 11

    1 Introduction ................................................................. 15

    1.1 What Is ALE? ................................................................ 15

    1.2 BAPIs and IDocs An Introduction ............................. 18

    1.2.1 BAPIs ............................................................... 18

    1.2.2 IDocs ............................................................... 19

    1.3 Differentiation of ALE and EDI ...................................... 25

    1.4 Summary ...................................................................... 27

    2 Generating IDocs ........................................................ 29

    2.1 Standard Methods for the IDoc Generation ................... 29

    2.1.1 Shared Master Data Tool .................................. 29

    2.1.2 Message Control .............................................. 43

    2.1.3 Special Functions ............................................. 46

    2.2 Use of Logical Systems in the Message Control ............. 49

    2.3 Summary ...................................................................... 50

    3 Test Tools ..................................................................... 51

    3.1 Individual IDocs ............................................................ 52

    3.2 Testing Processing of Multiple IDocs ............................ 57

    3.2.1 Message Control .............................................. 57

    3.2.2 Sending Ready-for-Dispatch IDocs .................... 58

    3.2.3 Files ................................................................. 59

    3.3 Processing Status Files .................................................. 61

    3.4 Summary ...................................................................... 66

    4 Changes to IDocs ........................................................ 67

    4.1 Customizing .................................................................. 67

    4.1.1 Filtering Using Filter Objects ............................ 67

    www.sap-press.com

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    4/253

    8

    4.1.2 Custom Filter Objects ....................................... 73

    4.1.3 Filtering Segments ............................................ 76

    4.1.4 Reducing IDocs Through Views ........................ 77

    4.1.5 Rules ................................................................ 80

    4.1.6 Version Conversion ........................................... 844.1.7 Special Conversions in SAP ERP Financials ........ 85

    4.2 Adapting Existing IDoc Types ........................................ 89

    4.2.1 Different Exit Types on the Basis of the

    Material Master Example ................................. 90

    4.2.2 General Exits .................................................... 119

    4.2.3 Custom Segments ............................................. 122

    4.2.4 Special Requirements for Master Data .............. 134

    4.3 Custom Function Modules for File Generation

    in File Ports ................................................................... 1384.4 Custom IDocs .............................................................. 141

    4.4.1 Creating Custom IDoc Types and

    Message Types ................................................. 143

    4.4.2 Generating an IDoc .......................................... 153

    4.4.3 Updating an IDoc ............................................. 161

    4.4.4 Generating IDoc Function Modules .................. 172

    4.4.5 Error Workow for Custom IDocs ..................... 175

    4.4.6 Useful Function Modules .................................. 184

    4.5 Summary ...................................................................... 186

    5 Conrmations .............................................................. 187

    5.1 ALEAUD IDocs ........................................................... 187

    5.2 STATUS IDocs ............................................................ 190

    5.3 Summary ...................................................................... 192

    6 Serializing IDocs ......................................................... 193

    6.1 Serialization Using Groups ............................................ 193

    6.2 Serialization Using Timestamps ..................................... 198

    6.3 Serialization Using Business Objects .............................. 200

    6.4 Serialization Using qRFC ............................................... 205

    6.5 Summary ...................................................................... 209

    www.sap-press.com

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    5/253

    9

    7 Administration ............................................................. 211

    7.1 IDoc Links .................................................................... 211

    7.2 Regular Jobs ................................................................. 216

    7.3 Transaction Code Overview ........................................... 2177.4 Archiving ...................................................................... 224

    7.5 Status Conversion ......................................................... 230

    7.6 Summary ...................................................................... 242

    8 IDocs in Conjunction with SAP NetWeaverProcess Integration ...................................................... 243

    8.1 Conversion of Logical Systems to Business Systems ....... 243

    8.2 Conversion of IDoc Partner Roles .................................. 2448.3 Header Mapping ........................................................... 245

    8.4 Handling the Control Record in SAP NetWeaver PI ....... 246

    8.5 Updating IDocs Directly in SAP NetWeaver PI .............. 248

    8.6 Summary ...................................................................... 248

    The Author .................................................................................. 249

    Index ............................................................................................. 251

    www.sap-press.com

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    6/253

    S a b i n e M a i s e l

    Practical Guide to IDoc

    Development for SAP'

    Galileo Press

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    7/253

    Preface

    I D o c s r e p r e s e n t a s t a n d a r d i n t e r f a c e t o S A P s y s t e m s . T h e y a r e a l w a y s

    a s y n c h r o n o u s , s o t h e s y s t em s h o u l d b e d e s i g n e d f o r c h a n g in g a n d c r e a t -

    i n g d a t a i n t h e d a t a b a s e . T h e e r r o r h a n d l i n g , w h i c h c a n b e c a r r ie d o u t

    w i t h a t i m e d e la y i n a s y n c h r o n o u s c o m m u n i c a t i o n , is a l w a y s h a n d l e d

    w h e r e t h e e r r o r o c c u r s i n c o n t r a s t t o t h e n o r m a l RF C c o m m u n i c a t i o n

    w h e r e t h e e r r o r i s a l w a y s n o t i f i ed t o t h e s e n d e r .

    A l t h o u g h m o r e r e c e n t S AP re l e a se s a ls o h a v e o t h e r n o n S A P p r o p r i e ta r yc o m m u n i c a t i o n o p t i o n s ( s uc h a s SO AP , HTTP , a n d p r o x ie s ) , t h e i m p o r -

    t a n c e o f I Do c s is u n d i m i n i s h e d : T h i s is b e c a u s e o f t h e h i g h n u m b e r in

    w h i c h t h e y a r e a v a i la b l e, a s w e l l as t h e m u l t i t u d e o f s o f t w a r e s o l u ti o n s

    t h a t w o r k w i t h S AP a n d a l r e a d y s u p p o r t t h i s fo r m a t . I D o c s a s s t a n d a r d

    i n t e rf a c e s t o SA P s y s t e m s a r e u s e d b o t h f o r E DI s c e n a r i o s b e t w e e n d i f -

    f e r e n t e n t e r p r i s e s a n d f o r AL E s c e n a r io s w i t h i n e n t e r p r is e s .

    L ike a ll s t an da rd i n t e r f aces , t he IDocs r e f e r t o t he pa r t o f t he SAP sys t em

    tha t i s de l i ve re d by SAP . In m os t bus in esses , how ever , i t 's necessa ry t o

    b re a k a d a p ta t io n s t h a t w e re m a d e i n t h e b u s in e s s p a r t o f t h e SAP sy s tem

    d o w n t o t h e i n t e r f a ce s . T h is t a s k i s c a r r i e d o u t b y A B A P d e v e l o p e r s . T h is

    b o o k is p a r t ic u la r ly i n t e n d e d fo r t h e m , a n d t h e ta sk s re la t in g to th e se

    a d a p t a t i o n s a re d i s c u s s e d i n d e t a il . T h e s y s t e m a d m i n i s t r a t o r s u s u a l l y

    h a n d l e t h e c o m m u n i c a t i o n s e t t in g s s o t h e s e s e t ti n g s a re o n l y m e n t i o n e d

    i f t h e y a r e d i re c tl y r e la t e d t o t h e d e v e l o p m e n t w o r k .

    Content of This Book

    T h is b o o k d e s c r i b e s t h i n g s i n t h e s e q u e n c e i n w h i c h t h e y a p p e a r . I t s t ar ts

    w i t h t h e c r e a ti o n o f I D o c s a n d c o n c l u d e s w i t h t h e r e g u l a r ta sk s . T h e

    a d a p t a t io n o f I D o c s t o c u s t o m e r r e q u i r e m e n t s s t a r ts w i t h t h e l o w e s t

    e f fo r t, t h a t i s, t h e o p t i o n s o f C u s t o m i z i n g , a n d p r o c e e d s s t e p b y s t e p to

    11

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    8/253

    Preface

    t h e ta s k th a t r e q u i r e s t h e h i g h e s t e ff o r t: t h e c o m p l e t e c u s t o m p r o g r a m -

    m i n g o f ID o cs .

    C h a p t e r 1 , In tr o du cti on , d i f f e r e n t i a t e s AL E a n d E D I a n d d e s c r i b e s t h e

    b as ic p r in c ip le s o f IDocs. C h a p te r 2 , Generating IDocs, o u t l i n e s t h e d i f -

    f e r e n t o p t i o n s f o r g e n e r a t i n g I D o c s. C h a p t e r 3 , Test Tools, d i s c u s s e s h o w

    y o u c a n te s t I D oc s f o r t h e d a ta e x c h a n g e e v e n w i t h o u t th e c o m m u n i c a -

    t i on pa r tne r .

    A f t e r t h e g e n e r a t i o n o f s t a n d a r d I D o c s h a s b e e n f u ll y o u t li n e d , t hi s

    c h a p t e r d e ta i ls t h e c u s t o m e r a d a p t a t i o n s . H e r e, I D o c s a r e c o n n e c t e d to

    t h e d i f f e re n t e n h a n c e m e n t t e c h n o l o g i es o f SAP. S o m e o p t i o n s o f I Do c

    m a n i p u l a t i o n a l r e a d y a r i s e i n C u s t o m i z in g , w h i l e o t h e r s r e q u i r e c u s t o m

    d e v e l o p m e n t s o r t h e e n h a n c e m e n t o f t h e s ta n d a r d I D o c fu n c ti o n m o d -

    u l e s . T h e r e a r e a l s o s p e c i a l d e v e l o p m e n t o b j e c t s t h a t a r e o n l y u s e d i n

    c o m b i n a t i o n w i t h I D o c s. S o C h a p t e r 4 , Changes to IDocs, d e s c r i b e s p a r -

    t ic u la rl y w i t h r e g a rd t o I D oc s h o w y o u m u s t h a n d l e e n h a n c e m e n t s a n d

    w h a t y o u n e e d t o c o ns id e r. T h e f o cu s is o n t h e e n h a n c e m e n t t e c h n o l o -

    g i e s r e l e v a n t f o r I D o c s . T h o s e e n h a n c e m e n t s t h a t a r e u s e d f o r a l l I D o c

    types a r c d i scusse d i n de t a i l. Th is cha p t e r a lso desc r ibes t he spec i fi c fea -

    t u r es i n t h e c o n t e x t o f e n h a n c e m e n t s o r c u s t o m d e v e l o p e d I Do c s, s u c h

    a s th e w o r k f l o w c o n n e c t i o n .

    C h a p t e r 5 , Confirmations, t h e n d i s c u s se s t h e l iv e o p e r a t i o n a n d s h o w sh o w y o u c an l e ar n f ro m y o u r c o m m u n i c a ti o n p a r tn e r s w h a t h a p p e n e d

    t o t h e I D o c d e s p i te t h e a s y n c h r o n o u s p r o c e d u r e . C h a p t e r 6 , Serializing

    ID ocs , o u t l i n e s t h e d i f f e r e n t o p t i o n s t o k e e p a s pe c if ic s e q u e n c e f o r p r o -

    c e s s in g I D o c s , a s w e l l a s t h e a v a i l a b il i ty o f t h e s e o p t i o n s . C h a p t e r 7,

    A d m in is tra tio n , desc r ibes necessa ry r egu l a r t a sks i n de t a i l . F ina l l y , i n

    C h a p t e r 8 , ID ocs in C onju nction w ith SA P N e tW ea v er Process In te gra ti on ,

    t h o s e w h o w o r k w i t h S A P N e t W e a v e r P I ( f o r m e r l y S A P N e t W e a v e r X I )

    l ea r n h o w t h e y c a n i m p l e m e n t t as ks t h a t a r e o n l y r e q u i r e d i n t h e c o n t e x t

    o f I D oc s , s p e c if ic a l ly i n t h e c o m m u n i c a t i o n w i t h S AP N e t W e a v e r PI.

    12

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    9/253

    Prefa

    A c k n o w l e d g m e n t s

    A b o v e al l, I w o u l d l i ke t o l h a n k m y h u s b a n d M a n f r e d . T h i s b o o k c o n -

    s u m e d a lo t o f o u r t im e , a n d w i t h o u t h i s s u p p o r t a n d a ll t h e w o r k h e d i d,

    I w o u l d n ' t h a v e b e e n a b l e t o w r i t e it.

    I w o u l d a l s o li ke t o t h a n k M a i k e L u b b e r s , S t e fa n P r o k s c h , a n d M e g

    D u n k e r le y o f G a li le o P r es s w i t h o u t t h e i r e n c o u r a g e m e n t a n d s u p -

    p o r t , I m i g h t h a v e b e e n a b le to f in ish th i s b o o k , b u t i t w o u ld d e f in i te ly

    h a v e c o n t a i n e d m a n y e r r o r s.

    S a b i n e M a i s el

    13

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    10/253

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    11/253

    T his cha p t er in t roduces t he i n t e r face t ypes used by SA P in A L E

    sc enarios. Y ou 'l l le a rn a b o u t th e cha ra cte r is ti cs o f th e d iffe re n t

    t echn iques and w hy d i ff e ren t areas need d i f fe re n t i n t e r face types.

    Y oul l a lso rev iew t e rmino logy u sed t hro ug hou t t he book.

    1 Introduction

    Y o u ' r e c e r t a in l y f a m i l ia r w i t h t h e t o p ic o f e l e c t r o n i c d a t a e x c h a n g e

    b e tw e e n d i f f e r e n t e n t e r p r i s e s . B u t e v e n w i th in e n te rp r i s e s , in d iv id u a lp ro c ess s te p s c a n t b e c a r r ie d o u t o n th e s a m e m a c h in e (o r in th e s a m e

    d a t a b a s e ) u s i n g t h e s a m e s o f t w a r e . S A P m e e t s t h i s r e q u i r e m e n t b y p r o -

    v i d i n g s t a n d a r d i n t e r fa c e s f o r l o c a ti o n s w h e r e t h i s k i n d o f s e p a r a t i o n is

    c o m m o n . Stand ard inter faces app ly spec if i c norm s to ac tua l da t a t r ans fe r

    t o p r o v i d e y o u w i t h a c e r t a i n r e l e a s e s ec u ri ty .

    1.1 W h at Is A LE ?

    A n e x a m p l e o f h o w y o u c a n s tr u c t u r e th e c o m m u n i c a t i o n a cc o rd i ng

    t o p r o c e ss s t e p s is th e s e p a r a t i o n o f h u m a n r e s o u rc e m a n a g e m e n t a n d

    a c c o u n t in g , w h i c h y o u c a n f i nd i n m a n y c o m p a n i e s . All d a t a g e n e r a t e d i n

    HR on bus in ess t r i ps , fo r exam ple tha t a lso nee ds t o be t r ans fe r r ed

    t o a c c o u n t i n g c a n b e p o s t e d i n t h e S A P s y s t e m b o t h l o c al ly o r r em o t e l y .

    B e c au s e o f t hi s, i t is a t t h e s o l e d i s c re t io n o f a c o m p a n y w h e t h e r t o u s e

    o n e o r s e v e ra l s y s t e m s . S AP r e f e r s t o t h i s s e p a r a t i o n o f p r o c e s s e s w i t h i n

    a n e n t e r p r i s e a s A p p li ca ti on L in k E nabling (ALE); processes that conta in

    t h e r e l e v a n t i n t e r f a ce s a r e c a ll e d A L E business proce sses o r A L E sc enarios.

    A n i n t e rf a c e g e n e r a ll y a ll o w s y o u t o s e n d d a t a f r o m a c e r t a in p o i n t

    w i t h i n t h e p r o c e s s ( o u t b o u n d i n t er f a c e) o r t o r e c e iv e d a t a a t a s pe c if ic

    p o in t ( i n b o u n d in te r fa c e ) . A p re re q u i s i te fo r t h e u se fu l e m p l o y m e n t o f

    S t r u c t u r i n g

    c o m m u n i ca t io n

    In te r f a c e s

    15

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    12/253

    1 Introduct ion

    Techn ica l

    d e s c r i p t i o n

    S e m a n t i c

    d e s c r i p t i o n

    R e m o t e F u n c t i o n

    Ca l l

    P r o t o c o l

    S y n c h r o n o u s

    c o m m u n i c a t i o n

    a n i n t e rf a c e i s t h a t b o t h a t ec h n i c al a n d s e m a n t i c d e s c r i p t io n o f t ha t

    i n t e r f ace a rc ava i lab l e .

    T h e technical description s p e c if ie s w h i c h d a t a i s s u p p l i e d o r e x p e c t e d in

    w h i c h f o r m a t a n d i n w h i c h s e q u e n c e . T hi s d e s c r i p t i o n i s r e q u i r e d t o

    u n p a c k t h e d a t a.

    T h e sem a n ti c descrip tion c o n t a i n s all o f t h e r e q u i r e d b u s i n e s s i n f o r m a -

    t io n c o n c e r n i n g t h e u s e o f t h e i n te r fa c e , f o r in s t a n ce , w h e t h e r t h e d a ta

    is r e a d o n l y o r c a n b e e d i t e d . T h i s d e s c r i p t i o n i s r e q u i r e d t o i n t e r p r e t

    t h e i n c o m i n g d a t a .

    Technical and Semantic Descriptions of an Interface

    Consider an interface that we all use very often in our daily life: transferring

    sentences by telephone. Here, the semantic descript ion corresponds to theknowledge that the last sentence is usually a farewell; the technical descrip-

    t ion, on th e other hand, correspon ds to th e knowledge of how to structure a

    farewell note in English.

    O f c o u r s e , i n a d d i t i o n t o t h e d e s c r i p t io n s , t h e p h y s i c a l t r a n s f e r o f d a t a

    i s n e c e s s a i y a s w e l l v i a a p r o t o c o l . S A P s u p p o r t s i t s o w n R FC p r o t o c o l

    (Remote Function Call) in a ll r el eases , w he reas ne w er r e l eases a l so supp or t

    HTTP (H yperte x t Transfe r Pro toco l) a n d S O A P ( w h i c h o r i g in a l ly s t o o d f o r

    Sim ple Ob ject Access Protocol) . Because ALE bus iness p ro cesses r ep resen ta s li g h t ly o l d e r t e c h n o l o g y , t h e y u s e o n l y s t a n d a r d i n t e rf a c e s b a s e d o n

    R FC a n d d o n ' t s u p p o r t t h e n e w p r o x y i n t er f ac e s y e t , w h i c h a r c b a s ed

    on SOAP.

    Protocol of an Interface

    Let's ge t back to ou r telep hon e analogy: The ph on e line basically allows you

    to transfer data via fax or language. However, before you do that, you must

    agree with your partner on which of the two options you w ant to use. This

    correspo nds to selecting the protocol, tha t is. the transfer type.

    W h e n d e s i g n in g a n i n te r fa c e , y o u h a v e t h e f o ll o w i n g o p ti o n s :

    S y n c h r o n o u s i n te r fa c e s

    S y n c h r o n o u s i n t e r f a c e s c o n s i s t o f a request a n d a response. Dur ing t h i s

    p ro c ess , th e c o n n e c t io n b e tw e e n th e s y s te m s is k e p t a l ive . C onsc

    16

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    13/253

    W ha t Is ALE |

    q u e n t l y , s y n c h r o n o u s i n t e r f a c e s i m m e d i a t e l y p r o v i d e a r e s u l t . T h i s

    m e a n s t h a t y o u t h e u s e r o f t h is t y p e o f in t e r fa c e c a n w a i t f o r t h e

    r e s p o n s e . T h e a d v a n t a g e o f a s y n c h r o n o u s i n te r fa c e is t h a t y o u r e ce iv e

    a d ir e c t c o n f i r m a t i o n a s t o w h e t h e r y o u r o r d e r w a s p r o c e s s e d o r n o t .

    I t' s y o u r r e s p o n s i b il it y t o t ri g g e r th e e x e c u t i o n o f t h e t as k . T h e d i s a d -

    v a n t a g e o f t h i s ty p e o f i n t e rf a c e is th a t y o u c a n t c o n t i n u e t o w o r k

    u n t il t h e o t h e r s y s t e m p r o c e s s es t h e r e q u e s t o r w h e n t h e o t h e r s y st e m

    i s n ' t a v a i la b l e . In a d d i t i o n t o t h a t , l o n g r u n t i m e s c a n r e q u i r e y o u to

    r e p e a t t h e s a m e o p e r a t i o n i f y o u t h in k a n e r r o r h a s o c c u rr e d .

    Example: Synchronous Interface

    Y o u w a n t t o b u y a b o o k a b o u t A LE a n d ID o c s a n d c a l l y o u r lo c a l b o o k s h o p t o

    o b t a in i n f o r m a t i o n o n a v a i la b l e b o o k s a n d t h e r e s p e c t iv e p r ic e s . I t d e p e n d s

    o n t h e r e sp o n s e y o u g e t w h e t h e r y o u l l a c t u a l ly m a k e th e p u rc h a s e o r n o t . If

    a te c h n i c a l f a i lu r e t e r m i n a t e s t h e p h o n e c a ll p r e m a t u r e l y , y o u l l c a ll b a c k o n l y

    i f y o u h a v e n ' t r e ce iv e d a n y r e s p o n se y e t .

    A s y n c h r o n o u s i n te r fa c e s

    A s y n c h r o n o u s i n t e r fa c e s s e n d t h e r e q u i r e d d a t a to t h e o t h e r s y s t e m

    i n v o l v e d a n d d o n ' t r e c e i v e a n i m m e d i a t e r e s p o n s e . T h i s m e a n s t h a t

    o n l y a r e q u e s t i s s e n t . A s a p r e r e q u i s i te , n o r e s p o n s e i s n e e d e d f o r t his

    p ro cess . C o n s e q u e n t ly , y o u c a n c o n t in u e w o rk in g ir re sp ec t iv e o f th e

    o t h e r s y st e m . H o w e v e r , b e c a u s e y o u w o n ' t r e ce iv e a n i m m e d i a t e

    r e s u lt , in a n a s y n c h r o n o u s c o m m u n i c a t i o n p r o c e ss , it m u s t b e e n s u r e d

    w i t h o u t y o u r in t e r f e r e n c e t h a t t h e r e q u e s t a rr i v e s i n t h e o t h e r s y s t e m

    a n d o n l y o n c e . T h e f a ct t h a t a n a c t i o n is c a rr i e d o u t o n l y o n c e is

    r e fe r r ed t o a s transaction security.

    Example: Transaction S ecurity

    Y o u w a n t to b u y m y b o o k a n d s e n d a fa x c o n t a i n in g t h e p u rc h a se o r d e r d a ta

    t o t h e b o o k s h o p . T h e b o o k s e l le r d o e s n ' t r e s p o n d t o y o u r fa x . H o w e v e r , th e

    t ra n s m is s io n r e p o r t o f y o u r fa x m a c h i n e te l ls y o u t h a t th e b o o k s h o p h a s r e -

    c e iv e d t h e p u r ch a s e o r d e r e x a c t ly o n c e .

    A LE sc e n a r io s c a n c o n si s t o f a n y n u m b e r o f s y n c h r o n o u s a n d a s y n c h r o -

    n o u s i n t e r f a c e s . S A P u s e s s y n c h r o n o u s i n t e r f a c e s e v e r y t i m e d a t a f r o m

    t h e d a t a b a s e i s s u p p o s e d t o b e d i s p l a y e d ; a s y n c h r o n o u s i n t e rf a c e s , in

    t u r n , a r e u s e d e v e i y t im e y o u w a n t t o c re a t e o r c h a n g e d a t a i n t h e d a ta

    A s y n c h ro n o u s

    c o m m u n i ca t io n

    In te r f a c e s i n A L E

    scenar ios

    17

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    14/253

    base . In t h e la t te r case , t h e t ra n s a c t io n s e c u r i ty is p a r t ic u la r ly im p o r t a n t

    t o m a i n t a i n d a t a b a s e c o n s i s te n c y .

    1.2 BA PIs and IDoc s An Introduction

    BAPis T h e m e d i u m f o r s y n c h r o n o u s i n te r fa c e s i n A LE s c e n a r io s i s th e B usi-

    ness Appl icat ion Programm ing Inter face (BAPI) . The term A pp li ca ti on Pro-

    g ra m m in g In te rfa ce (API ) i s genera l l y used i n t he IT env i ronment . SAP

    e x t e n d e d i t b y t h e a d d i t i o n " B u s in e s s" t o i n d i c a t e t h a t t h e p r o c e s s n o t

    o n l y i n v o l v e s a p u r e l y t e c h n i c a l d a t a t r an s f e r, b u t a s t e p w i t h i n a b u s i-

    n e s s p r o c e s s . In t h is c o n t e x t , t h e i n d i v i d u a l s t e p s t h a t m a k e u p t h e p r o -

    cess can o ccu r i n d i f f e r en t sys t ems .

    I D o c s A s y n c h r o n o u s i n t er f a c e s i n A LE s c e n a ri o s a r c i m p l e m e n t e d u s i n g In te r-

    mediate Documents ( ID o cs ). I n a d d i t i o n t o t h e b u s i n e s s d o c u m e n t s t h a t

    a r e c re a t e d i n t h e d i f f e r e n t s y s t e m s i n v o l v e d , a s y n c h r o n o u s p r o c e s s es

    a l s o g e n e r a t e a d a t a d o c u m e n t t h a t e n s u r e s t r a n s a c t i o n s e c u r it y . B ec a u se

    t h i s d o c u m e n t i s n ' t p a r t o f t h e a c tu a l b u s i n e s s p r o c e s s b u t is r a t h e r a n

    i n t e r m e d i a t e d o c u m e n t , i t h a s b e e n a s s ig n e d t h e c o r r e s p o n d i n g n a m e .

    T h e f o l l o w i n g s e c t i o n s p r o v i d e a b r i e f i n t r o d u c t i o n t o t h e t o p ic o f BAPIs

    a n d I Do cs . Y ou 'll l e ar n h o w t h e s e d if f e re n t m e t h o d s w o r k a n d w h y t w o

    d i f f e r e n t t y p e s o f i n t e rf a c e e x i s t w i t h i n A LE s c e n a r io s .

    1.2.1 BAPis

    A B API is a r e m o t e e n a b l e d f u n c t i o n m o d u l e , t h a t i s, a m o d u l e t h a t

    c a n b e e x e c u t e d b y a n o t h e r p r o g r a m . In t h i s c o n t e x t , i t i s n ' t i m p o r t a n t

    w h e t h e r t h a t p r o g r a m ca lls t h e f u n c t i o n m o d u l e l oc al ly o r f r o m w i t h i n a

    d i f f e ren t sys t em. BAPi s d i f f e r f rom regu la r RFCenabled fu n c tio n m odule s

    (RFM) in t h e fo l l ow ing aspec t s :

    b a p i r e q u i r e m e n t s A s a m e t h o d , a B AP I is p a r t o f a b u s i n e s s o b j e c t t y p e f r o m t h e Business

    Object Rep osi tory (BOR) . For a l l r e l evan t ob j ec t s i n t he SAP sys t em,

    S AP p r o v i d e s a c o r r e s p o n d i n g e l e m e n t i n t h e B O R. I n t h e B OR , y o u

    c a n f i n d i n f o r m a t i o n r e g a r d i n g w h i c h t a b l e s p e r t a i n t o a n o b j e c t a n d

    w h a t y o u c a n d o w i t h t h e m . I t' s a l so t h e b a s is f o r th e business work-

    f lo w . S o , it m a k e s m u c h s e n s e t o a ls o s t o r e i n t h e B O R in f o r m a t i o n

    1 | Introduction

    18

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    15/253

    BAPIs and IDoc s An Introduct ion | 1

    a b o u t w h i c h p r o c e s s s t e p s i n AL E s c e n a r i o s y o u c a n c a r r y o u t w i t h t he

    respec t i ve ob j ec t s .

    B AP Is a r e r e l e a se d , h a v e a f r o z e n s i g n a t u r e , a n d t h u s p r o v i d e r e le a s e

    secur i ty .

    T h e y t y pi ca l ly u s e a n u p d a t e t e c h n i q u e f o r p o s t i n g s i n s te a d o f p o s t in g

    d i re c tl y . M o r e o v e r , t h e y d o n ' t c o n t a i n a n y C o m m i t o r R o l l b a c k s t a t e -

    m e n t s . ( T h e f e w , m o s t l y v e r y o l d e x c e p t i o n s a r e s p e c i f i c a l l y d o c u -

    mented by SAP . )

    T h e a c tu a l p o s t i n g p r o c e s s i s t r ig g e r e d b y t h e s p e c ia l B A P I _ T R A N S A C

    T I O N . C O M M I T B AP l o r is u n d o n e v ia B A P I _ T R A N $ A C T I O N _ R O L L B A C K .

    B AP Is u s u a ll y d o n t d i s p la y t h e r e s u l t s b e c a u s e i t 's u n l i k e l y t h a t t h e

    cal ler has a GUI (graphical user interface) ava i l ab l e . BAPIs t ha t were

    s p ec i fi ca l ly d e v e l o p e d f o r a n SA P /S A P c o m m u n i c a t i o n a r e a n e x c e p -

    t i o n t o t h a t . H o w e v e r , t h e s e B A P I s a r e n ' t r e l e v a n t f o r i n t e r f a c e s t o

    ex t e rna l sys t ems .

    L ik e a ll r e m o t e e n a b l e d f u n c t i o n m o d u l e s , B A PI s c a n g e n e r a l l y b e c a ll ed

    us ing a synchronous RFC (sRFC) o r a transact ional RFC ( tRFC) . The t rans-

    a c t io n a l ca ll is a s y n c h r o n o u s a n d m a k e s s u r e t h a t t h e c al l is e x e c u t e d

    e x a ct ly o n c e . H o w e v e r , n o t e t h a t b o t h t h e s y n c h r o n o u s a n d t h e t r an s a c -

    t io n a l c all n o t i f y o n l y t h e c a ll in g s y s t e m i n c a s e o f p o t e n t i a l e r r o r s , e v e n

    i f t h a t s y s t e m c a n t r e m o v e t h e e r r o r . T h a t ' s w h y B AP Is a r e g e n e r a l l yu s e d o n l y f o r s y n c h r o n o u s c al ls i n AL E s c e n a r i o s . I n a s y n c h r o n o u s c as es ,

    e r r o r s s h o u l d p r e f e r a b l y b e r e p o r t e d d i r e c t l y t o t h e r e c e i v e r , p r o v i d e d

    t h e s e e r r o r s a r e b u s i n e s s r e l a te d . B A PI s a r e n ' t i n t e n d e d f o r t h i s p u r p o s e .

    T h e f o l l o w i n g se c t i o n d e s c r i b e s h o w t h e s e p a r a t io n b y e r r o r t y p e s i s

    i m p l e m e n t e d b y m e a n s o f I Do cs .

    1 . 2 . 2 I DO CS

    S A P d e v e l o p e d I D o c s s p e c i f i c a l l y t o e n a b l e t h e a s y n c h r o n o u s m e s s a g ee x c h a n g e b e t w e e n m u l t i p l e S A P a n d / o r n o n S A P s y s t e m s . T h e a d v a n -

    t ages ove r a norm al , a sy nch ron ou s ly ( t r ansac ti ona l l y ) ca l led RFM inc lude

    a n i m p r o v e d e r r o r h a n d l i n g p r o c e s s a s w e l l a s a s p e c i f i c m o n i t o r i n g

    l ayer m ad e ava i l ab l e t o IDocs . Because e r ro r p rocess ing v i a IDocs af f ec t s

    t h e s t r u c t u r e o f I D o c i n t e r f a c e s , w e ll l o o k a t i t f ir st i n t h e f o l l o w i n g

    sec t i ons .

    Ca l l ing BAPIs

    v ia RFC

    19

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    16/253

    1 Introduct ion

    E r ro r t y p e s

    E r ro rs in s e n d i n g

    a n d r e c e i v i n g

    s y s te m s

    Error Ha ndl ing w i th IDocs

    Y ou c an g e n e r a l l y d i s t i n g u i s h b e t w e e n t w o d i f f e r e n t ty p e s o f e r ro r :

    T e c h n ic a l e r r o r s

    T e ch n ic a l e r r o r s o b v i at e t h e c o m m u n i c a t i o n w i t h t h e p a r t n e r s y st e m .T h e y o c c u r , f o r e x a m p l e , i f t h e p a r t n e r s y s t e m i s n t a v a i la b l e , th e

    d a t a b a s e i n t h a t s y s t e m c a n ' t a c c e p t a n y a d d i t io n a l r e q u e s t s , o r th e

    spec i f i ed password i s i ncor rec t .

    B u s i n e s s r e la t e d e r r o rs

    B u s i n e s s r e la t e d e r r o r s o c c u r i f t h e p a r t n e r s y s t e m g e n e r a l l y r e s p o n d s

    t o r e q u e s t s b u t c a n ' t p r o c e s s y o u r s pe c if ic r e q u e s t . M i s s i n g a u t h o r i z a -

    t i o n s, m i s s i n g C u s t o m i z i n g , o r t h e l i k e ca n c a u s e t h is t y p e o f e r r o r.

    In t he c on t ex t o f RFCs , t h i s d i s t i nc t i on i sn t ma de . In a RFC, t he use rd i r e c t l y r e c e i v e s a n e r r o r m e s s a g e a n d m u s t m a k e s u r e t h a t t h e r e q u e s t

    w i ll b e r e p e a t e d a t a l a t e r p o i n t i n t i m e . B e c a u se c al ls c o n t a i n i n g e r r o r s

    c a n ' t b e r e p e a t e d a u t o m a t i c a ll y a n d d o n ' t h a v e t o b e l o g g ed , t h e d i s t i n c -

    t i o n b e t w e e n e r r o r t y p e s w o u l d n ' t m a k e s e n s e h e r e.

    I n tR FC s, e a c h c a ll t h a t c o n t a i n s a n e r r o r i s w r i t t e n t o a t a b l e i n t h e s e n d -

    ing sys t em a nd can b e r e s t a r t ed us ing a spec i f i c t r ansac t i on . In t h i s case ,

    it d o e s m a k e s e n s e t o d i s t in g u i s h b e t w e e n t h e t y p e s o f e r r o r. I n t h a t

    case , techn i ca l e r ro r s wo uld be l ogged in t he se nd ing sys t em , an d t he call

    w o u l d b e r e p e a t e d , i f n e c e s s a iy , w h i l e b u s in e s s r e l a t e d e r r o r s w o u l d b e

    l o g g e d a n d p r o c e s s e d i n t h e r e c e i v in g s y s t e m . T h is o p t i o n t o d i s ti n g u i s h

    b e tw e e n d i f f e re n t t y p e s o f e r ro rs is a specif ic f e a tu re o f ID ocs a n d i s n t

    p ro v id e d b y RFC s th e i r sel f. In a d d i t io n , y o u can a lso c h a n g e th e c o n -

    t e n t s o f I D o c s r e t r o a c ti v e l y i n c a s e o f e r r o r s , w h i c h i s n t p o s s i b l e e i t h e r

    w i t h s t a n d a r d R F Cs .

    T o d i s t i n g u i s h b e t w e e n t e c h n ic a l e r r o r s a n d b u s i n e s s r e la t e d e r r o r s , th e

    p ro c e ss in g o f t h e r e s p e c t iv e p ro c e ss es m u s t b e d iv id e d i n to t w o s t e p s as

    w e l l . T h e f ir st s t e p i s r e s p o n s i b l e f o r p u r e l y t r a n s f e r r i n g t h e r e q u e s t t ot h e d a t a b a s e o f t h e r e c e i v i n g sy s t e m . T h is s t e p d o e s n t d e p e n d o n t h e

    t y p e o f d a t a t h a t i s t r a n s f e r r e d . F o r e x a m p l e , i t d o e s n t m a k e a n y d i f f e r -

    e n c e w h e t h e r y o u w a n t t o c r e a t e m a t e r i al s o r c a n c e l a sa le s o r d e r . To

    c a r ty o u t t h e t r a n s f e r i n t h e s a m e m a n n e r f o r a ll k i n d s o f d a ta , y o u u s e

    a neu t r a l fo rmat : t he IDoc fo rmat .

    20

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    17/253

    BAPIs and IDoc s An Introduct ion | 1

    T h e s e c o n d s t e p i s c a r r ie d o u t l o ca ll y i n t h e r e c e i v in g s y s t e m a n d i n v o lv e s

    p o s t i n g t h e r e l e v a n t d o c u m e n t . T h is s t e p c a n v a ry d e p e n d in g o n th e

    b u s in e ss o b je c t t o b e p ro c e ssed .

    Technical Desc r ipt ion o f the IDoc Forma t

    A n I D o c c o n s i s ts o f a header record, a n y n u m b e r o f l in e s o f a p p l ic a ti o n

    d a t a (application records), a n d a n y n u m b e r o fs ta tu s records pe r IDoc .

    H ea de r

    T h e h e a d e r c o n t a in s g e n e ra l i n f o r m a t i o n a b o u t w h i c h d a t a is s u p -

    p o s e d to b e t ra n s fe r r e d , w h o is th e s e n d e r , a n d w h o is t h e receiver.

    T h is m e a n s t h a t t h e r e c e i v e r c a n l e a rn f r o m t h e h e a d e r r e c o r d w h i c h

    d a t a h a s b e e n r e c e i v e d a n d b a s e d o n t h i s i n f o r m a t i o n d e c i d e

    h o w t o p r o c e s s t h is d a ta .

    D a t a re co rd s

    T h e d a t a r e c o r d s c o n t a i n b u s i n e s s r e l a t e d i n f o r m a t i o n . T o m a k e s u r e

    t h e t e c h n ic a l f o r m a t is i n d e p e n d e n t o f t h e b u s i n e s s o b j e c t a n d c a n

    a ls o b e u n d e r s t o o d b y n o n S A P sy s t em s , t h e c o n t e n t o f e a c h d a t a

    r e c o r d i s s to r e d a s a s t r i n g o f 1 0 0 0 c h a r a c t e r s. T h i s c h a r a c t e r s t r i n g i s

    p re c e d e d b y a c o n t ro l a r e a c o n ta in in g in fo rm a t io n a b o u t h o w to i n te r -

    p r e t t h e 1000 cha rac t e r s .

    Sta tus reco rdsS ta tu s r e c o r d s c o n t a i n i n f o r m a t i o n a b o u t t h e p r e v i o u s s t a t u se s o f th e

    IDoc , such as " success fu l l y c r ea t ed" o r " success fu l ly po s t ed . " S t a tus

    r e c o r d s a r e n ' t t r a n s f e rr e d ; t h a t is, b o t h t h e s e n d e r a n d r e c e i v e r k e e p

    t h e i r o w n s t a t u s r e c o rd s .

    F r o m a t e c h n i c al p o i n t o f v i e w , t h e s e t h r e e t y p e s o f r e c o r d h a v e t h e s a m e

    s t r u c t u r e . C o n s e q u e n t l y , t h e s t r u c t u r e d o e s n ' t p r o v i d e a n y c l u e a s t o

    w h i c h k i n d o f b u s i n e ss re l a te d i n f o r m a t i o n y o u ' r e d e a li n g w i t h.

    F i g u r e 1. 1 c o n t a i n s a t h e o r e t i c a l i ll u s t ra t i o n o f h o w t h e d i f f e r e n t t y p e so f r e c o rd s c an b e u s e d . N o t e t h a t y o u c a n u s e a n u n l i m i t e d n u m b e r o f

    da t a r ecord s an d s t a tus r ecords . Th is i s des c r ib ed i n g rea t e r de t a i l i n t he

    f o l l o w i n g s e c t io n .

    I D o c a s a n e u t r a l

    f o rm a t

    H e a d e r r e c o r d /

    c o n t ro l r e c o rd

    D a t a r e c o rd s

    S ta tu s re c o rd s

    21

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    18/253

    1 Introduct ion

    C o n t r o l R e co rd I D o c N u m b e r

    Sen d er an d R ece iver

    Messa g e T yp e an d ID o c T ype

    External St ructure

    D a t a R e c o rd s

    Contro l Sect ion with

    I D o c N u m b e r A p p l ica t io n D at a

    Seg m en t T yp e e t c .M at er ia l N u m b er , D at e e t c . as C h arac t er S tr in g

    ( L e n g t h : 1 0 0 0 )

    S ta tu s R e c o rd s I D o c N u m b e r

    Status In form at ion (e.g . . 53 : P oste d Su ccessful ly )

    F igu re 1.1 S t ruc tu re o f an IDoc

    To process i h e IDoc, t he r ece ive r need s meta information, t ha t is, i n form a-

    t i o n c o n c c m i n g t h e m a n n e r i n w h i c h t h e d a t a is s u p p o s e d t o b e p ro c e ss e d .

    The m eta i n form at ion t ha t desc r ibes an IDoc cons i s t s o f t h ree pa r ts :

    M e s s a g e t y p e M e s s a g e t y p e

    T h e m e s s a g e t y p e p r o v i d e s a s e m a n t i c d e s c r i p t i o n o f t h e d a t a to b e

    p ro c e sse d . F o r e x a m p le , m e s sa g e ty p e MATMAS i nd i ca t es t ha t ma te r i a l

    m a s t e r d a t a is s u p p o s e d t o b e e x c h a n g e d . T h e m e s s a g e t y p e i s a ls o

    r e s p o n s i b l e fo r t h e w a y a m e s s a g e w il l b e p r o c es s ed . W h e n y o u c r e -

    a t e o r c h a n g e a s a l e s o r d e r , f o r e x a m p l e , t h e a c t u a l i n f o r m a t i o n i s

    i d e n t ic a l , b u t th e p r o c e s s i n g i s d i f fe r e n t , w h i c h is w h y t h e c r e a t i o n o f

    t h e o r d e r i s a s s i g n e d t h e ORDERS m e s s a g e t y p e , w h i l e m e s s a g e t y p e

    OROCHG is a s si g n e d t o t h e c h a n g e a c ti vi ty . T h e n a m e s o f m e s s a g e t y p e s

    a r e b a s e d o n t h e n a m e s o f t h e U N / ED I FA C T s t a n d a r d (United Nations

    E lectronic D a ta In te rchangef o r A d m in is tr a ti o n , Commerc e a n d Tra nsp ort ),

    b u t a p a r t f r o m th e n a m e s , t h e re a r e n o o t h e r s im ila r i t ie s b e t w e e n th e

    IDoc an d EDIFACT forma t s .

    ID o c t y p e I D o c t y p e

    T h e I D o c t y p e r e p r e s e n t s t h e t e c h n i ca l d e s c r i p t io n o f t h e d a t a . I t t el ls

    y o u w h i c h f ie ld s o f w h i c h b u s i n e s s o b j e c t s a re s u p p o s e d t o b e f il le d

    22

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    19/253

    BAPIs and IDoc s An Introduct ion | 1

    w i t h w h i c h v a l u e s . T h i s m e a n s t h a t t h e I D o c t y p e d e s c r i b e s h o w t o

    i n t e r p r e t t h e 1 0 0 0 c h a r a c t e r s i n th e d a t a r ec o r d.

    S e g m e n t t y p e S eg me nt typ e

    F o r e a c h p o s s i b le v a r i a n t o f t h e s e 1 0 0 0 c h a r a c t er s , t h e r e is o n e s e g -

    m e n t t y p e. F o r e x a m p l e, s e g m e n t t y p e E1MARAM i nd i ca t es t h a t ma te r i a l

    m a s t e r d a t a f r o m T ab le MARA i s go ing t o fo l l ow. In ea ch SAP sys t em ,

    i n f o r m a t i o n i s s t o r e d a s t o w h i c h I D oc t y p e c a n h a v e w h i c h s e g m e n t s ,

    h o w o f t e n , a n d i n w h i c h s e q u e n c e .

    Y o u c a n e x p o r t t h i s d a t a t o e x t e r n a l s y s t e m s t o a v o i d h a v i n g t o m a i n -

    t a i n al l s t r u c t u r e s m a n u a l l y . SA P s u p p o r t s t h e t r a n s f e r o f d a t a v i a t r a n s -

    p o r t ID ocs , C fil es, DTD (Docu me nt Type Description),o r H T M L (Hypertext

    M a rk u p Language). I f y o u w a n t t o u s e tr a n s p o r t ID o cs , y o u m u s t e n s u r e

    t h a t y o u r p a r t n e r c a n g e n e r a ll y re c e i ve I D o c s fr o m y o u , w h i c h m e a n st h a t y o u r SA P sy s t e m m u s t k n o w t h e p a r t n e r a s a l og ic al s y s te m .

    T h e I D o c, w h i c h e x i s ts a s a s e t o f d a t a r e c o r d s , is t h e n t r a n s f e r r e d f r o m

    t h e s e n d e r t o t h e r e ce iv e r. T h e m o s t c o m m o n l y u s e d t y p e o f t r a n s f e r is

    t h e t R FC . T h e t r a n s f e r is c a rr i e d o u t in s u c h a w a y t h a t t h e s e n d i n g s y s -

    te m calls th e fu n c ti o n m o d u le ID0C_INB0UND_ASYNCHR0N0US in t h e re ce iv -

    i n g sy s t e m . T hi s f u n c t io n m o d u l e r e ce i ve s t h e d a t a a n d p o s t s t h e h e a d e r

    and data records to the associa ted database tables EDIOC and EDID4, and

    the s t a tus o f t he IDoc to ED I OS. Af t e r t ha t has bee n do ne , t he t echn ica l

    p a r t is f in i sh ed . I f p r o b l e m s o c c u r d u r in g th is p ro c e ss , t h e s e n d e r w ill b e

    n o t i f ie d a n d m u s t r e s e n d t h e d a t a a t a l a t e r p o i n t i n t im e .

    O t h e r t y p e s o f t r a n sf e r , s u c h a sf i l e (flat file), XML (file in XM L fo rm at) , IDoc as file

    o r HTTPc a n a l so b e u s e d b e c a u se o f t h e s e p a r a t i o n o f d a t a t r a n s f e r a n d

    d a t a p r o c e s s i n g . F i g u re 1 . 2 s h o w s t h e f i rs t p a r t o f a sm a l l m a t e r i a l m a s t e r

    I D o c a s a f il e, o p e n e d i n N o t e p a d .

    i:DI_DC 40_U 800000 000000 07607 64 700 3012 MATMftSOS2HABA*007 800000000000076076400000100000002005SH100

    2KABA1001 800000000000076076400000200000103/ 2MAKTM001 8000000000000760764000003 00000103005CWM ano lE2HAKTM001 8000000000000760764000004 00000103005 EMet hano lE2KAKTM001 8000000000000760764000005 00000103005 rMe t hano lE2HAKTM001 800000000000076076400000600000103005Jrfsy *E2MAKTM001 800000000000076076400000700000103005 P we t ano l

    1 9 9 5 1 0 0 5 /ZSM1

    /

    Figure 1 .2 IDoc in Notepad Editor

    23

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    20/253

    1 Introduct ion

    Y ou c a n s p e c i f y t h e t y p e o f tr a n s f e r t o b e u s e d f o r t r a n s f e r r in g I D o cs t o

    t h e p a r t n e r s y s t em v i a th e outbou nd p ar tner proj ile (T ransac t i on WE20) .

    A f t e r t h e I D o c h a s a r r i v e d i n t h e r e c e i v in g s y s t e m , t h e b u s i n e s s r e l a te d

    p o s t i n g p ro c e s s b e g in s . Typic ally , th is is a lso c a r r ie d o u t b y m e a n s o f a

    f u n c t io n m o d u l e .

    T h e inbound p ar tn er proji le (a l so T ransac t i on W E20) spec i f i e s t he p rocess

    c o d e t o b e u s e d . F o r e a ch p o s s i b le c o m b i n a t i o n o f s e n d e r a n d m e s s ag e

    t y p e , y o u c a n d e f i n e w h i c h f u n c t i o n m o d u l e w i ll b e u s e d . S AP p r o v i d e s

    a ll n e c e s s a i y f u n c t i o n m o d u l e s f o r a l l A LE s c e n a r i o s a v a il a b le . N o t e t h a t

    y o u c a n cu s t o m i z e t h e s e f u n c t io n m o d u l e s o r e v e n r e p l ac e t h e m w i th

    y o u r o w n . C h a p t e r 4 , C h a n g e s t o I D oc s, p r o v i d e s m o r e d e t a i le d i n f o r -

    m a t i o n o n t h i s .

    IDoc t rack ing I f an e r ro r occur s du r ing t he bu s iness r e l a t ed pos t i ng , t he e r ro r wi ll be

    d o c u m e n t e d i n t h e s u b s e q u e n t s t a tu s r e c o r d o f t h e I D oc , a n d y o u c an

    res t a rt t he pos t i ng p rocess l a te r. SAP prov ides a sepa ra t e t r ansac t i on fo r

    p o s in g a n ID oc a f te r a p roc ess in g er ro r : T ran sact ion BD87. This t ransac tio n

    c an r e s e n d I D o cs t h a t c o n t a i n e d e r r o r s i n t h e s e n d i n g s y s t e m d u r i n g t he

    f ir s t a t t em pt and can r e process e r ro ne ou s IDocs in t he r ece iv ing sys tem,

    i f necessa iy . Af t e r t he r eprocess , ev e ry th ing i s f i n i shed . The p os t i ng o f t he

    IDoc crea tes t he bus iness D ocum ent , o r changes it. Th i s is on ly d on e once .

    On ce i t is successfu l ly c r ea t ed o r cha nged , t he Bus iness Do cu m ent i s no t

    t o u c h e d a g a i n. I f b o t h s y s t e m s a r e S A P s y s te m s , y o u c a n e v e n u s e t h e ID oc

    trackingf u n c t io n f r o m w i t h i n t h e s e n d i n g s y s t e m t o o b t a i n i n f o r m a t i o n o n

    the cu r r en t s t a tus o f t he r e spec t i ve IDoc in t he r ece iv ing sys t em. You can

    s t a r t IDoc tr ack ing f rom wi th in t he IDoc m on i to r (T ransac ti on BD87). Th is

    fu nc tio n us es th e fu nc tio n m o d u le I D0C_DATE_T IME_GET vi a sRFC to read

    the IDoc nu m be r and i ts s t a tus i n t he r ece iv ing sys t em.

    BAPIs and IDocs in ALE Scenarios

    D u e t o t h e t r a n s a c t io n s e c u r it y e n a b l e d b y th e u p d a t in g o f e r ro n e o u s c o n -

    n e c t io n s a n d b e ca u se o f t a r g e t o r ie n t e d e r r o r h a n d l in g p r o c e d u re s , th e A L E

    i n t e g r a t io n s c e n a r io s p r o v i d e d b y S A P a lw a y s u s e B A P Is f o r s y n c h r o n o u s , r e -

    q u e s t in g a cc e ss , a n d I D o c s f o r a s y n c h r o n o u s , c h a n g i n g a c c es s. I f i t' s p o s s ib le

    t o t r a n s f e r d a t a in b o t h w a y s , th a t is , s y n c h r o n o u s l y a n d a s y n c h r o n o u s l y (e .g .,

    in a f i r s t , s y n c h r o n o u s te s t r u n , a n d t h e n t h e a c t u a l p o s t in g a s y n c h r o n o u s ly ) ,

    b o t h a B A P I a n d a m a t c h i n g I D o c a r e n e e d e d . T h e I D o c t h e r e f o r e c a n b e c re -

    a t e d v i a T r a n s a c ti o n B D B G , w h i c h is a l so a v a il a b le t o c u s t o m e r s .

    24

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    21/253

    D i f fe re n t i a t i o n o f A L E a n d E D I |

    1.3 D ifferen tiation of ALE and EDI

    T h e c o n c e p t o f ALE c o m p r i s e s c o m m u n i c a t i o n w i t h in a n e n t er p r is e .

    H o w e v e r , w i t h i n a n e n t e r p r i se , d i f f e re n t p r o c e s s e s a re c a r r ie d o u t in

    p h y s ica l ly d i f f e r e n t IT s y s te m s , w h i c h m e a n s t h a t in d iv id u a l p ro c ess

    s t e p s c a n i n v o l v e d i f f e r e n t s y s te m s . A s y o u ' v e a l r e a d y l e a r n ed , t h e s e

    s t e p s c a n b e c a r r i e d o u t i n a s y n c h r o n o u s p r o c e s s v ia B AP Is a s w e ll a s i n

    a n a s y n c h r o n o u s p r o c e s s i n v o l v in g I D o cs .

    I n t h is c o n t e x t , t h e c o m m u n i c a t i o n i t s e l f is c a r r i e d o u t b e t w e e n t h e l o g i-

    c al s y s t e m s ( LSs). E a ch L S r e p r e s e n t s a c o m b i n a t i o n o f h a r d w a r e a n d

    s o f t w a r e i n s ta l le d o n t h a t s y s t e m . I n a n S AP s y s te m , a c l i e n t c o r r e s p o n d s

    to a LS . The LS i s a s s igned t o t he c l i en t and prov ides i n format ion as t o

    w h e t h e r a d o c u m e n t w a s c r ea t ed o n t h a t SA P c li en t o r w h e t h e r i t wa s

    a d o p t e d b y m e a n s o f c o n s o l id a t io n p r oc e ss e s ( t h e m a j o ri ty o f d o c u m e n t s

    con ta in t he o r ig ina l sys t em in a spec if ic f i eld i n t he da t abase ) . The as s ign-

    m e n t o f t h e LS is p a r t o f t h e p o s t in s t a l la t i o n p r o c e d u r e s . A s y s t e m m u s t

    k n o w i ts o w n s y s te m n a m e a s w e ll a s th e n a m e s o f a ll LSs it c o m m u n i -

    ca t es wi th .

    T h e L Ss m u s t b e u n i q u e a c r o s s t h e e n t i r e e n t e r p r i s e ( a c t u a ll y a c r o s s t h e

    e n t i r e r a n g e o f c o m m u n i c a t i o n ) . M o r e o v e r , t h e L Ss f o r no n S A P s y s t e m s

    w i t h w h i c h a c o m m u n i c a t i o n is e st a b l is h e d m u s t a l so b e k n o w n . Y ou

    c a n a ss i g n t h e LS f o r y o u r o w n c l i e n t a s w e ll a s m a k e s y s t e m s k n o w n

    w i t h w h i c h m e s s a g e s w i l l b e e x c h a n g e d v i a A L E C u st o m i zi n g , w h i c h c a n

    b e re a c h e d u s in g T ra n sa c t io n SA LE . F ig u re 1 .3 s h o w s th e C u s to m iz in g

    func t ions , Def ine Logica l Sys t em and Ass ign Logica l Sys t em to C l i en t .

    T r a n s a c t io n B D 5 4 e n a b l e s y o u t o a ss i g n n a m e s t o LS s. In a d d i t i o n t o t h e

    n a m e f o r t h e LS, y o u s h o u l d a l so e n t e r a b r i e f d e s c ri p ti o n .

    Structure

    ^ I D o c l i^ r fa c e V

    Bas ic Set t ings [ I D o c A d m i ni s tr a ti o n

    Q ( > I n b ou n d S O A P f o r I D oc : R e g i s t e r S e rv ic e

    Per f o rm A u t o m at ic Wo rk f lo w C u st o m iz in g

    Q A c ti va te e v e n t r e c ei v e r l in k a g e f o r I D o c i n b ou n d

    1:7 Logica l Sys tems

    D ef in e L o g ica l Syst em

    A ss ig n L o g ica l Syst em t o C l ien t____________________|

    Figure 1 .3 Sett ing Up Logical Systems

    Log ica l sys tem

    U n i q u e n e s s o f

    l o g i c a l s y s te m s

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    22/253

    1 Introduct ion

    C u s t o m e r

    d i s t r i b u t i o n m o d e l

    EDI

    E D I s t a n d a rd s

    T h e cus tomer dis tr ibut ion model (T ransac t i on BD64) a l l ows y o u to de f ine

    w h i c h B A PI s a n d I D o c s w i ll b e e x c h a n g e d b e t w e e n w h i c h s y s t e m s . In

    t h i s c o n t e x t , e a c h s y s t e m c a n f u n c t i o n a s t h e s e n d e r o r r e c e i v e r . I n o u r

    example (see F igure 1 .4) , the LS T 9 0 C L N T 0 9 0 s e n d s t h e I D o c MATMAS to

    the LS S A L E S , w h i l e t h e I D o c M A T F E T i s s e n t i n t h e o p p o s i t e d i r e c t i o n .

    I n a d d i t i o n , t w o B AP Is a re e x c h a n g e d . T h e M a t e r i a 1 . G e t D e t a i 1 BAPI is

    s e n t f r o m T 9 0 C L N T 0 9 0 t o S A L E S , w h i l e t h e M a t e r i a l . A v a i l i b i 1 i t y BAPI

    is s e n t i n t h e o p p o s i t e d i r e c ti o n .

    D is tribu tio n M odel |D e s c r ip tio n /te c h n ic a l n a m e

    ^ M o d el v ie w s

    ^ g g Z S M I ZSM1

    ^ 0 X D O c lie n t 8 0 0 T 9 0 C L N T 0 9 0

    ^ @ S a le s s ys te m (c lie n t 8 1 0 ) SA L ES

    V f a M ATM AS M a te ria l m a s te r

    $ S t a n d a rd M a t e r la l .G e t D e ta i l

    ^ @ S a l es s y ste m (c li en t 8 1 0 )

    D et erm in e d e t a i l s o n m at er ia l

    SA L ES

    ^ 0 X D O c lien t 8 0 0 T 9 0 C L N T 0 9 0

    f a M A TFE T R e q u e s t m ateria l

    $ S tan d ard M ater ia lA va ilab ility A TP info rm atio n

    F i g u r e 1 .4 D i s t ri b u t io n M o d e l w i t h E x a m p l e f o r I D o c a n d B A PI

    I n c o n t r a s t t o A LE a s a m e a n s o f e n t e r p r i s e i n t e r n a l c o m m u n i c a t i o n , E DI

    (Electronic Data Interchange ) c o m p r i s e s t h e t r a n s f e r o f d a t a b e t w e e n d i f -

    f e r e n t e n t e r p r i s e s , f o r e x a m p l e , b e t w e e n c u s t o m e r s a n d s u p p l i e r s . E a c hc o m p a n y h a s i ts o w n p r o c e s s fl o w s. H o w e v e r , a t c e r t a i n p o i n t s w i t h i n a

    p ro c e ss , t h e p a r tn e r m u s t b e in fo rm e d . To p r e v e n t t h e p a r t n e r f ro m h a v -

    i n g to e n t e r s pe c if ic i n f o r m a t i o n m a n u a l l y i n t o t h e s y s t e m , t h e r e l e v a n t

    i n f o r m a t i o n m u s t b e t r a n s m i t t e d t o t h e p a r t n e r e l ec t ro n i ca l ly .

    E DI i s a l w a y s a n a s y n c h r o n o u s p r o c e s s . W i t h r e g a r d t o S A P s y s t e m s , t h is

    m e a n s t h a t I D o c s a r c a ls o u s e d f o r ED I c o m m u n i c a t i o n . H o w e v e r , n o t e

    t h a t E DI c o m m u n i c a t i o n i s a l w a ys c a r ri e d o u t w i t h o u t t h e d i s t r ib u t i o n

    m o d e l a n d L Ss. W i t h i n t h e s y s t e m , t h e r e l e v a n t s e n d e r s a n d r e c ei v e rs

    o f messag es a r e a l so r e f e r r ed t o a s p a r tn ers, c u s t o m e r s a n d s u p p l i e rs a re

    o n e e x a m p l e h e r e . N o t e t h a t t h e y m u s t b e m a i n t a in e d a s c u s t o m e r s a n d

    sup pl i e r s i n t he SAP sys t em. N o new , IDocspec if i c mas t e r da t a i s need ed

    in t h is con t ex t .

    B e c a u se d i f f e r e n t c o m p a n i e s u s e d i f f e r e n t IT s y s t e m s , s p e ci fi c ED I s t a n -

    da rds ex i s t t o f ac i li t a te da t a t r ans fe r s . In Eu rope an cou nt r i e s , t h e EDI

    2 6

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    23/253

    S u m m a ry | 1

    FACT s t an dard i s p r im ar i l y used , w he reas i n t he U ni t ed S t a te s , ANSI ASC

    X I 2 {American Na t ional S tanda rds Ins t i tu te Accredited Standa rds Comm ittee

    X I 2) i s t h e p r e d o m i n a n t s t a n d a r d . E DI FA CT a s s ig n s n a m e s t o m e s s ag e s ,

    w h i l e A N SI u s e s n u m b e r s . F o r e x a m p l e , a c c o r d i n g to t h e E D IF AC T s t a n -

    d a r d , t h e m e s s a g e ORDERS r e p r e s e n t s a p u r c h a s e o r d e r ; a c c o r d i n g t o t h e

    A N SI s t a n d a r d , t h e s a m e m e s s a g e is c al le d 8 5 0 . W i t h r e g a r d t o m e s s a g e

    t y p e s , SA P h a s b a s e d i ts n a m i n g c o n v e n t i o n s o n t h e E D IF AC T s t a n d a r d ;

    h o w e v e r , t h e s t r u c t u r e o f t h e m e s s a g e s d i ff e rs s u b s t a n t ia l ly f r o m t h a t

    s t a n d a r d . ( C h a p t e r 2, G e n e r a t i n g I D oc s , d e s c r i b e s t h e s t r u c t u r e o f I D oc s

    i n g r e a t e r d e t a il . ) In S A P s y s t e m s , I D o c s a r e u s e d f o r a s y n c h r o n o u s d a t a

    t r a n s fe r s b o t h i n ED I a n d A LE p r o c e s s es , w h i c h is w h y t h e p r o c e d u r e s

    d e s c r ib e d i n t h e c o u r s e o f th i s b o o k c a n a lw a y s b e a p p l i e d t o b o t h w a y s

    o f c o m m u n i c a t io n .

    T h e f o l l o w i n g c h a p t e r s w i l l f o c u s e n t i r e l y o n u s i n g I D oc s . A s f a r a s t h e

    u s e o f BA PIs i s c o n c e r n e d , i t' s s i m i l a r t o u s i n g f u n c t i o n m o d u l e s . C o n -

    s e q u en t ly , d e v e l o p e r s w h o a r e f a m i li a r w i t h f u n c t i o n m o d u l e s c a n c a ri y

    o u t a l l d e v e l o p m e n t t a s k s r e l a t e d t o B A P I s w i t h o u t a p r o b l e m . I D o c s ,

    o n t h e o t h e r h a n d , c o n t a i n s o m e s p e c i f i c f e a t u r e s t h a t a r e n t u s u a l l y

    d e s c r i b e d i n d e v e l o p e r m a n u a l s . T h e s e s p e ci fi c f e a t u r e s a r e d e s c r i b e d i n

    th i s book .

    1 . 4 S u m m a r y

    I n t h is c h a p t e r , w e d i s c u s s e d t h e r e a s o n s f o r u s i n g i n t e r fa c e s i n g e n e r a l ,

    a s w e l l a s t h e t y p e s o f in t e r f a c e s p r o v i d e d f r o m SAP. You l e a r n e d t h a t

    C u s t o m i z in g a n d p r o g r a m m i n g w i t h I D oc s is v e i y i m p o r t a n t .

    I n t h e n e x t c h a p t e r , w e ll t a k e a d e e p e r l o o k a t I D oc s , b y s t a r t i n g a t t h e

    v e i y b e g i n n i n g t h e d i f f e r e n t p o s s i b i li t ie s t o c r e a t e ID o c s f o r s e n d i n g

    t h e m t o o u r LS s o r p a r t n e r s .

    27

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    24/253

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    25/253

    I n th e sen d in g sy s te m , i t ' s necessary to gen era te IDocs so th a t

    they can be sent to the receiv ing sys tem . H ow th is is done depends

    on t he t ype o f da ta a nd t he app l i ca ti on . T h is chap t er describes

    t he d i f f e ren t genera t i on op t i ons an d t h e i r use .

    2 Generating IDocs

    S AP h a s p r o v i d e d t o o l s f o r t h e g e n e r a t i o n o f I D o c s in a l l lo c a t i o n s w h e r e

    t h e y a r e u s e d i n A LE s c e n a r i o s o r c l a ss ic E DI , a n d t h e y c a n u s u a l l y b ea c t i v a t e d u s i n g t h e C u s t o m i z i n g s e t t i n g s . H o w e v e r , t h e r e a r e d i f f e r e n t

    m e t h o d s o f ID o c g e n e r a t i o n d e p e n d i n g o n t h e t y p e o f d a t a a n d t h e l o c a-

    t i o n w h e r e t h e I D o c w i l l b e g e n e r a t e d . T h i s c h a p t e r p r e s e n t s t h e m o s t

    c o m m o n m e t h o d s o f I Do c g e n e r a t i o n . U s u a ll y t h e I D oc a d m i n i s tr a t o r

    n o t t h e d e v e l o p e r i m p l e m e n t s t h e s e t ti n g s r e q u i r e d f o r c r e a t in g t h e

    p a r tn e r p rof ile s , f o r in s tan c e , so t h e y a re o u t l in e d o n ly briefly, a n d m o re

    i m p o r t a n c e i s a t t a c h e d t o t h e f u n c t i o n a l p r o c e s s fl ow .

    2.1 Standard M etho ds for the IDoc Gene rat ion

    I ni ti al ly , y o u m u s t d i s t in g u i s h b e t w e e n t h e g e n e r a t i o n o f m a s t e r d a t a a n d

    t h e g e n e r a t i o n o f t r a n s a c ti o n d a t a b e c a u s e t h e r e a r e d i f f e r e n t re q u i r e -

    m e n t s o n t h e g e n e r a t i o n p r o c es s o r t h e g e n e r a t i o n f r e q u e n c y d e p e n d i n g

    o n t h e t y p e o f d a t a . A s p ec i a l to o l is a v a il a b le t o g e n e r a t e m a s t e r d a t a ,

    c a l l e d t h e Shared M as t er Data Tool (SMD) . T ransac t i on da t a IDocs a re

    g e n e r a t e d v ia t h e a l r e a d y e x i st i n g m e s s a g e c o n t r o l . T h e r e a r e a l s o s o m e

    spec i a l func t i ons fo r IDocs t ha t a r c d i rec t l y ge ne ra t e d i n a p rocess .

    2.1.1 Shared M as ter Da ta Tool

    T h e S M D is a s p e c ia l to o l f o r s e n d i n g m a s t e r d a t a v i a ID o c . M a s t e r d a t a

    is c h a r a c t e ri z e d b y a r e l a ti v e ly l o n g r e t e n t i o n p e r i o d i n t h e s y s t e m d u r i n g

    M a s t e r d a ta

    in t h e I D o c

    29

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    26/253

    2 | Gene rat ing IDocs

    A u to m a t io n a n d

    c o n t r o l v ia v i e w s

    C h a n ge p o i n t e r

    W r i ti n g t h e h i s to r y

    i n t h e a p p l i c a t io n

    w h i c h t h e d a t a is c h a n g e d r ar el y. M a s t e r d a t a u s u a ll y c o n s i s ts o f m u l t i p l e

    v i e w s t h a t a r e n o t u s e d a l l t h e t i m e . Y ou c a n o m i t v ie w s , i n c l u d i n g t h o s e

    t h a t c o n t a i n m a n d a t o r y f ie ld s, b e c a u s e t h e c h e c k o f w h e t h e r all m a n d a

    to iy f ie lds a r e po pu la t ed is on ly ca r r i ed ou t i f t he v i e w i s ac tua l l y used .

    T h is e n a b l e s y o u t o s e le c t f r o m t h e w e a l t h o f i n f o r m a t i o n t h a t i s o f f er e d

    f o r a s p e c i f i c o b j e c t a n d u s e e x a c t l y t h e d a t a t h a t i s a c t u a l l y r e q u i r e d

    w i t h i n y o u r e n t e r p r is e .

    T o d i s t r i b u t e d a t a u s i n g I D o c s , a n a u t o m a t e d p r o c e s s i s d e s i r a b l e t h a t

    r e s p o n d s t o t h e c r e a ti o n a n d m o d i f i c at io n o f m a s t e r d a t a w i t h o u t r e q u i r -

    i n g f u r t h e r u s e r i n t e rv e n t i o n s . A ls o, e m p t y v i e w s a r e n o t s u p p o s e d to

    b e t r an s fe r re d .

    T h e S M D t ak e s t h e s e r e q u i r e m e n t s i n t o a c c o u n t . T h e te c h n i ca l i m p l e -

    m e n t a t i o n o f a u t o m a t i o n a n d c o n t r o l v i a v ie w s e n t a il s t h a t a l re a d y e xi st

    i n g p r o c e d u r e s c a n b e u s e d f o r b o t h f u n c t io n s . F o r a u t o m a t i o n , y o u

    r e v e r t to r e c o r d i n g c h a n g e s , w h i c h is i m p l e m e n t e d b y d e fa u l t ; f o r c o n -

    t r o l v ia v i e w s , y o u u s e t h e o p t i o n ( w h i c h o r i g i n a te d f r o m b a t c h i n p u t

    p ro c e ss in g ) to c o n t ro l i r r e le v a n t fi elds u s in g a N 0 _ D A T A charac t e r . Then ,

    t h e I D o c s a r e r e g u l a r ly g e n e r a t e d v ia b a c k g r o u n d j o b s .

    Addi t i ona l l y , fo r a lmo s t al l ob j ec t s , y o u a l so have t h e op t ion t o exp l ic i t ly

    g e n e r a t e I D o c s o r t o r e q u e s t I D oc s . You c a n u s e t h i s o p t i o n i f w a i t in g f o r

    p e r io d ic a l ly s c h e d u le d j o b s is im p o ss ib le .

    Rec ording Changes

    F o r c o n s i s te n c y r e a so n s , c h a n g e s t o t h e m a s t e r d a t a a r e u p d a t e d i n d e -

    p e n d e n t ly o f th e u s e o f ALE in SAP sy s tem s . F o r ea ch i n d iv id u a l d a ta

    e l e m e n t o f t h e t a b le s c o n c e r n e d , S AP h a s s t ip u l a t ed w h e t h e r a c h a n g e

    s h o u l d b e l o g g e d o r n o t . F i g u re 2 .1 s h o w s t h e C h a n g e D o c u m e n t F l a g ,

    w h i c h i s a c t iv a t e d i n t h i s c a s e a s a n e x a m p l e o f BI SM T (O ld M ater ia l Nu m -

    ber) f ro m t h e MARA t a b l e .

    F o r u p d a t i n g t h e c h a n g e s , y o u a l w a y s ca ll t h e CHANGEDOCUMENT.OPEN f u n c -

    t io n m o d u l e , w h i c h p r e p a r e s t h e w r i ti n g o f t h e c h a n g e h i s to r y . T h e n ,

    a l l c h a n g e s t o b e w r i t t e n a r e c o l l e c t e d , a n d t h e p r o c e s s i s c o n c l u d e d

    u s i n g t h e C H A N G E D O C U M E N T .C L O S E f u n c t i o n m o d u l e . B e c a u s e I D o c s a r e

    30

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    27/253

    Standard M ethods for the I Do c Generat ion | 2

    s u p p o s e d t o b e g e n e r a t e d w h e r e v e r c h a n g e s a r e u p d a t e d b y d e f a u l t, t h e

    CHANGEDOCUMENT_CLOSE f u n c t i o n m o d u l e h a s a n A LE s h a r e i n a d d i t io n

    t o i ts s t a n d a r d f u n c t i o n . T h is e n a b l e s y o u t o g e n e r a t e change pointers

    f o r ALE for t he des i r ed message t ypes . In a l l Unicodeenab l ed r e l eases ,

    t h is i s d o n e u s i n g t h e C H A N G E _ P O I N T E R S _ C R E A T E _ L O N G f u n c t i o n m o d u l e ;

    i n o ld r e l eases , t h i s i s done us ing t he C H A N G E _ P O IN T E R S _ C R E A T E f u n c t i o n

    m o d u l e .

    Dictiona ry: D isplay Data Element

    ssiMMMiMMfisisMSMTsiasHiData elem ent BISHT Active

    Short Description Old mate rial numbe r

    Attributes Da ta Type PAifi i.abe i________

    Search Help

    N am e

    Parameters

    Parameter ID

    Default Component Nam e OLD_HM_HO

    Figure 2.1 C h a ra c te ri s ti c s o f D a ta E l e m e n ts

    You a l so have t he C H A N G E _ P O I N T E R S _ C R E A T E _ D I R E C T f u n c t i o n m o d u l e a s

    a s e c o n d o p t i o n t o g e n e r a t e c h a n g e p o i n t e r s . T h i s f u n c t i o n m o d u l e i s

    c a ll e d b y a p p l i c a ti o n s t h a t a r e n o t c o n n e c t e d t o t h e p r e v i o u s l y d e s c r ib e d

    c h a n g e m a n a g e m e n t f o r d o c u m e n t s .

    I n b o t h c a se s , c h a n g e p o i n t e r s a r e o n l y w r i t t e n i f y o u u s e t h e S M D f o r

    p e r f o rm a n c e re a so n s . In th e ALE C u s to m iz in g , y o u can sp e c ify w h e th e r

    t h is is th e c a s e a n d f o r w h i c h m a s t e r d a t a y o u r e q u i r e c h a n g e p o i n t e r s .

    The re i s a sepa ra t e T ransac t i on co de SALE for t he ALE Cus tom iz ing t ha t

    t a k e s y o u d i r e c t ly t o t h e c o r r e c t p o s i t i o n i n t h e m e n u t r e e . F ig u r e 2. 2

    s h o w s t h e m e n u p a t h i n C u s t o m i z in g i n w h i c h y o u m a k e t h e n ec e s s a ry

    set t ings .

    G e n e r a t in g c h a n

    p o i n t e r s d i r e c t ly

    31

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    28/253

    2 | Gen erating I Docs

    A c t iv a t in g c h a n g e

    p o i n te r s

    A c t iv a t in g c h a n g e

    p o i n t e r s f o r o b j e c t

    Structure ___________________________________________________________________________

    ^.Interface

    P Bas ic Set t ings

    P C o m m u n i c a t i o n

    ^ M o d e l li n g a n d I m p l e m e n t in g B u s i n e s s P r o c e s s e s

    P Glob al Organ izat ional Units

    M ain t a in D is t n b u tio n M o d el an d D is t rib u te V iews

    t> C o n f ig u re Pred ef in ed A L E B u sin e ss Pro ces ses

    ________ M a s t e r D a t a D i st n bu t io n

    ^ R e p l ic a t io n o f M o d i fi e d D a t a

    B ( > A c ti va te C h a n g e P o in t e r s - G e n e r a ll y

    _____________________________Ac tiv at e C h a n g e P o in te rs fo r M e s s a g e T y p es______________

    F i g u r e 2 .2 A c t iv a t in g C h a n g e P o in t e rs f o r th e S M D

    I n it ia ll y , y o u a c t i v a t e t h e g e n e r a t i o n o f c h a n g e p o i n t e r s g e n e r a l ly . A s

    a re su lt, th e sh ar e o f th e CHANGEDOCUNENT_CLOSE fu n c ti o n m o d u le th a t

    h a s n o t b e e n u s e d u p t o n o w a n d t h a t is r e s po n s i bl e f o r t h e S M D i s ru n

    t h r o u g h . T h is m u s t b e s e t o n c e o n l y f o r a ll m a s t e r d a t a . F i g u re 2 .3 s h o w s

    the app rop r i a t e func t iona l i t y .

    A cti va te C hange P o in te rs G enera lly

    Activation si at u s/

    p ] Chang e pointers activated - general^

    F ig u r e 2 . 3 A c t i v a t e Ch a n g e Po in t e rs Ge n e r a ll y

    I f t h e c h a n g e p o i n t e r s a r e a c t i va t e d g e n er a ll y , y o u c a n s p e c i f y i n a s e c o n d

    s t e p f o r w h i c h m e s s a g e t y p e y o u r e q u ir e t h e g e n e r a t i o n o f c h a n g e p o i n t -

    e r s . Th i s i s done in t he second menu sub i t em (Act iva t e Change Po in t e r s

    f o r M e s s a g e T y p e s ) a n d h a s b e e n i m p l e m e n t e d f o r t h e m e s s a g e t y p e s ,

    MATMAS a n d MATMAS_WMS ( s ee F i g u re 2. 4 ) . N o c h a n g e p o i n t e r s a r e w r i t t e n

    for MATCOR a n d m a t m a s . G D S , w h i c h h a v e n o t b e e n a c t i v a t e d .

    I n t h i s c o n t e x t , i t s i m p o r t a n t t h a t a c h a n g e p o i n t e r i s n ' t w r i t t e n f o r

    each chan ged f ie ld because the re a re f ie lds wh os e va lues a re no t s ign i fi -

    c a n t f o r th e d o w n s t r e a m s y s t e m . By m e a n s o f T r a n s a c ti o n B D 5 2 , SA P

    p ro v id e s fields fo r e ac h m e s sa g e ty p e c o n n e c te d to t h e SM D , w h ic h are

    r e l e v a n t f o r c h a n g e s f r o m S A P' s p o i n t o f v ie w . F o r t h e m a t e r ia l m a s te r ,

    t he DMAKTSPRAS f i e ld i s impor t an t , fo r example . In t he t r ansac t ion ,

    y o u e n t e r t h e fi el ds t h a t a r e u s e d w i t h in y o u r e n t e r p r i s e. I f y o u ' v e m a d e

    32

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    29/253

    Standard M ethods for the IDoc Generat ion | 2

    c h a n g e s t o t h e c o r r e s p o n d i n g m a s t e r d a t a ta b le s v i a t h e SA P e n h a n c e -

    m e n t c o n c e p t a n d u s e c u s t o m e r s p e c if i c f ie ld s , y o u c a n a ls o s e t t h e c u s -

    tomer spec i f i c f i e lds he re . R efe r t o Ch apte r 4 , Ch ange s t o IDocs, t o l ea rn

    h o w t o p r o v i d e t h e s e f ie ld s.

    Change V i ew "Ac t iva te Change p o i n te r s f o r Message T ype" :

    ^ N e wE rfr .e s | S |

    Activate Chan ge pointers for M ess age Type

    M essgT ype active | d

    MATMAS 0

    MATMAS_6DS 0

    MATHASJMS 0

    MATQM 1

    F i g u r e 2 . 4 A c t iv a t e C h a n ge Po n t er s f o r M e s s ag e T yp e

    Change View "Change docum ent items fo r message type ": Overview

    ^ N e w Entries Q . Q

    Mess aae Type MATMAS

    Chan ae document items for mes saa e froe

    TObject [fa b le Nam e fFieiC Nam e

    MATERIAL D6ESV KEY

    MATERIAL D6ESV KOVBM

    MATERIAL D6ESV VBWRT

    MATERIAL DMAKT KEY

    MATERIAL DMAKT flAKTX

    ___MATERIAL

    m T F P l 1 1

    |DMAKT___________________________

    r M t P N

    [SPRAS |

    R R P I T A I C l M A L

    MATERIAL

    U n A n n

    DMARM

    o n e 1 1

    BR6EW

    MATERIAL pHARH EAN11

    MATERIAL DMARM GE WE I

    1ATERIAL DMARM GTIN_VARIAMT

    MATERIAL DMARM HOEHE

    MATERIAL DMARM KEY

    F ig u r e 2 .5 Ch a n g e - Re le v a n t F i e ld s i n T ra n s a c t io n BD 52

    F i g u re 2 . 5 s h o w s a s e c t i o n o f t h e f ie ld s f o r t h e MATMAS m e s s a g e t y p e ,

    w h i c h a r e p r o v i d e d b y S A P a s c h a n g e r e l e v a n t . T h e m e s s a g e t y p e i s

    d i r e c tl y r e f e r e n c e d t o f ie ld s a n d t a b le s o f th e m a t e r i a l m a s t e r e x c e p t f o r

    the KEY f i eld . Th i s f i eld i sn t pa r t o f t he r espe c t ive t ab l e bu t assum es a

    v e i y i m p o r t a n t , a d d i t i o n a l c o n t r o l r ol e : It e n s u r e s t h a t t h e c r e a t i o n o f a

    C h a n g e - r e l e v a n t

    f ie lds

    33

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    30/253

    2 | Gene rat ing IDocs

    A s s ig n in g c h a n g e -

    re l e v a n t f i e l d s

    E v a l u a t in g c h a n g e

    p o i n te r s

    t ab l e en t ry can be sen t v i a IDoc . I f t he KEY f ie ld i s spec i f i ed i n T ransac -

    t io n B D 5 2 , a c h a n g e p o i n t e r i s w r i t t e n d u r i n g t h e c r e a ti o n o f t h e c o r r e -

    s p o n d i n g o b j e c t , f o r e x a m p l e , d u r i n g t h e i n it ia l c r e a t i o n o f t h e m a t e r i a l

    f o r th e M A R A KE Y d u m m y f i el d o r d u r i n g t h e c r e a t i o n o f a t e x t i n a n e w

    l a n g u a g e f o r t h e M AK T KE Y d u m m y f ie ld . I m a g i n e t h a t t h e k e y v a l u e

    o f t h e t a b l e c o n c e r n e d i s c h a n g e d f r o m " e m p t y " t o t h e n e w v a l u e . A s a

    resu lt , a l l fi e lds o f t h i s t ab l e a r e t r ans fe r r ed .

    A d d i t i o n a ll y , f o r e a c h o f t h e c h a n g e r e l e v a n t f ie ld s , y o u m u s t s p e c i fy to

    w h i c h f i e ld i n w h i c h s e g m e n t o f t h e I D o c t y p e it b e lo n g s . T h i s is d o n e

    in T ransac t i on BD66, w hic h i s sh ow n in F igure 2 .6 . Th e DMAKTSPRAS

    s a m p l e fi el d f r o m T r a n s a c ti o n B D 5 2 b e l o n g s t o t h e E1MAKTM I D o c s e g -

    m en t an d t o t h e f ie ld t h a t i s a l so ca l l ed " SPRAS." Fo r y o u r ow n f ie lds ,

    y o u m u s t s p e c i f y t h i s u s i n g t h e N e w E n t r i e s b u t t o n .

    Change V iew "Segm ent F ie ld Change D ocum ent F ie l d : Overv iew

    * N e w E n t n e s

    Mess age Type MATMAS

    Segm ent F ield - Ch ange Documen t Field

    Seg m ent type Fie ld N a m e Object Table N am e : ieid N a m e j

    1MAKTM MATERIAL DNAKT k e y m

    1MAKTM MAKTX MATERIAL DMAKT MAKTX W

    1MAKTM SPRAS MATERIAL DMAKT SPRAS I ]

    1MARAM MATERIAL MARA KEY

    1MARAM AENAM MATERIAL MARA AENAM

    1MARAM AESZN MATERIAL MARA AESZN

    1MARAM 8E6RU MATERIAL MARA 8E6RU

    1MARAM BEHVO MATERIAL MARA 8EHV0

    1MARAM 8IS M T MATERIAL MARA 8ISM T

    1MARAM 8LANZ MATERIAL MARA 8LANZ

    tMARAM 8LATT MATERIAL MARA 8LATT

    1MARAM 8MATN MATERIAL MARA 8MATN

    F i g u re 2 .6 A s s i g n m e n t o f ID o c F i el d s t o C h a n g e R e l e v a n t F ie ld s

    T h e c h a n g e p o i n t e r s a re t h e n e v a l u a t e d . It j u s t d e p e n d s o n t h e o b j e c t

    c o n c e r n e d w h i c h f u n c t i o n m o d u l e is u s e d h e r e . W h e n y o u c all Tr an sa c-

    t i o n B D 6 0, y o u c a n v i e w t h e s e f u n c t i o n m o d u l e s a n d r e p la c e t h e m w i th

    y o u r o w n f u n c t io n m o d u l e s i fy o u w a n t t o m a k e s o m a n y c h a n g e s t o t he

    34

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    31/253

    Standard M ethods for the IDoc Generat ion | 2

    s t a n d a rd f u n c ti o n a li ty t h a t y o u d o n t w a n t t o e n h a n c e o r m o d i f y t h e S AP

    o r ig i na l . F ig u re 2 . 7 s h o w s a n o t h e r e x a m p l e o f th e m a t e r ia l m a s t e r d a ta .

    T h e r e , t h e f u n c t i o n m o d u l e t h a t u s e s c h a n g e p o i n t e r s t o g e n e r a t e I D oc s

    is ca l led MASTER I DOC_CREATE_SMD_MA TMAS.

    C h a n g e V ie w " A d d it io n a l D a ta fo r M e s s a g e T y p e " : O v e r v ie w

    ^ Q N e w En tr .e s

    A d d i t io n a l D at a f o r Mes sag e T yp e

    M e s s g T y p e R e fm s g . F u n d M od T a b le E j

    -

    h a t h a s Im a t h a s HASTERIDO C_CREATE_SM D_HATM AS HARA

    nAT HA SJM S |MATHAS NASTERIDOC_CREATE_SMD_M ATMAS UR A

    F i g u re 2 .7 F u n c t i o n M o d u l e s t o E v a l ua te C h a n g e P o i n te rs

    T h e RBD MI DOC r e p o r t , w h i c h m u s t b e s c h e d u l e d a t r e g u l a r i n te r va l s, m u s t

    t h e n u s e t h e s e f u n c t i o n m o d u l e s t o g e n e r a t e I D o c s f r o m t h e c h a n g e

    p o in t e r s a n d u p d a t e w h ic h c h a n g e p o in t e r s h a v e b e e n p ro c e s se d . As

    a tr a n s f e r v al u e, y o u c a n s p e c if y f o r w h i c h m e s s a g e t y p e y o u w a n t to

    i m p l e m e n t t h e e v a l u at io n . F o r th i s p u r p o s e , y o u s p e c if y t h e a p p r o p r i a te

    type (he re : m a t m a S ) i n t he M essag e Type f ie ld i n t he i n i t i a l s c ree n o f t he

    RBDM I DOC r epo r t . Th i s i s il l us t r a t ed i n F igure 2 .8.

    C r e a t in g ID o c T y p e fr o m C h a n g e P o in t e rs

    M es sa ge type MATMAS| E>

    F i g u r e 2 . 8 I n i ti a l S c re e n o f t h e " R B D M I D O C " R e p o r t

    F o r s e n d i n g I D o c s u s in g t h e S M D a n d f o r c h a n g e p o i n t e r s , t h e a p p l i ca -

    t i o n a n d t h e A LE c o m m u n i c a t i o n l a y e r i n t e ra c t cl os el y. F i gu r e 2 . 9 s c h e -

    m a t i c al ly s h o w s t h e p r o c e s s f l o w o f ID o c g e n e r a t i o n . T h e e n t i r e p r o ce s s

    o f w r i t i n g c h a n g e p o i n t e r s t a k e s p l a ce i n t h e a p p l i c a t io n ; t h e e v a l u a t i o n

    o f t h e c h a n g e p o i n t e r a n d t h e g e n e r a t io n o f I D o c s a r e c a rr ie d o u t b y t h e

    A LE c o m m u n i c a t i o n l ay e r.

    " R B D M I D O C

    b a c k g r o u n d j o b

    C h a n g e s i n t h e

    S M D

    35

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    32/253

    2 | Gene rat ing IDocs

    D i s t ri b u t i o n lo c k

    A p p l i c a t i o n

    1 . W r i t e n o r m a l h i s to r y

    2 . C h e c k i f c h a n g e p o i n te r s a r e g e n e r a ll y s u p p o s e d t o b e w r i tt e n

    3 . C h e c k i f c h a n g e p o i n t e r s a r e s u p p o s e d t o b e w r i t t e n f o r th e

    o b j e c t i n q u e s t i o n

    4 . W r i t e c h a n g e p o i n te r s

    A p p l i c a t i o n

    D o c u m e n t Change

    P o i n t e r s

    C h a n g e

    D o c u m e n t

    R B D M I D O C

    1 . R e a d c h a n g e p o i n t e rs

    2 . W r it e I D o c

    3 . M a r k c h a n g e p o i n te r s as

    p r o c e s s e d

    F i g u r e 2 . 9 I D o c G e n e r a t io n U s in g t h e S M D

    N o te t h a t w h e n y o u s e n d ID ocs via c h a n g e p o in te r s , y o u o n ly s e n d th o se

    v i e w s i n w h i c h c h a n g e s h a v e ac t ua l ly b e e n m a d e . I f a n e w v i e w h a s b e e n

    c r e a te d , a ll i ts f i el d s a r e t r a n s f e r r e d ; i f a v i e w h a s b e e n c h a n g e d , o n l y

    t h e c h a n g e d f ie ld s a r e t r a n s f e r r e d t o i n c r e a s e p e r f o r m a n c e . C h a p t e r 4 ,C h a n g e s t o I D o c s, u s e s th e e x a m p l e o f t h e m a t e r ia l m a s t e r t o d e s c r i b e

    h o w y o u c a n c h a n g e t h is d e f a u l t b e h a v i o r u s i n g a m i n o r m o d if ic a ti o n .

    Y o u c a n f i n d t h e c h a n g e p o i n t e r s i n t h e BDCP t a b le a n d t h e c o r r e s p o n d -

    ing s t a tus r ecords i n t he BDCPS t a b l e. A s o f S AP N e t W e a v e r A p p l i c a t io n

    S e r v e r 6 . 2 0 ( SA P N e t W e a v e r AS), p r o c e s s i n g w i t h h i g h e r p e r f o r m a n c e

    i s poss ib l e v i a a sha red t ab l e ca l l ed B D C P 2 . H o w e v e r , t hi s n e w p r o c e d u r e

    i s n ' t s u p p o r t e d f o r all m e s s a g e t y p e s . W h e t h e r i t 's a p p l ic a b l e f o r y o u r

    m e s s a g e t y p e i s i n d i c a t e d i n t h e d e t ai l v i e w o f T r a n s a c t io n B D 6 0 . A s o f

    R e le a se 7 . 1 , o n l y t h e n e w p r o c e s s i n g u s i n g T a b le 8 D C P 2 i s avai lable for

    al l messag e t ypes .

    F o r th e d i s t ri b u t i o n v i a t h e S M D , y o u m u s t c o n s i d e r s o m e s p ec if ic s f o r

    s o m e m a s t e r d a t a . Y o u c a n s e t a d i s t r i b u t i o n l o c k f o r t h e m a t e r i a l m a s -

    t e r t o g e n e r a l ly p r e v e n t t h e s e n d i n g o f a m a t er ia l . F o r t h is p u r p o s e , y o u

    36

  • 5/26/2018 Practical Guide to IDoc Development for SAP

    33/253

    Standard M ethods for the IDoc Generat ion | 2

    m u s t m a k e a s h o r t d e t o u r . I n t h e d e s i g n d a t a o f t h e m a t e ri a l in t h e m a r a

    t ab l e , t he re i s a c ross p l an t ma te r i a l s t a tus (MARAMSTAE f i e ld ) . Th i s

    s t a t u s r e fe r s t o a n e x i s t i n g e n t r y i n t h e T 1 4 l t a bl e. H e r e , y o u c a n a s si g n

    a d d i t i o n a l p r o p e r t i e s f o r e a c h s t a t u s v a l u e . I f t h e D LO CK f ie ld p r o v i d e d

    here is s e l ec t ed , t h e d i s t r i b u t ion l ock i s s et .

    F o r c o n t r a c t s (BLAORD m e s s a g e t y p e ) , o n l y r e l e a s e d c o n t r a c t s a r e t r a n s -

    f e r r e d u s i n g t h e S M D .

    Reducing Messages

    T h e s e c o n d r e q u i r e m e n t o n t h e d i s t r i b u ti o n o f m a s t e r d a t a ar is e s f ro m

    t h e d i s t r i b u ti o n o f all m a s t e r d a t a t o i n d i v i d u a l v ie w s a n d t h e o p t i o n to

    d e f in e , i n C u s t o m i z i n g , w h i c h f ie l ds o f a v i e w a r e a c t u a l ly s u p p o s e d to

    b e u se d . T h is is sca la b le f o r t h e ID o c t r a n s f e r b y u s in g t h e r e d u c e d m e s -

    sage t ypes .

    A r e d u c e d m e s s a g e t y p e a l w a y s r e la t e s t o a n e x i s ti n g m e s s a g e t y p e b u t

    t r a n s f e r s l es s d a t a . T h e r e d u c t i o n i s n ' t p o s s i b l e f o r al l m e s s a g e t y p e s ;

    s o t h e d e v e l o p e r o f t h e m e s s a g e t y p e m u s t e x p l ic it ly d e f i n e i t a s r e d u c -

    i b le . A ll v i e w s a n d f ie ld s t h a t m u s t b e t r a n s f e r r e d a s a m i n i m u m a rc

    p re d e f in e d h e re ; all o t h e r v ie w s a n d fields c a n b e s e le c te d a d d i t io n a l l y i f

    r e q u i r e d . T r a n s a c ti o n B D 6 0 i n t h e d e t a i l v i e w f o r a m e s s a g e t y p e i s t h e

    t r ansac t i on fo r de f in ing a m essage t y pe as r educ ib l e . By ca l l ing T ransac -

    t io n B D 6 5 , y o u d e f i n e t h e m a n d a t o i y f ie ld s.

    F o r e a c h d e l i v e r e d m e s s a g e t y p e , S AP s p ec i fi c s w h e t h e r i t s r e d u c i b le .

    B e c a u se t h is i n v o l v e s f u n c t i o n s i n th e g e n e r a t i o n a n d u p d a t e m o d u l e f or

    t h e c o r r e s p o n d i n g I D