首页 > 其他分享 >物料查询F4帮助增强(添加筛选条件)----方式二

物料查询F4帮助增强(添加筛选条件)----方式二

时间:2022-10-17 10:00:29浏览次数:46  
标签:物料 lvorm F4 mara shlp ---- step callcontrol

货铺QQ群号:834508274

进群统一修改群名片,例如BJ_ABAP_森林木。群内禁止发广告及其他一切无关链接,小程序等,进群看公告,谢谢配合
不修改昵称会被不定期踢除,谢谢配合


需求:

1、通过F4快捷按钮查询物料主数据时,在查询界面增加已删除/冻结物料点选按钮(如上图)

2、系统默认不点选已删除/冻结物料,查询结果不包括已删除和已冻结物料;当用户点选已删除/冻结物料时,查询结果包括已删除和已冻结物料。

3、当物料主数据MARA-MATNR的跨工厂物料状态MARA-MSTAE为非空时表示该物料已经冻结

4、当物料主数据MARA-MATNR的MARA-LVORM字段为“X”表示该物料已删除


物料查询F4帮助增强(添加筛选条件)----方式二_主数据


这是几年前的实现方式,不知道现在是否有更多办法,仅供参考


首先创建帮助

物料查询F4帮助增强(添加筛选条件)----方式二_sed_02

这个FM的参数是固定的,可以从其他地方copy(有时候写上FM名字直接双击就能自动创建,我的系统双击没反应,所以从别的地方copy过来的)

物料查询F4帮助增强(添加筛选条件)----方式二_主数据_03


物料查询F4帮助增强(添加筛选条件)----方式二_sed_04

里面初始代码页是固定的


自己添加的:

物料查询F4帮助增强(添加筛选条件)----方式二_主数据_05

对这个函数不是很熟悉


通过debug发现把 删除标记 值赋给了Shlp-selopt表


              把 最大显示数量 赋值给了callcontrol-maxrecords

物料查询F4帮助增强(添加筛选条件)----方式二_微信_06

然后配置自建帮助 

物料查询F4帮助增强(添加筛选条件)----方式二_sed_07

MAT1_A是物料查询时各个页签的帮助

物料查询F4帮助增强(添加筛选条件)----方式二_sed_08

点进去


在MAT1_A中添加自建帮助

物料查询F4帮助增强(添加筛选条件)----方式二_sed_09

添加完后


进入编辑模式,分配参数

物料查询F4帮助增强(添加筛选条件)----方式二_sed_10

然后激活

激活后执行如下

物料查询F4帮助增强(添加筛选条件)----方式二_sed_11

参考代码

附:FM内代码

FUNCTION zcom_se_f4_help_exit.

*"--------------------------------------------------------------------

*"*"本地接口:

*" TABLES

*" SHLP_TAB TYPE SHLP_DESCT

*" RECORD_TAB STRUCTURE SEAHLPRES

*" CHANGING

*" REFERENCE(SHLP) TYPE SHLP_DESCR

*" REFERENCE(CALLCONTROL) TYPE DDSHF4CTRL

*"--------------------------------------------------------------------



DATA:

BEGIN OF str_help,

maktg TYPE maktg ,

spras TYPE spras ,

matnr TYPE matnr ,

lvorm TYPE lvorm ,

mstae TYPE mstae ,

END OF str_help.



DATA:

l_it_show LIKE TABLE OF str_help WITH HEADER LINE.

************************************************************************

* 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 (Select one of the elementary searchhelps)

*"----------------------------------------------------------------------

* 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.



IF callcontrol-step = 'SELONE' OR

callcontrol-step = 'PRESEL1'.

** Generic function module for F4 search help exit

** Delete inactive ESH search helps

* CALL FUNCTION 'ESH_F4_HELP_EXIT'

* TABLES

* shlp_tab = shlp_tab

* record_tab = record_tab

* CHANGING

* shlp = shlp

* callcontrol = callcontrol.

*

** Don't process additional STEP. ..

* RETURN.

ENDIF.



*"----------------------------------------------------------------------

* STEP PRESEL (Enter selection conditions)

*"----------------------------------------------------------------------

* 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.



IF callcontrol-step = 'PRESEL'.

ENDIF.



