Anda di halaman 1dari 15

Beginners Guide to ALE and IDocs a step-by-step approach

http://www.riya.net/b!og/beginners-guide-to-a!e-and-idocs-a-step-by-step-
approach/techno!ogy/sap/"#/
This article will help you understand the basics of ALE and IDocs via a simple do-it-yourself example.
We will create a custom IDoc in one A! system and then post some business data throu"h it to
another A! system. #usiness data will be pic$ed up from custom data dictionary tables.
ALE % Application Lin$ Enablin" is a mechanism by which A! systems communicate with each
other and with non-A! EDI subsystems. Thus it helps inte"ration of distributed systems. It supports
fail-safe delivery which implies that sender system does not have to worry about messa"e not
reachin" the source due to unavoidable situations. ALE can be used for mi"ration and maintenance
of master data as well as for exchan"in" transactional data.
The messa"es that are exchan"ed are in the form of IDocs or Intermediate Documents. IDocs act li$e
a container or envelope for the application data. An ID&' is created as a result of execution of an
&utbound ALE. In an Inbound ALE an ID&' serves as an input to create application document. In the
A! system IDocs are stored in the database tables. They can be used for A! to A! and A! to
non-A! process communication as lon" as the participatin" processes can understand the syntax
and semantics of the data. 'omplete documentation on ID&' is obtained by usin" transaction WE().
Every IDoc has exactly one control record alon" with a number of data records and status records.
'ontrol record has the details of sender*receiver and other control information. Data records contain
the actual business data to be exchan"ed while the status records are attached to IDoc throu"hout
the process as the IDoc moves from one step to other.
+ow, let us understand the ALE 'onfi"uration by means of an example scenario below-
The Scenario
Data from custom tables .created in customer
namespace/ is to be formatted into an IDoc and sent from
one A! 0*1 system to another usin" ALE service. We
need to have two instances of A! 0*1 systems or we can
simulate this on two clients of the same A! 0*1 system.
'reate three tables as shown below.
Creating Custom IDoc type and Message type
All the ob2ects created should be present on both source as well as tar"et system.s/.
3. 'reate se"ments % Transaction WE13
'reate a se"ment 404E53
Add all fields of table 4'6T&7E0 to it
ave the se"ment
0elease it usin" the menu path Edit -8 et 0elease
imilarly create two more se"ments "iven below
e". 404E59 % to hold all fields of table 4&:EADE0
e". 404E51 % to hold all fields of table 4&ITE7
9. 'reate #asic IDoc type % Transaction WE1)
'reate a #asic type 404&0DE0
Add the created se"ments in the hierarchy shown
7aintain attributes for each of the se"ments
ave the ob2ect and "o bac$
0elease the ob2ect usin" the menu path Edit -8 et 0elease
1. 'reate*Assi"n 7essa"e type % Transactions WE;3*WE;9
5o to WE;3
'reate a new 7essa"e type 404&<7T
ave the ob2ect
5o to WE;9 and create new entry
Assi"n the messa"e type 404&<7T to the basic type 404&0DE0
Also specify the 0elease =ersion
ave the ob2ect
Thus we have defined the IDoc structure which will hold the data to be transferred. In the next part of
the article we will understand the outbound settin"s, i.e. the settin"s to be done in the source system.
Beginners Guide to ALE and IDocs $art II
http://www.riyaz.net/blog/beginners-guide-to-ale-and-idocs-part-ii/technology/sap/!/
In the previous part we created an IDoc structure which can carry our data from source system to
tar"et system.s/. In this part we will understand how to setup the source system to be able to
"enerate and send an outbound IDoc.
"utbound Settings
Define Lo"ical ystems and Assi"n 'lient to Lo"ical ystem % Transaction ALE
5o to Define Lo"ical ystem .ee the fi"ure/
Define a new lo"ical system to identify the local system
and save it
+ow, "o to Assi"n 'lient to Lo"ical ystem .ee the
fi"ure/
Add a new entry
pecify the client, previously created lo"ical system and other attributes
ave the entry
Define a new lo"ical system to identify the partner system and save it
7aintain 0>' Destinations % Transaction 7?@
'reate a new 0>' destination for 0*1 type connection
pecify the tar"et host on Technical settin"s tab
!rovide the Lo"on credentials on the Lo"on*ecurity tab
ave the settin"s
To verify the settin"s, 'lic$ on Test connection or 0emote lo"on
Define !orts % Transaction WE93
We need to define a t0>' port for the partner system
'lic$ on Transactional 0>' node
'reate a new port
!rovide a description
pecify the name of the tar"et 0>' destination
ave the ob2ect
7aintain Distribution 7odel % Transaction #D(A
'lic$ on 'han"e
'reate a new model view
!rovide a hort text and Technical name to the model view
Add messa"e type
pecify sender and receiver systems
Also, specify the messa"e type that we created previously
ave the Distribution model
5enerate*'reate !artner !rofile % Transactions #D;9*WE9)
To "enerate !artner profiles automatically you may use #D;9 or "o to #D(A and use the menu path
Environment -8 5enerate partner profiles
&therwise, you may use transaction WE9) to create a partner profile
&n selection screen, specify the model view, tar"et system and execute
The result lo" will be displayed on the next screen
To verify the partner profile "o to WE9)
'hec$ the partner profile for the tar"et system
Distribute 7odel =iew % Transaction #D(A
elect the 7odel =iew
5o to menu path Edit -8 7odel =iew -8 Distribute
0esult lo" will be displayed on the next screen
"utbound IDoc #eneration $rogram
'reate an executable pro"ram 404<&0DE0<ID&' in E1;. #elow, I have described the pro"ram
lo"ic-
>etch the data from the DDic tables 4'6T&7E0, 4&:EADE0 and 4&ITE7 as per the
selection criteria
>ill the control record structure of type EDID'
pecify messa"e type, #asic IDoc type, t0>' !ort, !artner number and !artner type of the
receiver
>ill the data records
Define structures li$e the IDoc se"ments
>ill the structures with fetched data
!ass the se"ment name and the above structure to the appropriate fields of EDIDD type
structure
Append the EDIDD structure to the EDIDD type internal table
+ow, call the function module 7ATE0<ID&'<DIT0I#6TE and pass the IDoc control record
structure and data record table
'ommit wor$ if return code is Bero
>unction module returns a table of type EDID' to provide the details about "enerated IDoc
Display appropriate lo"
Cou can download sample code for the above pro"ram here.
*&---------------------------------------------------------------------*
*& Report ZRZ_ORDER_IDOC *
*& *
*&---------------------------------------------------------------------*
REPORT ZRZ_ORDER_IDOC .
***********************************************************************
* PURPOSE OF REPORT *
***********************************************************************
* Generats an Idoc for Custoer !aster" Sa#es !aster
* and Sa#es $te ta%#e.
***********************************************************************
T&'(ES ) ZCUSTO!ERS" *Cutoer +eader
ZSO+E&DERS" *Sa#es +eader
ZSOITE!S. *Sa#es Ites
D&T& ) S_CTR(_REC (I,E EDIDC" *Idoc Contro# Record
S_ZRZSEG- (I,E ZRZSEG-" *CUSTO!ER +eader Data
S_ZRZSEG. (I,E ZRZSEG." *S&(ES +E&DER Data
S_ZRZSEG/ (I,E ZRZSEG/. *S&(ES Deta$# Data
D&T& ) T_ZCUSTO!ERS (I,E ZCUSTO!ERS OCCURS 0 1IT+ +E&DER (I2E.
D&T& ) T_ZSO+E&DERS (I,E ZSO+E&DERS OCCURS 0 1IT+ +E&DER (I2E.
D&T& ) T_ZSOITE!S (I,E ZSOITE!S OCCURS 0 1IT+ +E&DER (I2E.
D&T& ) T_EDIDD (I,E EDIDD OCCURS 0 1IT+ +E&DER (I2E.*Data Records
D&T& ) T_CO!!_IDOC (I,E EDIDC OCCURS 0 1IT+ +E&DER (I2E.
*Generated Coun$cat$on IDOc
CO2ST&2TS )
C_ZRZSEG- (I,E EDIDD-SEG2&! 3&(UE 4ZRZSEG-4"
C_ZRZSEG. (I,E EDIDD-SEG2&! 3&(UE 4ZRZSEG.4"
C_ZRZSEG/ (I,E EDIDD-SEG2&! 3&(UE 4ZRZSEG/4.
CO2ST&2TS) C_IDOCTP (I,E EDIDC-IDOCTP 3&(UE 4ZRZORDER4.
*** Se#ect$on Screen
SE(ECT-OPTIO2S ) S_,U22R FOR ZCUSTO!ERS-,U22R O'(IG&TOR5"
S_3'E(2 FOR ZSO+E&DERS-3'E(2.
P&R&!ETERS ) C_!EST5P (I,E EDIDC-!EST5P DEF&U(T 4ZRZSO_!T4"
*!essa6e T7pe
C_RC3PRT (I,E EDIDC-RC3PRT DEF&U(T 4(S4"
*Partner t7pe of rece$8er
C_(OGS5S (I,E EDIDC-RC3PR2 DEF&U(T 4590-4"
C_RC3POR (I,E EDIDC-RC3POR DEF&U(T 4&000000..:4"
C_S2DPR2 (I,E EDIDC-S2DPR2 DEF&U(T 4(SSE2DS4"
C_S2DPRT (I,E EDIDC-S2DPRT DEF&U(T 4(S4.
*Dest$nat$on S7ste
***ST&RT-OF-SE(ECTIO2
ST&RT-OF-SE(ECTIO2.
PERFOR! GE2ER&TE_D&T&_RECORDS.
PERFOR! GE2ER&TE_CO2TRO(_RECORD.
PERFOR! SE2D_IDOC.
***********************************************************************
*&---------------------------------------------------------------------*
*& For 6enerate_data_records
*&---------------------------------------------------------------------*
FOR! GE2ER&TE_D&T&_RECORDS .
PERFOR! FETC+_ZCUSTO!ERS.
PERFOR! FETC+_ZSO+E&DERS.
PERFOR! FETC+_ZSOITE!S.
PERFOR! &RR&2GE_D&T&_RECORDS.
E2DFOR!. * 6enerate_data_records
*&---------------------------------------------------------------------*
*& For fetc;_<custoers
*&---------------------------------------------------------------------*
FOR! FETC+_ZCUSTO!ERS.
SE(ECT *
FRO! ZCUSTO!ERS
I2TO T&'(E T_ZCUSTO!ERS
1+ERE ,U22R I2 S_,U22R.
IF S5-SU'RC 2E 0.
!ESS&GE E/9=>00? 1IT+ 42o Custoers Found4.
E2DIF.
E2DFOR!. * fetc;_<custoers
*&---------------------------------------------------------------------*
*& For fetc;_<so;eaders
*&---------------------------------------------------------------------*
FOR! FETC+_ZSO+E&DERS.
SE(ECT *
FRO! ZSO+E&DERS
I2TO T&'(E T_ZSO+E&DERS
1+ERE 3'E(2 I2 S_3'E(2
&2D ,U22R I2 S_,U22R.
IF S5-SU'RC 2E 0.
!ESS&GE I/9=>00? 1IT+ 42o Sa#es orders found4.
E2DIF.
E2DFOR!. * fetc;_<so;eaders
*&---------------------------------------------------------------------*
*& For fetc;_<so$tes
*&---------------------------------------------------------------------*
FOR! FETC+_ZSOITE!S.
IF 2OT T_ZSO+E&DERS@A IS I2ITI&(.
SE(ECT *
FRO! ZSOITE!S
I2TO T&'(E T_ZSOITE!S
FOR &(( E2TRIES I2 T_ZSO+E&DERS
1+ERE 3'E(2 B T_ZSO+E&DERS-3'E(2.
IF S5-SU'RC 2E 0.
!ESS&GE I/9=>00? 1IT+ 42o Sa#es order $tes found4.
E2DIF.
E2DIF.
E2DFOR!. * fetc;_<so$tes
*&---------------------------------------------------------------------*
*& For 6enerate_contro#_record
*&---------------------------------------------------------------------*
FOR! GE2ER&TE_CO2TRO(_RECORD .
S_CTR(_REC-RC3POR B C_RC3POR. *Rece$8er Port
S_CTR(_REC-!EST5P B C_!EST5P. *!essa6e t7pe
S_CTR(_REC-IDOCTP B C_IDOCTP. *'as$c IDOC t7pe
S_CTR(_REC-RC3PRT B C_RC3PRT. *Partner t7pe of rece$8er
S_CTR(_REC-RC3PR2 B C_(OGS5S. *Partner nu%er of rece$8er
S_CTR(_REC-S2DPRT B C_S2DPRT. *Sender Partner t7pe
S_CTR(_REC-S2DPR2 B C_S2DPR2. *Sender Partner 2u%er
E2DFOR!. * 6enerate_contro#_record
*&---------------------------------------------------------------------*
*& For send_$doc
*&---------------------------------------------------------------------*
FOR! SE2D_IDOC.
C&(( FU2CTIO2 4!&STER_IDOC_DISTRI'UTE4
ECPORTI2G
!&STER_IDOC_CO2TRO( B S_CTR(_REC
T&'(ES
CO!!U2IC&TIO2_IDOC_CO2TRO( B T_CO!!_IDOC
!&STER_IDOC_D&T& B T_EDIDD
ECCEPTIO2S
ERROR_I2_IDOC_CO2TRO( B -
ERROR_1RITI2G_IDOC_ST&TUS B .
ERROR_I2_IDOC_D&T& B /
SE2DI2G_(OGIC&(_S5STE!_U2,2O12 B D
OT+ERS B E.
IF S5-SU'RC FG 0.
!ESS&GE ID S5-!SGID T5PE S5-!SGT5 2U!'ER S5-!SG2O
1IT+ S5-!SG3- S5-!SG3. S5-!SG3/ S5-!SG3D.
E(SE.
CO!!IT 1OR,.
(OOP &T T_CO!!_IDOC.
1RITE)H 4IDoc Generated - 4" T_CO!!_IDOC-DOC2U!.
E2D(OOP.
E2DIF.
E2DFOR!. * send_$doc
*&---------------------------------------------------------------------*
*& For arran6e_data_records
*&---------------------------------------------------------------------*
FOR! &RR&2GE_D&T&_RECORDS .
D&T&) 1_I2DEC- (I,E S5-T&'IC"
1_I2DEC. (I,E S5-T&'IC.
SORT T_ZCUSTO!ERS '5 ,U22R.
SORT T_ZSO+E&DERS '5 ,U22R 3'E(2.
SORT T_ZSOITE!S '5 3'E(2 POS2R.
(OOP &T T_ZCUSTO!ERS.
S_ZRZSEG--,U22R B T_ZCUSTO!ERS-,U22R.
S_ZRZSEG--2&!E- B T_ZCUSTO!ERS-2&!E-.
S_ZRZSEG--ORT0- B T_ZCUSTO!ERS-ORT0-.
S_ZRZSEG--(&2D- B T_ZCUSTO!ERS-(&2D-.
T_EDIDD-SEG2&! B C_ZRZSEG-.
T_EDIDD-SD&T& B S_ZRZSEG-.
&PPE2D T_EDIDD.
C(E&R T_EDIDD.
C(E&R 1_I2DEC-.
RE&D T&'(E T_ZSO+E&DERS 1IT+ ,E5 ,U22R B T_ZCUSTO!ERS-,U22R 'I2&R5 SE&RC+.
IF S5-SU'RC B 0.
1_I2DEC- B S5-T&'IC.
(OOP &T T_ZSO+E&DERS FRO! 1_I2DEC-.
IF T_ZSO+E&DERS-,U22R 2E T_ZCUSTO!ERS-,U22R.
ECIT.
E2DIF.
S_ZRZSEG.-3'E(2 B T_ZSO+E&DERS-3'E(2.
S_ZRZSEG.-,U22R B T_ZSO+E&DERS-,U22R.
T_EDIDD-SEG2&! B C_ZRZSEG..
T_EDIDD-SD&T& B S_ZRZSEG..
&PPE2D T_EDIDD.
C(E&R T_EDIDD.
C(E&R 1_I2DEC..
RE&D T&'(E T_ZSOITE!S 1IT+ ,E5 3'E(2 B T_ZSO+E&DERS-3'E(2 'I2&R5 SE&RC+.
IF S5-SU'RC B 0.
1_I2DEC. B S5-T&'IC.
(OOP &T T_ZSOITE!S FRO! S5-T&'IC.
IF T_ZSOITE!S-3'E(2 2E T_ZSO+E&DERS-3'E(2.
ECIT.
E2DIF.
S_ZRZSEG/-3'E(2 B T_ZSOITE!S-3'E(2.
S_ZRZSEG/-POS2R B T_ZSOITE!S-POS2R.
S_ZRZSEG/-!&T2R B T_ZSOITE!S-!&T2R.
S_ZRZSEG/-2ET1R B T_ZSOITE!S-2ET1R.
S_ZRZSEG/-Z!E2G B T_ZSOITE!S-Z!E2G.
T_EDIDD-SEG2&! B C_ZRZSEG/.
T_EDIDD-SD&T& B S_ZRZSEG/.
&PPE2D T_EDIDD.
C(E&R T_EDIDD.
E2D(OOP.
E2DIF.
E2D(OOP.
E2DIF.
E2D(OOP.
E2DFOR!. * arran6e_data_records
Thus we have completed sender side confi"uration reDuired for ALE. In the next part we will see how
to confi"ure the receivin" system to be able to receive and post the inbound IDoc.
Beginners Guide to ALE and IDocs $art III
http://www.riyaz.net/blog/beginners-guide-to-ale-and-idocs-part-iii/technology/sap/20/
In the previous parts we learned how to create a custom IDoc and set up the source system to send
an outbound IDoc. In this part we will learn how to confi"ure the receivin" A! 0*1 system to be able
to receive and post the inbound IDoc.
Inbound IDoc $osting %unction Module
In the receivin" system, create a function module 4<ID&'<I+!6T<404&<7T usin" E1E. #elow, I
have described the lo"ic for the same.
Add Include 7#D'&+W>. This include contains predefined ALE constants.
Loop at EDID' table
'hec$ if the messa"e type is 404&0DE0. &therwise raise W0&+5<>6+'TI&+<'ALLED exception
Loop at EDIDD table
Append data from the se"ments to appropriate internal tables
>or example- append data from 404E53 se"ment to the internal table of type 4'6T&7E0
6pdate the DDic tables from internal tables
Dependin" on the result of the update, fill the IDoc status record .type #DID&'TAT/ and append it to
the correspondin" table.
tatus ?1 F8 uccess
tatus ?3 F8 Error
Cou can download the sample A#A! code for the above function module here.
FU2CTIO2 Z_IDOC_I2PUT_ZRZSO_!T.
**----------------------------------------------------------------------
****(oca# $nterface)
** I!PORTI2G
** 3&(UE>I2PUT_!ET+OD? (I,E 'D1F&P_P&R-I2PUT!ET+D
** 3&(UE>!&SS_PROCESSI2G? (I,E 'D1F&P_P&R-!&SS_PROC
** ECPORTI2G
** 3&(UE>1OR,F(O1_RESU(T? (I,E 'D1F_P&R&!-RESU(T
** 3&(UE>&PP(IC&TIO2_3&RI&'(E? (I,E 'D1F_P&R&!-&PP(_3&R
** 3&(UE>I2_UPD&TE_T&S,? (I,E 'D1F&P_P&R-UPD&TET&S,
** 3&(UE>C&((_TR&2S&CTIO2_DO2E? (I,E 'D1F&P_P&R-C&((TR&2S
** T&'(ES
** IDOC_CO2TR( STRUCTURE EDIDC
** IDOC_D&T& STRUCTURE EDIDD
** IDOC_ST&TUS STRUCTURE 'DIDOCST&T
** RETUR2_3&RI&'(ES STRUCTURE 'D1FRET3&R
** SERI&(IZ&TIO2_I2FO STRUCTURE 'DI_SER
** ECCEPTIO2S
** 1RO2G_FU2CTIO2_C&((ED
**----------------------------------------------------------------------
* Inc#ude F$#e conta$n$n6 &(E constants
I2C(UDE !'DCO21F.
T&'(ES ) ZCUSTO!ERS" *Cutoer +eader
ZSO+E&DERS" *Sa#es +eader
ZSOITE!S. *Sa#es Ites
***Data
D&T& ) 1_ZRZSEG- (I,E ZRZSEG-"
1_ZRZSEG. (I,E ZRZSEG."
1_ZRZSEG/ (I,E ZRZSEG/.
D&T& ) T_ZCUSTO!ERS (I,E ZCUSTO!ERS OCCURS 0 1IT+ +E&DER (I2E.
D&T& ) T_ZSO+E&DERS (I,E ZSO+E&DERS OCCURS 0 1IT+ +E&DER (I2E.
D&T& ) T_ZSOITE!S (I,E ZSOITE!S OCCURS 0 1IT+ +E&DER (I2E.
***********************************************************************
1OR,F(O1_RESU(T B C_1F_RESU(T_O,.
(OOP &T IDOC_CO2TR(.
IF IDOC_CO2TR(-!EST5P 2E 4ZRZSO_!T4.
R&ISE 1RO2G_FU2CTIO2_C&((ED.
E2DIF.
* 'efore read$n6 a neI entr7" c#ear app#$cat$on %uffer
(OOP &T IDOC_D&T& 1+ERE DOC2U! EJ IDOC_CO2TR(-DOC2U!.
C&SE IDOC_D&T&-SEG2&!.
1+E2 4ZRZSEG-4.
1_ZRZSEG- B IDOC_D&T&-SD&T&.
!O3E-CORRESPO2DI2G 1_ZRZSEG- TO T_ZCUSTO!ERS.
I2SERT I2TO ZCUSTO!ERS 3&(UES T_ZCUSTO!ERS.
1+E2 4ZRZSEG.4.
1_ZRZSEG. B IDOC_D&T&-SD&T&.
!O3E-CORRESPO2DI2G 1_ZRZSEG. TO T_ZSO+E&DERS.
I2SERT I2TO ZSO+E&DERS 3&(UES T_ZSO+E&DERS.
1+E2 4ZRZSEG/4.
1_ZRZSEG/ B IDOC_D&T&-SD&T&.
!O3E-CORRESPO2DI2G 1_ZRZSEG/ TO T_ZSOITE!S.
I2SERT I2TO ZSOITE!S 3&(UES T_ZSOITE!S.
E2DC&SE.
E2D(OOP.
************************************************************************
* CUSTO!ER +E&DER *
************************************************************************
* SE(ECT *
* FRO! <custoers.
* E2DSE(ECT.
* IF s7-su%rc 2E 0.
* I2SERT I2TO <custoers 3&(UES t_<custoers.
* E(SE.
UPD&TE ZCUST+E&D FRO! T_ZCUSTO!ERS.
* E2DIF.
IF S5-SU'RC EJ 0.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E/4.
IDOC_ST&TUS-!SGT5 B 4I4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400D4.
IDOC_ST&TUS-!SG3- B T_ZCUSTO!ERS-,U22R.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
E(SE.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E-4.
IDOC_ST&TUS-!SGT5 B 4E4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400E4.
IDOC_ST&TUS-!SG3- B T_ZCUSTO!ERS-,U22R.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
1OR,F(O1_RESU(T B C_1F_RESU(T_ERROR.
RETUR2_3&RI&'(ES-1F_P&R&! B 4Error_Idocs4.
RETUR2_3&RI&'(ES-DOC_2U!'ER B IDOC_CO2TR(-DOC2U!.
&PPE2D RETUR2_3&RI&'(ES.
C(E&R RETUR2_3&RI&'(ES.
E2DIF.
************************************************************************
* S&(ES +E&DER *
************************************************************************
* SE(ECT *
* FRO! <so;eaders.
* E2DSE(ECT.
* IF s7-su%rc 2E 0.
* I2SERT I2TO <so;eaders 3&(UES t_<so;eaders.
* E(SE.
UPD&TE ZSO+E&DERS FRO! T_ZSO+E&DERS.
* E2DIF.
IF S5-SU'RC EJ 0.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E/4.
IDOC_ST&TUS-!SGT5 B 4I4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400D4.
IDOC_ST&TUS-!SG3- B T_ZSO+E&DERS-3'E(2.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
E(SE.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E-4.
IDOC_ST&TUS-!SGT5 B 4E4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400E4.
IDOC_ST&TUS-!SG3- B T_ZSO+E&DERS-3'E(2.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
1OR,F(O1_RESU(T B C_1F_RESU(T_ERROR.
RETUR2_3&RI&'(ES-1F_P&R&! B 4Error_Idocs4.
RETUR2_3&RI&'(ES-DOC_2U!'ER B IDOC_CO2TR(-DOC2U!.
&PPE2D RETUR2_3&RI&'(ES.
C(E&R RETUR2_3&RI&'(ES.
E2DIF.
************************************************************************
* S&(ES ITE! *
************************************************************************
* SE(ECT *
* FRO! <so$tes.
* E2DSE(ECT.
* IF s7-su%rc 2E 0.
* I2SERT I2TO <so$tes 3&(UES t_<so$tes.
* E(SE.
UPD&TE ZSOITE!S FRO! T_ZSOITE!S.
* E2DIF.
IF S5-SU'RC EJ 0.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E/4.
IDOC_ST&TUS-!SGT5 B 4I4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400D4.
IDOC_ST&TUS-!SG3- B T_ZSOITE!S-3'E(2.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
E(SE.
IDOC_ST&TUS-DOC2U! B IDOC_CO2TR(-DOC2U!.
IDOC_ST&TUS-ST&TUS B 4E-4.
IDOC_ST&TUS-!SGT5 B 4E4.
IDOC_ST&TUS-!SGID B 45!4.
IDOC_ST&TUS-!SG2O B 400E4.
IDOC_ST&TUS-!SG3- B T_ZSOITE!S-3'E(2.
&PPE2D IDOC_ST&TUS.
C(E&R IDOC_ST&TUS.
1OR,F(O1_RESU(T B C_1F_RESU(T_ERROR.
RETUR2_3&RI&'(ES-1F_P&R&! B 4Error_Idocs4.
RETUR2_3&RI&'(ES-DOC_2U!'ER B IDOC_CO2TR(-DOC2U!.
&PPE2D RETUR2_3&RI&'(ES.
C(E&R RETUR2_3&RI&'(ES.
E2DIF.
************************************************************************
E2D(OOP.
E2DFU2CTIO2.
Inbound Settings
Define Lo"ical ystems % Transaction ALE .!lease refer to &utbound ettin"s discussed in previous
part/
Assi"n 'lient to Lo"ical ystem % Transaction ALE .!lease refer to &utbound ettin"s discussed in
previous part/
7aintain 0>' Destinations % Transaction 7?@ .!lease refer to &utbound ettin"s discussed in
previous part/
Define !orts % Transaction WE93 .!lease refer to &utbound ettin"s discussed in previous part/
5enerate*'reate !artner !rofile % Transactions #D;9*WE9) .!lease refer to &utbound ettin"s
discussed in previous part/
Assi"n >unction 7odule to Lo"ical messa"e % Transaction WE?E
'reate a new entry
pecify name of the >unction 7odule as 4<ID&'<I+!6T<404&<7T
Also, specify Type as >, #asic IDoc type as 404&0DE0, 7essa"e type as 404&<7T and
Direction as 9 .Inbound/
ave the entry
Define Input method for Inbound >unction 7odule % Transaction #D?3
'reate a new entry
!rovide >unction 7odule name as 4<ID&'<I+!6T<404&<7T
pecify the Input method as 9
ave the entry
'reate a !rocess 'ode % Transaction WEA9
'reate a new !rocess 'ode 4!'04
elect !rocessin" with ALE ervice
'hoose !rocessin" type as !rocessin" by function module
ave the entry
&n the next screen, select your function module from the list
ave the chan"es
+ow you will be ta$en to the next screen
Double-clic$ on Lo"ical messa"e
In the Assi"nment to lo"ical messa"e, specify the messa"e type 404&<7T
ave the chan"es
Send and recei&e data
&n the sender system, execute the IDoc 5eneration !ro"ram. 'hec$ the status of IDoc usin"
transaction WE)9.
'hec$ the status of the IDoc in the receiver system usin" transaction WE)9. Cou can also chec$ the
contents of DDic tables to ma$e sure that the records have been created in the receiver system.
Thus to summariBe we have learned how to-
'reate a custom IDoc
Write an &utbound IDoc 5eneration !ro"ram
Write Inbound >unction 7odule to post Inbound IDoc
'onfi"ure and test ALE scenario to transmit data between systems distributed across the networ$

Anda mungkin juga menyukai