Professional Documents
Culture Documents
Go to start of metadata
Introduction:
In this document the steps are mentioned to do the ALE configuration as well as to populate and
send the custom IDOC from sending client/system and the processing of IDOC in receiving
client/system.
This document does not demonstrate any business scenario. The main purpose of this document is
to make you understand the different configuration and technical settings to be done to send the
custom IDOC from SAP R/3. It is highly recommended to use the standard IDOC types and message
types provided by SAP or extend the standard IDOC types to suite the business requirements.
This document assumes that you have two different clients available on SAP server (You can also
follow the steps mentioned in this document to setup the ALE scenario between two different SAP
systems) . Also the assumption is that you have all the necessary authorizations to execute the
transactions mentioned in this document.
It is recommended for you to get the basic understanding of ALE and its basic configuration steps
like setting up the distribution model, setting up partner profiles, maintaining logical ports, message
types etc. before going through this document.
Generally the logical systems are available for client of SAP system in which you are working. Please
do not create logical systems unnecessarily. Use the existing logical system attached to the client in
which you intend to work. You can find the logical system name attached to the client in which you
are working by going to the transaction SALE.
Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will
need to cancel the release of the IDoc type as well as the segment release using a similar procedure
followed above (except now you uncheck the release box for the segment and you choose cancel
release for the IDoc type).
2. Define Logical system (Transaction SALE):
To Define Logical system, follow these next few steps:
- Goto transaction SALE and select Logical Systems-> Define Logical System.
- You will get the message that 'Caution: The table is cross-client'. Go ahead by clicking on
'Continue'. You will go to the next screen. On next screen define 2 logical systems (K100 as Sender
and K200 as Receiver). You can decide your own name while defining the logical system. The next
step involved is assigning these logical systems to client. If logical system is already created and
assigned to the client then you need not create the new logical system. Use the existing logical
systems which are already assigned to clients.
3. Create RFC Destination for receiving client in sending client (Transaction SM59):
(Transaction SM59):
- Goto transaction SM59 and then click on ABAP or R/3 Connection and then create.
- Enter the Logon Details of the client system in that newly created RFC connection.
- After saving it Test the connection and also check whether you are able to logon to the
Recieving system if not then there is a problem in the RFC connection (You need to report it to the
BASIS team)
- If you can logon remotely then RFC connection has been made.
4. Define a new message type (Transaction WE81):
Goto transaction WE81 and create a message type by giving the description
save it.
Here is the code which I have written to populate the IDOC 'Z_CUSTOM_IDOC'. You can refer to this
program and write your own code to populate the IDOC created by you. You can write function
module, module pool or report program based on the requirement.
*&---------------------------------------------------------------------*
*& Report Z_CREATE_CUSTOM_IDOC
*&
*&---------------------------------------------------------------------*
*& This report will create the custom IDOC of type 'Z_CUSTOM_IDOC' with*
*& with message type 'Z_CUSTOM_MESSAGE_TYPE'
*&---------------------------------------------------------------------
report z_create_custom_idoc .
parameters: p_matnr like mara-matnr obligatory.
data: wa_z1customsegment type z1customsegment.
data: i_edidc like edidc occurs 0 with header line, i_edidd like edidd occurs 0 with header line,
wa_edidd type edidd,
wa_edidc type edidc. *Segment name
wa_edidd-segnam = 'Z1CUSTOMSEGMENT'.
*This IDOC type contains only one segment.
*This segment contains only 1 field i.e. 'matnr'
wa_z1customsegment-matnr = p_matnr.
wa_edidd-sdata = wa_z1customsegment.
append wa_edidd to i_edidd.
*Message type
wa_edidc-mestyp = 'Z_CUSTOM_MESSAGE_TYPE'.
*IDOC type
wa_edidc-idoctp = 'Z_CUSTOM_IDOC'.
*Receiver Partner type
wa_edidc-rcvprt = 'LS'.
*Receiving Logical system name
wa_edidc-rcvprn = 'K200'.
*Sender Partner Type
wa_edidc-sndprt = 'LS'.
*Sender Logical System
wa_edidc-sndprn = 'K100'.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = wa_edidc
* OBJ_TYPE = ''
* CHNUM = ''
tables
communication_idoc_control = i_edidc master_idoc_data =
i_edidd 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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
read table i_edidc into wa_edidc with key status = '03'.
if sy-subrc = 0.
write: 'IDOC Number: ', wa_edidc-docnum, ' is sent to logical port'.
endif.
endif.
*A COMMIT WORK must be dispatched in the calling program, otherwise the
*IDocs may not be dispatched.
commit work.
***************************************************************
************************************
This is the complete process of creating an Outbound Idoc through ALE.