Introduction:
In this document we will discuss the steps in sending an Idoc ( i.e Outbound Idoc) through ALE.
Our requirement is that when we go into transaction IW21 (To create PM notifications),
After we create a notification and save it the Idoc should be triggered.
Here we will fill the mandatory fields while creating Notification i.e QMNUM :- Notification Number, QMART :- Notification Type, QMTXT :- Short Text.
For this scenario was given to me as an assignment.
This document has all the steps required in doing it.
To Create Idoc Type.
- First go into transaction WE30 and there we can search for the standard Idoc type
Which will satisfy our requirement and if we don't find any standard Idoc type then we will create our own custom Idoc type.
- Here I have found a standard Idoc type which satisfies our requirement as it has the
Necessary fields which we fill when we create Notification ( the fields are QMNUM, QMTXT, QMART).
STEP 1 
STEP2 After opening the Idoc type in Display mode. 
STEP 3 After double clicking on E1NTHDR. 
STEP 4 Click on the segment editor to see the fields which are there in that segment. 
Therefore this segment has the three fields which we require i.e Qmnum, Qmart, Qmtxt.
NOTE :- If we are using a custom idoc then release it. Then only you will be able to use it.
Finding the message type attached to this Idoc type
- To find the Message which is attached to this particular idoc type Goto transaction
WE82.
- If it's a Custom idoc type then first goto transaction WE81 create a message type and Release it and then Come to transaction WE82 and associate the
Idoc type with your message type.
- After knowing the name of the message type attached to our Idoc type (INOTIF01) we go to next step.
TRANSACTION WE82. 
Now we know the message type (INOTIF) for our Idoc type(INOTIF01).
To Establish the RFC connection between the sending system and receiving system.
- To establish an RFC connection Goto transaction SM59 and select the ABAP connections and find for the RFC connection for your receiving system ,
If you find any RFC connection then test it and try to remote logon.
- If you are able to remotely logon to receiving system then your RFC connection
Is working fine otherwise you have to create it again.
- If you don't find the RFC connection for your receiving system then create an RFC connection by giving the necessary parameters and test it before you confirm that an RFC connection has been established.


Logical system names
- To know the Logical system name of sending system.
- Goto transaction SALE there click on the Assign Logical system and then display
the receiving system details.
- There you will get to know it's Logical system name.
- Do the same thing in the receiving system to know its logical system name.
After selecting the Assign Logical system to client 
Display the 100 client system as we are using that system. 
Therefore its Logical system name is EC1CLNT100.
To create a Distribution Modal.
- Goto transaction BD64 and then goto change mode->create a distribution modal-> save it-> click on add message type and give the logical system names of sending system and receiving system and also give the message type.
- After that click on that Modal and goto Environment-> Generate partner profiles -> execute. This will create the partner profile.
- Next goto Edit -> Modal view -> Distribute.
- If your Distribution modal is distributed then we can send an idoc now.



