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: 

Get Archived IDocs based on IDoc creation date

Former Member
0 Kudos
1,087

Save Our Environment. Save Yourself.

Hi Experts!!!

We need to get the archived idocs based on the idoc creation date. If I give some date, then I should get all the idocs that are archived in that period. How can this be possible?

One more doubt is - I checked the logical path in FILE for archived idocs. But when I go to that in AL11, I can not see any data in that. Where can I find the details of all the archived idocs?

I serached in SCN for the same but in vain.

Please help me out. Thanks.

- I'm not an environmentalist. I'm an Earth warrior.

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos
149

1. You can get Archieved IDoc thru transaction code WE09> choose "Datasource" button from the toolbar> and choose check box "Archieve"

2. Use Transaction Code SARA and in the main screen enter IDoc as the object. then choose Customising --> Technical settings. This will give you logical filename (configured via transaction FILE)

0 Kudos
149

Save Our Environment. Save Yourself.

Hi,

Firstly, I am unable to see the Datasource in WE09. Secondly, I have the path name in FILE. But I can't find any data in that folder.

We don't need to go for SARA, as we are not authorized to use that and as we need to create a customized report for the archived Idocs.

Please help me out.

- I'm not an environmentalist. I'm an Earth warrior.

0 Kudos
149

Please find the code to read archeived idocs


FORM read_datarecord.
  STATICS ls_open TYPE boolean VALUE false.
  DATA: ld_tabix TYPE sytabix,
        lt_edidc TYPE STANDARD TABLE OF edidc,
        ld_edidc TYPE edidc.

  MOVE syst-tabix TO ld_tabix.           
  IF int_edidc-mandt IS NOT INITIAL.
  ELSE.
    IF gd_use_as IS INITIAL.
      IF ls_open = false.
        CALL FUNCTION 'ARCHIVE_OPEN_FOR_READ'
          EXPORTING
            object         = 'IDOC'
          IMPORTING
            archive_handle = gd_archive_handle
          TABLES
            archive_files  = gt_arch_sel.
        MOVE true TO ls_open.
      ENDIF.
      CLEAR ld_edidc.
      WHILE ld_edidc-docnum <> int_edidc-docnum.
        CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
          EXPORTING
            archive_handle = gd_archive_handle
          EXCEPTIONS
            end_of_file    = 1.
        IF syst-subrc IS INITIAL.
          REFRESH lt_edidc.
          CALL FUNCTION 'IDOC_ARCHIVE_GET_TABLE'
            EXPORTING
              archive_handle   = gd_archive_handle
              record_structure = 'EDIDC'
            TABLES
              t_data           = lt_edidc.

          READ TABLE lt_edidc INTO ld_edidc INDEX 1.
          IF ld_edidc-docnum = int_edidc-docnum.
            CALL FUNCTION 'IDOC_ARCHIVE_GET_TABLE'
              EXPORTING
                archive_handle   = gd_archive_handle
                record_structure = 'EDIDD'
              TABLES
                t_data           = int_edidd.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
      ENDWHILE.
    ELSE.
      CALL FUNCTION 'EDI_IDOC_GET_FROM_ARCHIVE'
        EXPORTING
          docnum                       = int_edidc-docnum
        TABLES
          int_edidd                    = int_edidd
        EXCEPTIONS
          idoc_not_in_infostructures   = 1
          idoc_read_error_from_archive = 2
          archive_close_error          = 3
          others                       = 4.
      IF sy-subrc <> 0.
      ENDIF.
    ENDIF.
  ENDIF.

  IF ls_open = true AND ld_tabix = anz_int_edidc.
    CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
      EXPORTING
        archive_handle = gd_archive_handle.
  ENDIF.
ENDFORM.                               " READ_DATARECORD

PS if you don't have auth to SARA then get auth . you need to talk to your business owner or talk to basis to get auth

former_member194669
Active Contributor
0 Kudos
149

1. You can get Archieved IDoc thru transaction code WE09> choose "Datasource" button from the toolbar> and choose check box "Archieve"

2. Use Transaction Code SARA and in the main screen enter IDoc as the object. then choose Customising --> Technical settings. This will give you logical filename (configured via transaction FILE)