Ale for Abapers_day3

download Ale for Abapers_day3

of 15

Transcript of Ale for Abapers_day3

  • 8/3/2019 Ale for Abapers_day3

    1/15

    IBM Global Services

    Copyright IBM Corporation 2003

    Application Link Enabling(ALE)

    - Day 314 Jan, 2009

  • 8/3/2019 Ale for Abapers_day3

    2/15

  • 8/3/2019 Ale for Abapers_day3

    3/15

    IBM Global Services

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

    Topics to coverTopics to cover

    How to Write ABAP Programs for ALE/IDoc

    1. Outbound

    2. Inbound

  • 8/3/2019 Ale for Abapers_day3

    4/15

    IBM Global Services

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

    Writing ABAP Programs for ALE / IDocWriting ABAP Programs for ALE / IDoc

    Scenarios:

    1. Pr ograms for custom IDocs

    Outbound IDoc from Message Control

    Outbound IDoc from stand-alone programs

    Outbound IDoc from Change pointers

    2. Pr ograms for IDoc Extension

    3. Pr ograms to enhance the process

  • 8/3/2019 Ale for Abapers_day3

    5/15

    IBM Global Services

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

    An Outbound program triggered from Message Control

    Application

    IDOC_OUTPUT_

    Application

    document

    ApplicationPosting

    MessageProcessing

    Message Control IDoc generationProgram

    Format Applicationdata to IDoc

    RSNASTED

    Call to program

    IDOC_OUTPUT_

    Create IDoc in

    databse

    Mainly used for transaction data

    Must use function Module

  • 8/3/2019 Ale for Abapers_day3

    6/15

    IBM Global Services

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

    An Outbound program triggered from Message Control

    Contd

    Example: IDOC_OUTPUT_DELVRY.

    *"*"Global interface:

    *" IMPORTING

    *" VALUE(OBJECT) LIKE NAST STRUCTURE NAST

    *" VALUE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC

    *" EXPORTING

    *" VALUE(OBJECT_TYPE) LIKE WFAS1-ASGTP

    *" VALUE(CONTROL_RECORD_OUT) LIKE EDIDC STRUCTURE EDIDC

    *" TABLES

    *" INT_EDIDD STRUCTURE EDIDD

    *" EXCEPTIONS

    *" ERROR_MESSAGE_RECEIVED

    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

    Process Code DELV

  • 8/3/2019 Ale for Abapers_day3

    7/15

    IBM Global Services

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

    A StandA Stand--Alone program to generate IDocsAlone program to generate IDocs

    Application

    Document

    ApplicationPosting

    Application

    Document Selection

    Foramt Applicationdata to IDOC data

    Call toMASTER_IDOC_DIST

    RIBUTE

    Commit

    Stand-AloneProgram

    IDoc

  • 8/3/2019 Ale for Abapers_day3

    8/15

  • 8/3/2019 Ale for Abapers_day3

    9/15

    IBM Global Services

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

    An Outbound Program triggered from Change PointersAn Outbound Program triggered from Change Pointers

    Application

    document

    ApplicationPosting or change

    Valid for change

    RBDMIDOC IDoc generationProgram

    Process Message Type

    Call to

    MASTERIDOC_CREATE_SMD_

    Change Pointer

    BDCP

    Application

    MASTERIDOC_CREATE_SMD_

    Analyze changepointers

    Determine DocumentKey

    Format Applicationdata to IDoc data

    Call toMASTER_IDOC_DISTRIBUTE

    IDoc

  • 8/3/2019 Ale for Abapers_day3

    10/15

    IBM Global Services

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

    An Outbound Program triggered from Change PointersAn Outbound Program triggered from Change Pointers

    ContdContd

    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

    *" IMPORTING

    *" VALUE(MESSAGE_TYPE) LIKE TBDME-MESTYP

    *" VALUE(CREATION_DATE_HIGH) LIKE SY-DATUM DEFAULTSY-DATUM

    *" VALUE(CREATION_TIME_HIGH) LIKE SY-UZEIT DEFAULTSY-UZEIT

    Example: MASTERIDOC_CREATE_SMD_MATMAS

    Example : RBDSEMAT

  • 8/3/2019 Ale for Abapers_day3

    11/15

    IBM Global Services

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

    An Inbound program for Custom Basic IDoc TypesAn Inbound program for Custom Basic IDoc Types

    Read IDocs

    Lock IDocs

    Call inbound program

    Write Status records

    Commit Work

    Unlock IDocs

    Process Message type

    Call direct input FunctionModule or Call transaction

    Return the results

    ALE Layer Application Layer

    Application

    Document

    Inbound Posting Function Module

  • 8/3/2019 Ale for Abapers_day3

    12/15

    IBM Global Services

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

    An Inbound Program for Custom Basic type ContdAn 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, ifnot 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

  • 8/3/2019 Ale for Abapers_day3

    13/15

    IBM Global Services

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

    Programs for IDoc extensionPrograms 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 anddata 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 toreturn the control back to the ALE layer

  • 8/3/2019 Ale for Abapers_day3

    14/15

    IBM Global Services

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

    Testing the ALE InterfaceTesting the ALE Interface

    Basic Sanity Check:

    RFC destination : SM59 test connection

    Port : Access test

    Partner Profile : RSECHK07

  • 8/3/2019 Ale for Abapers_day3

    15/15

    IBM Global Services

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

    QuestionsQuestions