We currently have a requirement to prevent users issuing materials to orders of a certain type via transaction MB1A, unless they have the correct authorisation in one of their assigned roles.
So far I've managed to achieve this using a CO validation (defined in transaction OKC7) which calls exit U100, part of form pool ZGGBR000. The code I have in this exit currently looks like this:
FORM u100 USING b_result. AUTHORITY-CHECK OBJECT 'I_AUART' ID 'IWERK' FIELD '1000' ID 'AUFART' FIELD 'ZHI1'. IF SY-SUBRC = 0. B_RESULT = B_TRUE. ELSE. B_RESULT = B_FALSE. ENDIF. ENDFORM.
This code currently works for order type ZHI1, but is obviously very rudimentary as I'm a functional consultant rather than an ABAPer. What I'd like to achieve is to avoid hard-coding the order type, by passing the type of the current order into the exit from the validation. How would I go about achieving this?
Alternatively, is there a way for the exit to retrieve the current order type itself? This can be achieved in the validation transaction by just referencing the field CAUFV-AUART, but I'm not sure how to achieve this in ABAP.
Any help or guidance would be greatly appreciated.