Note : SAP is Integrated By Default i.e When the Same (Single)SAP System is Used by the entire Enterprise , the
Materials Created by MM Dept Can be Accessed By SD,WM,PP etc as long as they are Authorized and Which
reduces the redundancy of DATA and Avoids un-unnecessary Communication across the Depts.
When it is Not Possible & Profitable to run the Entire Enterprise from the Same SAP System(Place) it is
recommended to go for Distributed Applications, to let the Apps Work Autonomously (Independently) and the
Distributed Systems can be Integrated If Required via SAP’s Technology ALE.
Integrated Applications(SAP-ERP)
SAP-PP SAP-SD
SAP-PP SAP-MM
SAP-SD
Non -SAP
Note : Using ALE, Integration Can be done at the required Application Data Level But Not at the entire
Application Level.
SD
WM
Material Master
MM
PP
Here Intergration Should be Done to Make Sure that Every Material ie Created, Changed in MM Should be
there in SD,WM,PP Always
Note : The DataTransfer across all the Distributed Applications that are integrated through ALE is Always
Via IDoc (Intermediate Document) and Which Acts as the Container to Carry the data .
Note: IDoc is SAP’s Own Format So that Only SAP – Systems Can understand the Data in IDoc Format
and While Integrating SAP <->Non-SAP, a Mediator(Interface) is required to
Convert IDOC Any Other Format.
Middle ware
Tool is
OutBound Required
IDO Which Can XM Non-SAP
SAP C Convert L
Note : Here Customer’s Company Code Data Only Send Conditionally i.e When the Ccode is 1000 -> Sys B
2000 -> Sys C etc and rest of the Data Can be Sent Un-Conditionally.
IDocType In Detail
IDoc Type: Collection Of Segment types. And Each Segment Type is Collection Related Fields.
2) Create the IDOc type i.e Arrange the Segment Types according to the Hierarchy Of Data
And Characterstics of the Data.
Execute - WE30
Note: Std.Segment Names Begin with ‘E1’ so that it is recommended to begin the Custom Segments With
‘Y1’/’Z1’
Note: The Total Length Of all the Fields in a Segment type cannot be more than 1000 Chars(Bytes).
IT_EDIDD
1 Distribution Model
Select Data For the 2 Tcode – BD64
Segements Of IDocType
List Of Receivers
TType
IDOc type Recvr
ZCUST R1
Database ALE Service Layer
ZCUST R2
3 ZCUST R3
F
M MASTER_IDOC_DISTRIBUTE
IDoc1 IDoc2 IDoc3 Communication IDocs/
Outbound Partner Receiver Specific IDocs
Profile(WE20)
Communication IDocs
IDoc1 IDoc IDoc
1 2 3
Message Type Vs IDoc Type
Ex : KUNNR – Customer No (Data Element)
(Data Element)
Vendor No LIFNR
EBELN - Puchase Order No(Data Element)
CHAR,10
DOMAIN ZTEXT10
IDOC TYPE Acts as Domain and Message Type Acts as Data Element i.e IDoc types Can be re-used
For Variaous Application Data So that , Only IDoc type name is not ENOUGH to Identify the Purpose
and the Same Can be done Via Message Type.
Note : Message Type is to Identify the Application Data in the IDoc type(Purpose)
Mainly When the Same IDoc type Is used for Carrying Various types of Application Data.
List Of Some Standard Message Types
Application IdocType Message Type
Outbound Prog/ Inbound Prog/
Tcode Process Code
Send Mat. MATMAS01,02… MATMAS BD10 MATM
Note: Table EDIMSG -> For All Message Types & IDoc Types.
Note: Transaction Code is a Link to the Program and Similarly Process Code is a Link to FM.
Note : Communication From / To an SAP System is Always Via it’s Client So that the Participated
Clients Should be Identified With Unique Names Called Logical Systems(Tcode – SALE)
Note : Make Sure that Both the Logical Systems Can Communicate With Each Other and It Can be
By Maintaining the RFC Destination between the Logical Systems (Tcode – SM59),
Where the Logon details are Actually Provided.
Identify the Participated Systems(Clients) With Unique Name Names i.e Called Logical
Systems.
Execute – Tcode - SALE
3) Maintain the RFC Destination Between the Participated Clients(Logical Systems)
a. Execute – Tcode - SM59
Note : Outbound Partner Profile Also Can be Generated From Distribution Model Itself(BD64)
Execute BD64
12 03
Note :
When the IDoc Final Status Is – 30(Yellow Lights)
– Ready to Dispatch
i.e Niether Successful Nor Un-Successful.
Filtering: Send the IDoc Conditionally i.e according to the Receivers Requirement.
Either Outbound/Inbound IDocs that are Failed Should be reprocessed from the Point of Failure itself
Tcode – BD87.
Filtering
Purpose: To Generate & Dispatch the IDoc Conditioanlly i.e
according to receiver's requirement
Types Of Filtering
. IDoc Filtering (BD64)
. Segment Filtering(BD56)
. Reduced Message Type(BD53)
System A
Sends Customer
System B System D
System C
Bank Data Company Code Data Sales Data
Not Required Not Required Not Required
Note : By Default, For Each IDoc type , Some Std.Filtering Objects(Fields) are
Provided &
If Required , Custom Filtering Objects(Fields) Can be Created for any Message type.
Note : Make Sure that the New Filtering Object is also now available ,
along with Std.Filtering Objs
and Verify the Same in BD64 By Adding/Creating Filter Group
for the respective Message type.
Note : Outbound & Inbound Programs of Std.Message types can be used by the
Respective Reduced Message Types ALso.
Note : BD14 -> Send Vendors Can be used For CREMAS and ZRCREMAS(Reduced Msgtype)
But Make Sure that an Entry is Maintained in Distribution ModeL for the required
Message type I,e CREMAS/ZRCREMAS
Note : Change Pointer Technique Can guarantee that Master IDOC Creation
Can be Done Only For the Newly Created and Changed Data.
1) Execute BD61 –
Note : One time Activitiy and Not Specific to Any Message type
2) Execute BD50
Note : This has to be repeated For Each Message Type
Note : Make Sure that the Input required to Execute the Program in
Background is Saved as Variant , So that Both Program & Variant Can be Provided as
As an Input for Background Job, While Scheduling.
To Create the Variant -> Execute the Tcode/Program and Here it is RBDMIDOC & Fill the Input
i.e
When the Change Pointer Technique Is Not Working i.e Not Generating the
Master IDoc Even for the Changed Data
3) Make Sure that an entry Exist in BD52 for the respective Field.
Mandatory INBOUND Configuration For Each Message Type
Maintain the Partner Profile & Inbound Parameters
For the Message type to be Processed/Posted. ( WE20 )
Execute – WE20
Note : Outbound Programs Can be Implemented in any Form i.e as Program,FM,…
But Inbound Programs Should be Implemented as Function Module Only the FM
Has to be Linked to the Process Code .
Note : The Structure (Interface Parameters) of all the Inbound FMs is SAME, So that
It is recommended to Copy any Std.Inbound FM -> Custom Inbound FM
to Make use of Interface Parameters and Implement the respective Business
Logic.
Ex : FM : ‘IDOC_INPUT_DEBITOR’ -> Process Code -> DEBM
‘IDOC_INPUT_CREDITOR’ -> Process Code -> CRE1
Custom IDocs :
When there is No Standard IDoc type to Carry the required Data.
Outbound IDoc Requirement : To Carry the Customer Legacy Data From Table : KNA1 and
Which is Added as a result of Screen Enhancement(BADI)
IDoc type : ZDEBMAS_01
Segment type : Z1LEGACY_KNA1
KUNNR -> SAP Customer No
LKUNNR -> Legacy Customer No
LEGSYS -> Legacy System Name
*&---------------------------------------------------------------------*
*& Report ZDEMO_SEND_CUST_LEGACY_DATA *
*& *
*&---------------------------------------------------------------------*
REPORT ZDEMO_SEND_CUST_LEGACY_DATA .
IF IT_MASTER_IDOC IS INITIAL.
MESSAGE I000(ZALL). "Zero Master IDocs
EXIT.
ELSE.
MESSAGE I008(ZALL). "One Master IDoc
IF P_LOGSYS IS INITIAL. "No Recivered Enterd
*Check for the receivers in the DM
SELECT SINGLE RCVSYSTEM INTO v_recvsystem FROM TBD05
WHERE SNDSYSTEM = 'LS_800_9AM'
AND MESTYP = P_MSGTYP.
IF SY-SUBRC <> 0. "No Receivers In the DM Also
MESSAGE I001(ZALL). "Zero Comm IDocs
exit.
ENDIF.
ENDIF.
WA_CTRL_rec-MESTYP = P_MSGTYP.
WA_CTRL_rec-IDOCTP = 'ZDEBMAS01'.
IF P_LOGSYS IS NOT INITIAL.
WA_CTRL_REC-RCVPRT = 'LS'.
WA_CTRL_REC-RCVPRN = P_LOGSYS.
ENDIF.
ENDIF.
REPORT ZDEMO_SEND_CUST_LEGACY_IDOC .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETER :P_sKUNNR TYPE zsKUNNR OBLIGATORY,
P_MSGTYP TYPE EDI_MESTYP DEFAULT 'ZDEBMAS',
P_LEGSYS TYPE LOGSYS.
SELECTION-SCREEN END OF BLOCK B1.
ENDIF.
IF IT_MASTER_IDOC IS INITIAL.
MESSAGE I007(ZALL).
EXIT.
ELSE.
MESSAGE I008(ZALL).
WA_CTRL_rec-MESTYP = P_MSGTYP.
WA_CTRL_rec-IDOCTP = 'ZDEBMAS01'.
*Trigger ALE Service Layer & Communication Layer
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = WA_CTRL_REC
* OBJ_TYPE = ''
* CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
MASTER_IDOC_DATA = IT_MASTER_IDOC
* EXCEPTIONS
* ERROR_IN_IDOC_CONTROL = 1
* ERROR_WRITING_IDOC_STATUS = 2
* ERROR_IN_IDOC_DATA = 3
* SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
* OTHERS = 5
.
DATA V_LINES TYPE I.
DESCRIBE TABLE IT_COMM_IDOCS LINES V_LINES.
MESSAGE I010(ZALL) WITH V_LINES.
ENDIF.
*&---------------------------------------------------------------------*
*& Report ZDEMO_SEND_CUST_LEGACY_DATA *
*& *
*&---------------------------------------------------------------------*
REPORT ZDEMO_SEND_CUST_LEGACY_DATA .
**************************************************
* WAs & ITABs
**************************************************
DATA : WA_CTRL_REC TYPE EDIDC,
WA_MASTER_IDOC TYPE EDIDD,
IT_MASTER_IDOC TYPE TABLE OF EDIDD,
IT_COMM_IDOCS TYPE TABLE OF EDIDC,
WA_COMM_IDOCS TYPE EDIDC,
v_RECVSYSTEM type RECVSYSTEM,
wa_z1LEGACY_KNA1 TYPE z1LEGACY_KNA1.
IF IT_MASTER_IDOC IS INITIAL.
MESSAGE I000(ZALL). "Zero Master IDocs
EXIT.
ELSE.
MESSAGE I008(ZALL). "One Master IDoc
IF P_LOGSYS IS INITIAL. "No Recivered Enterd
*Check for the receivers in the DM
SELECT SINGLE RCVSYSTEM INTO v_recvsystem FROM TBD05
WHERE SNDSYSTEM = 'LS_800_9AM'
AND MESTYP = P_MSGTYP.
IF SY-SUBRC <> 0. "No Receivers In the DM Also
MESSAGE I001(ZALL). "Zero Comm IDocs
exit.
ENDIF.
ENDIF.
WA_CTRL_rec-MESTYP = P_MSGTYP.
WA_CTRL_rec-IDOCTP = 'ZDEBMAS01'.
IF P_LOGSYS IS NOT INITIAL.
WA_CTRL_REC-RCVPRT = 'LS'.
WA_CTRL_REC-RCVPRN = P_LOGSYS.
ENDIF.
Note : The Structure(Interface Parameters) Of All the Inbound FMs is Same , So that it is recommend to
Copy any Std.Inbound FM Instead of Creating Newly and After Copying Implement the
Respective Business Logic .
Ex : Std.Inbound FM : IDOC_INPUT_DEBITOR “Post Customer Data
IDOC_INPUT_CREDITOR “Post Vendor Master
Make Sure it is Copied into Custom Function Group
1) Maintain the Other(Each Sendor) as a PARTNER and ADD the Inbound Parameters
For each Message type with Inbound Prog(Process Code) .
Input type
0 - Call Trasaction
1 - Open SQL Statements Directly
2 - Both 0 + 1
Note : Inbound FM Can be tested Even Before receiving IDoc From Sendor Sys.
Note : IDoc Can be Generated and Send from Sendor System Even before Completion of
the Outbound Program.
Note : The Tcode : WE19 is for Both the above Cases.
Execute – WE19
2) Execute WE30
IDoc Related BADIs from XD01(Customer Master)
Note : Make Sure that the respective Std.Message type’s Outbound Program is
Also enhanced to fill the Data for the Additional Segments in the Extended IDoc type.
Note : Make Sure that The Extended IDoc type Name is Known to the respective Std.Message Type
Execute – WE82
2) BD64 – Add the Receiver & Respective Std.Message (DEBMAS) to the Distribution Model &
Generate the Outbound Partner Parameters(Profile) Also .
Note : To Process the Data through the Additional Segments along with Std.Segements,
Make Sure that respective Std.Outbound & Inbound Programs are
Also Extended (Enhanced).
Note : While Creating Outbound Parameters from WE20 Explictly i.e Not From BD64,
The Port has to be Created Explictly which Points the RFC Destination.
Execute WE21
Note : The Port Can be Generated automatically from the DM(BD64) Only When there is
an RFC Destination With the Name Of the Receiver Logical System in DM So that
it is recommended to Maintain the Same Name for both RFC Destination & Reciver
Logical System But they Can be Differed.
Note : Make Sure that the Outboud & Inbound Progs of the respective Std.Msg type
Are Enhanced Since Every Std.IDoc type Can be Enhanced, In Every
Std.IDOc Programs Functional Exit/BADI Should be Provided by SAP to
Process the Additional Segment Types.
IDoc Specific BADI Details From Customer Master (XD01)
Note : The Same Outbound IDOC BADI(Outbound Method) is Called After Filling the
Data For Each Std.Segment and It is to allow the Data Records
for the Additional Segments Also after the respective Std.Segments So that
Master IDoc Can be Prepared according to Extended IDoc type.
CUSTOMER_ADD_DATA_BI
Method: FILL_ALE_SEGMENTS_OWN_DATA (Outbound)
CASE I_SEGMENT_NAME.
WHEN 'E1KNA1M'.
READ TABLE T_IDOC_DATA INTO WA_IDOC_DATA
with key SEGNAM = 'E1KNA1M' .
WA_E1KNA1M = WA_IDOC_DATA-SDATA.
SELECT SINGLE KUNNR prty rank INTO WA_Z1PRTY_CUST
FROM KNA1
WHERE KUNNR = WA_E1KNA1M-kunnr. “Crrent KUNNR
"WA_IDOC_DATA-sdata+3(10).
WA_IDOC_DATA-SEGNAM = 'Z1PRTY_CUST'.
wa_idoc_data-SDATA = WA_Z1PRTY_CUST.
APPEND WA_IDOC_DATA TO T_IDOC_DATA.
ENDCASE.
endmethod.
Note : Make Sure that The Extended IDoc type is Created and Linked to the respective
Std.Message Type.(WE31,WE30,WE82)
Note : Make Sure that Inbound Partner Profile is Mantained for the respective Std.Message type
WE20
Note : The Same Inbound BADI(Method) is
Implementing Inbound IDoc Method(BADI) i.e to Enhance the
Std. Inbound Program to Process the Additional Segments(Tcode – SE19)
*Note : Same Inbound Method/Exit is Called Only After Each Additional Segment with both Segment Name &
Segment Data as Input .
*Inbound
method IF_EX_CUSTOMER_ADD_DATA_BI~PASS_NON_STANDARD_SEGMENT .
DATA WA_Z1LEGACY_KNA1 TYPE Z1LEGACY_KNA1.
CASE I_SEGMENT_NAME.
WHEN 'Z1LEGACY_KNA1'.
WA_Z1LEGACY_KNA1 = I_SEGMENT_DATA.
ENDCASE.
UPDATE KNA1 SET SKUNNR = WA_Z1LEGACY_KNA1-SKUNNR
LEGSYS = WA_Z1LEGACY_KNA1-legsys
WHERE KUNNR = WA_Z1LEGACY_KNA1-KUNNR.
endmethod.
method IF_EX_VENDOR_ADD_DATA_BI~PASS_NON_STANDARD_SEGMENT .
DATA WA_Z1LEGACY_LFA1 TYPE Z1LEGACY_LFA1.
CASE I_SEGMENT_NAME.
WHEN 'Z1LEGACY_LFA1'.
WA_Z1LEGACY_LFA1 = I_SEGMENT_DATA.
ENDCASE.
UPDATE LFA1 SET ZLLIFNR = WA_Z1LEGACY_LFA1-llifnr
ZLEGSYS = WA_Z1LEGACY_LFA1-zlegsys
WHERE LIFNR = WA_Z1LEGACY_LFA1-lifnr.
endmethod.
Note : The Same Outbound BADI(Method) is Called Repeatedly After Filling the
Data For Each Std.Segment and It is allow the Data for the Additional
Segments Also After the respective Std.Segments, Where Inbound Method
Is also Called repeatedly but Only after Each Additional Segment.
Exits
. User Exits – Via Subroutine Calls within the Std.Programs with no Functionality
inside FORM – ENDFORM.
Note : Access key is Required to Implement the FORM – ENDFORM in the
Standard Program.
Customer Exits Via Function Module Calls within the Std.Programs with no Functionality
inside FUNCTION – ENDFUNCTION.
Note: No Access key is required as there is a Custom Inlcude i.e begins with ZX Withing
Each Function Module Exit So that Writing the Business Within Custom Include
Requires No Access Key.
Note : The Same Exit Cannot be Implemented more than Once as the Same Include Program
Cannot be accessed by more than one user at a time Where as the same BADI(Interface)
Can have any no of Implementations, Because the Same Interface Can be Implemented
By any No Of Classes an In Each Class with a different Implementation.
Populating SDATA
SDATA(1000)
wa_idoc_data-SDATA = WA_e1KNA1m.
WA_e1KNA1m
MSGFn KUNNR ANRED
3 10 15
001 C1 Mr
WA_e1KNA1m = wa_idoc_data-SDATA.