Application Development and Automation 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: 
Read only

MM_EKKO archiving issue

Former Member
0 Likes
5,979

Dear Experts,

      I have a requirement to archive EKKO, EKPO tables. When i tried doing it using MM_EKKO object, im getting error that "Retention period is not maintained". But I have maintained the retention period in SPRO Tx. I have given residence time 1 and residence time 2 as '1' . Though the last changed date is far behind the current date, i'm getting this issue. Please help me out.

Thanks in advance

Regards,

Shanthi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,071

Hi,

Check the below information once again before archiving the PO's.

  1. All  PO’s are needs to be set the deletion indicator at Header Level (in EKKO). Unable to archive the PO’s without deletion flag
  2. Need to check the tolerance period for  PO’s. it means need to check the table T161R

         Need to check the residence time 2   : ( 0030 days ).

         Example:  PO creation date is less than the (system date – residence time 2  =                   PO comparison date


IF PO creation date is greater than the PO comparison date we can’t able to archive the PO’s.

Put the break point on the below report and statement you will get the problem RM06EW47

if t161r-bstyp ne ekko-bstyp or
      t161r-bsart ne ekko-bsart or
      t161r-pstyp ne ekpo-pstyp.
*     t161r-tage2 is initial.                                " 1024764
     select single * from t161r where bstyp = ekko-bstyp
                                and   bsart = ekko-bsart
                                and   pstyp = ekpo-pstyp.
     if sy-subrc <> 0.
       call function 'ARCHIVE_PROTOCOL_COLLECT_APPL'
         exporting
           i_object  = ekko-ebeln
           i_msgtype = '02'
           i_text    = text-011.      
* clear is necessary for correct message in calling program.
       clear t161r.                                          "1024764
       clear p_archive.
       exit.
     endif.
   endif.

20 REPLIES 20
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
4,071

Hi Shanthi

Have you maintained the residence time based on purchasing document category/document type / item category in table T161R

Nabheet

Read only

0 Likes
4,071

Hi Nabheet

        Ya i have maintained the residence times in SPRO Tx and checked in T161R table too. The values have got reflected over there.

Regards,

Shanthi

Read only

Former Member
0 Likes
4,072

Hi,

Check the below information once again before archiving the PO's.

  1. All  PO’s are needs to be set the deletion indicator at Header Level (in EKKO). Unable to archive the PO’s without deletion flag
  2. Need to check the tolerance period for  PO’s. it means need to check the table T161R

         Need to check the residence time 2   : ( 0030 days ).

         Example:  PO creation date is less than the (system date – residence time 2  =                   PO comparison date


IF PO creation date is greater than the PO comparison date we can’t able to archive the PO’s.

Put the break point on the below report and statement you will get the problem RM06EW47

if t161r-bstyp ne ekko-bstyp or
      t161r-bsart ne ekko-bsart or
      t161r-pstyp ne ekpo-pstyp.
*     t161r-tage2 is initial.                                " 1024764
     select single * from t161r where bstyp = ekko-bstyp
                                and   bsart = ekko-bsart
                                and   pstyp = ekpo-pstyp.
     if sy-subrc <> 0.
       call function 'ARCHIVE_PROTOCOL_COLLECT_APPL'
         exporting
           i_object  = ekko-ebeln
           i_msgtype = '02'
           i_text    = text-011.      
* clear is necessary for correct message in calling program.
       clear t161r.                                          "1024764
       clear p_archive.
       exit.
     endif.
   endif.

Read only

0 Likes
4,071

Hi Kiran,

    I have checked the dates. Actually the PO creation date is 22.01.2013 i have given both residence time1 and 2 as "1". I tried archiving today. So PO creation date is lesser than the PO comparison date

Regards,

Shanthi

Read only

0 Likes
4,071

Can you please put a breakpoint as mentioned above. Please cross check the purchasing document which you are using its document type/category etc is maintained. Please debug it

Nabheet

Read only

0 Likes
4,071

As highlighted  the code above, the error is triggered particular piece of code only.

Read only

0 Likes
4,071

Im getting the issue in preprocessing stage. Anyway i have set the debugger in the write program also as you suggested. But it is showing zero log messages. The control didn't reach the breakpoint

Read only

0 Likes
4,071

Hi,

Put the break point on the below perform go step by step please

* EKPO
     perform check_ekpo changing l_archive.

Read only

0 Likes
4,071

Actually the loekz  value is not set to 'L' for the POs. The field is empty.


SELECT ebeln    FROM  ekko INTO TABLE lt_sekko

     WHERE ebeln  IN er_ebeln

       AND ekorg  IN er_ekorg

       AND bstyp  IN er_bstyp

       AND bedat  IN er_bedat

       AND bsart  IN er_bsart

       AND ekgrp  IN er_ekgrp

       AND loekz  = 'L'

       ORDER BY ebeln.

When the above query is executed, lt_sekko internal table is empty and control is not reaching there.


Read only

0 Likes
4,071

Hi Shanthi,

I have clearly written on the first point

All  PO’s are needs to be set the deletion indicator at Header Level (in EKKO). Unable to archive the PO’s without deletion flag

Read only

0 Likes
4,071

The problem is with the preprocessing step. I think only this program sets the deletion indicator for POs at header level. But when i run this program, i'm getting issues that retention period is not maintained and the deletion indicator is not set. Is there any other way to flag the POs at header level?

Read only

JL23
Active Contributor
0 Likes
4,071

Just want to advise you  not to do anything foolish with the deletion indicators.

Those indicators are set with the pre-processing step. And you should check the log if the deletion indicator was not set, there you can find the reasons why it was not set.

The residence time alone does not decide if a document can be archived. A document has to be closed from a business point of view. if you have for example a difference between invoice and goods receipt then this document is not ready to be archived, even the residence time is over

Read only

Former Member
0 Likes
4,071

Hi Jurgen

   When i ran the preprocessing step, the log contains only one message that retention period is not maintained. But they are already set. As this is not successful the deletion indicator is not set.

Read only

JL23
Active Contributor
0 Likes
4,071

Does it really talk about retention period? or about residence time?

the logic is explained in OSS note 588463 - Importance of residence times during archiving


you have to have an entry for each combination or purchasing document type and iten category in table T161R

if you are certain that you have one, then have a look into OSS note 335800 - SARA: Deletion indicator not set, but why?

it explains how and where to debug .


further reasons that prevent setting a deletion flag are explained in OSS note 401318 - Archiving: Additional information

Read only

Former Member
0 Likes
4,071

Ya the log message is "Retention period is not maintained". I think there is some data inconsistency.

Read only

JL23
Active Contributor
0 Likes
4,071

I think the word Retention period and Residence time is just the same meaning here, probably translated by 2 different persons. Because in ERP system you can only customize Residence time.

This means who long the documents will stay in the table space. After archiving, you still have to keep the archive for several years and this is the retention period. For example Residence time 30 days, and a retention period in total is  10 years as those documents are audit relevant. But these 10 years period is not maintained in ERP system, this is a setting in your content repository or ILM system

Read only

Former Member
0 Likes
4,071

Is it necessary that the document must be closed in order to archive the PO data. Can't we do it at any stage we want?

Read only

0 Likes
4,071

Hi Shanthi,

No you can't do it! document must be closed. If you are not close the document, it should be the major impact on the business.

For example, You created delivery with reference to PO.  The goods are in transit with reference to your PO. So how can you archive the PO without closing the delivery.  If you archive the PO, there is no reference document to receive the goods.

I hope you understand the situation.

Thanks,

Kiran.

Read only

0 Likes
4,071

Ya i understood Kiran. Thank you.

Read only

Former Member
0 Likes
4,071

Thank you all.

Regards,

Shanthi