This framework is based on two new features available on SAP NetWeaver Application Server since release 6.10:
- Persistence Services
- Ability to include string and binary string fields in the transparent tables
Persistence Services introduction
The first feature, Persistence Service, allow developers to abstract from OpenSQL instructions, allowing to create, wizard based, an object oriented layer that represents all Dictionary tables. This layer interacts with these tables using classics OpenSQL commands, grouping all changes in update tasks, increasing consistency and load balancing on the SAP NetWeaver Application Server.
For more informations please follow this link: http://help.sap.com/saphelp_nw2004s/helpdata/en/ab/9d0a3ad259cd58e10000000a11402f/frameset.htm
String and XString in transparent tables
The second feature replace the old method of using fields LCHR and LRAW (preceded by an INT2 field), making it possible to store strings of any size in the underlying database.
What I’ve created
Leveraging these two technologies, I’ve created a small framework, that allow our developers to quickly and simply save all file types without the need to use “ArchiveLink” (that need always the business object to link it with the stored file, and that need a storage system), and without the need to save the file on the Application Server filesystem.
The file is stored in one custom table called ZARCHIVE_CENTRAL, togheter with some informations regarding the file.
For example you want to save an mp3 file on the SAP NetWeaver Application Server.
Simply you run the report ZARCHIVE_INS_TEST, select the file and enter an unique ID (in your programs you can generate this ID with the best logic needed).
The file is loaded into the SAP NetWeaver AS, and is compressed with the standard SAP zip utility class, in order to occupy as little space as possible.
The following image show the central table with the file uploaded:
It is time to get our file and listening our music!
Simply you run the report ZARCHIVE_GET_TEST, and you chose the unique ID of the file in the repository (2 in this case).
The system ask you the position where to download the file as shown below:
And now you can listen your favorite music! 🙂
How to use
First you download and import the nugget using SAPLink.
Following there are all objects involved with this development:
Then, it is recommended to reorganize the imported repository objects as shown below:
Finally, simply follow the guide lines of the two test reports on how to use the framework.
NOTE: all methods are exposed by the business object class ZCL_B_ARCHIVE_CENTRAL. You shouldn’t touch anything in the persistence classes (this layer is auto-generated).
ZCL_B_ARCHIVE_CENTRAL give you the most used CRUD operations to make all changes you may need, performing all necessary consistency checks (unique IDs, existence of a record, etc.) and also a lock object is available in order to avoid user conflicts.
How to download
Do you want to collaborate in this project? Join us on GitHub.
Comments, real business cases and suggestions are really appreciated!
New features will came in next releases.
As from SAP NetWeaver Application Server 6.10