Skip to Content
0
Jun 03, 2022 at 07:03 PM

Archiving Empty HUs - Runtime Errors

146 Views

Hello,

We are trying to archive a large number, 12m+, empty HUs, using SAP Programs:

  1. Archiving Handling Units: Analysis ( Program: RHU_AR_ARCHIVABILITY_CHECK)
  2. Archiving Handling Units: Write to Archive ( Program: RHU_AR_WRITE_TO_ARCHIVE)
  3. Archive Handling Units: Delete Archived Data ( Program: RHU_AR_DELETE_FROM_DATABASE)

We are on ECC 6.0 EHP 7, Windows/SQL Server.

After doing a test of 1000, which was successful, then 5000 we are comfortable with the process and want to increase the the scale to efficiently archive/delete the 12m+. Trying to do 100k+ we started running into errors.

Specifically, during RHU_AR_ARCHIVABILITY_CHECK we receive a DBSQL_ARGUMENT_ERROR error:

Runtime Errors DBSQL_ARGUMENT_ERROR

Except. CX_SY_OPEN_SQL_DB

The reason for the exception is:

Parameter:

P1 VEKP

P2 SQL code: -1

P3 SQL message: MSSQL: Too many parameters: 10001. Cannot handle more than 10000 parameters.

P4 SQL dbsl rc: 2

         79 * Select all VEKPs matching the given selection criteria. The selected
80 * document numbers are used as a worklist
>>>>> select venum from vekp
82 into corresponding fields of table gt_complete
83 where exidv in s_exidv
84 and venum in s_venum
85 and lgnum in s_lgnum
86 and erdat in s_erdat
87 and aedat in s_aedat.

As well as, DBSQL_DUPLICATE_KEY_ERROR, when running RHU_AR_WRITE_TO_ARCHIVE(after selecting under 10,000 HUs)

Runtime Errors DBSQL_DUPLICATE_KEY_ERROR

Except. CX_SY_OPEN_SQL_DB

ABAP Program SAPLARCH

Application Component BC-CCM-ADK

The reason for the exception is:

When an Open SQL array insert is performed, trying to insert a record

into the database table "ADMI_VARIA" causes the function to terminate if a

record with the same key already exists.

They don't seem to be in any specific set, or range, of values so unable to figure out how to remove without manually putting in the HU's from SQL results.

Has anyone run into this issue, have a solution, or a more efficient way to cleanup these empty Handling Units? Was thinking, or trying, to find a way to temporarily increase MSSQL parameter limit but unsure if that is possible?

Additional information:

SAP Release..... 740

SAP Basis level 0019

Database server... MCCSAPPRD1

Database type..... MSSQL

Database name..... PRD

Database user ID dbo

Notes:

1694788 - HU Archiving - Frequently Asked Questions

1081145 - Deleting empty handling units that are not used (Started with this, but is now unavailable)

Any help would be appreciated.

Thank you.