Application Development and Automation 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: 
Read only

Avoid hard coding in exits

Former Member
0 Likes
1,249

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
Read only

Former Member
0 Likes
1,078

Anybody, any ideas on this?

Read only

former_member194965
Active Participant
0 Likes
1,078

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.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,078

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.

Read only

0 Likes
1,078

Thanks Sandra - that was a good suggestion.

Read only

Former Member
0 Likes
1,078

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

Read only

0 Likes
1,078

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