Skip to Content

VB12 - Protect a field in the Fast entry screen based on some logic/Condition.

Jan 02 at 03:42 PM


avatar image
Former Member

Based on some logic against the particular material being substituted I would like to set a particular field (Reason code) to Read only, so that it can not be changed.

I can see that when using VB13 all fields are set to read only, and it uses the same program and screens as VB12, so I'm guessing there's some setting and logic that dictates this. I would just have to change it slightly so that it allows me to just set one field to Read only when in VB12, if the condition is true.

As yet I have not come across an article/question on this same subject, and I have also not found an easy way to achieve this. I was wondering if anyone has achieved something similar.

10 |10000 characters needed characters left characters exceeded
Former Member

Probably going to use an enhancement against In clude MV13DO0D - form DUNKEL_VERARBEITEN and insert some code at the top to check the transaction code (T180-TCODE) equals 'VB12' and that the screen number (SY-DYNNR) equals '1501' and that the category is not already set to 'A' (T180-AKTYP). Then I'll read the necessary material (KONDD-SMATN) based on the knumh value (XVAKE-KNUMH) and finally check whether this material is maintained externally or not (using z table). If it is then I'll set T180-AKTYP to 'A' otherwise I'll leave it set to 'V'. That should work, I just need to get an access key to the SAP object and then add the enhancement and code. ;)

Will let you all know if it works.

* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Jelena Perfiljeva
Jan 02 at 09:37 PM

If it was a popular requirement it would've already been discussed on SCN.

It doesn't sound like a great idea, to be honest. I doubt there is a user exit/BADI for this, so essentially you have to modify/enhance SAP standard code.

Somewhere in PBO event of the screen there should be a routine that manipulates screen fields based on whether transaction is display or change type. This is usually determined by T180-TRTYP field. Shouldn't be difficult to find using debugger.

I would suggest to reconsider though. If this is just a matter of authorization (not sure how complex the logic is) then you could probably create a variant transaction (SHD0).

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Many thanks for the reply.

To answer your question, it has nothing to do with authorisation what so ever. The condition being checked is whether the material being determine is sourced in the PIM (Product Information Management) system or SAP, as some materials are managed/maintained in this external PIM system and then exported into SAP, and some are maintainable from SAP itself, as normal. I've already taken care of MM02 to ensure that if it's a PIM maintained material then any fields passed to SAP are NOT editable via MM02, and this is working just fine via an enhancement. When the material is updated or created from the PIM the material determination is also created/updated, and hence the need to not allow the user to change this data if the material is deemed PIM managed rather than SAP managed.

I'll take a look at T180-TRTYP though, thanks for that. I may need to make some klnd of enhancement for this particular request. It's doubly awkward as regardless of whether tha material being determined is sourced by tyhe PIM or SAP if they choose the option to run down stock (2nd option) then this condition should NOT be applied, as it should ONLY be applied if they choose the regular material (Immediate), option 1.


Thanks for posting more information. The goal to disable just the reason field seems a bit odd in this context. I'd understand if there was a need to disallow substitution for certain material type but just the reason... Not sure what this would achieve, really.

Just make sure to discuss all possible options with an MM/SD person before rushing in with ABAP.