61
IBM Global Training Center © Copyright IBM Corporation 2007 Basic ALE Training material 2/7/22 Intermediate Document (IDoc)

IDoc's

Embed Size (px)

DESCRIPTION

idocs....exp

Citation preview

Basic ALE Training material

Basic ALE Training materialJul-12Intermediate Document (IDoc)IBM Global Training Center Copyright IBM Corporation 2007IBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#2Jul-12Basic ALE Training materialIntroduction An IDoc is simply a data container that is used to exchange information between any two systems that can understand the syntax and semantics of the data.

Electronic Data Interchange (EDI) and Application Link Enabling (ALE) are used for exchanging business data between different systems.

ALE is basically the scheduling mechanism that defines when and between which partners ( mostly internal ) and what kind of data will be exchanged on a regular or event triggered basis

In EDI technique business data is exchanged with an external partner system ( customer or vendor ).

No difference between EDI & ALE processing from application point of viewIBM Global Training Center 2007 IBM Corporation3Jul-12Basic ALE Training materialALE ARCHITECTUREApplication layerThis layer provides ALE with an Interface to R/3 to originate or receive messages containing data to or from external or other R/3 systems

Distribution / ALE LayerThis layer filters and converts messages containing data based on predefined or custom defined rule sets.

Communication LayerSending data to communicating partner.IBM Global Training Center 2007 IBM Corporation4Jul-12Basic ALE Training materialApplication DataMasterIDOCDetermineReceipientsFilter/ConvertData, Create IDOCComm.IDOCApplication FunctionsFilter/ConvertDataComm.IDOCCarrierApplication LayerDistribution/ ALE LayerCommunication LayerApplicationIn a Nut ShellIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#5Jul-12Basic ALE Training materialWhat Data can be Exchanged ?Transaction DataSD, MM, FI, CO, etc.

Master DataMaterial, Customer, Vendor, etc.

IBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#6Jul-12Basic ALE Training materialIDoc ProcessThe two available process for IDOCs are

Outbound ProcessInbound Process

Sending out the data from our system. The IDOC which is called as Outbound IDOC.When the data is coming in, the process is called Inbound Process and the IDoc is known as Inbound IDoc.IBM Global Training Center 2007 IBM Corporation7Jul-12Basic ALE Training materialLOGICAL SYSTEMA logical system ( LS ) is the representation of an R/3 or external system in SAP R/3 for the distribution of data to and from the R/3 systemIn SAP, Logical system implies to client. T-code to create Logical system : BD54 T-code to assign Logical system to client : SCC4

IBM Global Training Center 2007 IBM Corporation8Jul-12Basic ALE Training material

TCODE:BD54Logical SystemIBM Global Training Center 2007 IBM CorporationThe distribution of systems (ALE) makes it necessary to be able to identify every system individually within a network. The "logical system" is used to do this. A logical system is an application system within which the applications are coordinated to work in one database. In the SAP sense of the word, a logical system corresponds to a client.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#9Jul-12Basic ALE Training material

SALE > BASIC SETTINGS > SET UP LOGICAL SYSTEM > ASSIGN LOGICAL SYSTEM TO THE CLIENTTCODE:SCC4Allocate Logical System to the clientIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#10Jul-12Basic ALE Training materialMESSAGE TYPEMessage Type: A message type represents the application message being exchanged between R/3 systems and another R3/non-R3 external system.

It is the representation of the data from a business perspective.

Tcode WE81

Example: MATMAS is message type for Material Master DEBMAS is message type for Customer Master CREMAS is message type for Vendor MasterIBM Global Training Center 2007 IBM Corporation11Jul-12Basic ALE Training material

WE81Message TypesIBM Global Training Center 2007 IBM CorporationOnce the IDOC type is defined a message type has to be created. A message type determines how the data in the IDOC is being processed. This allows to use the same IDOC in different scenarios but process the data differently through different message types. A Message Type is the equivalent of a business document type. It characterizes the data being sent across systems, e.g. MATMAS is a message type for Material Master. Here is how to define a new message type :Go to the maintenance of IDOC typesIn the ALE-IMG: Extensions->IDOC types -> Maintain IDOC type

Go to message type maintenance:Environment -> Message typesTable view -> Display -> ChangeNew entriesCustomer message types should be in the customer name range (starting with Z)

Last step of the IDOC creation process is to link the new IDOC type with the new message type. Later in the process the message type will be linked to the outbound and inbound programs. With these configurations it is determined how the IDOC is being processed. The relationship between IDOC type and message type is a 1-to-many relationship. That means an IDOC can be associated with multiple message types thus allowing the IDOC to be processed differently, but a message type refers to exactly one IDOC type. Here is how to link the message type with the IDOC type :Go to the maintenance of IDOC typesIn the ALE-IMG: Extensions->IDOC types -> Maintain message type for Intermediate structure

