2011 Sep 19 9:48 AM
Hi
I've written an ABAP code to generate IDocs using 'MASTER_IDOC_DISTRIBUTE. Though now am facing a problem that IDoc generated remain in status 30 and goes to status 0 only after manually processing it on transaction BD87 and that too it is not a sureity that it would go onto status 03 even after processing. I've used BDC recording for the very purpose but it is also not giving favourable result. Please Help with this problem.
Regards
Arun
2011 Sep 22 7:37 AM
First check the flag "Transfer IDoc Immed." in WE20. If u get the same status 30 then write the below code after the FM
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = control_record_out
TABLES
communication_idoc_control = li_edidc[]
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.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_synchron = 'E'.
ENDIF.
*READ TABLE li_edidc[] INTO lwa_edidc INDEX 1.
*IF sy-subrc = 0.
lc_doc = lwa_edidc-docnum .
SUBMIT rseout00
WITH docnum = lc_doc
WITH p_outmod = lc_outmode
AND RETURN.
*ENDIF.
"SUBMIT rseout00" is used to bring the to idoc satus 3 from the status 30.
Edited by: Shilpa_gunjan on Sep 22, 2011 8:38 AM
Edited by: Shilpa_gunjan on Sep 22, 2011 8:39 AM
2011 Sep 19 10:40 AM
Hi,
do a COMMIT WORK after calling 'MASTER_IDOC_DISTRIBUTE'.
Best regards,
Oliver
2011 Sep 19 11:01 AM
Hi Oliver
This is the sample code I've used;
&----
*& Report ZTEST_CALLIDOC
*&
&----
*&
*&
&----
REPORT ztest_callidoc.
TABLES: ztest_idoc.
PARAMETER : sel_psno TYPE i.
DATA: header_segment_name LIKE edidd-segnam VALUE 'ZTEST_SEG',
item_segment_name LIKE edidd-segnam VALUE 'ZTEST_SEG',
idoc_name LIKE edidc-idoctp VALUE 'ZTEST_IDOC'.
DATA: header_segment_data LIKE ztest_seg,
item_segment_data LIKE ztest_seg.
DATA: control_record LIKE edidc.
DATA: messagetyp LIKE edmsg-msgtyp VALUE 'ZTEST_MESSG'.
DATA: i_communication LIKE edidc OCCURS 0 WITH HEADER LINE,
i_data LIKE edidd OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF itab OCCURS 0,
name TYPE ztest_idoc-name,
psno TYPE ztest_idoc-psno,
END OF itab.
DATA: wa LIKE LINE OF itab.
START-OF-SELECTION.
SELECT name psno FROM ztest_idoc
INTO TABLE itab WHERE psno EQ sel_psno.
control_record-mestyp = messagetyp.
control_record-rcvpor = 'A000000017'.
control_record-rcvprt = 'LS'.
control_record-idoctp = idoc_name.
control_record-rcvprn = 'PICCLNT300'.
LOOP AT itab.
header_segment_data-psno = itab-psno.
header_segment_data-name = itab-name.
i_data-segnam = header_segment_name.
i_data-sdata = header_segment_data.
APPEND i_data.
ENDLOOP.
CLEAR itab.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = control_record
OBJ_TYPE = ''
CHNUM = ''
TABLES
communication_idoc_control = i_communication
master_idoc_data = i_data
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.
LOOP AT i_communication.
WRITE: 'IDOC GENERATED', i_communication-docnum.
ENDLOOP.
COMMIT WORK.
ENDIF.
2011 Sep 19 11:49 AM
Hi,
this looks good to me. I have a very similar szenario where this works. The only difference there is that I fill i_data-segnum, too. But I don't know if this makes a difference.
So and your IDoc get's stuck in status 30? What is the message that comes with the status?
Best regards,
Oliver
2011 Sep 19 11:53 AM
Hi Oliver
This is the message I get when I try to process the IDoc in BD87.
IDoc ready for dispatch (ALE service) Receiver exists , No filters , No conversion , No version change.
Thanks.
2011 Sep 19 12:06 PM
Did you tried calling the function module DEQUEUE_ALL after MASTER_IDOC_DISTRIBUTE call?
Regards, Vinod
2011 Sep 19 12:24 PM
Hi,
okay, and did you set the flag "Transfer IDoc Immed." in WE20?
And is the port (WE21) and connection (SM59) maintained properly?
Best regards,
Oliver
2011 Sep 22 7:37 AM
First check the flag "Transfer IDoc Immed." in WE20. If u get the same status 30 then write the below code after the FM
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = control_record_out
TABLES
communication_idoc_control = li_edidc[]
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.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_synchron = 'E'.
ENDIF.
*READ TABLE li_edidc[] INTO lwa_edidc INDEX 1.
*IF sy-subrc = 0.
lc_doc = lwa_edidc-docnum .
SUBMIT rseout00
WITH docnum = lc_doc
WITH p_outmod = lc_outmode
AND RETURN.
*ENDIF.
"SUBMIT rseout00" is used to bring the to idoc satus 3 from the status 30.
Edited by: Shilpa_gunjan on Sep 22, 2011 8:38 AM
Edited by: Shilpa_gunjan on Sep 22, 2011 8:39 AM
2011 Oct 12 11:52 AM
Hi,
This generally happens when the receiver system is down or there is a long queue for transferring IDOC's.
You can always execute the report RSEOUT00 or submit it inside your program after the idoc's have been created.
Thanks,
Manish
2011 Oct 12 11:56 AM