# Role Concept

## Displaying Error Messages that May Occur When Standard Items Are Copied

| The user USER1 is permitted to copy items when logged into the system owing to his or her assignment to a job function. This access privilege does not apply to standard parts (which can be identified in this example by their STD prefix). If the user tries to copy a standard part, the LogiView procedure CUS_TASK/ItemCopy generates an error message unless the user USER1 has also been assigned to the group STANDARD (which you may have to create first).
| In the logic model CUS_TASK, create the ItemCopy procedure with the following parameters:
| Variables of the procedure
    EP_COUNT I 0 0

    EP_ALL_OKAY L

    EP_PART_ID  S Item identifier
    LogiView Procedure CUS_TASK/ItemCopy

    10 C -- Get the ID of the item to be copied

    20 EP_PART_ID = sel_string("T_MASTER_DAT.PART_ID",actual)

    30 C -- If the item is a standard item (prefix STD), then

    40 C -- it may only be copied by members of group DEVELOPMENT.

    50 if (strpart(EP_PART_ID,1,3)== "STD")

    60     EP_COUNT = sel_value(count("T_GRP_USR.C_ID"),

                             "T_GROUP.C_NAME"="STANDARD"&

                              "C_ID_1"=:"T_GROUP.C_ID"&

                              "C_ID_2"=:"T_USER.C_ID"&

                              "T_USER.C_NAME"=user())

    70         if (EP_COUNT == 0)

    80            put("A standard item can only be copied by members

                       of group STANDARD.")

    90            C -- Return with 'exit' to generate an error

    100           exit()

    110        endif

    120 endif
| LogiView Documentation