Choose function EDI: Message types and assignment to IDOC typesLink your message type with your IDOC typeTable view -> Display -> ChangeNew entriesMessage type : ZBasic IDOC type: Z..

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#12Jul-12Basic ALE Training materialBASIC TYPEAn IDOC type represents the structure of the data associated with a message type ( DEBMAS06 for message type DEBMAS ) while an IDOC is an object containing the data of a particular message type.

It gives the actual hierarchy in which business data should be arranged.

Tcode WE30IBM Global Training Center 2007 IBM Corporation13Jul-12Basic ALE Training materialBasic type of IDoc

WE30IBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#14Jul-12Basic ALE Training materialIDoc Types (cont)Sample IDoc types:

Orders (ORDERS01)Material (MATMAS05)Customer (DEBMAS06)Vendor (CREMAS04)Invoice (INVOIC01)Bill of materials (LOIBOM01)

IBM Global Training Center 2007 IBM Corporation15Jul-12Basic ALE Training materialIDoc SegmentsCollection of data fields filled with alphanumeric charactersNon character values (ie floating point) have to be converted to alphanumeric charactersFields are aligned leftCurrencies, countries and units of measure have to be named in ISO-codesThe complete data in a segment can have a maximum length of 1000 bytes

IBM Global Training Center 2007 IBM Corporation16Jul-12Basic ALE Training materialStructure of SegmentsIDoc Segments

Header segments (E1EDK . . .)Line item segments(E1EDP . . .)Summary segments(E1EDS . . .)

IBM Global Training Center 2007 IBM Corporation17Jul-12Basic ALE Training material

TCODE:WE31Create SegmentIBM Global Training Center 2007 IBM CorporationThe first step in creating a new IDOC is to create all the segments that go into that IDOC. There are some rules that have to be followed while creating the segments:The name of that segment type must start with Z1

For each field in the segment you have to define a field name, a data element for the segment structure and a data element for the segment documentation.

The data element for the segment structure has to be of data type CHAR

The IDOC tools create overall three structures:

Z1nnnnn - field names

Z2nnnnn - data elements for structure definition

Z3nnnnn - data elements for documentationIDoc typeIDoc structure typeReceiver port/partner type/partner numberSender port/sender type/sender number

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#18Jul-12Basic ALE Training materialSegment, contd..

IBM Global Training Center 2007 IBM Corporation19Jul-12Basic ALE Training material

TCODE:WE30Idoc TypesIBM Global Training Center 2007 IBM CorporationThe next step is to create the IDOC type by assembling all the necessary segments. Part of our scenario analysis was to define the layout of the IDOC. We should have addressed the following questions:

Which segments should be used ?What is the hierarchy of the segments ?Which segments are mandatory and which are optional ?How often may a segment be repeated ?

SAP recommends to create the structures as flat as possible. Usually each level of segment hierarchy results in a looping structure in the corresponding program. Therefore its easier to deal with flat structures.Conceptually the IDOC type describes the technical structure of the messageIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#20Jul-12Basic ALE Training material

How to Attach SegmentsIBM Global Training Center 2007 IBM CorporationHere is how to create a new IDOC type by assembling previously defined segments:Go to the maintenance of IDOC typesIn the ALE-IMG: Extensions->IDOC types -> Maintain IDOC type

Select creation of new basic IDOC typePut segments into the IDOCSegment -> CreateEnter segment nameEnter attributes (Mandatory/Minimum/Maximum number)

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#21Jul-12Basic ALE Training material

WE82Assign Message Type with Basic typeIBM Global Training Center 2007 IBM CorporationOnce the IDOC type is defined a message type has to be created. A message type determines how the data in the IDOC is being processed. This allows to use the same IDOC in different scenarios but process the data differently through different message types. A Message Type is the equivalent of a business document type. It characterizes the data being sent across systems, e.g. MATMAS is a message type for Material Master. Here is how to define a new message type :Go to the maintenance of IDOC typesIn the ALE-IMG: Extensions->IDOC types -> Maintain IDOC type

Go to message type maintenance:Environment -> Message typesTable view -> Display -> ChangeNew entriesCustomer message types should be in the customer name range (starting with Z)

Last step of the IDOC creation process is to link the new IDOC type with the new message type. Later in the process the message type will be linked to the outbound and inbound programs. With these configurations it is determined how the IDOC is being processed. The relationship between IDOC type and message type is a 1-to-many relationship. That means an IDOC can be associated with multiple message types thus allowing the IDOC to be processed differently, but a message type refers to exactly one IDOC type. Here is how to link the message type with the IDOC type :Go to the maintenance of IDOC typesIn the ALE-IMG: Extensions->IDOC types -> Maintain message type for Intermediate structure

