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

Database storage problem

Former Member
0 Likes
919

Hi ,

I have created a table with two fields. the first field is of type numc and second field is of type char. I generated the maintenance view. While entering the records in sm30, it is automatically sorting out the numc field and storing it in the database.

My requirement is to store the records in the database field as per the sequence I entered in the numc field and not in a sorted manner.

I appreciate your help.

Thanks and Regards,

Gopi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
869

Hello Gopi,

You have probably answered your own question by now, but for those who might read this thread later, I thought I would try to close the loop or, if nothing else, provide some insight into how a generated Table Maintenance Dialog can be custom enhanced.

I assume that, at a minumum, the NUMC field is defined as the key field of your table, right? If that is the case, then this is the reason for the records being stored (and presented) in sorted order based on the values stored in the NUMC field.

If you really want the records to be stored and presented in the order in which you enter them, then you need to define an additional field (e.g. an Integer type field to the 'left' of the NUMC field) and make it the key field instead of the NUMC field.

Once you have done that (and regenerated your Table Maintenance Dialog) you must then implement the Table Maintenance Dialog's Save Event exit to populate that Integer field in each of the newly entered records with a unique number that is greater than the number assigned to records already stored in the table, you know what I mean?

Here is the SAP Help Portal link to the topic 'Extended Table Maintenance Events' which contains details about the Save Event (Event 01 'Before saving the data in the database') I reference above, as well as all other Events available in the Table Maintenance Dialog functionality:

http://help.sap.com/saphelp_nw70/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm

I hope this helps. Let me know.

Best Regards,

Andy

5 REPLIES 5
Read only

Former Member
0 Likes
869

Welcome to SDN, but please do not cross post:

Read only

nkr1shna
Contributor
0 Likes
869

Hi Gopi,

Have you defined key fields in the table, check once.

Best Regards,

Krishna

Read only

Former Member
0 Likes
869

I rejected the other duplicate.

Please take a moment to read the forum rules, and also note that if you dont keep to them (e.g. duplicate posting) then people tend to avoid answering them completely, because such threads typically get deleted.

Welcome to SDN though,

Julius

Read only

Sandra_Rossi
Active Contributor
0 Likes
869

Could you explain with an example of values, and what you expect exactly ? (I don't understand well)

Read only

Former Member
0 Likes
871

Hello Gopi,

You have probably answered your own question by now, but for those who might read this thread later, I thought I would try to close the loop or, if nothing else, provide some insight into how a generated Table Maintenance Dialog can be custom enhanced.

I assume that, at a minumum, the NUMC field is defined as the key field of your table, right? If that is the case, then this is the reason for the records being stored (and presented) in sorted order based on the values stored in the NUMC field.

If you really want the records to be stored and presented in the order in which you enter them, then you need to define an additional field (e.g. an Integer type field to the 'left' of the NUMC field) and make it the key field instead of the NUMC field.

Once you have done that (and regenerated your Table Maintenance Dialog) you must then implement the Table Maintenance Dialog's Save Event exit to populate that Integer field in each of the newly entered records with a unique number that is greater than the number assigned to records already stored in the table, you know what I mean?

Here is the SAP Help Portal link to the topic 'Extended Table Maintenance Events' which contains details about the Save Event (Event 01 'Before saving the data in the database') I reference above, as well as all other Events available in the Table Maintenance Dialog functionality:

http://help.sap.com/saphelp_nw70/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm

I hope this helps. Let me know.

Best Regards,

Andy