You are on page 1of 14

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 1 of 14

Welcome, Guest Login Register Getting Started Newsletters Store

Solutions SAP Services & Support About SCN Downloads Industries Training & Education Partnership Code Exchange Lines of Business University Alliances Events & Webinars Idea Place

Outbound Idoc Through ALE


Added by Syed Nishad, last edited by Syed Nishad on Jul 17, 2008
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 : 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 Here I have found a standard Idoc type which satisfies our requirement as it has the Which will satisfy our requirement and if we don't find any standard Idoc type then we will create our own custom Idoc type. Necessary fields which we fill when we create Notification ( the fields are QMNUM, QMTXT, QMART). STEP 1

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 2 of 14

STEP2 After opening the Idoc type in Display mode.

STEP 3 After double clicking on E1NTHDR.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 3 of 14

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

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 4 of 14

WE82. 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.

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 a

Now we know the message type (INOTIF) for our Idoc type(INOTIF01). To Establish the RFC connection between the sending system and 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. been established.

To establish an RFC connection Goto transaction SM59 and select the ABAP connections and find for the RFC connection for your receivin

If you don't find the RFC connection for your receiving system then create an RFC connection by giving the necessary parameters and test

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 5 of 14

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 6 of 14

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 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.

the receiving system details.

After selecting the Assign Logical system to client

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 7 of 14

Display the 100 client system as we are using that system.

Therefore its Logical system name is EC1CLNT100. To create a Distribution Modal. 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.

Goto transaction BD64 and then goto change mode->create a distribution modal-> save it-> click on add message type and give the logic

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 8 of 14

If your Distribution modal is distributed then we can send an idoc now.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through ALE Page 9 of 14

To know whether your partner profile is created, goto transaction WE20 and click on the logical system and check whether your message t

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 N

For that while creating notification before pressing save button goto transaction SE24 and open 1. Go to the TCode SE24 and enter CL_EX

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through A... Page 10 of 14

Open In 'Display' mode, go to 'Methods' tab, Double click the method 'Get Instance' to display it source code, Set a breakpoint on 'CALL ME 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

cl_exithandler=>get_class_name_by_interface'.

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. For our requirement I have found a BADI NOTIF_EVENT_POST and implemented it into Z NOTIF_EVENT_POST

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 im

TRANSACTION SE19

CREATE IT.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through A... Page 11 of 14

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.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through A... Page 12 of 14

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 * OBJ_TYPE * CHNUM TABLES COMMUNICATION_IDOC_CONTROL MASTER_IDOC_DATA * EXCEPTIONS * ERROR_IN_IDOC_CONTROL * ERROR_WRITING_IDOC_STATUS * ERROR_IN_IDOC_DATA * OTHERS . 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. You can also know the status of an Idoc from Transaction WE47. =5 =3 =4 =1 =2 = master_cntrl_data = idoc_edidd = '' = '' = idoc_cntrl

* SENDING_LOGICAL_SYSTEM_UNKNOWN

Execute the Transaction (WE02 or WE05) and check whether the data is correctly populated in data records. Also make sure that IDOC sta

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through A... Page 13 of 14

******************************** 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.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012

SAP Community Network Wiki - ABAP Development - Outbound Idoc Through A... Page 14 of 14

Comments (3)

Follow SCN Contact Us SAP Help Portal Privacy Terms of Use Legal Disclosure Copyright

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idoc+Through+ALE

4/20/2012