Choose function EDI: Message types and assignment to IDOC typesLink your message type with your IDOC typeTable view -> Display -> ChangeNew entriesMessage type : ZBasic IDOC type: Z..

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#22Jul-12Basic ALE Training material

WE60Idoc DocumentationIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#23Jul-12Basic ALE Training materialRun time IDoc ComponentIntermediate Documents (IDocs) consist of three record types:

Control RecordOne per IDocData RecordMany per IDocStatus RecordSeveral per IdocIBM Global Training Center 2007 IBM Corporation24Jul-12Basic ALE Training materialStructure of an IDocSender Receiver MsgType IDoc-type StatusHEADERM1ITEMM9999SUBITEMM99ACCUMM1IDocIDoc structureTEXTO9999HEADERxxxxxxxxITEMSUBITEMSUBITEMTEXTITEMSUBITEMSUBITEMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxACCUMxxxxxxxx"Ready for processing" 16:22:34"Successfully processed"16:22:42Control recordData recordsStatus recordsIBM Global Training Center 2007 IBM Corporation25Jul-12Basic ALE Training material

1 Idoc contains1 Control recordN Data RecordsN Status RecordsIDOC Intermediate DocumentIBM Global Training Center 2007 IBM Corporation An IDOC Type:is an SAP Data Dictionary defined structureprovides the highest level definition for a filehas a predefined structurerepresents a series of related business documents An IDOC (formally Message):is the occurrence of a message typeis the actual representation of a business transactionIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#26Jul-12Basic ALE Training materialControl RecordControl Record - table EDIDC

IDoc numberDirection - inbound or outboundIDoc typeIDoc structure typeReceiver port/partner type/partner numberSender port/sender type/sender number

IBM Global Training Center 2007 IBM Corporation27Jul-12Basic ALE Training material

The very first record of an IDoc package is always a control record. Thestructure of this control record of the structure EDIDC and describes the contents of the data contained in the idoc.

Control Record contains information about: IDOC type (what data is in the IDOC)Message type (how is the IDOC being processed)Sender information (who is the sender of that IDOC)Receiver information (who is the receiver of that IDOC)Latest status of EDI processing.EDI standard and version.Control RecordIBM Global Training Center 2007 IBM CorporationThe IDOC control record is a kind of envelope record that contains information about the IDOC likeIDOC type (what data is in the IDOC)Message type (how is the IDOC being processed)Sender information (who is the sender of that IDOC)Receiver information (who is the receiver of that IDOC)Latest status of EDI processing.EDI standard and version.The only two mandatory fields that must be filled are the Message type (MESTYP) andIDOC type (IDOCTP)Note that you have to use uppercase literals when you fill the two fieldsThe sender information - along with additional information - is automatically filled in by the ALE layer (in function module MASTER_IDOC_DISTRIBUTE)The receiver information is optional:If a receiver is specified, a check is carried out against the Distribution Model if this receiver is valid. If it is, an IDOC is created; otherwise no IDOC will be created. If no receiver is specified, MASTER_IDOC_DISTRIBUTE will determine all valid receivers that are maintained in the distribution model for that message type and create an IDOC for each receiver !IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#28Jul-12Basic ALE Training materialData RecordsData Record - structure EDIDD / table EDID4This contains two partsAdministrative Section and Data SectionAdministrative Section consists of Segment Name, Segment number, Segment Hierarchy etc.Data Section contains the data of respective segment Application header informationApplication line item informationApplication sub-line information (schedule lines, partners, tax information, text, etc.)IBM Global Training Center 2007 IBM Corporation29Jul-12Basic ALE Training material

All records in the IDoc, which come after the control record, are the IDoc data. They are all structured alike, with a segment information part and a data part, which is 1000 character in length, filling the rest of the line.

Hierarchical structure (internal representation as flat structure)Contains the actual business dataData RecordIBM Global Training Center 2007 IBM CorporationThe IDOC data records contain the data of the message. The data records are passed in an internal table and they have to match the structure of the IDOC (sequence of segments, min/max, hierarchy etc.)EDIDD is a generic structure used for all IDOC segments SEGNAM field identifies the segment typeSDATA contains the actual data of the segment IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#30Jul-12Basic ALE Training materialStatus RecordsStatus Records - table EDIDSWhenever a process is taken place, system will generate status records.We can identify the process with the number of status record.01 - 49 for Outbound Process50 - 75 for Inbound Processwhen IDoc is processed the messages are:01 - IDoc is created 30 - IDoc is ready for dispatch03 - IDoc is processed

IDoc identification numberStatus number - table verifiedIDoc typeDirectionData and time stampIBM Global Training Center 2007 IBM Corporation31Jul-12Basic ALE Training material

