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: 

Generic data in database table

Former Member
0 Kudos

Hi,

so, it's not possible to use REF TO DATA in a database table, which's logical.

However, I'd like to save data generically. I heart of the possibility to use the description classes (abap_struct_descr etc.) to create a raw string or something, which can be saved in a database table. With this string, you can later recreate the structure/table/class/...

So, I searched for something like this about an hour now and I don't know how I can achieve, what I want.

Does anybody have an idea or a good link or something?

Thanks a lot in advance!

Kind Regards,

Michael

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hai,

You save generic data in the database table if the field type is RAW.

Check it.

Regards,

Venkat

6 REPLIES 6

Former Member
0 Kudos

Hai,

You save generic data in the database table if the field type is RAW.

Check it.

Regards,

Venkat

0 Kudos

Ok, thanks, and how can I create RAW-data in my program out of a table, a structure or something then? I didn't find a proper method in the descriptor classes.

Thanks so far

naimesh_patel
Active Contributor
0 Kudos

You can use the EXPORT / IMPORT with database for generic purpose. Table INDX has the field type LRAW which saves your data. When ever you want to get back the data you can use the IMPORT. You need to make sure, your structure remains same while Export and Import other wise, IMPORT would fail.

Like:


EXPORT tab = itab 
  TO DATABASE indx(XY) 
  FROM wa_indx 
  CLIENT cl 
  ID 'TABLE'. 

Regards,

Naimesh Patel

0 Kudos

Hi,

ok, I looked that up. But it seems that I had to create a new table with some attributes. I heart of another way (like serializing an object to a RAW which can be inserted in just one field of my own table). I think, the EXPORT/IMPORT method creates a lot of overhead!?

So, there is no way using the descriptor classes, is it?

0 Kudos

Hi Michael,

I think you are looking for [persistent objects|http://help.sap.com/saphelp_nw70/helpdata/en/d2/7849bbbec911d4b2e80050dadfb92b/content.htm]

Or what is your goal in business terms? You have an object and want to save it's current state so that it can be re-used in a follow-up transaction?

But this can not be accomplished fully generic.

The RTTS classes CL_ABAP_.._DESRC determine the description of the class definition, the result will never change depending on the current state of the object.

Regards,

Clemens

0 Kudos

Ok, my project is as follows:

I've got a distribution list type with parameters. The relationship between a distribution list and a parameter is n : m. Each parameter has got an attribute DATA_ELEMENT. My program will look up the domain values of the data element, so that we have a list of possible values. Then, you can assign values to a certain distribution list (which has got n parameters).

So, a value is assigned to a distribution list and a parameter. And its type depends on which parameter it's assigned to. Therefore, I've got the type saved in another table.

Well, at the moment, it's just a data element and a domain, so the values are strings each, but this can change soon, so that I want to accomplish a dynamic version.

Hopefully, that's clarified my problem a bit. Maybe I told you a lot of unusual information 😕

Thanks so far for your time!!