UF with Macro to change value of Read Only field Answered

ERE

 Hi

 Used B1UP to apply a more simplistic approval procedure to PO's.

The OPOR.Confirmed (item 136) is set to read only (B1UP Read only) for all except those that can approve doc.

For exceptions (such as Sample PO's at zero val) I have a a Validation Config that calls UF macro to set the Item136 value to "Y", however, I found through testing that the macro will only works for those whom are excluded from the "read only" rule.

Is there a way that the macro can change the value for the b1UP read only field across all users?

B1 Validation Configuration,

IF($[OPOR.DocTotal]) = 0

BEGIN SELECT 'Approve' FOR BROWSE

END

 

 UF Macro  ("Approve")

Set($[$136.0.0]|Y)

 

Fully aware of SAP approval procedure - just far less flexible for our requirement.

 

Many thanks

SAP v9.1PL11

Comments

6 comments

  • Comment author
    Yaremi Miranda Lopez
    • Official comment

    Hello Ere,

    If you're using the Read Only functionality then you can't modify the value with a Macro. What you can do in this case is the following: Add a B1 Validation system on Form Load that executes a Macro. This macro has the command Disable($[$item.col.0]);

    In your macro, you can add the Enable($[$item.col.0]); command before your set and the Disable again after.

    You can also "play" with the user's definitions in the validations so you don't have to add this in your macros.

     

  • Comment author
    David Stegnitz

    Hi Yaremi Miranda Lopez,

    I've followed your approach and it works fine. However, if you edit any other field in the same form, or navigate from one to the next record without closing the form, the disabled field automatically gets enabled again. Would you have an advise how to avoid this?

    Thanks, David

    0
  • Comment author
    Geoff Booth

    Try switching the validation to after data load instead of form load (hopefully the resizing doesn't reload the data).

    If not, then I think you need to add a validation on the field itself to block any changes.

     

    Good luck

    0
  • Comment author
    David Stegnitz

    Hi Geoff Booth 

    Thank you for the reply. Data Load trigger does not disable the field. A validation on the field won't work, since similar to the original question in this post, I have a different macro which temporarily enables the field to update its value, and then disables it again. Basically the idea is to have a field, which can only be changed by a B1UP macro, but not by a user manually. 

    Thanks, David

    0
  • Comment author
    Geoff Booth

    Does the field need to be visible?

    If not then possibly "Hide" the field on Form Load and then add the show & hide to your set macro?

    0
  • Comment author
    David Stegnitz

    Hi Geoff Booth

    I have the issue with a field value which needs to be displayed and with a hidden button. The issue with the Button is that it can be pressed with a hot-key combination (Alt+S), so user could theoretically find a 'work-around' to bypass the validation. 

    So basically only the Macro should be able to change the field and click the button. Not the user manually. I also cannot use the 'disable item' option, as then even the Macro won't be able to enable the field. It seems I can only use a Validation, but here I got the described problem that the Validation doesn't trigger if the user navigates to the next record, or if the user changes any field on the already loaded form. 

    Any hints are appreciated. 

    Thanks, David

    0

Please sign in to leave a comment.