‎2016 Mar 23 4:31 AM
Hello Experts
many a time, we need to write exits in the SD Sales order framework (form includes, conventional exits, badis, and so on) where we need to carry out different actions depending on create/change or on the doc category (sales order, quotation, etc.).
we end up touching the sapmv45a exists here and there and the same code gets called for all situations. in many places, people hard code transaction codes (if va01, do this; if va21, do that etc etc) in these exits to trigger different streams for various scenarios.
i Was looking for options to avoid hard coding in exits:
there are two options that I know of: T180-trtyp = H or V to track create / change mode. We can check the document category to check if its sales order or quote.
is there any other way of dealing with this that you can suggest?
regards
Arijit
‎2016 Apr 02 5:02 AM
‎2016 Apr 02 5:51 AM
Hi Arjit,
Use AUTHORITY-CHECK OBJECT.
While creating Authorization object we can maintain the fields and values.
I hope this may helpful.
Thanks,
E.Ananthachari.
‎2016 Apr 02 9:20 AM
Generally speaking (not SD especially), you may avoid hardcoding by using BRF+ (business rule framework) which provides a user interface to enter conditions externally, and decide which processing applies. Ex: in one of your user exits, you call a BRF+ rule, by passing T180, the user exit parameters, and BRF+ will route to one of your ABAP implementations. Of course, it means a lot of redesign, so you should start using it only for new features, or for redesigning problematic code.
‎2016 Apr 02 1:18 PM
‎2016 Apr 03 12:45 AM
TRTYP is good, but it may not reflect when you switch from create to change or vv inside the transaction. MM doesn't.
As for SD, you can use VBTYP for the document type rather than the TCODE. It works, too, if your company uses a Z* transaction code or if the exit gets called in mass processing.
Wolfgang
‎2016 Apr 03 5:47 AM
Thanks Wolfgang. The point that you made about TRTYP was helpful since I wasn't aware of it.