Information about the IDoc status like:IDoc identification numberStatus number - table verifiedIDoc typeDirectionData and time stamp

Idoc has been processed yes/no?Processing successful/erroneousWhat type of error?Status RecordIBM Global Training Center 2007 IBM CorporationStatus Record- table EDIDS Information we get from Status record:Status number MessageIDoc typeDirectionData and time stampDetailed description of status by code and textLocation of exception in Intermediate DocumentDetector of exception by program and user. The statuses for outbound IDocs are between '01' and '49', while the statuses for inbound IDocs begin from '50'. When an IDoc is created, the IDoc Interface sets the status in the function module EDI_DOCUMENT_CLOSE_CREATE. All additional status records are written explicitly by the function module EDI_DOCUMENT_STATUS_SET. It is possible to have Custom Statuses also.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#32Jul-12Basic ALE Training material

TCODE:SM59Maintaining RFC DestinationsIBM Global Training Center 2007 IBM CorporationThe Remote Function Call is controlled via the parameters of the RFC destination. The RFC destinations must be maintained in order to create an RFC port.The name of the RFC destination should correspond to the name of the logical system in question. The following types of RFC destinations are maintainable:

R/2 links R/3 links internal links logical destinations CMC link SNA/CPI-C connections TCP/IP links links of the ABAP/4 drivers

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#33Jul-12Basic ALE Training materialPORTSA port is a logical representation of a communication channel in SAP with the data communicated being IDOCs.Types of Ports:tRFCFileR/2InternetALE can use all port types to distribute IDOCEDI typically uses a File-based portTCODE -------> WE21IBM Global Training Center 2007 IBM Corporation34Jul-12Basic ALE Training material

A port is a logical representation of a communication channel in SAP with the data communicated being IDocs.

TCODE:WE21Displaying and Maintaining PortsIBM Global Training Center 2007 IBM CorporationYou specify the technical characteristics of the link between the SAP System and the other system in the port definition.The following port types are supported:Asynchronous RFCR/2 SystemFile interfaceThe ALE interface generates ports automatically. The EDI interface assigns numbers internally for these ports. Hence the ports can be identified explicitly. The system can only generate the numbers if a number range is entered for the number range object EDIPORT in number range 01.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#35Jul-12Basic ALE Training material

TCODE:WE20Partner ProfilesIBM Global Training Center 2007 IBM CorporationTells the ALE Layer how to send Msg. Between systems.The Partner No. is the logical system name of the other system.The Partner type is LS ( logical system) for ALE.The Partner Class is a free text field that classifies Partners.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#36Jul-12Basic ALE Training material

Partner Profiles-OutboundIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#37Jul-12Basic ALE Training materialPartner Profiles-Inbound

IBM Global Training Center 2007 IBM Corporation38Jul-12Basic ALE Training materialCUSTOMER DISTRIBUTION MODELIt is a tool that stores information about the flow of messages across various systems

The model stores data that dictates which messages flow to which logical systems

TCODE-----> BD64

IBM Global Training Center 2007 IBM Corporation39Jul-12Basic ALE Training material

TCODE:BD64Required mainly for master dataFilter values set up for master data outboundDistribution ModelIBM Global Training Center 2007 IBM CorporationThe Distribution Model is a tool that stores information about the flow of messages across various systems. The model stores data that dictates which messages flow to which logical systems.

It Combines logical systems, message types, and filter objects to represent the distribution scenario and is maintained with in the IMG (transaction SALE).In the IMG, the model is maintained from a senders perspectiveA distribution model is owned and mastered by one logical system and distributed to other logical systems

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#40Jul-12Basic ALE Training materialFILTER OBJECTA filter object type is used in the Customer Distribution Model to impose a selection criterion on the message type flowing to a logical system

A filter object type with a value associated with it is called a filter object.Tcode to maintain filter object for message type BD59Tcode to find list of filter object BD95

IBM Global Training Center 2007 IBM Corporation41Jul-12Basic ALE Training materialFiltrationOnly the idocs having values maintained in the Distribution model for each filter group will be allowed to pass

Maintain filter for Sender, Receiver, Message type combination

Segment level filtration ( T-code BD56 )

Idoc level filtration ( Distribution model BD64 )

Logics for filtration :AND logic among different filter groupOR logic within the filter groupIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#42Jul-12Basic ALE Training material

BD95BD59Filter ObjectsIBM Global Training Center 2007 IBM Corporation A filter object type is used in the Customer Distribution Model to impose a selection criterion on the message type flowing to a logical system. A filter object type with a value associated with it is called a filter object .

