1、用户输入t-code后只展示有公司代码权限的数据
1 LOOP AT extract. 2 DATA(lv_tabix) = sy-tabix. 3 PERFORM auth_bukrs USING view_action. 4 IF sy-subrc <> 0. 5 DELETE extract INDEX lv_tabix. 6 ENDIF. 7 ENDLOOP. 8 DESCRIBE TABLE extract LINES maxlines.View Code
1 DATA:lv_actvt TYPE tact-actvt, 2 lv_sellist TYPE vimsellist. 3 CONSTANTS:lv_bukrs TYPE dd03p_d-fieldname VALUE 'BUKRS', 4 lv_actvt_display TYPE tact-actvt VALUE '03', 5 lv_actvt_change TYPE tact-actvt VALUE '02', 6 lv_actvt_create TYPE tact-actvt VALUE '01'. 7 FIELD-SYMBOLS:<fs> TYPE any, 8 <fs_bukrs> TYPE bukrs. 9 sy-subrc = 0. 10 CASE p_view_action. 11 WHEN aendern."change 12 lv_actvt = lv_actvt_change. 13 WHEN anzeigen."diaplay 14 lv_actvt = lv_actvt_display. 15 WHEN neuer_eintrag."create 16 lv_actvt = lv_actvt_create. 17 WHEN OTHERS. 18 RETURN. 19 ENDCASE. 20 21 IF lv_actvt = lv_actvt_create. 22 CHECK vim_object IS NOT INITIAL. 23 ASSIGN (vim_object) TO <fs> CASTING TYPE (vim_object). 24 ELSE. 25 ASSIGN extract TO <fs> CASTING TYPE (vim_object). 26 ENDIF. 27 28 ASSIGN COMPONENT lv_bukrs OF STRUCTURE <fs> TO <fs_bukrs>. 29 IF sy-subrc <> 0 OR <fs_bukrs> IS INITIAL. 30 RETURN. 31 ENDIF. 32 33 AUTHORITY-CHECK OBJECT 'F_BKPF_BUK' 34 ID 'BUKRS' FIELD <fs_bukrs> 35 ID 'ACTVT' FIELD lv_actvt. 36 IF sy-subrc <> 0 AND lv_actvt = lv_actvt_create. 37 MESSAGE e800(fr) WITH <fs_bukrs> . 38 ENDIF.View Code
2、点击新增按钮、校验输入数据权限
表维护生成器-->环境--->修改--->事件 新增05的子例程form
3、校验用户修改原来的数据、PAI中加代码
标签:sy,create,actvt,lv,ABAP,ENDIF,SM30,SAP,TYPE From: https://www.cnblogs.com/coderfarmer/p/16851248.html