‎2006 Jan 25 10:19 AM
Hi all!
I am configuring an outbound interface through ALE and IDocs.I am doing a standard stand alone program for this and designing an selection screen for this.My query is that this report has to be attached or configured in any way for the OUTPUT to be successful .Since in case of FM's we do certain configs and attach the FM's to IDoc types.
please advise
kumar
‎2006 Jan 25 10:46 AM
Hi,
i've already done a standalone program like your.
In synthesis i followed those steps:
1. Define Idoc type (only in the case of custom idoc)
2. Define message type (and customizing for message/idoc types linkage WE81, WE82)
3. in WE20 transaction define partner customizing (linking sender/receiver/message types)
4. In the program fill work area EDIDC with idoc type and message type
wedidc-doctyp = idoctyp.
wedidc-mestyp = mestyp.
5. In the program fill an internal table EDIDD with the segments you want to send
6. Choose receiver parner
select *
from edp13
into table xedp13
where mestyp = mestyp.
loop at xedp13 into wedp13.
perform ale_determine_if_to_be_sent using wedp13.
if sy-subrc = 0.
perform master_idoc_distribute using wedp13.
endif.
endloop.
7. Determine if to send the idoc for a specified partner
*&---------------------------------------------------------------------*
*& Form ALE_DETERMINE_IF_TO_BE_SENT
*&---------------------------------------------------------------------*
* Controllo se l'idoc deve essere inviato
*----------------------------------------------------------------------*
form ale_determine_if_to_be_sent using edp13 type edp13.
data: logsys like t000-logsys,
sent type c.
select single logsys
from t000
into logsys
where mandt = sy-mandt.
clear sent.
call function 'ALE_MODEL_DETERMINE_IF_TO_SEND'
exporting
message_type = edp13-mestyp
sending_system = logsys
receiving_system = edp13-rcvprn
validdate = sy-datum
importing
idoc_must_be_sent = sent
exceptions
own_system_not_defined = 1
others = 2.
if sent is initial.
sy-subrc = 4.
else.
sy-subrc = 0.
endif.
endform. " ALE_DETERMINE_IF_TO_BE_SENT
8. Eventually send the idoc
*&---------------------------------------------------------------------*
*& Form master_idoc_distribute
*&---------------------------------------------------------------------*
* Invio idoc
*----------------------------------------------------------------------*
form master_idoc_distribute using edp13 type edp13.
data: idoc_control type edidc,
xedidc type table of edidc.
move-corresponding edp13 to idoc_control.
idoc_control-idoctp = edp13-idoctyp.
idoc_control-stdmes = edp13-idoctyp.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = idoc_control
tables
communication_idoc_control = xedidc
master_idoc_data = xedidd
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.
commit work.
loop at xedidc into wedidc where docnum <> space.
message i186 with wedidc-docnum.
exit.
endloop.
else.
message e187.
endif.
endform. " master_idoc_distribute
This are the only steps/configurations needed to send an outbound Idoc
If you find this answer useful, please remember to reward some points and eventually close post if your problem is solved
Regards, Manuel
‎2006 Jan 25 10:46 AM
Hi,
i've already done a standalone program like your.
In synthesis i followed those steps:
1. Define Idoc type (only in the case of custom idoc)
2. Define message type (and customizing for message/idoc types linkage WE81, WE82)
3. in WE20 transaction define partner customizing (linking sender/receiver/message types)
4. In the program fill work area EDIDC with idoc type and message type
wedidc-doctyp = idoctyp.
wedidc-mestyp = mestyp.
5. In the program fill an internal table EDIDD with the segments you want to send
6. Choose receiver parner
select *
from edp13
into table xedp13
where mestyp = mestyp.
loop at xedp13 into wedp13.
perform ale_determine_if_to_be_sent using wedp13.
if sy-subrc = 0.
perform master_idoc_distribute using wedp13.
endif.
endloop.
7. Determine if to send the idoc for a specified partner
*&---------------------------------------------------------------------*
*& Form ALE_DETERMINE_IF_TO_BE_SENT
*&---------------------------------------------------------------------*
* Controllo se l'idoc deve essere inviato
*----------------------------------------------------------------------*
form ale_determine_if_to_be_sent using edp13 type edp13.
data: logsys like t000-logsys,
sent type c.
select single logsys
from t000
into logsys
where mandt = sy-mandt.
clear sent.
call function 'ALE_MODEL_DETERMINE_IF_TO_SEND'
exporting
message_type = edp13-mestyp
sending_system = logsys
receiving_system = edp13-rcvprn
validdate = sy-datum
importing
idoc_must_be_sent = sent
exceptions
own_system_not_defined = 1
others = 2.
if sent is initial.
sy-subrc = 4.
else.
sy-subrc = 0.
endif.
endform. " ALE_DETERMINE_IF_TO_BE_SENT
8. Eventually send the idoc
*&---------------------------------------------------------------------*
*& Form master_idoc_distribute
*&---------------------------------------------------------------------*
* Invio idoc
*----------------------------------------------------------------------*
form master_idoc_distribute using edp13 type edp13.
data: idoc_control type edidc,
xedidc type table of edidc.
move-corresponding edp13 to idoc_control.
idoc_control-idoctp = edp13-idoctyp.
idoc_control-stdmes = edp13-idoctyp.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = idoc_control
tables
communication_idoc_control = xedidc
master_idoc_data = xedidd
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.
commit work.
loop at xedidc into wedidc where docnum <> space.
message i186 with wedidc-docnum.
exit.
endloop.
else.
message e187.
endif.
endform. " master_idoc_distribute
This are the only steps/configurations needed to send an outbound Idoc
If you find this answer useful, please remember to reward some points and eventually close post if your problem is solved
Regards, Manuel
‎2006 Jan 25 2:52 PM
Hi manuel!
BAsed on your inputs i had creATED the following CODE FOR THE outbound interface but it is doing nothing,just blank and the IDoc is also not created.I am attaching my code please go through it and advise.I just created the header data and didn't do any logical validations.I was just seeing weather the IDoc is triggered or not.
REPORT ZPAI15_CATSOUT NO STANDARD PAGE HEADING MESSAGE-ID Z001.
*& PARAMETERS
OBJECT KEY
PARAMETERS:P_CATSEN LIKE CATSDB-PERNR.
MESSAGE TYPE
PARAMETERS:P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
DESTINATION SYSTEM
PARAMETERS:P_LOGSYS LIKE TBDLST-LOGSYS.
*& CONSTANTS
DATA:
SEGMENT NAMES
C_HEADER_SEGMENT LIKE EDIDD-SEGNAM VALUE 'E1BPCATS1',
C_EXTENDED_SEGMENT LIKE EDIDD-SEGNAM VALUE 'ZE1BPCATS1',
IDoc TYPE
C_CATS_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZCATS_INSERT02'.
*& DATA DECLARATIONS
IDoc CONTROL RECORD
DATA:CONTROL_RECORD_OUT LIKE EDIDC.
CATS HEADER DATA
DATA:FS_CATSHEADER_DATA LIKE E1BPCATS1.
CATS HEADER DATA1
DATA:FS_CATSHEADER1_DATA LIKE E1BPCATS2.
CATS EXTENDED SEGMENT DATA
DATA:FS_CATSEXTENDED_DATA LIKE ZE1BPCATS1.
*& DATABASE TABLES
APPLICATION DATA TABLES
TABLES:CATSDB,CSLT,PA0002,EDIDC.
*& INTERNAL TABLES
DATA:
HEADER
IT_CATSHEADER LIKE E1BPCATS1 OCCURS 0 WITH HEADER LINE,
EXTENDED SEGMENT
IT_CATSEXTENDED LIKE ZE1BPCATS1 OCCURS 0 WITH HEADER LINE,
DATA RECORDS
IT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,
COMMUNICATION IDOCS GENERATED
IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE,
IT_EDP13 LIKE EDP13 OCCURS 0 WITH HEADER LINE,
wa_edp13 like edp13 occurs 0 with header line,
WA_EDIDC LIKE EDIDC OCCURS 0 WITH HEADER LINE.
&----
*& PROGRAM LOGIC
*&
&----
***********************SELECT APPLICATION DATA************************
SELECT SINGLE * FROM CATSDB WHERE PERNR = P_CATSEN.
IF SY-SUBRC NE 0.
MESSAGE E001 WITH P_CATSEN.
EXIT.
ENDIF.
***********************BUILD CONTROL RECORD***************************
FILL CONTROL RECORD INFORMATION
CONTROL_RECORD_OUT-MESTYP = P_MESTYP.
CONTROL_RECORD_OUT-IDOCTP = C_CATS_REPORT_IDOC_TYPE.
CONTROL_RECORD_OUT-RCVPRT = 'LS'.
CONTROL_RECORD_OUT-RCVPRN = P_LOGSYS.
***********************BUILD DATA RECORDS**************************
*--
*FILL THE CATSHEADER INFORMATION
FS_CATSHEADER_DATA-EMPLOYEENUMBER = CATSDB-PERNR.
FS_CATSHEADER1_DATA-DATE_OF_APPROVAL = CATSDB-APDAT.
FS_CATSEXTENDED_DATA-LSTAR = CATSDB-LSTAR.
FS_CATSEXTENDED_DATA-LTEXT = CSLT-LTEXT.
FS_CATSHEADER_DATA-CATSHOURS = CATSDB-CATSHOURS.
FS_CATSHEADER_DATA-STARTTIME = CATSDB-BEGUZ.
FS_CATSHEADER_DATA-ENDTIME = CATSDB-ENDUZ.
FS_CATSEXTENDED_DATA-ZPBHRPAYROLLNO = PA0002-ZPBHRPAYROLLNO.
FS_CATSEXTENDED_DATA-ZPBHRPAYROLLSYS = PA0002-ZPBHRPAYROLLSYS.
FS_CATSEXTENDED_DATA-ZPBHRPAYROLLINS = PA0002-ZPBHRPAYROLLINS.
FS_CATSHEADER_DATA-WORKDATE = CATSDB-WORKDATE.
*FILL THE ADMINISTRATIVE SECTION OF THE DATA RECORD
IT_EDIDD-SEGNAM = C_HEADER_SEGMENT.
IT_EDIDD-SDATA = FS_CATSHEADER_DATA.
*APPEND THE CATS HEADER DATA TO THE IDOC DATA
APPEND IT_EDIDD.
select * from edp13 into table IT_EDP13 where mestyp = p_mestyp.
loop at IT_edp13 into wa_edp13.
perform ale_determine_if_to_be_sent using wa_edp13.
if sy-subrc = 0.
perform master_idoc_distribute using wa_edp13.
endif.
endloop.
*& FORM ALE_DETERMINE_IF_TO_BE_SENT
form ale_determine_if_to_be_sent using edp13 type edp13.
data: logsys like t000-logsys,
sent type c.
select single logsys
from t000
into logsys
where mandt = sy-mandt.
clear sent.
call function 'ALE_MODEL_DETERMINE_IF_TO_SEND'
exporting
message_type = edp13-mestyp
sending_system = logsys
receiving_system = edp13-rcvprn
validdate = sy-datum
importing
idoc_must_be_sent = sent
exceptions
own_system_not_defined = 1
others = 2.
if sent is initial.
sy-subrc = 4.
else.
sy-subrc = 0.
endif.
endform. " ALE_DETERMINE_IF_TO_BE_SENT
****************PASS CONTROL TO THE ALE LAYER***********************
form master_idoc_distribute using edp13 type edp13.
data: idoc_control type edidc,
xedidc type TABLE OF edidc.
move-corresponding edp13 to idoc_control.
idoc_control-idoctp = edp13-idoctyp.
idoc_control-stdmes = edp13-idoctyp.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
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.
if sy-subrc = 0.
commit work.
loop at xedidc into wA_EDidc where docnum <> space.
message i186 with wA_edidc-docnum.
exit.
endloop.
else.
message e187.
endif.
endform. " master_idoc_distribute
‎2006 Jan 25 4:35 PM
Hi praneeth,
I hope its problem with the settings.
You are using the Extended IDOC type in the program.Check the Extended one is assigned correctly or not to the Basic Type..Etc.
Thanks
Eswar
‎2006 Jan 25 4:44 PM
Hi
Along with the steps mentioned previously, I would also like to add that you need to confirm that the sending logical system and receiving logical system are correctly defined. Check out the Output mode defined in outb ound options also. Whether Transfer idocs immed is selected or collect idocs
Please also add checks are various stages in your program to catch exceptions so you can get an error message and analyze properly the mistake.
Regards
Ketaki
‎2006 Jan 25 4:54 PM
Hi Praneeth,
the code seem to be right,
maybe there is a customizing problem
try to debug the program
- does FM ALE_MODEL_DETERMINE_IF_TO_SEND set flag "sent" to X?
- does select from edp13 extract some data ?
if not , probably the customizing is wrong.
Let me know,
Manuel
‎2006 Jan 26 11:55 AM
Hi Manuel
As u see my code this is based on a stand alone report program,instead of that i want to attach it as a Function module to the extended IDOC i.e i will define it in WE 57 and when ever there is a trigerring of IDoc from we19 this should run.How to achieve this?
Please advise
kind regards
praneet
points awarded
‎2006 Jan 26 1:11 PM
hi praneet,
your code is intended for the generation of an Idoc (from SAP tables).
with WE19 you manually create an Idoc. To send an Idoc from WE19 choose "Standard outbound processing". The only things you need are the informations about ports, sender, receiver ecc.. inside the control record EDIDC.
Outbound Idoc doesn't need specific FM, it is sufficient to send the idoc manually generated to the receiver specified.
kind regards, Manuel
‎2006 Jan 26 2:31 PM
Hi manuel!
Thanks for the reply!
I will explain u my requirement below .Please advise
Actually i am doing an outbound interface for CATS trans.
I created an extended IDoc based on the basic IDoc cats_insert02.I had coded the idoc as given in my earlier post.i assigned the extended idoc to the basic IDoc.The partner profiles and distribution is succesful.my query is
1)I don't want the selection screen for the O/B interface and how to achieve this
2)can i trigger it from we19.
please advise
kumar
points rewarded