A Filter Object Type is used in the Customer Distribution Model to impose a selection criterion on the message (type) flowing to a logical systemA Filter Objectis a Filter Object Type with a value associated with it, e.g. BUKRS (company code) is a filter object type available for message type DEBMAS (Customer Master). A filter object with value BUKRS = 1001 will allow distribution of Customer Master data for Company Code 1001 only for that specific Logical System

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#43Jul-12Basic ALE Training materialSegment level filtration

IBM Global Training Center 2007 IBM Corporation44Jul-12Basic ALE Training materialPROCESS CODESProcess Codes are used in ALE and EDI to identify the function modules to be invoked for subsequent processing Tcode BD67

Inbound interface uses a process code to determine the application module that will process the inbound IDOC. Stored in table TEDE1.Tcode WE42

Outbound interface uses process codes only in the case of applications that use message control. Stored in table TEDE2.Tcode WE41.

IBM Global Training Center 2007 IBM Corporation45Jul-12Basic ALE Training materialProcess code FM

IBM Global Training Center 2007 IBM Corporation46Jul-12Basic ALE Training materialCHANGE POINTERCD objects record the changes in table CDHDR & CDPOS.Internal mechanisms update table BDCP & BDCPS / BDCP2 which host the change pointer.Activate change pointers for message type (Tcode BD50) or generally (Tcode BD61).Change Pointers are R/3 objects that mark changes to SAP Master data. - Tcode BD52Change Pointers are managed by mechanisms in a SMD (Shared Master Data) tool and are based on Change Document Objects. Tcode BD60.When data volume is high, we use table BDCP2 for change pointer. Path to config this setting : t-code SPRO. Path: Application server -> IDoc interface / ALE -> Modelling and implementing business processes -> master data distribution -> Replication of modified data -> Switch change pointer storageIBM Global Training Center 2007 IBM Corporation47Jul-12Basic ALE Training materialApplication Posting Post Application document

Create Change Document

Are changes ALE relevant ?

Write Change Pointers

Commit WorkALE configuration ALE relevant FieldsBatch Program(RBDMIDOC) IDOC Module (Masteridoc_Create_SMD_)

Read Change Pointers Fill IDOC Call ALE layer Update Change PointerMaster dataChange pointersALE layerMaster_IDOC_DISTRIBUTE Determine IDOC module Call IDOC moduleChange Pointers IBM Global Training Center 2007 IBM CorporationChange Pointers is a technique that was specifically developed to support master data distribution for changed data only.Change Pointers are (usually) based on change documents. Change documents (table CDHDR, CDPOS) are documents that are written to provide an audit trail about changes made to certain data (old value, new value, person who made the change etc.). While change documents keep track of all the changes made in the system, the change pointers are temporary in a sense that they have a status associated with them that keeps track if the change has already been processed or not. The change pointers therefore give a clear picture what changes need to be sent out.Change Pointer based IDOCs are usually generated with a batch job (RBDMIDOC) RBDMIDOC determines and calls a message type-specific function module that loops over the open change pointers and generates an IDOC for each of them.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#48Jul-12Basic ALE Training material

BD61BD50Change PointersIBM Global Training Center 2007 IBM CorporationChange Pointers are R/3 objects that mark changes to SAP Master data. Change Pointers are managed by mechanisms in a SMD tool and are based on Change Document Objects.CD objects record the changes in table CDHDR & CDPOS. Internal mechanisms update table BDCP & BDCPS, which host the change pointer. In case there are any changes to the data by running transaction BD21for the particular message type we can pick up thechanged materials for that particular message type. Activate change pointers for message type or generally.

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#49Jul-12Basic ALE Training material

BD52BD60Change Pointers ContinuedIBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#50Jul-12Basic ALE Training materialChange Pointer, ContdSend Material / Article : BD10 Send Customer : BD12Send Vendor : BD14

IBM Global Training Center 2007 IBM Corporation51Jul-12Basic ALE Training materialIDoc Reduction and ExtensionMaximal IDoc types for master data are supplied by SAP.You can create your own reduced IDoc type, by selecting only those segments and fields which are relevant to your project. ( T-code : BD53 )You can also create an extended IDoc type, by appending one or more segments to an existing IDoc type. (e.g. /GLB/XGTX_YDEBMAS06)An SAP IDoc structure can be extended by appending new sub-segments with additional data.Adding fields to original SAP segments is not allowed.Transaction: WE30.IBM Global Training Center 2007 IBM Corporation52Jul-12Basic ALE Training materialIDoc Extensions in INBOUND and OUTBOUND transactionsTo post and extract data to and from an IDoc extension, find a user exit in the application code. User exits are found in the function modules, which are tied to the process codes used by ALE. (e.g. EXIT_SAPLVEDA_001/002) The ABAP code to process an IDoc extension is added within an include statement in the user exit (e.g. Include - ZXVEDU03, ZXVEDU04, ZXMGVU03, Code - /AMS/OCA_CREDIT_ORDER_01/02)IBM Global Training Center 2007 IBM Corporation53Jul-12Basic ALE Training materialIDoc Reduction

