You are on page 1of 7

12/20/2016

OutboundIDocstepsinSAP

Outbound IDoc steps in SAP (/home/blogd/outbound-idoc-steps-in-sap/)


- in ABAP (/home/blog/ABAP)

2/9/2016 4:48:24 PM

Outbound IDoc steps in SAP-This blog will discuss step by step in sending an IDoc ( i.e Outbound IDoc) through ALE medium.Outbound processing in SAP involves
event handling. An event in SAP is de ned as an occurrence of a status change in an object. Events are created when the relevant status change occurs. Implementing
outbound IDoc for QA11. The following steps will give complete end to end implementation on SAP Outbound IDoc.From this blog additionally you can con gure
BizTalk server. Outbound IDoc from SAP to BizTalk server.
Real time scenario on Record usage decision-QA release using the transaction code QA11
Whenever QA release is happening in SAP then outbound IDoc should be triggered to BizTalk server. As I said earlier we need triggering point during Record usage
decision(QA11). So we need to implement anyone of the following enhancements.
1) Enhancement Spot
2) Business Add-Ins-(BADIs)
3) Customer exits(Function exit)
As you everyone aware how to nd which enhancement will be suitable. Still if you want please read the linkhttp://www.sappractical.com/home/blogd/how-to- ndcustomer-exits-in-sap-abap/ (http://www.sappractical.com/home/blogd/how-to- nd-customer-exits-in-sap-abap/) and
http://www.sappractical.com/home/blogd/how-to- nd-a-badi-or-kernel-badi-or-user-exit-for-a-particular-transaction-code/
(http://www.sappractical.com/home/blogd/how-to- nd-a-badi-or-kernel-badi-or-user-exit-for-a-particular-transaction-code/)
Basically we need to send below the elds to BizTalk server.
a)Warehouse Number / Warehouse Complex(LGNUM)
b)Material Number(MATNR)
c)Batch Number(CHARG_D)
d) Order Number(EBELN)
e) From Status(FROM_STATUS)
f)To Status(TO_STATUS)
Adsby Google

SapQM

SapIdoc

SapWarehouse

First we need to set up the IDoc basics.


Please follow the Step 1 to Step from the linkhttp://www.sappractical.com/Home/blogd/sap-inbound-idoc-step-by-step/
(http://www.sappractical.com/Home/blogd/sap-inbound-idoc-step-by-step/) since the IDoc type, segments, message types are common for both inbound and
outbound
1. WE31-Create segment type with the name ofSegment type ZQASEG
2. WE30-Create IDoc type with the name ofZQAIT
3. WE81-Create message Type with the name ofZQAMSG
4. WE82-Assign Messages for IDoc Type(Linking message typeZQAMSG with IDoc typeZQAIT)
Now IDoc basic setups are ready and we need to implement the code in enhancements
I have found the enhancement "QEVA0007" and I have created a project which is given below.

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

1/7

12/20/2016

OutboundIDocstepsinSAP

Note:Please do not forget to activate the project or else your implementation wont work
Please write below the coding inside the Function Exit "EXIT_SAPMQEVA_007" within theINCLUDEZXQEVU09.
*&---------------------------------------------------------------------*
*& Include ZXQEVU09
*&---------------------------------------------------------------------*

DATA : lwa_qa TYPE zedi_au_qa.

FIELD-SYMBOLS : <fs_mcha> TYPE mcha.


DATA : lv_mcha TYPE char50 VALUE '(SAPMQEVA)MCHA'.
DATA : lv_cmcha TYPE mcha,
lv_omcha TYPE mcha.

CONSTANTS : c_segnam TYPE char50 VALUE 'ZQASEG'.


*-IDOC
DATA : it_edidc TYPE STANDARD TABLE OF edidc,
it_edidd TYPE STANDARD TABLE OF edidd.
DATA : wa_edidd TYPE edidd,
wa_edidc TYPE edidc.
DATA : it_model TYPE TABLE OF bdi_mmodel,
wa_model TYPE bdi_mmodel.

REFRESH : it_edidc,it_edidd,it_model.
CLEAR : wa_edidd,wa_edidc,wa_model.

ASSIGN (lv_mcha) TO <fs_mcha>.


IF <fs_mcha> IS ASSIGNED.
lv_cmcha = <fs_mcha>.
SELECT SINGLE * FROM mcha
INTO lv_omcha
WHERE matnr = lv_cmcha-matnr
AND werks = lv_cmcha-werks
AND charg = lv_cmcha-charg.

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

2/7

12/20/2016

OutboundIDocstepsinSAP

ENDIF.
lwa_qa-lgnum = i_qals-lgnum.
lwa_qa-matnr = i_qals-matnr.
lwa_qa-charg = i_qals-charg.
lwa_qa-ebeln = i_qals-ebeln.

IF lv_omcha-zustd IS INITIAL.
lwa_qa-from_status = 'Unrestricted'.
ELSE.
lwa_qa-from_status = 'Restricted'.
ENDIF.

IF lv_cmcha-zustd IS INITIAL.
lwa_qa-from_status = 'Unrestricted'.
ELSE.
lwa_qa-from_status = 'Restricted'.
ENDIF.

PERFORM no_data USING lwa_qa-ebeln CHANGING lwa_qa-ebeln.


PERFORM no_data USING lwa_qa-from_status CHANGING lwa_qa-from_status.
PERFORM no_data USING lwa_qa-to_status CHANGING lwa_qa-to_status.

CALL FUNCTION 'MMODEL_INT_VALID_GET'


EXPORTING
mestyp = 'ZQAMSG'
TABLES
model = it_model.

wa_edidd-segnam = c_segnam.
wa_edidd-sdata = lwa_qa.
APPEND wa_edidd TO it_edidd.
CLEAR wa_edidd.

LOOP AT it_model INTO wa_model.


REFRESH : it_edidc.
wa_edidc-idoctp = 'ZQAIT'.
wa_edidc-mestyp = wa_model-mestyp.
wa_edidc-rcvprn = wa_model-rcvsystem.
wa_edidc-rcvprt = 'LS'.
APPEND wa_edidc TO it_edidc.
*-IDOC Distribute
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = wa_edidc
TABLES
communication_idoc_control = it_edidc

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

3/7

12/20/2016

OutboundIDocstepsinSAP

master_idoc_data = it_edidd
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.
ENDLOOP.
Please nd below the subroutine no_data
FORMno_dataUSINGp_oldCHANGINGp_new.
ifp_oldisINITIAL.
p_new='/'.
endif.
ENDFORM.
Step 5) Create distribution model view using the transaction code BD64
Note: before Create distribution model we have to create Program ID using the transaction SM59.

