SELECT FOR UPDATE
When you’re going to modify existing records of a database table it is common to first SELECT
them to see how they are and only then UPDATE
them with what they will be.
When you’re going to modify existing records of a database table it is common to first SELECT
them to see how they are and only then UPDATE
them with what they will be.
Did you know that, if you SAP is recent enough, you can use complex ABAP expressions in the middle of SQL commands?
When you try to insert a record with a key which already exists in the table the program dumps. This, in some cases, is not desirable because, even if you don’t care, it forces you to check if the keys already exist before trying to insert then. But ABAP has a solution for these situations: INSERT dbtab FROM TABLE itab [ACCEPTING DUPLICATE KEYS]. Don’t worry because this will not violate the first law of thermodynamics: the duplicate records are not inserted.
We’ve all sorted internal tables to use AT NEW on a LOOP. But starting from 7.40, we can use GROUP BY on LOOPs.
The ability to group by values based on expressions or even methods is great.
The grouping is done on the first LOOP and can be processed afterwards. Try running the code below and I bet you’ll be as impressed as I was.
And that’s it really. That’s the whole tip right there at the title. This has always been right under your nose but you probably never thought about it: you can save variants in SE16N. And they can even be user-specific. So useful and so little known. Thank you Sérgio Fraga for the tip. Thank you Cloudtail for the photo. Greetings from Abapinho.
A long time ago transaction SE17 was used to look at database tables content. They quickly felt ashamed and decided to improve it, creating SE16. When ALV was invented, SE16N was released (although until today many people still use SE16, go figure!).
Today I present you SE16H.