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: 

Avoid hard coding in exits

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

Anybody, any ideas on this?

former_member194965
Active Participant
0 Kudos

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.

Sandra_Rossi
Active Contributor
0 Kudos

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.

0 Kudos

Thanks Sandra - that was a good suggestion.

Former Member
0 Kudos

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

0 Kudos

Thanks Wolfgang. The point that you made about TRTYP was helpful since I wasn't aware of it.