Anda di halaman 1dari 15

IBM Global Services

Application Link Enabling (ALE) - Day 3


14 Jan, 2009

Copyright IBM Corporation 2003

IBM Global Services

Recap
Message Control
1. 2. Benefits and usage Message Control Architecture

Basic ALE Configuration 1.


Logical system, RFC Destination, Port and Partner Profile

Transactions For Monitoring and Processing IDocs. 1.


1. 2. 3. 4. T-code WE02, WE15, WE14, WE19, BD87, WE09

ALE in typical Project Scenario.


Synatax rules for Idoc Extending Vs Creating a new idocs Design Guidelines Configuration steps

Questions

Slide 2

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

Topics to cover
How to Write ABAP Programs for ALE/IDoc 1.
2. Outbound Inbound

Slide 3

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

Writing ABAP Programs for ALE / IDoc

Scenarios:
1. Programs for custom IDocs
   Outbound IDoc from Message Control Outbound IDoc from stand-alone programs Outbound IDoc from Change pointers

2. 3.

Programs for IDoc Extension Programs to enhance the process

Slide 4

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

An Outbound program triggered from Message Control


Application Application Posting Message Control IDoc generation Program

Application document
RSNASTED

Call to program
IDOC_OUTPUT_<MESSAGE TYPE>

Format Application data to IDoc

Message Processing

Create IDoc in databse

IDOC_OUTPUT_<MESSAGE TYPE>

Mainly used for transaction data Must use function Module


Slide 5 ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012 Copyright IBM Corporation 2009

IBM Global Services

An Outbound program triggered from Message Control Contd


Program Flow:
Copy incoming control record to outgoing record Populate the remaining fields in the control record Select application data from the database and using the object key passed in the NAST record Populate the internal table of data records (INT_EDIDD) with the various segments Return control to the calling program
Example: IDOC_OUTPUT_DELVRY. *"*"Global interface: *" IMPORTING *" *" *" *" *" VALUE(OBJECT) LIKE NAST STRUCTURE NAST VALUE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC VALUE(OBJECT_TYPE) LIKE WFAS1-ASGTP VALUE(CONTROL_RECORD_OUT) LIKE EDIDC STRUCTURE EDIDC INT_EDIDD STRUCTURE EDIDD

*" EXPORTING

*" TABLES

Process Code DELV

*" EXCEPTIONS *" ERROR_MESSAGE_RECEIVED


Copyright IBM Corporation 2009

Slide 6

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

IBM Global Services

A Stand-Alone program to generate IDocs StandApplication Application Posting Stand-Alone Program Document Selection Foramt Application data to IDOC data Application Document Call to MASTER_IDOC_DIST RIBUTE Commit

IDoc

Slide 7

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

A Stand-Alone program to generate IDocs Contd StandProgram flow:


Create a selection screen for the user to specify the objects for which IDocs are to be generated Determine the Key of the application document from the object specified in Step 1 Select application data from the database Populate the control record information Populate the internal table of type INT_EDIDD with data records Call MASTER_IDOC_DISTRIBUTE to create IDocs in the database Execute a Commit work

Slide 8

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

An Outbound Program triggered from Change Pointers


Application RBDMIDOC IDoc generation Program

Application Posting or change Application document

MASTERIDOC_CREATE _SMD_<MT>

Process Message Type Call to

Analyze change pointers Determine Document Key Format Application data to IDoc data Call to MASTER_IDOC_DISTRI BUTE

Valid for change Change Pointer BDCP

MASTERIDOC_CREATE_SMD_ <MT>

IDoc
Slide 9 ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012 Copyright IBM Corporation 2009

IBM Global Services

An Outbound Program triggered from Change Pointers Contd


Program flow:
Read the change pointers using the CHANGE_POINTERS_READ function module Analyze the change pointers to determine which documents are valid Determine the Key of the application document from the object specified in Step 2 Select application data from the database Populate the control record information Populate the internal table of type EDIDD with data records Call MASTER_IDOC_DISTRIBUTE to create IDocs in the database Update the change pointer status using CHANGE_POINTERS_STATUS_WRITE Execute a Commit work Example: MASTERIDOC_CREATE_SMD_MATMAS
*" IMPORTING *" VALUE(MESSAGE_TYPE) LIKE TBDME-MESTYP *" VALUE(CREATION_DATE_HIGH) LIKE SY-DATUM DEFAULT SY-DATUM *" VALUE(CREATION_TIME_HIGH) LIKE SY-UZEIT DEFAULT SY-UZEIT
Slide 10 ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012 Copyright IBM Corporation 2009

Example : RBDSEMAT

IBM Global Services

An Inbound program for Custom Basic IDoc Types


ALE Layer Read IDocs Inbound Posting Function Module Lock IDocs Process Message type Call direct input Function Module or Call transaction Return the results Application Document Application Layer

Call inbound program

Write Status records

Commit Work

Unlock IDocs

Slide 11

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

An Inbound Program for Custom Basic type Contd


Program flow:
Read the control record information. Verify the message type. If its not correct , raise exception Read the IDoc data for an IDoc. Several IDocs can be passed together. Parse through each data record. If using Call transaction build the BDC data table, if not build internal table as required by the Direct input method Call the posting program and capture the results Populate the return parameters If more IDocs are present, return to step 2 else go to next step Call MASTER_IDOC_DISTRIBUTE to create IDocs in the database Return form function module, returns are passed to ALE layer

Slide 12

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

Programs for IDoc extension


Types of User Exit:
Old Method : Perform USEREXIT_XXXX New Method: CALL CUSTOMER FUNCTION

Outbound IDoc Processing: A user exit is available after each segment is populated A user exit is also available after the system populates the control record information A user exit is also available after the system has completely filled out the control and data records

Inbound IDoc Processing: A user exit is available when a customer segment is encountered A user exit is also available after the system populates the status record and is about to return the control back to the ALE layer

Slide 13

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

Testing the ALE Interface


Basic Sanity Check:
RFC destination : SM59 test connection Port : Access test Partner Profile : RSECHK07

Slide 14

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

IBM Global Services

Questions

Slide 15

ABAP | Confidential | ALE For ABAPers .ppt | 2/14/2012

Copyright IBM Corporation 2009

Anda mungkin juga menyukai