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: 

Table Maintenance Generator

Former Member
0 Kudos

Hi Experts

              In Table Maintenance Generator i have maintained two entries-one for each material number. The entries are automatically being sorted on material number in ascending order. I do not want this to happen and would like the entries to be in the same order as i have created. While debugging i have seen that there is a table TOTAL that is automatically being sorted in ascending order and passing it to EXTRACT which is showing up on the TMG screen. Can you please provide suggestions as to how to achieve this requirement.

Thank you in advance.

Regards,

Divya.

16 REPLIES 16

maulik
Contributor
0 Kudos

Diya,

Do note that a table read such as select statement does not guarantee that the fields will be retrieved in the order they were created or entered in the DB. If you want to achieve this, you have to track the date and time explicitly in the DB table and make this part of your primary key for table maint to work as expected.. Another way is to not have date and time as a primary key and develop a custom program for DB maintenance.

You should create a template for such things so you can reuse them as needed. Doesn't take more than an hour or two to create one.

Jelena
Active Contributor
0 Kudos

Table entries are presented in their primary key order. I'm not aware of any functionality in standard table maintenance generator to change that (not sure it'd be a good idea). I'd suggest to write a custom program, although this seems like either an odd requirement or a poor table key choice...

tomas_talpa
Active Contributor
0 Kudos

As pointed above by Maulik, you will need some timestamp field to be able to sort the data; however, besides writing your own custom transaction/program, you can also use Maintenance Generator Events modification -- for nice intro see wiki EVENTS IN TABLE MAINTENANCE - ABAP 开发 (ABAP Development) - SCN Wiki.

TomT

Jelena
Active Contributor
0 Kudos

Tomas, which event would handle sorting then - 'Event 26 before displayed data is output in a list' ? Also - is there any risk if maintenance dialog gets regenerated in SE11?

Thank you.

0 Kudos

Unless I'm mistaken, Jelena, event 26 is actually for printouts. I would go with event AA "Instead of the Standard Data Read Routine", where the data are read from db (this event is replacing the standard logic, so easy way is just copy the standard routine and modify the sorting of table TOTAL).

As for the regeneration -- thankfully, regeneration does not affect events, only user interface (that's also the reason why there are so many checkboxes allowing you precisely specify which part of maintenace UI you want to modify, i.e. to prevent overwritting of modifications).

TomT

0 Kudos

ugh, just realised that I forgot to point to SAP documentation as well (which is actually quite usefull & extensive in this case), so here it is: Extended Table Maintenance Events - BC - Generate Table Maintenance Dialog - SAP Library.

Jelena
Active Contributor
0 Kudos

Thanks for the link. I checked the documentation before posting but found it a bit confusing actually. I picked the 26 one just because it seemed to match PBO ("before output") event by description. But the documentation is rather vague on this. "Output" could mean both screen and print output. The first possible use listed for this event is "Change table/view field display format", which seems exactly the case. If it's for printing only then documentation should just say so. Oh well, unambiguous and detailed official SAP documentation - whom am I kidding? Pigs will fly sooner...

Former Member
0 Kudos

Thank you for all,

  First i give one set of materials and hit enter it will get below details.Actually I had use the event 05 for getting the above details. And here I have used one button for modify (button can be seen in change view), and logic for modify and save return in process before output.

So, the problem is when I give one set of material no issues but when I was giving two set of material and click on save and getting back it messing up all the details can be seen in below screen shot:

0 Kudos

In capture2 we can see the problem.

0 Kudos

I'm sorry, Divya, but may you please rephrase your question? I didn't get it at all...

...what did you try to achive? what is the code you put into event 05 "When Creating a New Entry"?

Pragnesh_7se7
Participant
0 Kudos

Hi Divya,

Is it necessary to  make material as a key field ?, if you put serial number as a key field you can put material number as you want and at save time put validation for duplication in material field,

and it is better first you create view for table and then create maintenance view.

0 Kudos

Hi Patel,

What is purpose of creating view??

0 Kudos

HI Patel,

          I have created one ref_material with that reference material i am sorting no problem but the is with deletion its not deleting all the entries..

thank you.

0 Kudos

If you create view and then create maintaince view you can get Total and Extract both as a table not a string in debug mode.

0 Kudos

using events in table maintainance generator you can delete all materials, just find indicator of deletion flag in debug mode in EXTRACT or TOTAL table and delete all other lines with same material no.

Former Member
0 Kudos

hi divya shree,

if u do not want to sort the records automatically then make use of TMG events.

so that it will be executed before and after u create records o TMG.

Regards,

Jagadishan Mudaliyar