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: 

database sequence

Former Member
0 Kudos

Hi,

I have created a sequence in my SAP DB..We are using MAXDB database as our backend.

I have created a sequence in back end editor directly in database editor in server.

when we give query select apid_seq.nextval from dual means it will give the next value in the sequence..

Now i wrote this query in abap editor and execute it to get the maximum of sequence..but it is throwing error..

how to get the sequence through query..

can any body help me in this

2 REPLIES 2

joerg_wegener
Explorer
0 Kudos

Hi Mahesh,

in standard Open SQL ABAP you can only access fields that are defined in the ABAP DDIC. If you create something directly in the DB, bypassing the DDIC, Open SQL will not know about the field(s), which will cause an error.

From my point of view, you can do one of two things:

1. Use native SQL (EXEC SQL. ... ). However, this would make your code non-portable across different RDBMSs.

2. Use ABAP number ranges. These are the ABAP equivalent to database sequences and are portable across database systems.

I would strongly suggest to use number ranges. Have a look on help.sap.com for the details.

Kind regards, Joerg Wegener

Former Member
0 Kudos

answered