Skip to Content
0
Former Member
Dec 12, 2006 at 08:12 AM

USR05 table - used in include MV50AFZ1

666 Views

Hi All!

I have to allow the Post Goods Issue for one user and one specific plant. To do this:

1. I created one parameter ID which value is the Plant where the user have to be authorized to post goods.

2. I created two roles; the first has the authorization only for activity display for movement type in all Plants, the second has the authorization for activity create and change for movement type 601 in the same Plant as the parameter value created and set in SU01.

3. In the MV50AFZ1 include i writed the code:

-


TABLES : nast , usr05 .

DATA zparva TYPE XUVALUE.

DATA duplicate TYPE char1 .

CLEAR duplicate.

CLEAR zparva.

SELECT * INTO nast FROM nast UP TO 1 ROWS

WHERE objky = xlikp-vbeln

AND vstat = '1'

AND kappl = 'V2'

AND kschl = 'LD00'

AND aktiv = space.

ENDSELECT.

IF sy-subrc = 0.

duplicate = 'X'.

ENDIF.

SELECT SINGLE parva FROM usr05 INTO zparva

WHERE bname = sy-uname

AND parid = 'ZIG'.

IF xlikp-lfart = 'LF' OR xlikp-lfart = 'LR' .

IF sy-tcode NE 'VL01N'.

CASE zparva.

WHEN 'MM10'.

IF duplicate = 'X' AND xlips-werks NE zparva.

MESSAGE E228 .

ENDIF.

WHEN OTHERS.

IF xlips-werks NE zparva.

MESSAGE E228 .

ENDIF.

ENDCASE.

ENDIF.

ELSEIF xlikp-lfart = 'NL' .

IF xvbuk-wbstk NE 'C' AND sy-tcode NE 'VL01N'.

IF sy-tcode EQ 'VL02N'.

CASE zparva.

WHEN 'MM10'.

IF duplicate = 'X' AND xlips-werks NE zparva.

MESSAGE E228 .

ENDIF.

WHEN OTHERS.

IF xlips-werks NE zparva.

MESSAGE E228 .

ENDIF.

ENDCASE.

ENDIF. ENDIF. ENDIF.

-


Now, I have one problem: when I select the value for the parameter ID ZIG....it is not selected any value.

Could you help me?

If you have a better solution for the business request which i tried to solve, please tell me.

Thanks allot.

Florina C