Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC Error Report

Former Member
0 Kudos
15,074

Dear All,

There is an requirement to generate IDOC error report.

Normally t.codes we02 / we05 are used to see the idoc errors. I would like to know whether any transparent tables are available to see the error log.

More specially, I need to generate an report with IDOC Numer + Error Description as an output.

If any clues, please pass on the same.

Regards,

Ramki.

12 REPLIES 12

amit_khare
Active Contributor
0 Kudos
2,202

Welcome to SDN.

Please read Rules of Engagement before posting queries.

Check the table EDIDS

0 Kudos
2,202

Thanks for your suggesion.

EDIDS contains only error status. I need to fetch the detailed error of particular idoc, if did not get posted.

Regards,

Ramki.

0 Kudos
2,202

Define one internal table type BDIDOCSTAT .


FORM status_update TABLES p_ig_messtab STRUCTURE bdcmsgcoll
                          p_idoc_status STRUCTURE bdidocstat
                    USING p_idoc_status1
                          p_docnum.

  LOOP AT p_ig_messtab.
    p_idoc_status-docnum = p_docnum.
    p_idoc_status-status = p_idoc_status1.
    p_idoc_status-msgty  = p_ig_messtab-msgtyp.
    p_idoc_status-msgid  = p_ig_messtab-msgid.
    p_idoc_status-msgno  = p_ig_messtab-msgnr.
    p_idoc_status-msgv1  = p_ig_messtab-msgv1.
    p_idoc_status-msgv2  = p_ig_messtab-msgv2.
    p_idoc_status-msgv3  = p_ig_messtab-msgv3.
    p_idoc_status-msgv4  = p_ig_messtab-msgv4.
    APPEND p_idoc_status.
  ENDLOOP.


ENDFORM.                    " STATUS_UPDATE

You'll get idoc num , status and message correspondingly

Hope this helps u...

Edited by: anil sasidharan on Mar 6, 2009 3:55 PM

Edited by: anil sasidharan on Mar 6, 2009 3:57 PM

0 Kudos
2,202

Thanks Anil !!

I hope that, your code will work if we are using BDC program wherein error message get stored in bdcmsgcoll table. We can read the table and display as error report.

I can explain in detail what I was expecting....

1. Go to T.code WE02 / WE05

2. Execute the above t.code with status '51'

3. Report get executed with list of idoc's with status '51'.

4. Click on Selected IDocs.

5. We'll get the details of IDOC like 'Control Rec.', 'Data records' & 'Status records'

6. Click on 'Status Records' node, it will display error message as 'Application document not posted'

7. Under '51', you will get the detailed descriptions.

I would like to extract the detailed descrptions as an report with IDOC number and other details from 'Data record' section.

We are using ECC 6.0

If anyone has done it earlier, please pass on the same.

Regards,

Ramki.

uwe_schieferstein
Active Contributor
0 Kudos
2,202

Hello Ramki

If you are working already on SAP releases >= 6.20 then you have the standard report

RSEIDOCA (Active IDoc Monitoring as of Release 6.10)

available. Unfortunately this report triggers only a workflow which I am not really fond of.

Therefore, I have created a report ZRSEIDOCA which has an e-mail interface as well. Fore more details please refer to thread

Regards

Uwe

0 Kudos
2,202

Hi,

I have to work on a similar scenario where I need to collect the Idoc status and trigger an email. Could you please share your logic so that it is helpful for me.

Thanks

Sathish

nagarjun_kalletla
Participant
0 Kudos
2,202

HI Ramki,

Sorry its been long time you have posted this thread.

I have the same kind of requirement ,

Am fetching the Error Idoc from EDIDC Error status 51 and mestyp-matmas 

and for all entries fetching the EDIDS for Appl_log number .

I found one FM APPL_LOG_DISPLAY_WITH_LOGNO which takes Log no and displays whole Logs for that Idoc

I want only error logs from here to append in my local internal table.

If you could remember , please reply

0 Kudos
2,202

Hi Nagarj,

I haven't found anything,  If you answer, please post.

Regds...Ramki.

nagarjun_kalletla
Participant
0 Kudos
2,202

Hi Ramki ,

Below is the code to read the error messages also for Inbound IDOC , For Out bound you have to relay on the EDIDS record only ......

Inbound : Application Log will have detailed messages for each and every error.

TABLES : edidc.

TYPES : BEGIN OF ty_final ,

        docnum      TYPE edidc-docnum,

        status      TYPE edidc-status,

        direct      TYPE edidc-direct,

        rcvprn      TYPE edidc-rcvprn,

        sndprn      TYPE edidc-sndprn,

        credat      TYPE edidc-credat,

        last_run    TYPE edids-credat,

        cretim      TYPE edidc-cretim,

        mestyp      TYPE edidc-mestyp,

        message     TYPE char255,

        END OF ty_final.

DATA : lt_final    TYPE TABLE OF ty_final,                

       ls_final    TYPE          ty_final,                 

       lt_messages TYPE STANDARD TABLE OF balm,            

       ls_messages TYPE                   balm.           

