cancel
Showing results for 
Search instead for 
Did you mean: 

How to find Correct IDoc Status in SAP

Former Member
0 Kudos

Hi All,

I need some help on IDoc scenario, I have custom program to create Idoc and as well it will send IDoc to XI. I want to know idoc staus in the program to update custom table whether idoc sent successfully or not but idoc giving status as 03 (Data passed to port OK) irrespective of idoc send or not, actually idoc not sent to xi when I check SM58 showing error.

Please advice me how to find correct idoc status inside program itself.

**-----Create IDoc

CALL FUNCTION 'IDOC_OUTBOUND_WRITE_TO_DB'

TABLES

int_edidd = i_edidd

CHANGING

int_edidc = wa_int_edidc

EXCEPTIONS

idoc_not_saved = 1

OTHERS = 2.

COMMIT WORK.

i_edidc = wa_int_edidc.

APPEND i_edidc.

REFRESH i_edidd.

**-----Send Idoc

CLEAR i_edidd.

**-------Send Idoc to XI

CALL FUNCTION 'EDI_OUTPUT_NEW'

EXPORTING

onl_option = 'B'

error_flag = ' '

TABLES

i_edidc = i_edidc

i_edidd = i_edidd.

COMMIT WORK.

READ TABLE i_edidc INDEX 1.

**-----Update Dispatch order status based on Idoc status.

IF sy-subrc = 0 AND i_edidc-status ='03'.

znxi01_update c_03 i_edidc-docnum.

gw_success_record = gw_success_record + 1.

ELSE. " Error in Data Transfer

znxi01_update c_02 i_edidc-docnum.

gw_fail_record = gw_fail_record + 1.

ENDIF.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Anil,

for setting IDOC Status you can send back a IDOC of type <i>ALEAUD01</i>.

The function IDOC_INPUT_ALEAUD takes automatically this IDOC and writes the status to the origin IDOC.

Regards Mario

Former Member