Ale Idocs Mukheed

download Ale Idocs Mukheed

of 47

Transcript of Ale Idocs Mukheed

  • 8/8/2019 Ale Idocs Mukheed

    1/47

    Step-by-step guide to ALE and IDOCs

    By Shankar Reddy Chamala, ITChamps Software

    Introduction to EDI and ALE:

    EDI (Electronic Document interchange) - EDI is the electronic exchange of business documents

    between the computer systems of business partners, using a standard format over a

    communication network.EDI is also called paperless exchange.

    Advantages:

    Reduced Data entry errors

    Reduced processing time

    Availability of data in electronic form

    Reduced paperworkReduced Cost

    Reduced inventories and better planningStandard means of communications

    Better business process

    EDI has two process

    1. Outbound process

    2. Inbound process

    Outbound Process:

    1.Application document is created.2. IDOC is generated3.Idoc is transferred from SAP to Operating system layer

    4.Idoc is converted into EDI standards

    5.Edi document is transmitted to the business partner6.The Edi Subsystem report status to SAP

    Inbound Process:

    1.EDI transmission received2.EDI document is converted into an IDOC

    3.IDOC is transferred to the SAP layer

    4.The application document is created5.The application document can be viewed.

    IDOC:IDOC is a container that can be used to exchange

    data between any two processes.

    Each IDOC is assigned a unique number for tracking and future reference.

  • 8/8/2019 Ale Idocs Mukheed

    2/47

    IDOC consists of several segments, and segments contain several fields.

    IDOC contains the following three types of records...1. One Control Record.2. One or many Data Record3. One or many Status record.

    In IDOCs the following terms are to be known.

    PORT:

    Port is used in the outbound process to determine the name of the EDI subsystem program, thedirectory path where the IDOC file will be created at the operating system level, the IDOC file

    names and the RFC destinations.

    RFC Destination:

    Used to define the characteristics of communication links to a remote system on which a

    functions needs to be executed.

    Partner Profile:Partner profile specified the various components used in an outbound process (Partner number,

    IDOC type, message type, Port, Process code), the mode in which it communicates with thesubsystem (batch or immediate) and the person to be notified in case of errors.

    Message Control

    Used in pricing, account determination, material determination, and output determination. The

    message control component enables you to encapsulate business rules with out having to write

    ABAP programs.

    TO Process IDOCS the following TCODES will be used.

    On both sides:

    Logical System Names SALE

    Setup RFC destinations SM59

    Port Destinations WE21

    In Source system:

    Segment Creation WE31

    Basic IDOC Type Creation WE30

    Message Type Creation WE81

    Assign Message Type To Basic IDOC Type WE82

    Distribution Model BD64

  • 8/8/2019 Ale Idocs Mukheed

    3/47

    Writing Report Program SE38

    Partner Profile WE20

    Message control NACE

    Check IDOCs WE02, WE05

    In Destination System:

    Creating FM SE37

    Assign FM to Logical Message WE57

    Define I/P method for Inbound FM BD51

    Create Process Code WE42

    Generate Partner Profile BD64

    IDOC processing in the same instance of R/3 Clients.

    For example two clients in the same R/3 instance.

    Client 900.

    Client 800.

    To transfer the data between two clients the table structures and their data types should be

    match.

    In this example, Client 900 is Source system, and Client 800 is destination system.

    In Client 900 I have created a customized table and inserted some records.

    In Client 800 I have created only table.

    Common Steps in Both Clients:

    Creating the Logical System Names and Assigning to Clients:

    Go to TCODE SALE.

    IMG path IDoc Interface / Application Link Enabling (ALE) -> Basic Settings -> LogicalSystems -> Define Logical System

  • 8/8/2019 Ale Idocs Mukheed

    4/47

    Click on Display / Change Button

    Click on New Entries

  • 8/8/2019 Ale Idocs Mukheed

    5/47

    Specify the Logical System name and description.

    Note: Logical System Naming convention is CLNT

    Click on Save and Back buttons

    Now you will come back to the IMG path screen. Click on Assign Logical System to client.

  • 8/8/2019 Ale Idocs Mukheed

    6/47

    Click on Display / Change Button

    Click on New Entries

  • 8/8/2019 Ale Idocs Mukheed

    7/47

    Click on Save and Back.

    Click here to continue...

    ..Previous

    Creating the RFC Connection Names:

    Go to TCODE SALE. Direct TCODE SM59

    IMG Path IDoc Interface / Application Link Enabling (ALE) -> Communication -> Create RFCConnections

    Click on Create button.

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page2.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Index.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Index.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Index.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page2.htm
  • 8/8/2019 Ale Idocs Mukheed

    8/47

    Specify all the details in RFC connection screen

    Click on Logon Security tab and specify the details.

    Click on the Special options tab and specify the details which you want.

  • 8/8/2019 Ale Idocs Mukheed

    9/47

    Now click on Test Connection button

    It show the connection log in next screen

    Click on Back

    Click on Remote Logon Button

  • 8/8/2019 Ale Idocs Mukheed

    10/47

    Depends upon your settings the destination client will open. If you check the Current user option

    under Logon/ Security tab, then it will show the screen directly without asking the user name and

    password details.

  • 8/8/2019 Ale Idocs Mukheed

    11/47

    Creating RFC ports:

    Go to TCODE WE21

    Select the Transactional RFC in left side tree and click on Create button

    In dialog box you can select either Generate port name or own port name. If you select Generate

    Port name system will generate automatically. Here I selected Own port name. Click oncontinue.

  • 8/8/2019 Ale Idocs Mukheed

    12/47

    Specify the description and RFC destination name.

    Click on Save.

  • 8/8/2019 Ale Idocs Mukheed

    13/47

    Repeat the same above process in other client. By using opposite client instead of 900 specify

    800.

    In Client 900 steps:

    Creating table structure:

    Go to TCODE SE11.

    Specify table name as ZSTUDENTS.

    In Delivery and Maintenance tab set attributes as Display Maintenance Allowed

    The table fields are.

    Insert some records in table.

    Click here to continue...

    ..Previous

    Creating IDOC Segments:

    Go to TCODE WE31.

    Specify a name and Click on Create Button.

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page3.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page2.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page2.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page3.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page2.htm
  • 8/8/2019 Ale Idocs Mukheed

    14/47

    Here specify all the ZSTUDENTS table fields and their types as shown below.

    Click on SAVE button, then it will show dialog box with user name, press continue.

  • 8/8/2019 Ale Idocs Mukheed

    15/47

    Specify your package name and click on save.

    Specify your request and press Continue.

  • 8/8/2019 Ale Idocs Mukheed

    16/47

    Click on Back button, and then you will see the created segment.

    Creating Basic IDOC Type:

    Go to TCODE WE30

    Specify a name to your IDOC and click on create button.

  • 8/8/2019 Ale Idocs Mukheed

    17/47

    In next dialog box select create new option and specify the description of IDOC and click on continue.

    Click on Create segment in the screen.

    In dialog box specify the segment name which you created and check mandatory check box.

  • 8/8/2019 Ale Idocs Mukheed

    18/47

    Click on SAVE and BACK button.

    Go to menu EDIT ->Click Set Release

    In next dialog box, click on Yes.

  • 8/8/2019 Ale Idocs Mukheed

    19/47

    Creating Message Type:

    Go to TCODE WE81.

    Click on Display / Change button.

    Click on New Entries button.

  • 8/8/2019 Ale Idocs Mukheed

    20/47

    Specify a message type name and Description and click on SAVE button.

    Click on Back and Save

    Click here to continue...

    ...Previous

    Assign Message Type to Basic IDOC Type:

    Go to TCODE WE82

    Click on Display / Change Button

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page4.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page3.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page3.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page4.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page3.htm
  • 8/8/2019 Ale Idocs Mukheed

    21/47

    Click on New Entries, Specify the Message Type and Basic IDOC Type and Release version. Click onSave.

    Click on Back.

    Note:

    Here the Release version you can find in this way

    Creating Model View and Distributing and Generating Partner profile:

    Go to TCODE BD64

    Click on Display/ Change button

  • 8/8/2019 Ale Idocs Mukheed

    22/47

    Click on Edit menu -> Model View -> Create

    Specify description of model view and technical name in dialog box and press continue.

  • 8/8/2019 Ale Idocs Mukheed

    23/47

    Select your model view and click on Edit menu -> Add Message type

    In dialog box specify the sender, receiver, message type and click on continue.

  • 8/8/2019 Ale Idocs Mukheed

    24/47

    Now your Model View looks like

    Click on Environment Menu -> Generate Partner profile

  • 8/8/2019 Ale Idocs Mukheed

    25/47

    It will show the following screen, click on execute.

    It will show the partner profile log in next screen.

  • 8/8/2019 Ale Idocs Mukheed

    26/47

    Click on Back button 2 times, it will take back to Distribution Model screen.

    Click here to continue...

    ...Previous

    Click on Edit Menu -> Model View -> Distribute.

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page5.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page4.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page5.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page4.htm
  • 8/8/2019 Ale Idocs Mukheed

    27/47

    In displayed dialog box select the partner system and click continue

    Then it will show the Log of Model View Distribution.

  • 8/8/2019 Ale Idocs Mukheed

    28/47

    Click on Back button.

    To check partner profile Go to TCODE WE20

    In displayed screen select the partner system in left side tree under Partner Type LS.

    Write a Report Program in SE38 to create IDOC control records and transfer it to destinationpartner system.

    The following is the program to generate the IDOC control records and process it.

    *&---------------------------------------------------------------------**& Report ZSHAN_IDOC_STUD*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORT ZSHAN_IDOC_STUD.TABLES: ZSTUDENTS.DATA : S_CTRL_REC LIKE EDIDC, "Idoc Control Record

    S_ZSHSTUSEG LIKE ZSHSTUSEG. "CUSTOMER Header DataDATA : T_ZSTUDENTS LIKE ZSTUDENTS OCCURS 0 WITH HEADER LINE.DATA : T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE. "Data Records

  • 8/8/2019 Ale Idocs Mukheed

    29/47

    DATA : T_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE. "GeneratedCommunication IDOcCONSTANTS :C_ZSHSTUSEG LIKE EDIDD-SEGNAM VALUE 'ZSHSTUSEG'.CONSTANTS: C_IDOCTP LIKE EDIDC-IDOCTP VALUE 'ZSHSTUDIDOCS'.*** Selection ScreenSELECT-OPTIONS : S_STUID FOR ZSTUDENTS-ZSTUID OBLIGATORY.PARAMETERS : C_MESTYP LIKE EDIDC-MESTYP DEFAULT 'ZSHSTUDMT', "Message Type

    C_RCVPRT LIKE EDIDC-RCVPRT DEFAULT 'LS', "Partner typeof receiver

    C_LOGSYS LIKE EDIDC-RCVPRN DEFAULT 'IT3CLNT800',C_RCVPOR LIKE EDIDC-RCVPOR DEFAULT 'PORTSH800',C_SNDPRN LIKE EDIDC-SNDPRN DEFAULT 'IT3CLNT900',C_SNDPRT LIKE EDIDC-SNDPRT DEFAULT 'LS'. "Destination

    System***START-OF-SELECTIONSTART-OF-SELECTION.PERFORM GENERATE_DATA_RECORDS.PERFORM GENERATE_CONTROL_RECORD.PERFORM SEND_IDOC.

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

    *& Form GENERATE_DATA_RECORDS*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text*

  • 8/8/2019 Ale Idocs Mukheed

    30/47

    *----------------------------------------------------------------------** --> p1 text*

  • 8/8/2019 Ale Idocs Mukheed

    31/47

    Go to TCODE WE02 to check the generated IDOC control records.

    Click on Execute

  • 8/8/2019 Ale Idocs Mukheed

    32/47

    Click here to continue...

    ...Previous

    In Client 800 Steps:

    Function Module Creation:

    Create a Function Module to update the table from the IDOC segments

    Go to SE37

    Specify a name and click on create.

    In dialog box specify function group and description, and click on save.

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page6.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page5.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page6.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page5.htm
  • 8/8/2019 Ale Idocs Mukheed

    33/47

    Specify the Import parameters in Import tab

    Specify the Export parameters in Export tab

    Specify the Table parameters in Tables tab

  • 8/8/2019 Ale Idocs Mukheed

    34/47

    Specify the Exceptions in Exception tab

    Click on Source code Tab.

    Write the following code in Source code tab.

  • 8/8/2019 Ale Idocs Mukheed

    35/47

    FUNCTION ZSHAN_IDOC_ZSHSTUDMT.*"--------------------------------------------------------------------*"*"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*" WRONG_FUNCTION_CALLED*"--------------------------------------------------------------------

    * Include File containing ALE constantsINCLUDE MBDCONWF.TABLES : ZSTUDENTS.DATA : W_ZSHSTUSEG LIKE ZSHSTUSEG.DATA : T_ZSTUDENTS LIKE ZSTUDENTS OCCURS 0 WITH HEADER LINE.WORKFLOW_RESULT = C_WF_RESULT_OK.LOOP AT IDOC_CONTRL.IF IDOC_CONTRL-MESTYP NE 'ZSHSTUDMT'.RAISE WRONG_FUNCTION_CALLED.

    ENDIF.* Before reading a new entry, clear application buffer

    LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.W_ZSHSTUSEG = IDOC_DATA-SDATA.MOVE-CORRESPONDING W_ZSHSTUSEG TO T_ZSTUDENTS.INSERT INTO ZSTUDENTS VALUES T_ZSTUDENTS.

    ENDLOOP.UPDATE ZSTUDENTS FROM T_ZSTUDENTS.IF SY-SUBRC EQ 0.IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.IDOC_STATUS-STATUS = '53'.IDOC_STATUS-MSGTY = 'I'.IDOC_STATUS-MSGID = 'YM'.IDOC_STATUS-MSGNO = '004'.IDOC_STATUS-MSGV1 = T_ZSTUDENTS-ZSTUID.APPEND IDOC_STATUS.CLEAR IDOC_STATUS.

    ELSE.

    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.IDOC_STATUS-STATUS = '51'.IDOC_STATUS-MSGTY = 'E'.IDOC_STATUS-MSGID = 'YM'.IDOC_STATUS-MSGNO = '005'.IDOC_STATUS-MSGV1 = T_ZSTUDENTS-ZSTUID.APPEND IDOC_STATUS.CLEAR IDOC_STATUS.WORKFLOW_RESULT = C_WF_RESULT_ERROR.RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.

  • 8/8/2019 Ale Idocs Mukheed

    36/47

    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.APPEND RETURN_VARIABLES.CLEAR RETURN_VARIABLES.

    ENDIF.ENDLOOP.ENDFUNCTION.

    Click on Save and Activate.

    Assign FM to Logical Message:

    Go to TCODE WE57

    Click on Display / Change button.

    Click on New Entries Button

  • 8/8/2019 Ale Idocs Mukheed

    37/47

    Specify created FM name, Function Type, Basic Type (IDOC), Message Type, and Direction and click on

    SAVE button.

    Click on Back button.

    Click here to continue...

    ...Previous

    Define Input Method for Inbound Function Module:

    Go to TCODE BD51

    Click on Display / Change button

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page7.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page6.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page6.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page7.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page6.htm
  • 8/8/2019 Ale Idocs Mukheed

    38/47

    Click on New Entries

    Specify FM name and Input Types as 2. And Click on Save and Back buttons.

  • 8/8/2019 Ale Idocs Mukheed

    39/47

    Creating Process Code:

    Go to TCODE WE42

    Click on Display / Change Button

    Click on New Entries button

  • 8/8/2019 Ale Idocs Mukheed

    40/47

    Specify a process code name, Description and select the options processing with ALE services,Processing by Function Module.

    Click on save button

    In next screen select the FM name and click on SAVE button and Click on BACK button.

  • 8/8/2019 Ale Idocs Mukheed

    41/47

    It will take to you previous screen. Double Click on Logical Message in left side tree.

    Click on Display / Change button

  • 8/8/2019 Ale Idocs Mukheed

    42/47

    Click on New Entries button

    Click here to continue...

    ..Previous

    Specify the Message Type and Click on Save button

    http://www.saptechnical.com/Tutorials/ALE/Guide/Page8.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page7.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page7.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page8.htmhttp://www.saptechnical.com/Tutorials/ALE/Guide/Page7.htm
  • 8/8/2019 Ale Idocs Mukheed

    43/47

    Click on Back button

    Generating the Partner Profile:

    Go to TCODE BD64.

    Select the Model View which you distributed in client 900.

  • 8/8/2019 Ale Idocs Mukheed

    44/47

    Click on Environment Menu -> Generate Partner Profile

    It will show the next screen, in that click on Execute button

  • 8/8/2019 Ale Idocs Mukheed

    45/47

    It will show the Partner Profile details

    To check the partner profile details. Go to TCODE WE20. Select the partner system name.

  • 8/8/2019 Ale Idocs Mukheed

    46/47

    Transferring the IDOC control records from Client 900 to 800:

    In source system, go to TCODE SE38. (In client 900)

    Execute the Report program which you created.

    Check in Destination System: (Here client 800)

    Go to TCODE WE02

  • 8/8/2019 Ale Idocs Mukheed

    47/47

    Check in ZSTUDENTS table in SE11.