Você está na página 1de 43

Step-by-step guide to ALE and IDOCs

By Shankar Reddy Chamala, ITChamps Software


Introduction to EDI and ALE:
EDI (Electronic Document interchange) - EDI is the electronic exchange of business
documents between the computer systems of business partners, using a standard
format over a communication network
EDI is also called paperless exchange
Advantages:
!educed Data entry errors
!educed processing time
"vailability of data in electronic form
!educed paperwork
!educed #ost
!educed inventories and better planning
$tandard means of communications
%etter business process
EDI has two process
& 'utbound process
( Inbound process
Outbound Process:
&"pplication document is created
( ID'# is generated
)Idoc is transferred from $"* to 'perating system layer
+Idoc is converted into EDI standards
,Edi document is transmitted to the business partner
-.he Edi $ubsystem report status to $"*
Inbound Process:
&EDI transmission received
(EDI document is converted into an ID'#
)ID'# is transferred to the $"* layer
+.he application document is created
,.he application document can be viewed
IDOC:
IDOC is a container that can be used to exchane data between any two processes!
"ach IDOC is assined a uni#ue number for trackin and future reference!
IDOC consists of se$eral sements, and sements contain se$eral fields!
IDOC contains the followin three types of records!!!
%! One Control Record!
&! One or many Data Record
'! One or many Status record!
In ID'#s the following terms are to be known
PORT:
*ort is used in the outbound process to determine the name of the EDI subsystem
program, the directory path where the ID'# file will be created at the operating
system level, the ID'# file names and the !/# destinations
RFC Destination:
0sed to define the characteristics of communication links to a remote system on
which a functions needs to be executed
Partner Profie:
*artner profile specified the various components used in an outbound process (*artner
number, ID'# type, message type, *ort, *rocess code), the mode in which it
communicates with the subsystem (batch or immediate) and the person to be notified
in case of errors
!essage Contro
0sed in pricing, account determination, material determination, and output
determination .he message control component enables you to encapsulate business
rules with out having to write "%"* programs
.' *rocess ID'#$ the following .#'DE$ will be used
On both sides:
1ogical $ystem 2ames $"1E
$etup !/# destinations $3,4
*ort Destinations 5E(&
In "ource s#ste$:
$egment #reation 5E)&
%asic ID'# .ype #reation 5E)6
3essage .ype #reation 5E7&
"ssign 3essage .ype .o %asic ID'# .ype 5E7(
Distribution 3odel %D-+
5riting !eport *rogram $E)7
*artner *rofile 5E(6
3essage control 2"#E
#heck ID'#s 5E6(, 5E6,
In Destination "#ste$:
#reating /3 $E)8
"ssign /3 to 1ogical 3essage 5E,8
Define I9* method for Inbound /3 %D,&
#reate *rocess #ode 5E+(
:enerate *artner *rofile %D-+
IDOC processing in the sa$e instance of R%& Cients'
/or example two clients in the same !9) instance
#lient 466
#lient 766
.o transfer the data between two clients the table structures and their data types
should be match
In this example, #lient 466 is $ource system, and #lient 766 is destination system
In #lient 466 I have created a customi;ed table and inserted some records
In #lient 766 I have created only table
Co$$on "teps in (oth Cients:
Creating the Logica "#ste$ )a$es and Assigning to Cients:
:o to .#'DE $"1E
I3: path IDoc Interface 9 "pplication 1ink Enabling ("1E) -< %asic $ettings -<
1ogical $ystems -< Define 1ogical $ystem

#lick on Display 9 #hange %utton

#lick on 2ew Entries

$pecify the 1ogical $ystem name and description
2ote= 1ogical $ystem 2aming convention is >$ID<#12.>222<

#lick on $ave and %ack buttons
2ow you will come back to the I3: path screen #lick on "ssign 1ogical $ystem to
client

#lick on Display 9 #hange %utton

#lick on 2ew Entries
Creating the RFC Connection )a$es:
:o to .#'DE $"1E Direct .#'DE $3,4
I3: *ath IDoc Interface 9 "pplication 1ink Enabling ("1E) -< #ommunication -<
#reate !/# #onnections