Go to BizTalk server and do the below settings.

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

4/7

12/20/2016

OutboundIDocstepsinSAP

Please nd below the connection string which is from SAP(SM59) which has ListenerProgramId.
sap://CLIENT=420;LANG=EN;@a/116.138.76.20/00?
ListenerGwServ=sapgw00&ListenerGwHost=116.138.76.20&ListenerProgramId=PI_SAP05&RfcSdkTrace=False&AbapDebug=False

Step 6) Generate partner pro le using the transaction BD64


In this method we canavoidsome errors so please use the transaction code BD64

SAPPractical.com

Hello Guest! (/home/login)

Step 7) Con gure your message type, receiver port and Basic type using WE20

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

5/7

12/20/2016

OutboundIDocstepsinSAP

Actually from WE20 you can have message control or you can write your logic insite the enhancement.

Step 8) Final testing can be done using the transaction code QA11

Press enter

Select inspection lot tab and give the following inputs

SAPPractical.com
Hello Guest! (/home/login)

Click save
and Check your outbound IDoc using WE02 due to security reason I have not shown the IDoc segment data.
I hope all of you understood the detailed steps for outbound IDoc.
Thanks for using this site and I appreciate your comments in below.
SapFreight

Adsby Google

SapServer

SapUpgrade

If you like this blog, please share (Facebook/LinkedIn/Google+) to click below links so it will reach to others.

33

51

COMMENTS

LEAVE A COMMENT

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

6/7

12/20/2016

OutboundIDocstepsinSAP

Your name
Your email address

Lato

15

Submit comment

RECENT POSTS

How to create or generate a test inbound queue in sap (/home/blogd/how-to-create-or-generate-a-test-inbound-queue-in-sap/)


8/13/2016 12:17:40 AM

SQL Performance Monitoring-SAP SQLM Part3 (/home/blogd/sql-performance-monitoring-sap-sqlm-part3/)


5/26/2016 11:22:26 AM

SQL Performance Monitoring-SAP SQLM Part2 (/home/blogd/sql-performance-monitoring-sap-sqlm-part2/)


5/25/2016 3:18:27 PM

SQL Performance Monitoring-SAP SQLM PART1 (/home/blogd/sql-performance-monitoring-sap-sqlm-part1/)


4/25/2016 2:29:32 PM

How to implement SAP ABAP eld exit (/home/blogd/how-to-implement-sap-abap- eld-exit/)


4/23/2016 10:03:20 PM

SAPPractical.com
Hello Guest! (/home/login)

Share & Follow

(https://www.facebook.com/sappractical/)

(http://www.SAPPracticalCom.blogspot.com)

(https://plus.google.com/b/115103102431089818132)

(https://twitter.com/sap_practical)

http://www.sappractical.com/home/blogd/outboundidocstepsinsap/

7/7

You might also like