2009 Feb 19 5:13 PM
I have a customized FM which triggers the IDOCs. Most of the times the IDOCs are posted successfully with 03 status but sometimes they remain in 30 status.
I have checked the partner profile. Output mode is "Transfer IDOC Immed."
The tRFC for port is working correctly.
What can be the cause of this and How to correct this problem?
My code in FM is as following:
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = control_record_out
obj_type = object_type
TABLES
communication_idoc_control = l_edidc_tab
master_idoc_data = int_edidd
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF sy-tcode EQ 'QC20' OR sy-tcode EQ 'ZQC22'.
CLEAR w_edidc.
READ TABLE l_edidc_tab INDEX sy-tabix INTO w_edidc.
CALL FUNCTION 'EDI_DOCUMENT_DEQUEUE_LATER'
EXPORTING
docnum = w_edidc-docnum
EXCEPTIONS
idoc_is_not_to_dequeue = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK.
ENDIF.
ENDIF.
2009 Feb 19 9:41 PM
Please try this option. Once the IDOC is successfully processed do the "Commit" immediately. Looks like you are doing the commit after the dequeue process. In case there are any errors in dequeue process, IDOC will not be processed and the status will remains the same.
Before making the code changes, try to generate the situation. Process the IDOC using master distribution idoc (success process) and dequeue the idoc and set the sy-subrc ne 0. Now check the IDOC status. If it is 30, then you can change the coding accordingly.
Thanks
Nagarajan
2009 Feb 20 8:14 AM
Commit should be done only if the records is processed successfully it means when sy-subrc eq 0.
In your case there can be chance of using Commit for failure case also this leads to incosistency.
2009 Feb 20 8:42 AM
HI
Refer this link,
http://help.sap.com/saphelp_nw04/helpdata/en/52/16adef543311d1891c0000e8322f96/content.htm
Goto BD87 and process your IDOC there
Edited by: Tharani on Feb 20, 2009 9:45 AM