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

SD VA02 prevent user from changing fields

Former Member
0 Likes
1,248

Hi,

In VA02 with a certain sales doc. type there are users (suppose user group B)that should only be able to change the field FPLT-FAKSP (billing plan billing block).

For this i created an authorization object that can make the difference between user group A and user group B.

The only method we see is to use the user-exits in MV45AFZZ :

USEREXIT_MOVE_FIELD_TO_VBAK

USEREXIT_MOVE_FIELD_TO_VBAP

USEREXIT_MOVE_FIELD_TO_VBKD

In those exits we'll do a check on the sales doc type and auth. object. If positive we'll check if something changed on each field. (we don't use all fields ofcourse...)

f.e : if xvbak-* = yvbak-*. -->error

--> So this applies for all fields except FPLT-FAKSP

Isn't there a cleaner solution, do you have suggestions ?

Is there a certain general value set whenever something in a sales document has changed ?

with regards

1 REPLY 1
Read only

Former Member
0 Likes
536

Hi Erik,

Have you considered making the "unauthorized" fields closed for input when the authorization fails for the user? Making the "unauthorized" fields unavailable for input would prevent certain users from changing these fields (per your requirement).

You may be able to accomplish this in MV45AFZZ, USEREXIT_FIELD_MODIFICATION. We have done this in our system by checking the user's authorization in USEREXIT_MOVE_FIELD_TO_VBAK and setting a global flag zz_userprof_status = 'X' if they contain the correct authorization. We then have the following code in USEREXIT_FIELD_MODIFICATION:


if sy-tcode = 'VA02'.
  if screen-name = 'VBKD-BSTKD' or
     screen-name = 'VBKD-BSTKD_E' or
     screen-name = 'VBKD-KONDA' or
     screen-name = 'VBAP-WERKS' or
     screen-name = 'VBAP-PS_PSP_PNR' or
     screen-name = 'COBL-PS_POSID' or
     screen-name = 'FMZUOB-FONDS' or
     screen-name = 'FMZUOB-FISTL'.
    if zz_userprof_status = 'X'.
      screen-input = 1.
    else.
      screen-input = 0.
    endif.
  endif.
endif.

An alternative technique would be to use Modification V45A0003, function module EXIT_SAPMV45A_004. Both the call customer function '004' and the perform userexit_field_modification are called within PBO MODULE FELDAUSWAHL (in SAPMV45A).

<b>In your case it sounds like you would turn off (screen-input = 0) all fields except FPLT-FAKSP (screen-input = 1) for the user group that should only be allowed to change FPLT-FAKSP.</b>

If this does not work for you, I'm wondering if the values in XFPLT and YFPLT can be checked in a similar way that you propose to check XVBAK and YVBAK?

Hope this helps.

Regards,

James

Message was edited by: James Gaddis