2008 Dec 26 5:28 AM
Dear All,
I configed the customized IDOC,and used BD64,WE20 Generate Partner Profile.the partner type is u2018LSu2019,In We20,I clicked the check button .There is no error in check.Other config also correct.
My outbound program main code is :
WA_IDOC_CONTROL_RECORD-MESTYP = 'ZMSGTYPE_WE81'.
WA_IDOC_CONTROL_RECORD-IDOCTP = 'ZIDOCTYPE_WE30'.
Receiver
WA_IDOC_CONTROL_RECORD-RCVPOR = 'A000000003'. "Port
WA_IDOC_CONTROL_RECORD-RCVPRN = 'target100'. "Partner number
WA_IDOC_CONTROL_RECORD-RCVPRT = 'LS'."Partner type
WA_IDOC_CONTROL_RECORD-RCVPFC = 'LS'."Partner function
Sender
wa_idoc_control_record-sndpor = 'A000000001'. "Port
wa_idoc_control_record-sndprn = 'source500'. "Partner number
wa_idoc_control_record-sndprt = 'LS'. "Partner type
WA_IDOC_CONTROL_RECORD-SNDPFC = 'LS'."Partner function
DATA L_ITEM TYPE I.
LOOP AT GT_IDOC.
L_ITEM = L_ITEM + 1.
WA_EDIDD-SEGNAM = 'ZSEG_WE31'.
WA_EDIDD-SEGNUM = L_ITEM.
WA_EDIDD-SDATA = GT_IDOC.
APPEND WA_EDIDD TO IT_EDIDD.
ENDLOOP.
CLEAR L_ITEM.
SORT IT_EDIDD BY SEGNUM.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = WA_IDOC_CONTROL_RECORD
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMMUNICATION_IDOC_CONTROL
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
2008 Dec 26 5:37 AM
2008 Dec 26 5:48 AM
hi,
In your program before calling the FM 'MASTER_IODC_DISTRIBUTE' call this FM 'ALE_MODEL_DETERMINE_IF_TO_SEND' by passing the message type name which will determine whether the ale model is proper and the IDoc can be sent.
following is the sample on how to use this FM
Check whether IDOC needs to be created.
CALL FUNCTION 'ALE_MODEL_DETERMINE_IF_TO_SEND'
EXPORTING
message_type = p_mestyp
IMPORTING
idoc_must_be_sent = idoc_must_be_sent
EXCEPTIONS
own_system_not_defined = 01.
IF sy-subrc <> 0.
EXIT.
ENDIF. "IF sy-subrc <> 0.
{/code}
here the variable p_mesgetyp has the message type name.
If the value of IDOC_MSUT_BE_SENT variable is ABAP_TURE then you can the idoc generator FM 'MASTER_IODC_DISTRIBUTE'
2008 Dec 26 6:22 AM
Hi,Ashwinee
Thanks for your information
I added your code,and debuged found the idoc_must_be_sent = 'X',not eq 'ABAP_TURE'.
Could you tell me which field or t-code to determine idoc_must_be_sent value ?
BD64 or we21?
Sorry ,MY IDOC is very jackaroo.
Thanks
sun
2008 Dec 26 6:26 AM
hi Sun,
The value 'X' means ABAP_TRUE, which means the outbound ALE settings for your message type are OK.
Did you check the sy-subrc value after the FM 'MASTER_IDOC_DISTRIBUTE' is called ? and if yes what is the value ?
Also did u check the IT_EDIDD table, whether is contains any values ?
If all of the above is fine then call the FM 'EDI_DOCUMENT_DEQUEUE_LATER' by passing the document number of the outbound IDoc created, this number you will from the 'communication_idoc_control' table which you need to pass to your FM MASTER_IDOC_DISTRIBUTE.
for your reference attached is code for it
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = wf_edidc
TABLES
communication_idoc_control = int_comm_cntl
master_idoc_data = int_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.
APPEND LINES OF lt_idoc_comm_control TO g_idoc_comm_control.
endif.
LOOP AT g_idoc_comm_control.
CALL FUNCTION 'EDI_DOCUMENT_DEQUEUE_LATER'
EXPORTING
docnum = g_idoc_comm_control-docnum.
ENDLOOP.
{/code}
hope this will solve your problem
Edited by: Ashwinee on Dec 26, 2008 12:09 PM
2008 Dec 26 6:56 AM
hi,Ashwinee
when i CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
the sy-subrc value is 0,i think is succeed.
and i added your code:
APPEND LINES OF IT_COMMUNICATION_IDOC_CONTROL TO g_idoc_comm_control.
LOOP AT g_idoc_comm_control.
CALL FUNCTION 'EDI_DOCUMENT_DEQUEUE_LATER'
EXPORTING
docnum = g_idoc_comm_control-docnum.
ENDLOOP.
the error have still exits.
Maybe one field have no value
2009 Jan 06 3:33 AM