BD53IBM Global Training Center 2007 IBM Corporation54Jul-12Basic ALE Training material

TCODE:BDM5Required mainly for checking if ALE configuration has been correctly set upChoose the relevant Message Type under Logical System you want and double click. The system will show all relevant details pointing out errors if any in the configuration

ALE Configuration Technical Consistency CheckIBM Global Training Center 2007 IBM CorporationThe Distribution Model is a tool that stores information about the flow of messages across various systems. The model stores data that dictates which messages flow to which logical systems.

It Combines logical systems, message types, and filter objects to represent the distribution scenario and is maintained with in the IMG (transaction SALE).In the IMG, the model is maintained from a senders perspectiveA distribution model is owned and mastered by one logical system and distributed to other logical systems

IBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#55Jul-12Basic ALE Training materialCreate Segment - WE31)Create Idoc Type , Extension- WE30)Create Message Type - WE81Assign Idoc Type to Message Type - WE82Create and allocate Logical System BD54, SCC4Define RFC Destinations SM59Define Ports WE21Create Partner Profiles WE20Maintain Customer Distribution Model BD64, BD59Change Pointer BD61, BD50, BD52, BD60Process code WE41, WE42IDoc display WE02, WE09IDoc re-process BD87IDoc Reduction BD53IDoc copy WE19Important Transaction codesIBM Global Training Center 2007 IBM Corporation56Jul-12Basic ALE Training materialIDoc Display

IBM Global Training Center 2007 IBM Corporation57Jul-12Basic ALE Training materialIDoc Display, Contd.

IBM Global Training Center 2007 IBM Corporation58Jul-12Basic ALE Training materialIDoc re-proces

IBM Global Training Center 2007 IBM Corporation59Jul-12Basic ALE Training materialIDoc copy

IBM Global Training Center 2007 IBM Corporation60Jul-12Basic ALE Training materialDocument for creating IDoc Outbound IDoc Inbound IDoc

IBM Global Training Center 2007 IBM Corporation61Jul-12Basic ALE Training materialTHANK YOU

IBM Global Training Center 2007 IBM CorporationIBM Global Business ServicesBasic ALE Training MaterialSAP Release 6.20 IBM Global Training Center Mar 2007#Step 1: Create a function group and a function module, then

In T-code bd51 maintain Function module entry.

Step 2: T-code we 57 and maintain FM against basic type and message type

Step 3:

T-code we42 and maintain process code against above FM

Save it and it will go the following screen and maintain the FM

Go to message type and maintain message type against process type

T-code we64all ready maintains the following things

And t-code bd67 is also all ready populated

Step 4:

T-code we20 and maintain message type for inbound partners

Step 5: T-code se 37 and write FM ZSUBRATA_FM

FUNCTION ZSUBRATA_FM.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" REFERENCE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD

*" REFERENCE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC

*" EXPORTING

*" REFERENCE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT

*" REFERENCE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR

*" REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK

*" REFERENCE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS

*" TABLES

*" IDOC_CONTRL STRUCTURE EDIDC

*" IDOC_DATA STRUCTURE EDIDD

*" IDOC_STATUS STRUCTURE BDIDOCSTAT

*" RETURN_VARIABLES STRUCTURE BDWFRETVAR

*" SERIALIZATION_INFO STRUCTURE BDI_SER

*" EXCEPTIONS

*" WF_ERROR_PROCESS

*"----------------------------------------------------------------------

CONSTANTS: LC_Z1SC1M TYPE EDILSEGTYP VALUE 'Z1SC1M',

LC_Z1SC2O TYPE EDILSEGTYP VALUE 'Z1SC2O'.

DATA: LV_IDOC_NO TYPE EDI_DOCNUM.

DATA: LS_TABLE_TEST TYPE ZTEST_01.

DATA: LT_TABLE_TEST TYPE STANDARD TABLE OF ZTEST_01.

FIELD-SYMBOLS: TYPE EDIDC,

TYPE EDIDD,

TYPE EDIDD,

TYPE ZTEST_01.

READ TABLE IDOC_CONTRL ASSIGNING INDEX 1.

IF SY-SUBRC IS INITIAL.

LV_IDOC_NO = -DOCNUM.

ELSE.

RAISE WF_ERROR_PROCESS.

ENDIF.

LOOP AT IDOC_DATA ASSIGNING

WHERE SEGNAM = LC_Z1SC2O.

READ TABLE IDOC_DATA ASSIGNING

