abap:非主键搜索帮助创建删除重复项的方法
2013-07-26 11:37
441 查看
通过se11创建非主键的字段的搜索帮助会出现重复项在搜索帮助中出现。
这需要在搜索帮助的search help exit里面建一个自建的搜索帮助出口函数
在函数中将重复项去掉。
具体代码增加地方如下:
FUNCTION zeh_lxsecond.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCT
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" REFERENCE(SHLP) TYPE SHLP_DESCR
*" REFERENCE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"----------------------------------------------------------------------
* EXIT immediately, if you do not want to handle this step
IF callcontrol-step <> 'SELONE' AND
callcontrol-step <> 'SELECT' AND
" AND SO ON
callcontrol-step <> 'DISP'.
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* 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'.
IF callcontrol-step = 'SELONE'.
* PERFORM SELONE .........
EXIT.
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'.
* PERFORM PRESEL ..........
EXIT.
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'.
* PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL RC.
* IF RC = 0.
* CALLCONTROL-STEP = 'DISP'.
* ELSE.
* CALLCONTROL-STEP = 'EXIT'.
* ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*"----------------------------------------------------------------------
* STEP DISP (Display values)
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
* the only record left in RECORD_TAB. The corresponding fields of
* this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
* SORT shlp_tab BY zsecond.
SORT RECORD_TAB.
DELETE ADJACENT DUPLICATES FROM RECORD_TAB COMPARING ALL FIELDS."zsecond.
IF callcontrol-step = 'DISP'.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
EXIT.
ENDIF.
ENDFUNCTION.
转载自:http://hi.baidu.com/moonsdaught/item/98051c05a0cd41e3f45ba6ca?qq-pf-to=pcqq.c2c
这需要在搜索帮助的search help exit里面建一个自建的搜索帮助出口函数
在函数中将重复项去掉。
具体代码增加地方如下:
FUNCTION zeh_lxsecond.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCT
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" REFERENCE(SHLP) TYPE SHLP_DESCR
*" REFERENCE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"----------------------------------------------------------------------
* EXIT immediately, if you do not want to handle this step
IF callcontrol-step <> 'SELONE' AND
callcontrol-step <> 'SELECT' AND
" AND SO ON
callcontrol-step <> 'DISP'.
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* 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'.
IF callcontrol-step = 'SELONE'.
* PERFORM SELONE .........
EXIT.
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'.
* PERFORM PRESEL ..........
EXIT.
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'.
* PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL RC.
* IF RC = 0.
* CALLCONTROL-STEP = 'DISP'.
* ELSE.
* CALLCONTROL-STEP = 'EXIT'.
* ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*"----------------------------------------------------------------------
* STEP DISP (Display values)
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
* the only record left in RECORD_TAB. The corresponding fields of
* this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
* SORT shlp_tab BY zsecond.
SORT RECORD_TAB.
DELETE ADJACENT DUPLICATES FROM RECORD_TAB COMPARING ALL FIELDS."zsecond.
IF callcontrol-step = 'DISP'.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
EXIT.
ENDIF.
ENDFUNCTION.
转载自:http://hi.baidu.com/moonsdaught/item/98051c05a0cd41e3f45ba6ca?qq-pf-to=pcqq.c2c
相关文章推荐
- abap:非主键搜索帮助创建删除重复项的方法
- ABAP search help (搜索帮助) 五种方法
- ABAP search help (搜索帮助) 五种方法
- orm 通用方法——DeleteModel 主键删除
- Windows search 4.0微软搜索工具卸载删除方法
- DISCUZ站点DIY后,导致DIY功能失效,无法在前台删除已创建的DIY功能解决的方法
- javascript 对象的创建,引用,释放,删除方法
- Ubuntu下创建、重命名、删除文件及文件夹,强制清空回收站方法
- javascript动态创建及删除元素的方法
- 设置(创建)主键和外键的三种方式 和 删除含有主键外键的表顺序
- 如何删除通过主键和唯一约束创建的索引
- oracle中创建自增主键的方法
- Oracle之主键的创建、添加、删除操作
- ios 下创建,删除文件夹的方法
- js去除数组重复项,删除重复数据的方法
- PostgreSQL数据库创建、删除方法
- ubuntu强制清空回收站 创建、删除文件及文件夹的方法
- ios 下创建、删除文件夹的方法
- ubuntu创建、删除文件及文件夹,强制清空回收站方法
- Oracle中大批量删除数据的方法(通过主键删除)