Skip to Content
avatar image
Former Member

ABAP OO Interface for DB Access

Hello guys,

I'm searching for a best practice solution for accessing Z-Tables. My idea is to create an Interface for the CRUD operation, which can be used for all tables.

Maybe there is even a possibility to generate this class for new Z-Tables.

IF_DB_CRUD

create, update, delete, read

What about using "type ref to data" or "type data" as import/export structure?

And what about "mass" activities (deleting, creating several entries)?


Regards

Christopher

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 21 at 09:25 PM

    Ditto to Matthew’s answer. I have thought about it but don’t see much benefit. The added complication to make it generic negate the benefits - because now every developer is forced to use references or whatever. By hardcoding the IO parameters we make it easier for devs to just do a data(foo) = zcl_foo_db->read( ‘123’ ).

    So explicit classes for me are a trade off in the developer’s favour. Persistent classes did a nice job of generating it for you, and I could also add object specific code in there, but they have sadly not kept up with the times.

    Another idea is to go for BOPF. It’s a beastly framework but oh so versatile.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22 at 05:30 PM

    Hi,

    If you want a good point of reference, take a look at report adbc_demo.

    Update: Please see the comments for constraints and caveats.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 21 at 08:45 PM

    There was the persistence framework, but nowadays, I create a class for handling CRUD with the SQL in various methods. including those for mass operations.

    Add comment
    10|10000 characters needed characters exceeded