WITH KEY SEGNAM = LC_Z1SC1M.

IF SY-SUBRC IS INITIAL.

LS_TABLE_TEST-KUNNR = -SDATA(10).

LS_TABLE_TEST-NAME1 = -SDATA+10(35).

LS_TABLE_TEST-VKORG = -SDATA(4).

LS_TABLE_TEST-VTWEG = -SDATA+4(2).

LS_TABLE_TEST-SPART = -SDATA+6(2).

APPEND LS_TABLE_TEST TO LT_TABLE_TEST.

ENDIF.

ENDLOOP.

IF LT_TABLE_TEST IS NOT INITIAL.

LOOP AT LT_TABLE_TEST ASSIGNING .

CALL FUNCTION 'ENQUEUE_EZZTEST_01'

EXPORTING

MODE_ZTEST_01 = 'E'

KUNNR = -KUNNR

NAME1 = -NAME1

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

ENDLOOP.

UNASSIGN .

MODIFY ZTEST_01 FROM TABLE LT_TABLE_TEST.

LOOP AT LT_TABLE_TEST ASSIGNING .

CALL FUNCTION 'DEQUEUE_EZZTEST_01'

EXPORTING

MODE_ZTEST_01 = 'E'

KUNNR = -KUNNR

NAME1 = -NAME1

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

ENDLOOP.

UNASSIGN .

ENDIF.

ENDFUNCTION.

Create table

Step 6 : T-code we19

For the IDoc 154, click on 'standard inbound' button

Click on on first line 'EDIDC'

Change the sender and receiver information

Again, click on 'standard inbound' button

Press on 'inbound function module' button

Table has been updated

To find out the sequence for inbound processing

Tool--> ALE--> ALE Development--> IDoc-->Inbound processing--> Function Module

Step 1: Create two CTS ( workbench + customizing ) and create one package through t-code se80Step 2:

