Application Development and Automation 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: 
Read only

automatic increase fields

Former Member
0 Likes
655

All experts:

are there an automatic increase field in Transp. Table?

I need a field that can automatic save the record index when I insert record in customized table.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
619

You need to create a new number range object (Tcode SNRO). Then get the next sequential number using function module NUMBER_GET_NEXT in your ABAP code and insert in DB table.

5 REPLIES 5
Read only

Pramanan
Active Participant
0 Likes
619

Hi,

Use sy-tabix and sy-index , this shows how many times the loop get

executed and current position of loop

Sy-TABIX - gives the line number

SY-index - gives the current position.

sy-dbcnt - gives how many records get stored to or retrived from database

Read only

Former Member
0 Likes
619

Hi,

The indexes are activated along with the table and are created automatically with it in the database.

Regards,

Muneesh Gitta.

Read only

Former Member
0 Likes
619

Hi,

You mean to say that you have to maintain a field which autoincrements its value whenever a record is inserted.

Suppose the field is STUDENT_ID.

Whenever you are using LOOP ..ENDLOOP stmts and inserting the records, then You can pass SY-TABIX to the field STUDENT_ID. if you use DO..ENDO then go for SY-INDEX.

This is the case if you inert record by record, but if you want to insert multiple records using directly the internal table then you have to explicitly fill the column in the internal table and insert .

Reward points if helpful.

Thanks and regards.

Read only

Former Member
0 Likes
620

You need to create a new number range object (Tcode SNRO). Then get the next sequential number using function module NUMBER_GET_NEXT in your ABAP code and insert in DB table.

Read only

Former Member
0 Likes
619

Thank you very much.