Read LIKP Delivery Data from Archive using ABAP Code
This ABAP tutorial shows how to read LIKP delivery data from archive using ABAP function module ASH_RV_LIKP_READ Archived delivery documents can not be found by querying SAP LIKP transparent table (SD Document: Delivery Header Data) In case of a requirement to read archived delivery data from SAP system, ABAP developers can use the ASH_RV_LIKP_READ ABAP function module as demonstrated in this tutorial.
If you have a delivery document which is archived, you will not be able to query LIKP database table and return data by using the VBELN number. The result SAP user will get is "No table entries found for specified key"
On the other hand, using SAP transaction code VL03N and using the delivery document number it is still possible to display the delivery data. The VL03N transaction screen will inform you that the delivery data is read from archive.
For ABAP programmer, the ABAP function module ASH_RV_LIKP_READ enables it to read delivery data including LIKP, LIPS, etc using ABAP code programmatically. Here is how.
Create a new sample ABAP report using SE38 ABAP Editor transaction.
Using Pattern button add new statement for function module call to ASH_RV_LIKP_READ
If you check the output return parameters, there is more than you can expect to read about a delivery document.
I will only read the delivery header document for simplicity of this ABAP tutorial.
What makes it easy to read archived delivery document from archive is to use only the delivery number VBELN as input to the ABAP function module call.
Define a new borident type structure and assign the delivery number to the OBJKEY field of the borident structure.
Then pass this variable as input value for i_borident parameter of the ASH_RV_LIKP_READ function module.
That's all
I implemented the Exceptions otherwise if the delivery document cannot be found in the archive, the function module displays a popup screen to display the exception message. Since this code will run as a background program, I did not wanted the ABAP report to display messages in dynpro.
You can test the ABAP function module ASH_RV_LIKP_READ in action using SE37 tcode Test Function Module screen too. Here is what I got as output.
How to read LIKP delivery document from archive in SAP using ABAP function module
Although it is possible to use the ASH_RV_LIKP_READ ABAP function module using I_ARCHIVEKEY and I_OFFSET input parameters, it requires more steps to fetch these values for each delivery document number and its positions.
First SAP table AIND_STR1 (Archive Info Structures) has to be queried for a valid archive info structure for SAP standard RV_LIKP object type. Then AIND_STR2 table should be filtered for GENTAB field which returns the "Table where an archive information stucture is stored"
After finding the name of the archive table where the related archived data is stored, this table can be searched for the related key and offset data using the delivery document number VBELN and the POSNR item position.
Here is an other ABAP sample code.