T-code ( we31 and create segment Z1SC1M

Enter segment name ( which you want to create i.e. Z1SC1M and press create button ) and write the field name, data element and description and press save

Step 3:

Back from the previous screen, Do set releaseand press enter

You are getting release number '640'

Create another segment Z1SC2O like the following and do the set release as above

Step 4:

T-code ( we30 and try to create basic type ZSCCUS01

( click on create button )

Give the description

Select on basic type ZSCCUS01and press create button

Attach the segment Z1SC1M with the following details and save it.

Press on the segment Z1SC1M and 'use 'create' button and use the first radio button

Attach the segment Z!SC2O at the child level of mandatory segment Z!SC1M andf save it

Do the set release i.e. enter 'yes'

Step 5:

T-code ( we81 and create message type ZSCMES01 and save it

Step 6: Link message type with basic type and release number and save it

Step 7: T-code( bd54 (Create logical system ZSCELEGCY1 and save it

Step 8: T-code( scc4As we are using server TT2 with client 105 and we are creating logical system ZSCELEGCY1 in this server. So, just check whether client 105

Exists in this server or not. If it does not exist, we have to maintain this client. Here this client already exists

Step 9:

T-code( sm59 create RFC destination

Give RFC destination name and type of connection 3

Step 10:

T-code( we21. Try to create one trfc port Z1SC01

Step 11: T-code( we20 and create partner profile

Select partner type LS and press on create button

PRESS ON THE BUTTON WHERE THE CURSOR IS

Fill up the following part

Step 12: Check from t-code bd95, ALE object type 'VKORG' presents there

T-code( bd59 for message type ZSCMES01, maintain the following

ALE Object type and segment

Step 13: T-code( bd64 ( distribution model )

Step 14: Write program Z_SUBRTA_OB

*&---------------------------------------------------------------------*

*& Report Z_SUBRTA_OB

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT Z_SUBRTA_OB.

*Data declaration

*Constants

CONSTANTS: L_C_LS TYPE EDI_RCVPRT VALUE 'LS', "Partner Type of Receiver

L_C_Z1SC1M TYPE EDILSEGTYP VALUE 'Z1SC1M', "Segment type 'Z1SC1M'

L_C_Z1SC2O TYPE EDILSEGTYP VALUE 'Z1SC2O'. "Segment type 'Z1SC2O'

* Types

TYPES: BEGIN OF L_TY_KNA1, "for segment related with table KNA1

KUNNR TYPE KUNNR, "Customer Number 1

NAME1 TYPE NAME1_GP, "Name 1

END OF L_TY_KNA1,

BEGIN OF L_TY_KNVV, "for segment related with tbale KNVV

VKORG TYPE VKORG, "Sales Organization

VTWEG TYPE VTWEG, "Distribution Channel

SPART TYPE SPART, "Division

END OF L_TY_KNVV.

* Variable

DATA: LV_IDOC_NO TYPE EDI_DOCNUM. "IDoc number

* Work area

DATA: LS_EDIDC_CON TYPE EDIDC, "Control record (IDoc)

LS_EDIDD_DATA TYPE EDIDD. "Data record (IDoc)

* Internal table

DATA: LT_EDIDD_DATA TYPE STANDARD TABLE OF EDIDD, "Data record (IDoc)

LT_EDIDC_COM TYPE STANDARD TABLE OF EDIDC, "Control record (IDoc)

LT_KNA1 TYPE STANDARD TABLE OF L_TY_KNA1, "Internal table for DB table KNA1

LT_KNVV TYPE STANDARD TABLE OF L_TY_KNVV. "Internal table for DB table KNVV

* Field symbol

FIELD-SYMBOLS: TYPE EDIDC, "Control record (IDoc)

TYPE L_TY_KNA1, "Field symbol for DB table KNA1

TYPE L_TY_KNVV. "Field symbol for DB table KNVV

* Selection screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. "Selection Screen

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002. "Parameters

PARAMETERS: V_KUNNR TYPE KNA1-KUNNR OBLIGATORY, "Customer number

V_MESTYP TYPE EDMSG-MSGTYP OBLIGATORY, "Message type

V_IDOCTP TYPE EDBAS-IDOCTYP OBLIGATORY, "Basic IDoc type

V_RCVPRN TYPE EDPP1-PARNUM OBLIGATORY. "Partner No.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF BLOCK b1.

* Fetching data from table KNA1

SELECT KUNNR

NAME1

FROM KNA1

INTO TABLE LT_KNA1

WHERE KUNNR = V_KUNNR.

IF SY-SUBRC IS INITIAL AND LT_KNA1 IS NOT INITIAL.

* Fetching data from table KNVV

SELECT VKORG

VTWEG

SPART

FROM KNVV

INTO TABLE LT_KNVV

FOR ALL ENTRIES IN LT_KNA1

WHERE KUNNR = LT_KNA1-KUNNR.

IF SY-SUBRC IS INITIAL.

* Populating control data structure for IDoc

LS_EDIDC_CON-RCVPRT = L_C_LS. "partner type as 'LS'

LS_EDIDC_CON-RCVPRN = V_RCVPRN. "partner number

LS_EDIDC_CON-MESTYP = V_MESTYP. "message type

LS_EDIDC_CON-IDOCTP = V_IDOCTP. "basic IDoc type

* Populating data for segment 'Z1SC1M'

READ TABLE LT_KNA1 ASSIGNING INDEX 1.

IF SY-SUBRC IS INITIAL.

LS_EDIDD_DATA-SEGNAM = L_C_Z1SC1M. "segment name as 'Z1SC1M'

LS_EDIDD_DATA-SDATA = . "sdata as the field symbol of internal table LT_KNA1

APPEND LS_EDIDD_DATA TO LT_EDIDD_DATA.

ENDIF.

* Populating data for segment 'Z1SC2O'

LOOP AT LT_KNVV ASSIGNING .

LS_EDIDD_DATA-SEGNAM = L_C_Z1SC2O. "segment name as 'Z1SC2O'

LS_EDIDD_DATA-SDATA = . "sdata as the field symbol of internal table LT_KNVV

APPEND LS_EDIDD_DATA TO LT_EDIDD_DATA.

ENDLOOP.

IF LS_EDIDC_CON IS NOT INITIAL AND LT_EDIDD_DATA IS NOT INITIAL.

* Call the API FM 'MASTER_IDOC_DISTRIBUTE'

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

MASTER_IDOC_CONTROL = LS_EDIDC_CON

TABLES

COMMUNICATION_IDOC_CONTROL = LT_EDIDC_COM

MASTER_IDOC_DATA = LT_EDIDD_DATA

EXCEPTIONS

ERROR_IN_IDOC_CONTROL = 1

ERROR_WRITING_IDOC_STATUS = 2

ERROR_IN_IDOC_DATA = 3

SENDING_LOGICAL_SYSTEM_UNKNOWN = 4

OTHERS = 5.

IF SY-SUBRC IS INITIAL.

* From returning table of communication data for IDoc, obtain the IDoc number

READ TABLE LT_EDIDC_COM ASSIGNING INDEX 1.

IF SY-SUBRC IS INITIAL.

LV_IDOC_NO = -DOCNUM.

WRITE : 'The IDoc number is ', LV_IDOC_NO.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

.

And use following variant

Step 15:T-code we02 and check the IDoc

Step 16: T-code we14 and process the above IDoc

T-code: snro and check table 'NRIV'

For generating IDoc there is one object EDIDOC

Go to T-code snro and check the number range for above object

It has to be maintained and matched with entry in table NRIV