Documente Academic
Documente Profesional
Documente Cultură
Applies to:
ABAP Development, Data Transfer.
Summary
Using IDOCs data can be exchanged between SAP R/3 and Non R/3 systems. The objective of this article is
to show / configure data transmission from one SAP R/3 system to another SAP R/3 system via custom
IDOC.
Author(s): Trupti Zanwar
Company: ArchitectSAP Solutions
Created on: 04 January 2008
Author Bio
Trupti Zanwar works for ArchitectSAP Solutions as an SAP Process Integration Consultant.
This article explains the scenario of transferring data across two SAP R/3 systems using IDOCs. The IDOC
developed is a custom-developed IDOC.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Table of Contents
Applies to: ........................................................................................................................................ 1
Summary.......................................................................................................................................... 1
Author Bio ........................................................................................................................................ 1
Steps to Develop Outbound IDOC in Sender R/3 system............................................................... 3
Creation of Basic IDOC Type....................................................................................................... 3
Creation of Basic IDOC Type....................................................................................................... 4
Creation & Assignment of Message Type.................................................................................... 7
Creation of RFC connection for Receiver system...................................................................... 10
Creation of Logical system......................................................................................................... 10
Defining Partner Profile .............................................................................................................. 13
Steps to Develop Inbound IDOC in Receiving R/3 system ........................................................... 15
Create Inbound Function Module:.............................................................................................. 15
Maintain Attributes for Function Module .................................................................................... 16
Creating Process code............................................................................................................... 17
Creating Partner profile .............................................................................................................. 19
Testing the Data Transfer using IDOC Processing ....................................................................... 21
Disclaimer and Liability Notice....................................................................................................... 25
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
As shown in below screen shot, add the fields which are required to be sent using IDOC.
After adding the fields, release the segment using menu EDIT-> Release segment.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
As shown in below screen shot, assign the segment type to the IDOC type and release it.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
[The business background is established by assigning the IDOC type to one or more messages.]
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Go to TC: WE82
Assign Message Type to IDOC Type
Enter the SAP release.
Use your change request for the basic type definition again when you save the data.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Provide all technical settings for receiver system. System name for your R/3 system and its system number.
Move to the logon & security tab to provide logon details like Language, Client, user and password.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
System will give the message “Caution: The Table is cross-client “. Press Enter.
Create New Entries. Give name to your Logical System and Description for the same.
[Logical system name should be similar to partner profile.]
Go to TC: WE21
Configure Port in IDOC Processing for Receiver System.
Choose tRFC as a Port for IDOC Processing and Choose Create New
In a Pop up system will prompt you to choose options from Generate port name or to define your own port
name. You can define port name of your choice.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Create segments, IDOC type and release them as described in Section 1& 2
Create Message type and associate Message type with IDOC using Transaction WE82 as described in
section 3.
Define a Function Module to process the data received from receiving system and update the Z Table.
Go to TC: SE11
To store the received data, create Z database table with all the required fields as shown in below screen
shot.
Go to TC: SE37
To populate the data in Database table, we are required to create a function module in which code is written
to map the IDOC segment data with corresponding database table fields and update the table. Sample code
for the same is as below.
FUNCTION CHANGE_IDOC_STAT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
CLEAR idoc_status.
idoc_status-status = '53'.
idoc_status-msgid = 'B1'.
idoc_status-msgty = 'E'.
idoc_status-msgno = '561'.
idoc_status-repid = sy-repid.
idoc_status-docnum = idoc_contrl-docnum.
APPEND idoc_status.
CLEAR return_variables.
return_variables-wf_param = 'Error_IDOCs'.
return_variables-doc_number = idoc_contrl-docnum.
APPEND return_variables.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT idoc_data.
MOVE idoc_data-sdata(10) TO wa_table-MATERIAL_NO.
MOVE idoc_data-sdata+10(40) TO wa_table-M_DESCRIPTION.
MOVE idoc_data-sdata+50(200) TO wa_table-UOM.
INSERT ZPRO_MAT_IDOC1 FROM wa_table.
Endloop.
ENDFUNCTION.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Go to TC: WE57
Associate Function Module with IDOC.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Go to TC: WE21
To create tRFC port for sender system.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
As shown in below popup fill the values which are required to be transferred using IDOC.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
Go to TC: SE16
To check the data is posted to the database table in receiver system.
In the below screen shot we can see that the entry posted by inbound IDOC in the custom table.
© 2008 SAP AG
SAP-to-SAP Integration Using Custom IDOCs
© 2008 SAP AG