How to get batch_no from serial_and_batch_bundle of a Stock Entry Detail?

I find it extremely difficult to get the batch number created on a Stock Entry Detail. Looks like the SABB class methods and functions does not help too much as documentation is minimal.

Not exactly what you are looking for but might help. I had a similar issue where I wanted to transfer some custom information from a Purchase Receipt to the associated Batch created. To do this I had to get the created Batch number from the associated SABB entry. Hope it might be of use.

Not creation but querying existing data created by standard transactions.

In my case I only want the code to trigger on new batch creation.
The SABB has to be created for me to find it, so the code showed how to get that from the referenced Purchase Receipt, So you should be able to adapt the code to your use case.

Nope, totally different case and dynamics. Thanks for the effort though!