SAP ABAP ALE/IDOC for Master Data MAnagement

download SAP ABAP ALE/IDOC for Master Data MAnagement

of 14

Transcript of SAP ABAP ALE/IDOC for Master Data MAnagement

  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    1/14

    Chapter 2: Master Data Distribution andInterfaces

    Overview

    In this chapter, we learn about the distribution of master data using ALE andthe steps involved in building a master data interface. Many SAPimplementations re!uire the distribution of master data to other "#$systems or e%ternal systems. &or e%ample, certain applications running onlegacy systems may re!uire the 'ustomer Master database to processtransactions outside of "#$ , or in a distributed environment, the salesdepartment(s "#$ system may need to )eep its customer database in syncwith head!uarters. Master data in SAP encompasses a wide range of datasuch as materials, customers, vendors, classes, classification,characteristics, bills of materials, pricing conditions, general ledger master,cost elements, and so forth. In "#$ , there are over *+ message typesavailable for master data distribution using ALE services.

    here are three methods of communicating master data from SAP "#$ .he first method is to -send data directly, that is, an ALE program selects the

    master data present on "#$ databases based on user/specified criteria,and creates I01's of that type. hese I01's are communicated to the othersystem through the ALE communication layer. he second method is tocapture all changes occurring to the master data, e%ecute an ALE program toconvert the changes to an I01' , and then communicate it. he third methodis to -fetch the master data from another "#$ system2this option isavailable for only a few message types.

    Let us further e%plore the second method. "#$ provides robustmechanisms to capture changes occurring to the master data through itsShared Master 0ata tool. As shown in &igure 3/4, when changes 5changes

    are create, change, delete2mar) for deletion6 are posted to the master databy the application, change document services record these changes in tables'070" and '0P1S. hese changes are recogni8ed by the Shared Master0ata tool which chec)s if they are relevant for distribution by ALE services. Ifso, it creates change pointers. hese change pointers are maintained intables 90'P and 90'PS. 5 able 90'PS maintains a status flag for a givenpointer and message type. his flag indicates if the change pointer has beenprocessed.6 An ALE program is run to select all change pointers not yetprocessed for a given message type, access the master databases throughfunction modules, and populate the I01' segments pertaining to that I01' type. he ALE program chec)s the 'ustomer 0istribution Model to determinethe receiving logical system5s6 for that particular message type, filters thedata based on filter ob:ects, chec)s the partner profile for the I01' type, and

    then creates communication I01's.

  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    2/14

    Figure 2-1 'hange Pointer Mechanism

    In this section, we develop an ALE interface for distributing material masterdata to a non/"#$ system, using message type MA MAS. ;e also build an"#$ /"#$ interface to distribute 'lass 5message type 'LSMAS6 and'haracteristics 5message type '7"MAS6 data. ;e will step through theprocess of -sending data directly, as well as capturing changes via change

    pointers, and then communicating them to other systems. his section alsoteaches you the basic configuration that needs to be in place for ALE and E0Iinterfaces to function.

    Basic Configuration

    In order to use ALE functionality in the "#$ system, you have to configurecertain basic elements of the system. his can be performed through the ALEcustomi8ing menu 5see &igure 3/36. o invo)e it, use transaction SALE orIMG Cross-Applications Components Distribution ( ALE )

    Basic Configuration .

    Figure 2-2 SALE2 ALE 'ustomi8ing Menu

    &irst, let us set up the base logical system. As mentioned earlier, every clientin an "#$ instance needs to have a base logical system. his LS will be the-sender in outbound interfaces and -receiver in inbound interfaces. ocreate a logical system

  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    3/14

    = E%pand the tree Set up Logical System

    = E%ecute Maintain Logical System

    = 'lic) on push/button >E; E> "IES

    = Enter the name of the logical system, for e%ample, 9?4'L> +4+. 5@oucan adopt a naming standard for base LS< aaa'L> bbb, where aaa is the

    instance and bbb is the client. his helps in correlating the base LS with itsinstance and client.6

    = Enter a description

    = Save

    >e%t, let us allocate the base logical system to its client. his panel can alsobe accessed by e%ecuting transaction SCC4 .

    = E%ecute Allocate Logical System to t e Client

    = @ou should find an entry for your client, say +4+. Select that row, bydouble/clic)ing on it, using the push button for details.

    = Enter 9?4'L> +4+ in the field for logical system

    = Save

    Note he aforementioned activities are client/independent customi8ing.

    hese two activities are essential both for ALE and E0I. 0ata forlogical systems is stored in tables 90LS and 90LS .

    he other activities in this basic setup include number ranges for ports,I01's, change pointers, IS1 codes, and wor)flow settings. 1ther thanwor)flow settings, of which we learn in a later chapter, it is not mandatory toconfigure the number ranges as these will default to SAP /suppliedintervals.

    As part of the elementary configuration, we also have to set up globalcompany codes and business areas. his concept is relevant to ALE distribution for "#$ /to/"#$ in general. ;hen we distribute data pertainingto a particular company code and business area, they have to refer to thecorresponding company code and business area in the target system.7ence, we specify the company code and business area cross/reference inthis configuration. ALE re!uires that we perform this activity for "#$ to non/"#$ system interfaces as well. o do this, from SALE +4+ in the field for logical system. his is the base logicalsystem.

    = Enter a name for the model, say ALEM10EL+4

    = 'lic) the '"EA E button

    = @ou will see a tree structure with the base logical system as the parent,

    and all other logical systems as its children, as seen in &igure 3/$. Placethe cursor on the logical system E 4MA MAS3.

  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    5/14

    Figure 2-" 'onfiguring 'ustomer 0istribution Model

    = 'lic) on the '"EA E MESSABE @PE button. @ou will get a pop/upscreen.

    = Enter MA MAS as the logical message type, and clic) on the "A>S&E"button

    = Save

    Note @ou have the option of maintaining the customer distribution modelusing the P' tool as well. his provides a graphical interface to themodel. In this boo), we maintain the model directly using SAPscreens.

    9y configuring the customer distribution model, we have indicated that wewant to distribute message type MA MAS to the logical systemE 4MA MAS3, with the base system being 9?4'L> +4+.

    'ustomer distribution model data are stored in tables 90++ and 90+$.@ou can access the maintenance of the model by using transaction 90CD aswell.

    (ctivating Change )ointers

    Change pointers are ob:ects that reflect the changes to master data. heyare enabled through change document services and the Shared Master 0atatool. ALE programs and APIs use change pointers to select changed masterdata for populating I01's of the relevant message type. 'hange pointersare stored in database tables 90'P and 90'PS. able 90'PS maintainsthe processing status of the change pointer, with its )ey being a uni!uechange pointer identifier and the message type. 1nce the change pointer isprocessed, field P"1'ESS on table 90'PS is mar)ed with a value of .(

    'hange pointer generation has to be activated at both the general level and

    message type. o do this, from SALE < = E%pand tree Distribution scenarios

    = E%pand tree Master $ata $istribution

    = E%pand tree Acti%ate c ange pointer

    = E%ecute Acti%ate c ange pointer (generally) , chec) mar) the

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&image_id=7&previd=IMG_7
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    6/14

    field Active

    = Save

    = E%ecute Acti%ate c ange pointer for message types

    = 'hoose the row for message type MA&MAS, and chec) mar) thecorresponding field 5see &igure 3/D6.

    = Save

    Figure 2-* 'hange Pointer Activation for Message ype

    >ow we have activated change pointer generation at the general level, aswell as message type MA MAS. @ou can use transaction 90C4 to activatechange pointer at the general level. he flag is stored on table 90A4. oactivate change pointer for message types, you can also use transaction90*+. he data for this are stored in table 90A3.

    After having performed the aforementioned activities, change pointers will becreated every time a material master record is created, changed, or mar)edfor deletion. 5@ou can mar) for deletion a material at the general level, for aspecific plant, storage location, sales organi8ation#distribution channel,warehouse, or storage type.6 >ote that change pointers for material masterare going to be created even if the changes occur through 90's, 'all

    ransactions, or activation of planned changes.

    Co&&unications: )ort Definition

    A port is a channel for communication of I01's. here are four types ofports available in SAP "#$ < 546 ransactional "&' 5"emote &unction'all6, 536 &ile, 5$6 "#3 , and 5D6 Internet. In this e%ample, we define a file/based port for the communication of material master I01' to the e%ternalsystem. his will enable us to create a file of I01's.

    In order to define a port, from WEDI ID!C 'ort $efinition or usetransaction WE21 .

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&image_id=8&previd=IMG_8
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    7/14

    = 'hoose ile /based port

    = 'lic) on the '"EA E button

    = 'lic) on the >E; E> "IES button

    = Enter a name, '& MA&MAS* , and description for the file port 5see &igure 3/*6

    Figure 2-+ Port 0efinition

    = 'lic) on the 1F 91F>0 &ILE button

    = @ou will see a pop/up screen where you can enter a directory, file name,and function module. he entry for function module is for invo)ing a routinethat generates a file name. here are several SAP /delivered functionmodules that will create a file in the specified directory with the name beinga pattern such as user name concatenated with the date and timestamp.@ou can also create your own function module to name the file accordingto your re!uirements. Fse an e%isting function module as a model tocreate this routine.

    = 'lic) on the '7E'? button to ensure you can connect to the file server

    = If you would li)e to invo)e certain processing on a server once the file iscreated, such as e%ecuting an & P, you can lin) this port to a logical "&'destination. Fse transaction SM59 to create an "&' destination of type

    'P#IP connection. Specify a shell script to be triggered, and the directoryit resides in.

    = 'hec)

    = Save

    he data behind the port definition are stored in table E0IP1. hisconfiguration is client/independent and is transportable. ;e learn more about"&' destinations and transactional "&' ports in subse!uent chapters. his

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&image_id=9&previd=IMG_9
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    8/14

    configuration is applicable both to ALE and E0I.

    Co&&unications: )artner )rofi'e

    A partner profile is an identifier for the system being communicated with. In ALE , it is based on an e%isting logical system. he partner profile brings

    together several elements of ALE and serves as a gateway betweensystems. Let us create a partner profile for the material master outboundinterface 5see &igure 3/C6.

    Figure 2-, Partner Profile2Beneral Parameters

    &rom WEDI ID!C 'artner 'rofile , or from SALE Communication Manual maintenance of partner profiles Maintain partner profile 0PA"AME E"S

    = 'lic) on >E; E> "IES

    = Enter MA&MAS in the Message type field

    = Enter '& MA&MAS* in the "eceiver port field

    = &or 1utput modes, select Collect ID!Cs , and Do not startsubsystem . he first parameter instructs ALE communication layer tocollect all I01's until further processing is re!uested. he secondparameter is typically used for invo)ing third/party translation software orE0I subsystems. 5;e discuss these settings and their effects in depth in'hapter 4+ .6

    = Enter MA&MAS,* as the I01' type

    = Save

    ;e have now created the partner profile for outbound material masterinterface. >ote that the same partner profile can be used for multipleoutbound, as well as inbound, messages, given that the communications arefor the same logical system. Most of the data regarding outbound partnerprofile parameters are stored in table E0P4$. @ou can directly access thisactivity by e%ecuting transaction WE20 .

    >ote that outbound master data do not use message control parameters orprocess codes. Also, the fields for notification of messages will default to youruser I0. ;e learn more about its significance in the section dealing with;or)flow2 ALE and E0I error handling.

    Partner profile configuration is client/dependent and transportable. o includethe profile in a ' S re!uest, from the initial screen for 'artner 'rofile

    'artner &ransport Enter the relevant ' S values.

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&image_id=11&previd=IMG_11http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    10/14

    IDOC .%pe M(.M($/2 As configured earlier, in this e%ample we are usingI01' type MA MAS+3 for the outbound material master interface.MA MAS+3 consists of several segments 5record structures6 in a particularhierarchy. ypically, each segment represents a database table or a materialview. &or e%ample, segment E4MA"AM contains fields for basic data andrepresents table MA"A, segment E4MA"'M represents the plant view,E4MA"MM has fields for material units of measure, and so forth. ;hen youperuse the documentation for MA MAS+3 using transaction WE60 , you willnotice that some of the segments are re!uired 5mandatory6, while others areoptional. his means that the mandatory segments will always be populatedand present in an I01' , while the optional segments will be present only ifthere are data available for it, or if it has changed in case of generatingI01's using change pointers. hese segments have several fields that willbe populated with data from the database tables by ALE/selection modules.

    he field names on the segments are usually the same as those on thedatabase tables. As discussed earlier, these segments will redefine theS0A A field on the E0IH00 record of the I01' . Also, the segment can havea ma%imum length of 4+++ bytes. 5See Appendi% & for details of some masterdata I01' types.6

    9ased on your application re!uirements, if you need to eliminate the usage ofcertain segments, you can perform an activity )nown as IDOC reduction. 1nthe other hand, if you need additional data not present on the 9asic I01' type, it is possible to add segments using a procedure )nown as IDOC extension. ;e discuss and learn these concepts in 'hapter D .

    0or ing the Interface

    7aving completed the configuration for the material master outbound ALE interface, we now proceed with the e%citing tas) of testing the interface.

    here are two ways to wor) this interface. ;e can -send material masterI01's or capture changes occurring to it, and then convert the changes toI01's. >ote that there is a third method of -fetching the data wherein wecan re!uest material master data from a reference "#$ system. hisapproach uses message type MA &E .

    $ending3 Master Data he first approach to communicating master data isto -send I01's using standard ALE programs. In this case, all segments ofthe I01' type having data on the master database will be populated, and anI01' will be created for every master record selected to be sent. o do thisumber of Materials perprocess. 5 his concept is e%plained in 'hapter 4+, - ALE 1ptimi8ation. 6

    Converting Change )ointers to IDOCs he second method captures allchanges occurring to the master data, and an ALE program generatesI01's based on these change pointers. As e%plained earlier, ALE has to beconfigured to activate change/pointer generation at the general level, as wellas for that message type.

    = 'reate, change, or mar) for deletion materials using transactions MM01, MM02, or MM06

    = E%ecute transaction BALE 'erio$ic .or/ Analy"e c angepointers

    = Enter message type MA&MAS

    = E%ecute

    = @ou will receive informational messages indicating the number of I01'sgenerated

    1nce the change pointers have been processed to create I01's, they areflagged so that the same changes do not create duplicate I01's. 1bviously,if changes are made again to the same material, I01's will be created againbased on the new change pointers. 9ear in mind that the I01' will containonly mandatory segments and segments of fields that were changed on thematerial master.

    @ou can access this panel by e%ecuting transaction BD21 or e%ecutingprogram "90MI01'. ;hen processing large volumes of changes to masterdata periodically, the change pointer databases could grow to si8es thatcould degrade performance. In order to maintain these tables, and improveperformance of ALE programs and function modules related to creatingmaster data I01's from change pointers, you can use program "90'P'L"."ead 'hapter G for details.

    Disp'a%ing IDOCs4 IDOC $tatus 7aving created the I01's, let us nowdisplay the I01's and chec) the results of our tests 5see &igure 3/ 6. heproof of the puddingJ

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=659056#659056http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=659056#659056http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=659056#659056http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=787503#787503http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=659056#659056
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    12/14

    Figure 2-5 0isplay of I01' 0ata

    = &rom WEDI ID!C ID!C List

    = Enter the selection options such as message type, partner number ofreceiver, date of creation, and so forth

    = E%ecute

    = @ou will see a display with information about the I01's matching theselection criteria in the previous panel. he columns are< 0irection54K1utbound, 3KInbound6, Status, Message ype, Message 'ode,Message &unction, >umber of I01's, and Status 0escription. @ou willalso see lines for subtotals and totals based on status and direction.

    = 0ouble/clic) on the line for message type MA MAS or place cursor on therow and clic) on button I01' LIS

    = his display will list all I01's selected from the previous panel. hecolumns are< I01' number2this is a uni!ue number that identifies theI01' , and is internally assigned message type direction status senderinformation receiver information and I01' type.

    = 0ouble/clic) on a row or place cursor on the desired row and clic) buttonI01' 0ISPLA@.

    = @ou will see a hierarchical display of the I01' number with current status,control record, data records, and status records. 0ouble/clic)ing or

    e%panding the trees will result in the display of detailed information. &or thecontrol record tab, you will see the E0I0' information such as messagetype, sender and receiver details2partner number, partner type, port. &orthe data records, you will see a hierarchical display of the I01' segmentsthat were populated. &or the status records, you will see the variousstatuses the I01' has been through, with the current status being the firstentry. Each status record may also have associated messages.

    = 0isplaying a segment of the I01' data record will show you the datacontained within the segment. he two columns are the segment field

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&image_id=12&previd=IMG_12
  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    13/14

    name and its value. @ou will also see a description of the field.

    he I01' status records, which are stored on table E0I0S, indicate thehistory of the processing statuses of the I01' . hese values are note%ternali8ed and are maintained only within the "#$ system. SAP APIsare used to display the status records. &or a list of status codes, see

    Appeppndi% ' .

    I01's can also be displayed using transaction WE02 .EDI ID!C Display ID!C or BALE Monitoring ID!C !%er%ie0 .

    MESSAGE FUNCTION Every segment of master data I01' types has as itsfirst field MSB&>. his $/byte field, the Message &unction, determines theaction to be ta)en by the I01'(s receiving system. &or e%ample, -++indicates that the data contained in the segment represent an originalmessage, implying that it was newly created. See able 3/4 for possiblevalues of MSB&>. >ote that different segments of the same I01' couldhave different values for the message function. &or e%ample, segmentE4MA"AM could have MSB&>K-++D, indicating that one or more basic data

    fields for that material changed, and segment E4MA? M, being a mandatorysegment, could have MSB&>K-+4 indicating that the data are being-resent. Also, when master data are -sent through the ALE -send process5program "90SEMA for material master6, the message function fields forthe segments of the I01's will have a value of -++* 2"eplace.

    .(B67 2-18 Message Function 9M$ FN;

  • 8/12/2019 SAP ABAP ALE/IDOC for Master Data MAnagement

    14/14

    = E%ecute program "SE1F ++

    = In the selection parameters, specify the message type, sender andreceiver partner details, and so forth

    = E%ecute

    = @ou will receive an informational message indicating the number of I01'sselected for processing

    = 9rowse the file created on the server. It will be in AS'II 5te%t6 format. he

    file name will be as per the port definition. Each E0I0' record and eachI01' data segment will be a record in the file.

    = his file can be translated to the format re!uired by the e%ternal systemand processed by programs in the non/"#$ application. he translationcan also be accomplished by mapping tools. his is discussed in 'hapterC.

    'hec) the status of these I01's through I01' display. @ou will see that theyare in status -+$ 20ata passed to port 1?.

    http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=596195#596195http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=596195#596195http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=596195#596195http://www.books24x7.com/book/id_763/viewer.asp?bkid=763&destid=596195#596195