需求:
1、通过F4快捷按钮查询物料主数据时,在查询界面增加已删除/冻结物料点选按钮(如上图)
2、系统默认不点选已删除/冻结物料,查询结果不包括已删除和已冻结物料;当用户点选已删除/冻结物料时,查询结果包括已删除和已冻结物料。
3、当物料主数据MARA-MATNR的跨工厂物料状态MARA-MSTAE为非空时表示该物料已经冻结
4、当物料主数据MARA-MATNR的MARA-LVORM字段为“X”表示该物料已删除
实现:
首先找到帮助
MM01下,F1查看计算设置
双击帮助MAT1
默认:
点击查找物料编号的帮助
进入编辑状态,需要basis提供key
点击table field:
勾选需要的字段点击复制
返回到上一层,将需要的字段添加进去:
激活后如下:
上面的方法其实是修改了标准视图,其实不是很建议
可以自己建帮助,然后配置的时候把自建的帮助添加进去,修改应该是最小的,如下:
为了达到最开始的目的,冻结和删除在一个框中确定,需要自己写代码
首先创建帮助
这个FM的参数是固定的,可以从其他地方copy(有时候写上FM名字直接双击就能自动创建,我的系统双击没反应,所以从别的地方copy过来的)
里面初始代码页是固定的
我自己添加的:
对这个函数不是很熟悉
通过debug发现把 删除标记 值赋给了Shlp-selopt表
然后配置自建帮助,需要basis给key
在MAT1_A中添加自建帮助
进入编辑模式,分配参数
一般会有默认的,推荐字段,可以修改,比如仅仅保留物料,也可以直接点击复制按钮
激活后执行如下:
附:FM内代码
FUNCTION zcom_se_f4_help_exit.
*"--------------------------------------------------------------------
*"*"本地接口:
*"
*"
*"
*"
*"
*"
*"--------------------------------------------------------------------
************************************************************************
* This function module is designed to be used as a Search Help Exit
* within Search Help definitions in the ABAP dictionary.
*
* The function module incorporates a generic integration of the Search
* Engine Service (SES) into the F4 Search Help concept. Thus the F4
* Search Help integration for TREX-based searching can be done just by
* declaration, without further programming.
*
* Please read (click on!) "Function Module Documentation"
*
* Used template: F4IF_SHLP_EXIT_EXAMPLE (for more docu read there)
************************************************************************
*"----------------------------------------------------------------------
* STEP SELONE
*"----------------------------------------------------------------------
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.
* Note:
* 'SELONE' is not processed for nested collective searchhelps.
* Therefore form STEP_SELONE is processed as well at 'PRESEL1'.
* There, obsolete elementary search helps can still be deactivated,
* although the actual search help is already an elementary one.
** Generic function module for F4 search help exit
** Delete inactive ESH search helps
*
*
*
*
*
*
*
*
**
*
*"----------------------------------------------------------------------
* STEP PRESEL
*"----------------------------------------------------------------------
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
*"----------------------------------------------------------------------
* STEP SELECT
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
**
*
ENDFUNCTION.