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.