项目背景:
有个销售BOM的,需要了解替代料和其它信息,必须PMC的人才知道更改或删除哪些销售订单的组件。但是不能让PMC的人员看到价格。
更改的地方:
1.下图的红色框内
2.抬头和行项目的条件页签
实际动手:
项目比较急,直接做的隐式增强,在进去的时候,给个提示。方便后面的人通过权限对象查找到更改的地方。
MESSAGE ‘没有权限查看金额,检查权限对象:ZVA03‘ TYPE ‘S‘ DISPLAY LIKE ‘W‘.
1.SU21创建权限对象,权限对象名称为ZVA03,这个不会的,另行百度。
2.条件页签和组件屏幕,通过下面方法查找,其实在找条件页签的增强点的时候,还找到了出口,但是这个需求在出口处设置会有个BUG,懒得想办法了,这里就不提了,还是一样做的隐式增强。
3.条件页签抬头,和销售订单抬头的净价,先按F1找到屏幕字段、屏幕等信息。然后到se51,通过程序名和屏幕编号,查找增强点例如:
更改点:
下图的红色框框处,就是条件页签的增强出口。查找方法看上面,这里直接写更改点。
1.进入SE38,打开LV69AF01,
*----------------------------------------------------------------------* ***INCLUDE LV69AF01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form TCTRL_KONDITIONEN_INIT *&---------------------------------------------------------------------* FORM tctrl_konditionen_init. *{ INSERT S4DK908533 1 DATA: lv_check_va03 TYPE c. AUTHORITY-CHECK OBJECT ‘ZVA03‘ ID ‘ACTVT‘ FIELD ‘03‘. IF sy-subrc EQ 0. lv_check_va03 = ‘X‘. ENDIF. * *} INSERT DATA: da_tfill LIKE sy-tabix. * Refresh table control if screen number has changed STATICS: last_dynnr TYPE dynnr. IF sy-dynnr NE last_dynnr AND gf_called_by_lord IS INITIAL. last_dynnr = sy-dynnr. REFRESH CONTROL ‘tctrl_konditionen‘ FROM SCREEN sy-dynnr. ENDIF. DESCRIBE TABLE xkomv LINES da_tfill. * if not in display mode, offer blank line at the bottom IF trtyp_i NE ‘A‘. da_tfill = da_tfill + 1. ENDIF. tctrl_konditionen-lines = da_tfill. tctrl_konditionen-top_line = xkomv_tabix_zeile_1. * set title for table control tc_title = TEXT-001. * Check if CPE is used DATA: lv_cpe_is_used TYPE boolean. CALL FUNCTION ‘CPE_ERP_CHECK_IF_USED‘ EXPORTING iv_application = komk-kappl iv_knumv = komk-knumv iv_kposn = komp-kposn IMPORTING ev_cpe_is_used = lv_cpe_is_used. IF lv_cpe_is_used = ‘ ‘. READ TABLE xkomv WITH KEY krech = gc_commodity. IF sy-subrc NE 0. lv_cpe_is_used = ‘-‘. ENDIF. ENDIF. * Check if CPF is used DATA: lv_cpf_is_used TYPE boolean. DATA: lr_prc_switches TYPE REF TO if_prc_switches. lr_prc_switches = cl_prc_switch_check=>get_instance( ). IF lr_prc_switches->mv_log_prc_sfws_cs_617 EQ abap_true. READ TABLE xkomv WITH KEY is_cpf_enabled = ‘X‘. IF sy-subrc IS INITIAL. lv_cpf_is_used = abap_true. ENDIF. ENDIF. * hide columns at header condition screen DATA: acol TYPE cxtab_column. LOOP AT tctrl_konditionen-cols INTO acol. * Commodity pricing related columns IF acol-screen-name EQ ‘FA_DTL_PB‘. IF lv_cpe_is_used = ‘-‘. acol-invisible = 1. ELSE. acol-invisible = 0. ENDIF. IF lr_prc_switches->mv_log_prc_sfws_cs_617 EQ abap_true AND lv_cpf_is_used = abap_true. acol-invisible = 0. ENDIF. ENDIF. IF acol-screen-name EQ ‘CPET_SD_SAPGUI-TRAFFIC_LIGHT‘. IF lv_cpe_is_used NE ‘X‘ OR komp-kposn IS INITIAL. acol-invisible = 1. ELSE. acol-invisible = 0. ENDIF. ENDIF. * base unit of measure or conversion factors IF acol-screen-name EQ ‘KOMV-KUMZA‘ OR acol-screen-name EQ ‘RV61A-MEINS‘ OR acol-screen-name EQ ‘KOMV-KUMNE‘ OR acol-screen-name EQ ‘RV61A-KMEI1‘. IF komp-kposn IS INITIAL. " header level acol-invisible = 1. " invisible ELSE. " item level acol-invisible = 0. " visible ENDIF. ENDIF. * additional condition text IF acol-screen-name EQ ‘RV61A-KNBTXT‘. IF komk-kappl = ‘M‘. ASSIGN COMPONENT ‘KNBTXT‘ OF STRUCTURE komv TO <knbtxt>. IF sy-subrc = 0. ASSIGN COMPONENT ‘KNBTXT‘ OF STRUCTURE *komv TO <knbtxt_old>. acol-invisible = 0. ELSE. acol-invisible = 1. ENDIF. ELSE. acol-invisible = 1. ENDIF. ENDIF. *{ INSERT S4DK908533 2 IF sy-tcode EQ ‘VA03‘ OR sy-tcode EQ ‘VA02‘. IF lv_check_va03 EQ ‘‘ AND sy-dynnr EQ ‘6201‘." * IF sy-uname EQ ‘IT0003‘. acol-invisible = 1. * ENDIF. ENDIF. ENDIF. * *} INSERT MODIFY tctrl_konditionen-cols FROM acol INDEX sy-tabix. ENDLOOP. ENDFORM. "tctrl_konditionen_init
2.LV69AO03
*----------------------------------------------------------------------* ***INCLUDE LV69AO03 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module FELDAUSWAHL OUTPUT *&---------------------------------------------------------------------* MODULE feldauswahl OUTPUT. DATA: mpool LIKE sy-repid, dyngr LIKE sy-dyngr, loop(3) VALUE ‘LOO‘. * suppression of certain fields (if desired) DATA: mgame_no_display TYPE i, netwr_no_display TYPE i, mwsbp_no_display TYPE i. DATA: lv_acc_on(1) TYPE c. "accesibility mode *-> MMBSI P2P * DATA: l_ccm_srm_active TYPE xfeld. *<- MMBSI P2P * evaluate distinct bits from bit area GET BIT 1 OF gv_no_display INTO mgame_no_display. GET BIT 2 OF gv_no_display INTO netwr_no_display. GET BIT 3 OF gv_no_display INTO mwsbp_no_display. * translate KBFLAG into KONVFLAG IF sy-loopc NE 0 OR sy-dynnr = ‘0640‘. CALL FUNCTION ‘SD_BITS_TO_WORKAREA‘ EXPORTING i_bits = komv-kbflag i_wa_type = ‘KONVFLAG‘ IMPORTING e_workarea = konvflag EXCEPTIONS OTHERS = 0. ENDIF. * fcode used to turn off field selection (used for test issues, only) IF flag-no NE space. IF sy-stepl EQ sy-loopc. CLEAR flag-no. ENDIF. EXIT. ENDIF. mpool = sy-repid. dyngr = sy-dyngr. ENHANCEMENT-POINT FELDAUSWAHL_02 SPOTS ES_SAPLV69A . *$*$-Start: FELDAUSWAHL_02----------------------------------------------------------------------$*$* ENHANCEMENT 2 DIMP_GENERAL_SAPLV69A. "active version ** * * " enhance FDE functionality * DATA: lv_disp TYPE c VALUE ‘‘, * lv_trtyp TYPE t180-trtyp. * CALL FUNCTION ‘MILL_SE_ENHANCE_FDE_CHK_ACTIVE‘ * EXCEPTIONS * FDE_ACTIVE = 1 * OTHERS = 2. * IF SY-SUBRC = 1. * CALL FUNCTION ‘MILL_SE_MAINTAIN_ENH_FDE‘ * EXPORTING * IF_TASK = ‘R‘ * IF_POSNR = komp-kposn ** IS_ENH_VBAP = ** TABLES ** T_ENH_VBAP = * EXCEPTIONS * ITEM_EXIST = 1 * OTHERS = 2. * IF SY-SUBRC = 1. * lv_trtyp = trtyp_i. * TRTYP_I = ‘A‘. "changing the transaction type for the initial lines * ENDIF. * ENDIF. ENDENHANCEMENT. *$*$-End: FELDAUSWAHL_02----------------------------------------------------------------------$*$* "Get accessability mode CALL FUNCTION ‘GET_ACCESSIBILITY_MODE‘ IMPORTING ACCESSIBILITY = lv_acc_on EXCEPTIONS ITS_NOT_AVAILABLE = 1 OTHERS = 2. * dynpro modifications according SY-DYNGR *{ INSERT S4DK908533 1 DATA: lv_check_va03 TYPE c. AUTHORITY-CHECK OBJECT ‘ZVA03‘ ID ‘ACTVT‘ FIELD ‘03‘. IF sy-subrc EQ 0. lv_check_va03 = ‘X‘. ENDIF. * *} INSERT LOOP AT SCREEN. ENHANCEMENT-POINT FELDAUSWAHL_01 SPOTS ES_SAPLV69A. *$*$-Start: FELDAUSWAHL_01----------------------------------------------------------------------$*$* ENHANCEMENT 1 FSH_LV69AO03_01. "active version IF screen-name = ‘KOMP-KBMENG‘ AND komk-kappl = ‘M‘. screen-invisible = 1. screen-active = 0. ENDIF. IF screen-name = ‘KOMP-CNFM_QTY‘ AND komk-kappl = ‘V‘. screen-invisible = 1. screen-active = 0. ENDIF. ENDENHANCEMENT. ENHANCEMENT 5 OIC_SAPLV69A. "active version * Dynamic control of F&A specific elements "SO5K000609 MMU perform oic_feldauswahl_FA. "SO5K000609 MMU SO6K000225 KW PERFORM OIC_FELDAUSWAHL_D640. "so3k0002651 "SO5K000609 MMU ENDENHANCEMENT. *$*$-End: FELDAUSWAHL_01----------------------------------------------------------------------$*$* IF ctrl_grey IS INITIAL. * modify step loop during processing of loop lines only IF screen-group2 EQ loop. CHECK sy-stepl NE 0. * special field selection for blank lines of the loop IF rv61a-zeile_leer = ‘X‘. PERFORM feldauswahl_leere_zeilen. PERFORM userexit_field_modific_leer. ENDIF. * special field selecition for sub total lines IF rv61a-zeile_leer = ‘Z‘. PERFORM feldauswahl_zwischensumme. PERFORM authority_check USING co_origin_subtotal. PERFORM userexit_field_modific_kzwi. ENDIF. * special field selection for header subtotals IF rv61a-zeile_leer = ‘Y‘. PERFORM feldauswahl_kopfsumme. PERFORM authority_check USING co_origin_header_sum. PERFORM userexit_field_modific_kopf. ENDIF. PERFORM feldauswahl_sonderregeln. CHECK rv61a-zeile_leer EQ space. ELSE. CHECK sy-stepl EQ 0. ENDIF. * all other cases which don‘t own a useful business rule PERFORM feldauswahl_sonderregeln. PERFORM feldauswahl_subscreen. PERFORM authority_check USING co_origin_cond. PERFORM userexit_field_modification. * suppress display of quantity fields IF NOT mgame_no_display IS INITIAL. IF screen-name EQ ‘KOMP-MGAME‘ OR screen-name EQ ‘KOMP-VRKME‘. screen-active = 0. ENDIF. ENDIF. * suppress display of net value fields IF NOT netwr_no_display IS INITIAL. IF screen-name EQ ‘KOMP-NETWR‘ OR screen-name EQ ‘KOMK-WAERK‘. screen-active = 0. ENDIF. ENDIF. * suppress display of tax fields IF NOT mwsbp_no_display IS INITIAL. IF screen-name EQ ‘KOMP-MWSBP‘. screen-active = 0. ENDIF. ENDIF. ELSE. * suppress output if no display is desired screen-input = 0. ENDIF. *{ INSERT S4DK908533 2 IF sy-tcode EQ ‘VA03‘ OR sy-tcode EQ ‘VA02‘. IF lv_check_va03 EQ ‘‘."AND sy-dynnr EQ ‘6201‘. * IF sy-uname EQ ‘IT0003‘. CASE screen-name. WHEN ‘KOMP-NETWR‘ OR ‘KOMK-WAERK‘ OR ‘KOMP-MWSBP‘. screen-active = 0. WHEN OTHERS. ENDCASE. * ENDIF. ENDIF. ENDIF. * *} INSERT *-> MMBSI P2P *- Enhancements in EHP4 for "Central Contract Management" * IF cl_ops_switch_check=>mm_sfws_ui_p2pse( ) = abap_true. PERFORM feldauswahl_ccm. ENDIF. * Quantity Adjustment related field selection logic IF cl_prc_switch_check=>get_instance( )->mv_log_prc_sfws_cs_617_03 = abap_true. PERFORM field_selection_qty_adjustment. ENDIF. MODIFY SCREEN. ENDLOOP. CLEAR rv61a-zeile_leer. ENHANCEMENT-POINT FELDAUSWAHL_03 SPOTS ES_SAPLV69A . *$*$-Start: FELDAUSWAHL_03----------------------------------------------------------------------$*$* ENHANCEMENT 3 DIMP_GENERAL_SAPLV69A. "active version * *IF lv_trtyp IS NOT INITIAL. * trtyp_i = lv_trtyp. *ENDIF. "resetting the transcation type ENDENHANCEMENT. *$*$-End: FELDAUSWAHL_03----------------------------------------------------------------------$*$* ENDMODULE. "feldauswahl OUTPUT *&---------------------------------------------------------------------* *& Module KOT_FIRST OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE kot_first OUTPUT. PERFORM kot_init. PERFORM kot_first. ENDMODULE. "kot_first OUTPUT *&---------------------------------------------------------------------* *& Module FELDAUSWAHL_2 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE feldauswahl_2 OUTPUT. PERFORM fieldselection_log. ENDMODULE. " FELDAUSWAHL_2 OUTPUT
3.MV45AF0V_VBKD_INCO2_HIDE
*&---------------------------------------------------------------------* *& Include MV45AF0V_VBKD_INCO2_HIDE *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form VBKD-INCO2_HIDE *&---------------------------------------------------------------------* *& In the absence of Incoterm switch, hide INCO2 field *&---------------------------------------------------------------------* FORM vbkd-inco2_hide USING c_tctrl TYPE any. FIELD-SYMBOLS <fs_columns> TYPE scxtab_column_it. ASSIGN COMPONENT ‘COLS‘ OF STRUCTURE c_tctrl TO <fs_columns>. *{ INSERT S4DK908533 1 * dev3 tyh 2021年6月23日增加 DATA: LV_CHECK_VA03 TYPE C. AUTHORITY-CHECK OBJECT ‘ZVA03‘ ID ‘ACTVT‘ FIELD ‘03‘. IF SY-SUBRC EQ 0. LV_CHECK_VA03 = ‘X‘. ENDIF. * *} INSERT IF <fs_columns> IS ASSIGNED. LOOP AT <fs_columns> ASSIGNING FIELD-SYMBOL(<fs_column>). *{ INSERT S4DK908533 2 IF sy-tcode eq ‘VA02‘ OR SY-TCODE EQ ‘VA03‘. IF LV_CHECK_VA03 EQ ‘‘. "有该权限时,隐藏金额等字段 CASE <fs_column>-screen-name. WHEN ‘KOMV-KBETR‘ OR ‘VBAP-NETPR‘ OR ‘VBAP-NETWR‘. IF <fs_column>-invisible = ‘‘. MESSAGE ‘没有权限查看金额,检查权限对象:ZVA03‘ TYPE ‘S‘ DISPLAY LIKE ‘W‘. ENDIF. <fs_column>-invisible = ‘X‘. WHEN OTHERS. ENDCASE. ENDIF. ENDIF. * *} INSERT IF <fs_column>-screen-name EQ ‘VBKD-INCO2‘. <fs_column>-invisible = ‘X‘. ENDIF. ENDLOOP. ENDIF. ENDFORM.
4.SD_SEPA_VA_009,这里是在循环里面,省去了变量的定义。
*&---------------------------------------------------------------------* *& Include SD_SEPA_VA_009 *&---------------------------------------------------------------------* *{ INSERT S4DK908533 1 IF screen-name = ‘VBAK-NETWR‘. IF sy-tcode EQ ‘VA03‘ OR sy-tcode EQ ‘VA02‘. AUTHORITY-CHECK OBJECT ‘ZVA03‘ ID ‘ACTVT‘ FIELD ‘03‘. IF sy-subrc NE 0. * IF sy-uname EQ ‘IT0003‘. screen-active = 0. screen-invisible = 1. modify screen. * ENDIF. ENDIF. ENDIF. ENDIF. * *} INSERT if screen-GROUP1 = ‘MDT‘. if l_sd_sepa_exit IS BOUND. CALL BADI L_SD_SEPA_EXIT->SD_SEPA_VA_009 EXPORTING IS_VBAK = vbak IS_VBAP = vbap IT_XVBPA = xvbpa[] IMPORTING PV_ICON_STATUS = icon_status PV_SD_SEPA_STATUS_TXT = sd_sepa_status_txt CHANGING CS_VBKD = vbkd CS_SCREEN = screen. else. if screen-GROUP1 = ‘MDT‘. screen-active = 0. screen-invisible = 1. modify screen. endif. endif. endif.