*"----------------------------------------------------------------------

* STEP SELECT (Select values)

*"----------------------------------------------------------------------

* 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.





IF callcontrol-step = 'SELECT'.



DATA:

l_lvorm LIKE LINE OF shlp-selopt.

CLEAR l_lvorm.

READ TABLE shlp-selopt INTO l_lvorm INDEX 1.



IF shlp-selopt IS NOT INITIAL.

SELECT

makt~maktx

makt~spras

mara~matnr

mara~lvorm

mara~mstae

FROM mara

INNER JOIN makt ON ( makt~matnr = mara~matnr )

UP TO callcontrol-maxrecords ROWS

INTO TABLE l_it_show

WHERE lvorm = l_lvorm-low

OR mstae <> space.



ELSE.

SELECT

makt~maktx

makt~spras

mara~matnr

mara~lvorm

mara~mstae

FROM mara

INNER JOIN makt ON ( makt~matnr = mara~matnr )

UP TO callcontrol-maxrecords ROWS

INTO TABLE l_it_show

WHERE lvorm = ''

and mstae = space.

ENDIF.





CALL FUNCTION 'F4UT_RESULTS_MAP'

TABLES

shlp_tab = shlp_tab[]

record_tab = record_tab[]

source_tab = l_it_show

CHANGING

shlp = shlp

callcontrol = callcontrol

EXCEPTIONS

illegal_structure = 1

OTHERS = 2.



IF li_show[] IS NOT INITIAL.

callcontrol-step = 'DISP'.

ELSE.

callcontrol-step = 'SELECT'.

ENDIF.


** Don't process additional STEP. ..

* RETURN.

ENDIF.

ENDFUNCTION.

标签:物料,lvorm,F4,mara,shlp,----,step,callcontrol
From: https://blog.51cto.com/u_15680210/5761257

相关文章

  • QFramework v1.0 使用指南 架构篇:03. 引入 Command
    我们回顾一下目前的代码,如下;usingUnityEngine;usingUnityEngine.UI;namespaceQFramework.Example{//1.定义一个Model对象publicclassCounter......
  • Entry键值对对象
    Map中存储的是两种对象一种称为key键一种称为value值它们在Map中是一一对应关系这一对对象又称做Map中的一个Entry(项)Entry将键值对的对应关系封装成了对象即键值对对......
  • 女儿的部分书单
    大女儿的部分书单......
  • 邮箱通信方式
    是一种间接通信方式。借助于收发双方进程之外的共享数据结构作为通信中转,如消息队列。可以不用知道进程标识符,直接将消息送到信箱中即可,借助了中间商。 最大好处是,发送......
  • 【模板】AVL树
    据说啊,AVL树是第一种被发明的平衡树。它在动态维护过程中,保证了左右子树高度差不超过\(1\),所以说是一种严格平衡的二叉查找树。最重要的就是左旋、右旋以及左右旋、......
  • 临项交换法的正确性证明
    相信大家应该都会证,但是还是写一下吧(ouuan的博客里面说了,对于一个最优排列问题,如果一个比较函数\(\text{cmp}(x,y)\)满足严格弱序,那么经过\(\text{cmp}\)函数排序后......
  • 做Web自动化前,你必须掌握的几个技能
    每天进步一点点,关注我们哦,每天分享测试技术文章本文章出自【码同学软件测试】码同学公众号:自动化软件测试,领取资料可加:magetest码同学抖音号:小码哥聊软件测试学习web自......
  • 数据结构—数组和链表
    数组数组:Array,是有序的元素序列,数组是在内存中开辟一段连续的空间并在此空间存储元素就像是一排出租屋,从001到100每个房间都有固定编号通过编号就可以快速找到租房......
  • rsync同步SQLite3文件API返回旧数据
    问题描述EFCorecannotgetnewvalueindocker,ifusersyncreplacesqlitefile基于.NET6开发一个查询SQLite的API,使用Docker进行部署,通过挂载的方式来访问数据库文......
  • 数据结构—红黑树
    红黑树二叉树:binarytree,是每个节点不超过2的有序树(tree)简单的理解就是一种类似于我们生活中树的结构只不过每个结点上都最多只能有两子结点二叉树是每个节点最多有......