SELECT * FROM edidc INTO TABLE lt_edidc

          WHERE       upddat BETWEEN lv_date AND sy-datum

          AND         status  IN s_staus

          AND         direct  =  c_2

          AND         mestyp  IN s_mestyp

          AND         credat  BETWEEN lv_date AND sy-datum

          AND         cretim  BETWEEN lv_ltime AND sy-uzeit

          AND         rcvpor  = lv_rcvpor

          AND         rcvprt  = lv_rcvprt

          AND         rcvprn  = lv_rcvprn

          AND         sndpor  = lv_sndpor

          AND         sndprt  = lv_sndprt

          AND         sndprn  = lv_sndprn

          ORDER BY PRIMARY KEY.             " select the failed Idocs

SORT lt_edidc BY docnum ASCENDING.

  IF NOT lt_edidc IS INITIAL.

    SELECT * FROM edids INTO TABLE lt_edids FOR ALL ENTRIES IN lt_edidc

                                            WHERE docnum = lt_edidc-docnum.

    SORT lt_edids BY docnum ASCENDING countr DESCENDING.

    TRY.                                                    "#EC NEEDED

      CATCH cx_sy_dyn_table_ill_comp_val.               "#EC NO_HANDLER

    ENDTRY.

    DELETE ADJACENT DUPLICATES FROM lt_edids COMPARING docnum.

    LOOP AT lt_edids INTO ls_edids.

      lv_extnum = ls_edids-docnum.

      CALL FUNCTION 'APPL_LOG_READ_DB'         " To get Application Log details for Each Idoc

        EXPORTING

          object           = '*'

          subobject        = '*'

          external_number  = lv_extnum

          date_to          = sy-datum

          time_from        = '000000'

          time_to          = sy-uzeit

          log_class        = '4'

          program_name     = '*'

          transaction_code = '*'

          user_id          = ' '

          mode             = '+'

          put_into_memory  = ' '

        TABLES

          messages         = lt_messages.

      DELETE lt_messages WHERE lognumber NE ls_edids-appl_log. " Delete Messeages where APPl_log NE latest

      DELETE lt_messages WHERE msgty NE 'E'. " delete other than Error messages

      LOOP AT lt_messages INTO ls_messages.

        CALL FUNCTION 'FORMAT_MESSAGE'

          EXPORTING

            id   = ls_messages-msgid

            lang = 'EN'

            no   = ls_messages-msgno

            v1   = ls_messages-msgv1

            v2   = ls_messages-msgv2

            v3   = ls_messages-msgv3

            v4   = ls_messages-msgv4

          IMPORTING

            msg  = l_msg.               " Actual Error Message received

        ls_final-docnum    = ls_edids-docnum.

        ls_final-status    = ls_edids-status.

        ls_final-last_run  = ls_edids-credat.

        ls_final-cretim    = ls_edids-cretim.

        ls_final-message   = l_msg.

        CLEAR : ls_edidc.

        READ TABLE lt_edidc INTO ls_edidc WITH KEY docnum = ls_edids-docnum.

        IF sy-subrc = 0.

          ls_final-credat  = ls_edidc-credat.

          ls_final-direct  = ls_edidc-direct.

          ls_final-rcvprn  = ls_edidc-rcvprn.

          ls_final-sndprn  = ls_edidc-sndprn.

          ls_final-mestyp  = ls_edidc-mestyp.

        ENDIF.

        APPEND ls_final TO lt_final.       " Final Table will have Failed Idocs with Error Messages

        CLEAR ls_final.

      ENDLOOP.

      IF lt_messages IS INITIAL.

        CLEAR ls_final.

        ls_final-docnum    = ls_edids-docnum.

        ls_final-status    = ls_edids-status.

        ls_final-last_run  = ls_edids-credat.

        ls_final-cretim    = ls_edids-cretim.

        CLEAR : l_msg.

        CONCATENATE ls_edids-stapa1 ls_edids-stapa2 ls_edids-stapa3 ls_edids-stapa4 INTO l_msg SEPARATED BY space.

        CONDENSE l_msg .

        ls_final-message   = l_msg.

        CLEAR : ls_edidc.

        READ TABLE lt_edidc INTO ls_edidc WITH KEY docnum = ls_edids-docnum.

        IF sy-subrc = 0.

          ls_final-credat  = ls_edidc-credat.

          ls_final-direct  = ls_edidc-direct.

          ls_final-rcvprn  = ls_edidc-rcvprn.

          ls_final-sndprn  = ls_edidc-sndprn.

          ls_final-mestyp  = ls_edidc-mestyp.

        ENDIF.

        APPEND ls_final TO lt_final.

      ENDIF.

    ENDLOOP.

  ENDIF.

Final Table will now have all the error reasons for each and every Idoc ....

Hope this will help your requirement

0 Kudos
2,202

thanks

0 Kudos
2,202

Points

0 Kudos
2,202

a) we do not ask for points or offer any

b) one should check the the discussions to which a reply is added

- to know from which date this discussion is

- to know if the new question was asked from the owner of the question.

- to know if the discussion is already marked answered or assumed answered

Only the owner can mark an answer as correct, and this activity automatically assigns points.

Someone who hijacks a discussion cannot.

If you are keen on points, then you should not answer questions that got added to old discussions.

And in turn those who reopen old questions would learn that this is not the desired way in SCN.

And the OP of the question would get less annoying email notifications 5 years after he had asked his question.