#lick on #reate button

$pecify all the details in !/# connection screen

#lick on 1ogon $ecurity tab and specify the details

#lick on the $pecial options tab and specify the details which you want

2ow click on .est #onnection button

It show the connection log in next screen

#lick on %ack
#lick on !emote 1ogon %utton

Depends upon your settings the destination client will open If you check the #urrent
user option under 1ogon9 $ecurity tab, then it will show the screen directly without
asking the user name and password details

Creating RFC ports:
:o to .#'DE 5E(&
$elect the .ransactional !/# in left side tree and click on #reate button

In dialog box you can select either :enerate port name or own port name If you
select :enerate *ort name system will generate automatically ?ere I selected 'wn
port name #lick on continue

$pecify the description and !/# destination name

#lick on $ave

!epeat the same above process in other client %y using opposite client instead of 466
specify 766
In Cient *++ steps:
Creating tabe structure:
:o to .#'DE $E&&
$pecify table name as @$.0DE2.$
In Delivery and 3aintenance tab set attributes as ADisplay 3aintenance
"llowedB
.he table fields are

Insert some records in table
Creating IDOC Segments:
(o to TCOD" )"'%!
Specify a name and Click on Create Button!

*ere specify all the +ST,D"-TS table fields and their types as shown below!

Click on S./" button, then it will show dialo box with user name, press continue!
Specify your packae name and click on sa$e!

Specify your re#uest and press 0Continue1!

Click on Back button, and then you will see the created sement!

Creating Basic IDOC Type:
(o to TCOD" )"'2
Specify a name to your IDOC and click on create button!

In next dialo box select create new option and specify the description of IDOC and click on
continue!

Click on Create sement in the screen!

In dialo box specify the sement name which you created and check mandatory check box!

Click on S./" and B.C3 button!

(o to menu "DIT 45Click Set Release

In next dialo box, click on 6es!

Creating Message Type:
(o to TCOD" )"7%!
Click on Display 8 Chane button!

Click on -ew "ntries button!

Specify a messae type name and Description and click on S./" button!

Click on Back and Sa$e
Assign Message Type to Basic IDOC Type:
(o to TCOD" )"7&
Click on Display 8 Chane Button

Click on -ew "ntries, Specify the 9essae Type and Basic IDOC Type and Release $ersion!
Click on Sa$e!

Click on Back!
-ote:
*ere the Release $ersion you can find in this way
Creating Model View and Distributing and Generating artner pro!ile:
(o to TCOD" BD;<
Click on Display8 Chane button

Click on "dit menu 45 9odel /iew 45 Create

Specify description of model $iew and technical name in dialo box and press continue!

Select your model $iew and click on "dit menu 45 .dd 9essae type

In dialo box specify the sender, recei$er, messae type and click on continue!

-ow your 9odel /iew looks like

Click on "n$ironment 9enu 45 (enerate =artner profile

It will show the followin screen, click on execute!

It will show the partner profile lo in next screen!
Click on Back button & times, it will take back to Distribution 9odel screen!
Click on "dit 9enu 45 9odel /iew 45 Distribute!

In displayed dialo box select the partner system and click continue

Then it will show the >o of 9odel /iew Distribution!

Click on Back button!
To check partner profile (o to TCOD" )"&2
In displayed screen select the partner system in left side tree under =artner Type >S!

"rite a #eport rogram in S$%& to create IDOC control records and trans!er it to
destination partner system'
The followin is the proram to enerate the IDOC control records and process it!
*&-------------------------------------------------------------------
--*
*& Report ZSHAN_IDOC_STUD
*&
*&-------------------------------------------------------------------
--*
*&
*&
*&-------------------------------------------------------------------
--*
REPORT ZSHAN_IDOC_STUD.
TABLES: ZSTUDENTS.
DATA : S_CTRL_REC LIKE EDIDC, "Io! Co"tro# Re!or
S_ZSHSTUSE$ LIKE ZSHSTUSE$. "CUSTO%ER He&er D&t&
DATA : T_ZSTUDENTS LIKE ZSTUDENTS OCCURS ' (ITH HEADER LINE.
DATA : T_EDIDD LIKE EDIDD OCCURS ' (ITH HEADER LINE. "D&t&
Re!or)
DATA : T_CO%%_IDOC LIKE EDIDC OCCURS ' (ITH HEADER LINE. "$e"er&te
Co**+",!&t,o" IDO!
CONSTANTS :C_ZSHSTUSE$ LIKE EDIDD-SE$NA% -ALUE .ZSHSTUSE$..
CONSTANTS: C_IDOCTP LIKE EDIDC-IDOCTP -ALUE .ZSHSTUDIDOCS..
*** Se#e!t,o" S!ree"
SELECT-OPTIONS : S_STUID /OR ZSTUDENTS-ZSTUID OBLI$ATOR0.
PARA%ETERS : C_%EST0P LIKE EDIDC-%EST0P DE/AULT .ZSHSTUD%T.,
"%e))&1e T2pe
C_RC-PRT LIKE EDIDC-RC-PRT DE/AULT .LS.,
"P&rt"er t2pe o3 re!e,4er
C_LO$S0S LIKE EDIDC-RC-PRN DE/AULT .IT5CLNT6''.,
C_RC-POR LIKE EDIDC-RC-POR DE/AULT .PORTSH6''.,
C_SNDPRN LIKE EDIDC-SNDPRN DE/AULT .IT5CLNT7''.,
C_SNDPRT LIKE EDIDC-SNDPRT DE/AULT .LS..
"De)t,"&t,o" S2)te*
***START-O/-SELECTION
START-O/-SELECTION.
PER/OR% $ENERATE_DATA_RECORDS.
PER/OR% $ENERATE_CONTROL_RECORD.
PER/OR% SEND_IDOC.
*&-------------------------------------------------------------------
--*
*& /or* $ENERATE_DATA_RECORDS
*&-------------------------------------------------------------------
--*
* te8t
*--------------------------------------------------------------------
--*
* --9 p: te8t
* ;-- p< te8t
*--------------------------------------------------------------------
--*
/OR% $ENERATE_DATA_RECORDS .
SELECT * /RO% ZSTUDENTS
INTO TABLE T_ZSTUDENTS
(HERE ZSTUID IN S_STUID.
I/ S0-SUBRC NE '.
%ESSA$E E576=''> (ITH .No St+e"t) /o+"..
ENDI/.
PER/OR% ARRAN$E_DATA_RECORDS.
END/OR%. " $ENERATE_DATA_RECORDS
*&-------------------------------------------------------------------
--*
*& /or* $ENERATE_CONTROL_RECORD
*&-------------------------------------------------------------------
--*
* te8t
*--------------------------------------------------------------------
--*
* --9 p: te8t
* ;-- p< te8t
*--------------------------------------------------------------------
--*
/OR% $ENERATE_CONTROL_RECORD .
S_CTRL_REC-RC-POR ? C_RC-POR. "Re!e,4er Port
S_CTRL_REC-%EST0P ? C_%EST0P. "%e))&1e t2pe
S_CTRL_REC-IDOCTP ? C_IDOCTP. "B&),! IDOC t2pe
S_CTRL_REC-RC-PRT ? C_RC-PRT. "P&rt"er t2pe o3 re!e,4er
S_CTRL_REC-RC-PRN ? C_LO$S0S. "P&rt"er "+*@er o3 re!e,4er
S_CTRL_REC-SNDPRT ? C_SNDPRT. "Se"er P&rt"er t2pe
S_CTRL_REC-SNDPRN ? C_SNDPRN. "Se"er P&rt"er N+*@er
END/OR%. " $ENERATE_CONTROL_RECORD
*&-------------------------------------------------------------------
--*
*& /or* SEND_IDOC
*&-------------------------------------------------------------------
--*
* te8t
*--------------------------------------------------------------------
--*
* --9 p: te8t
* ;-- p< te8t
*--------------------------------------------------------------------
--*
/OR% SEND_IDOC .
CALL /UNCTION .%ASTER_IDOC_DISTRIBUTE.
EAPORTIN$
%ASTER_IDOC_CONTROL ? S_CTRL_REC
* OBB_T0PE ? ..
* CHNU% ? ..
TABLES
CO%%UNICATION_IDOC_CONTROL ? T_CO%%_IDOC
%ASTER_IDOC_DATA ? T_EDIDD
EACEPTIONS
ERROR_IN_IDOC_CONTROL ? :
ERROR_(RITIN$_IDOC_STATUS ? <
ERROR_IN_IDOC_DATA ? 5
SENDIN$_LO$ICAL_S0STE%_UNKNO(N ? C
OTHERS ? D
.
I/ S0-SUBRC ;9 '.
%ESSA$E ID S0-%S$ID T0PE S0-%S$T0 NU%BER S0-%S$NO
(ITH S0-%S$-: S0-%S$-< S0-%S$-5 S0-%S$-C.
ELSE.
CO%%IT (ORK.
LOOP AT T_CO%%_IDOC.
(RITE:E .IDo! $e"er&te - ., T_CO%%_IDOC-DOCNU%.
ENDLOOP.
ENDI/.
END/OR%. " SEND_IDOC
*&-------------------------------------------------------------------
--*
*& /or* ARRAN$E_DATA_RECORDS
*&-------------------------------------------------------------------
--*
* te8t
*--------------------------------------------------------------------
--*
* --9 p: te8t
* ;-- p< te8t
*--------------------------------------------------------------------
--*
/OR% ARRAN$E_DATA_RECORDS .
DATA: (_INDEA: LIKE S0-TABIA,
(_INDEA< LIKE S0-TABIA.
SORT T_ZSTUDENTS B0 ZSTUID.
LOOP AT T_ZSTUDENTS.
S_ZSHSTUSE$-ZSTUID ? T_ZSTUDENTS-ZSTUID.
S_ZSHSTUSE$-ZSNA%E ? T_ZSTUDENTS-ZSNA%E.
T_EDIDD-SE$NA% ? C_ZSHSTUSE$.
T_EDIDD-SDATA ? S_ZSHSTUSE$.
APPEND T_EDIDD.
CLEAR T_EDIDD.
ENDLOOP.
END/OR%. " ARRAN$E_DATA_RECORDS
-ow execute the proram, and specify the rane of records to transfer


(o to TCOD" )"2& to check the enerated IDOC control records!
Click on "xecute

In Client &(( Steps:
?unction 9odule Creation:
Create a ?unction 9odule to update the table from the IDOC sements
(o to S"'@
Specify a name and click on create!

In dialo box specify function roup and description, and click on sa$e!

Specify the Import parameters in Import tab

Specify the "xport parameters in "xport tab

Specify the Table parameters in Tables tab

Specify the "xceptions in "xception tab

Click on Source code Tab!

)rite the followin code in Source code tab!
/UNCTION ZSHAN_IDOC_ZSHSTUD%T.
*"-------------------------------------------------------------------
-
*"*"Lo!&# I"ter3&!e:
*" I%PORTIN$
*" RE/ERENCE=INPUT_%ETHOD> LIKE BD(/AP_PAR-INPUT%ETHD
*" RE/ERENCE=%ASS_PROCESSIN$> LIKE BD(/AP_PAR-%ASS_PROC
*" EAPORTIN$
*" RE/ERENCE=(ORK/LO(_RESULT> LIKE BD(/_PARA%-RESULT
*" RE/ERENCE=APPLICATION_-ARIABLE> LIKE BD(/_PARA%-APPL_-AR
*" RE/ERENCE=IN_UPDATE_TASK> LIKE BD(/AP_PAR-UPDATETASK
*" RE/ERENCE=CALL_TRANSACTION_DONE> LIKE BD(/AP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_-ARIABLES STRUCTURE BD(/RET-AR
*" SERIALIZATION_IN/O STRUCTURE BDI_SER
*" EACEPTIONS
*" (RON$_/UNCTION_CALLED
*"-------------------------------------------------------------------
-
* I"!#+e /,#e !o"t&,","1 ALE !o")t&"t)
INCLUDE %BDCON(/.
TABLES : ZSTUDENTS.
DATA : (_ZSHSTUSE$ LIKE ZSHSTUSE$.
DATA : T_ZSTUDENTS LIKE ZSTUDENTS OCCURS ' (ITH HEADER LINE.
(ORK/LO(_RESULT ? C_(/_RESULT_OK.
LOOP AT IDOC_CONTRL.
I/ IDOC_CONTRL-%EST0P NE .ZSHSTUD%T..
RAISE (RON$_/UNCTION_CALLED.
ENDI/.
* Be3ore re&,"1 & "eF e"tr2, !#e&r &pp#,!&t,o" @+33er
LOOP AT IDOC_DATA (HERE DOCNU% EG IDOC_CONTRL-DOCNU%.
(_ZSHSTUSE$ ? IDOC_DATA-SDATA.
%O-E-CORRESPONDIN$ (_ZSHSTUSE$ TO T_ZSTUDENTS.
INSERT INTO ZSTUDENTS -ALUES T_ZSTUDENTS.
ENDLOOP.
UPDATE ZSTUDENTS /RO% T_ZSTUDENTS.
I/ S0-SUBRC EG '.
IDOC_STATUS-DOCNU% ? IDOC_CONTRL-DOCNU%.
IDOC_STATUS-STATUS ? .D5..
IDOC_STATUS-%S$T0 ? .I..
IDOC_STATUS-%S$ID ? .0%..
IDOC_STATUS-%S$NO ? .''C..
IDOC_STATUS-%S$-: ? T_ZSTUDENTS-ZSTUID.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.
ELSE.
IDOC_STATUS-DOCNU% ? IDOC_CONTRL-DOCNU%.
IDOC_STATUS-STATUS ? .D:..
IDOC_STATUS-%S$T0 ? .E..
IDOC_STATUS-%S$ID ? .0%..
IDOC_STATUS-%S$NO ? .''D..
IDOC_STATUS-%S$-: ? T_ZSTUDENTS-ZSTUID.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.
(ORK/LO(_RESULT ? C_(/_RESULT_ERROR.
RETURN_-ARIABLES-(/_PARA% ? .Error_Io!)..
RETURN_-ARIABLES-DOC_NU%BER ? IDOC_CONTRL-DOCNU%.
APPEND RETURN_-ARIABLES.
CLEAR RETURN_-ARIABLES.
ENDI/.
ENDLOOP.
END/UNCTION.
Click on Sa$e and .cti$ate!
Assign )M to *ogical Message:
(o to TCOD" )"A@
Click on Display 8 Chane button!

Click on -ew "ntries Button

Specify created ?9 name, ?unction Type, Basic Type BIDOCC, 9essae Type, and Direction
and click on S./" button!

Click on Back button!
De!ine Input Met+od !or Inbound )unction Module:
(o to TCOD" BDA%
Click on Display 8 Chane button

Click on -ew "ntries

Specify ?9 name and Input Types as &! .nd Click on Sa$e and Back buttons!

Creating rocess Code:
(o to TCOD" )"<&
Click on Display 8 Chane Button

Click on -ew "ntries button

Specify a process code name, Description and select the options processin with .>"
ser$ices, =rocessin by ?unction 9odule!

Click on sa$e button
In next screen select the ?9 name and click on S./" button and Click on B.C3 button!

It will take to you pre$ious screen! Double Click on >oical 9essae in left side tree!

Click on Display 8 Chane button

Click on -ew "ntries button
Specify the 9essae Type and Click on Sa$e button

Click on Back button

Generating t+e artner ro!ile:
(o to TCOD" BD;<!
Select the 9odel /iew which you distributed in client D22!

Click on "n$ironment 9enu 45 (enerate =artner =rofile

It will show the next screen, in that click on "xecute button

It will show the =artner =rofile details
To check the partner profile details! (o to TCOD" )"&2! Select the partner system name!

Trans!erring t+e IDOC control records !rom Client ,(( to &((:
In source system, o to TCOD" S"'7! BIn client D22C
"xecute the Report proram which you created!


C+ec- in Destination System: ./ere client &((0
(o to TCOD" )"2&

Check in +ST,D"-TS table in S"%%!

Você também pode gostar