"1、VIEW_MAINTENANCE_CALL:调用标准表维护,可添加搜索条件
"2、VIEW_RANGETAB_TO_SELLIST:将range table转换为函数1中的筛选项,参考函数组获取更多用法
*&---------------------------------------------------------------------*
*& Form SUB_CONVERT_RANGE
*&---------------------------------------------------------------------*
*& 将选择屏幕的select option转换为 表维护程序的过滤条件
*&---------------------------------------------------------------------*
*& --> t_sellist 表维护过滤条件
*& --> t_range 初始range表
*& --> u_field 查询对应的字段
*&---------------------------------------------------------------------*
form sub_convert_range tables t_sellist structure vimsellist
t_range
using u_field.
data:lt_sellist type table of vimsellist,
lv_external_date(10).
check t_range[] is not initial.
assign component 'LOW' of structure t_range to field-symbol(<fs_low>).
check sy-subrc eq 0.
data(lo_type) = cast cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( <fs_low> ) ).
data(lv_type_kind) = lo_type->get_ddic_field( ).
call function 'VIEW_RANGETAB_TO_SELLIST'
exporting
fieldname = u_field
append_conjunction = 'AND'
tables
sellist = lt_sellist[]
rangetab = t_range[].
if lv_type_kind-comptype eq 'D'."日期字段,需要转换为用户格式如31122019,而不是20191231
loop at lt_sellist assigning field-symbol(<fs_list>).
call function 'CONVERT_DATE_TO_EXTERNAL'
exporting
date_internal = conv syst_datum( <fs_list>-value )
importing
date_external = lv_external_date
exceptions
date_internal_is_invalid = 1
others = 2.
replace all occurrences of '.' in lv_external_date with space.
replace all occurrences of '\' in lv_external_date with space.
condense lv_external_date no-gaps.
<fs_list>-value = lv_external_date.
endloop.
endif.
append lines of lt_sellist to t_sellist.
endform.
ABAP 选择屏幕调用表维护程序SM30-通用子例程
猜你喜欢
转载自blog.csdn.net/u012232542/article/details/93715740
今日推荐
周排行