- To know whether your partner profile is created, goto transaction WE20 and click on the logical system and check whether your message type is added in the outbound parameters of the receiving system. 
Finding a suitable BADI to code.
- Now we have to find a suitable BADI, a BADI in which the processing is done when we Press SAVE button in transaction IW21 (to create Notification).
- For that while creating notification before pressing save button goto transaction SE24 and open 1. Go to the TCode SE24 and enter CL_EXITHANDLER as object type.
- Open In 'Display' mode, go to 'Methods' tab, Double click the method 'Get Instance' to display it source code, Set a breakpoint on 'CALL METHOD cl_exithandler=>get_class_name_by_interface'.
- Then Press SAVE button.
- The screen will stop at this method.
- Check the value of parameter 'EXIT_NAME'. It will show you the BADI's for that particular step.
- After noting down the BADI's name goto transaction SE19 and implement those BADI's and
Place a break point in the method of that BADI and again create a notification and check whether the screen stops at this break point or not.
- Check the same for all BADI'S and after you find the appropriate BADI you have to write the code to fill the Idoc type in the method of the implemented BADI.
- For our requirement I have found a BADI NOTIF_EVENT_POST and implemented it into Z NOTIF_EVENT_POST
TRANSACTION SE19 
CREATE IT. 
GOTO INTERFACE and double click on the method. 
Now do the coding between this method and endmethod.
- Before writing the code to fill the Idoc we need to know which of the Tables has the data which we need to fill in the Idoc.
- I have found out in debugging mode that the data i.e. the values of QMNUM, QMART, QMTXT are there in IS_NEW_VIQMEL.
- So I have written the code according.
- You can refer the CODE below.
Method IF_EX_NOTIF_EVENT_POST~CHECK_DATA_AT_POST.
Types: idoc_cntrl1 type edidc,
idoc_edidd1 type edidd.
Data: idoc_cntrl type idoc_cntrl1,
wa_idoc_cntrl type idoc_cntrl1,
master_cntrl_data type standard table of idoc_cntrl1,
idoc_edidd type standard table of idoc_edidd1,
wa_idoc_edidd type idoc_edidd1.
Types: begin of qmel_struc,
qmnum type qmel-qmnum,
qmart type qmel-qmart,
qmtxt type qmel-qmtxt,
end of qmel_struc.
DATA: wa_qmel_struc type E1NTHDR.
clear idoc_cntrl.
* These values can be derived from EDP13 table.
idoc_cntrl-rcvpor = 'A000000108'.
Idoc_cntrl-rcvprt = 'LS'.
Idoc_cntrl-mestyp = 'INOTIF'.
Idoc_cntrl-idoctp = 'INOTIF01'.
Idoc_cntrl-rcvprn = 'CID'.
Wa_qmel_struc-qmnum = is_new_viqmel-qmnum.
Wa_qmel_struc-qmart = is_new_viqmel-qmart.
Wa_qmel_struc-qmtxt = is_new_viqmel-qmtxt.
Wa_idoc_edidd-SEGNAM = 'E1NTHDR'.
Wa_idoc_edidd-sdata = wa_qmel_struc.
clear wa_qmel_struc.
Append wa_idoc_edidd to idoc_edidd.
Clear wa_idoc_edidd.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = idoc_cntrl
* OBJ_TYPE = ''
* CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = master_cntrl_data
MASTER_IDOC_DATA = idoc_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.
ENDIF.
Endmethod.
Get IDOC number
- By executing the above program, you get the Idoc Number for the particular material .
- You can write the above code anywhere based upon your requirements.
- You can also Goto Transaction WE02 or WE05 to check the Status of the Idoc and the Data which is sent in the segment.
- Execute the Transaction (WE02 or WE05) and check whether the data is correctly populated in data records. Also make sure that IDOC status icon is Green.
- You can also know the status of an Idoc from Transaction WE47.
********************************
Important Transaction Codes:
SALE - IMG ALE Configuration root
WE20 - Manually maintain partner profiles
BD64 - Maintain customer distribution model
BD71 - Distribute customer distribution model
SM59 - Create RFC Destinations
BDM5 - Consistency check (Transaction scenarios)
BD82 - Generate Partner Profiles
BD61 - Activate Change Pointers - Globally
BD50 - Activate Change Pointer for Msg Type
BD52 - Activate change pointer per change.doc object
BD59 - Allocation object type -> IDOC type
BD56 - Maintain IDOC Segment Filters
BD53 - Reduction of Message Types
BD21 - Select Change Pointer
BD87 - Status Monitor for ALE Messages
BDM5 - Consistency check (Transaction scenarios)
BD62 - Define rules
BD79 - Maintain rules
BD55 - Defining settings for IDoc conversion
WEDI - ALE IDoc Administration
WE21 - Ports in Idoc processing
WE60 - IDoc documentation
SARA - IDoc archiving (Object type IDOC)
WE47 - IDoc status maintenance
WE07 - IDoc statistics
BALE - ALE Distribution Administration
WE05 - IDoc overview
BD87 - Inbound IDoc reprocessing
BD88 - Outbound IDoc reprocessing
BDM2 - IDoc Trace
BDM7 - IDoc Audit Analysis
BD21 - Create IDocs from change pointers
SM58 - Schedule RFC Failures
Basic config for Distributed data:
BD64: Maintain a Distributed Model
BD82: Generate Partner Profile
BD64: Distribute the distribution Model
Programs
RBDMIDOC - Creating IDoc Type from Change Pointers
RSEOUT00 - Process all selected IDocs (EDI)
RBDAPP01 - Inbound Processing of IDocs Ready for Transfer
RSARFCEX - Execute Calls Not Yet Executed
RBDMOIND - Status Conversion with Successful tRFC Execution
RBDMANIN - Start error handling for non-posted IDocs
RBDSTATE - Send Audit Confirmations
FOr testing you can use WE19.
********************************
This is the complete process of creating an Outbound Idoc through ALE.
Comments (3)
Sep 10, 2008
Disha Jain says:
This has been written very well. It explains every thing in detail and will scre...This has been written very well. It explains every thing in detail and will screen shot.
Dec 16, 2008
Avaneet Kumar says:
nice post. really very helpful.nice post. really very helpful.
Apr 12, 2009
SAP ABAPer says:
nice work. it helps to ALE beginners. By the way, if u wuld hv mention the nam...nice work.
it helps to ALE beginners.
By the way, if u wuld hv mention the names of Sending system & receiving syste, that wuld b more explanantory. And also u missed 1-2 screen shots, which explains the generation of partner profiles.......actually, unless its noticed in WE20, we dont know that, wht is the name of partenr profile?
anyways, its impressive.
thanq
shiva
srdupapers@yahoo.co.in