附加自建搜索帮助
分配参数
搜索帮助出口
代码
FUNCTION ZFI_SH_GL_ACCT_BP1.
*"----------------------------------------------------------------------
*"*"本地接口:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" REFERENCE(SHLP) TYPE SHLP_DESCR_T
*" REFERENCE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"----------------------------------------------------------------------
data: begin of ty_help,
partner type bu_partner,
name1 type bu_nameor1,
name2 type bu_nameor2,
name3 type bu_nameor3,
name4 type bu_nameor4,
end of ty_help.
data: lt_help like standard table of ty_help,
ls_help like ty_help.
if callcontrol-step = 'PRESEL'.
data: lv_bukrs type t012k-bukrs,
lv_spras type skat-spras,
r_bukrs type ddshselopt,
r_spras type ddshselopt.
* get parameter id 'BUK' field lv_bukrs.
* get parameter id 'SPR' field lv_spras.
*
* r_bukrs-shlpname = 'H_T000'. "搜索帮助名字
* r_bukrs-shlpfield = 'BUKRS'. "要进行条件限制的字段-销售凭证
* r_bukrs-sign = 'I'.
* r_bukrs-option = 'EQ'.
* append r_bukrs to shlp-selopt.
*
* r_spras-shlpname = 'H_T002'. "搜索帮助名字
* r_spras-shlpfield = 'SPRAS'. "要进行条件限制的字段-销售凭证
* r_spras-sign = 'I'.
* r_spras-option = 'EQ'.
* append r_spras to shlp-selopt.
endif.
if callcontrol-step = 'SELECT'.
data:
lr_name1 type range of but000-name_org1 with header line,
lr_name2 type range of but000-name_org1 with header line,
lr_name3 type range of adrc-name1 with header line,
lr_name4 type range of adrc-name1 with header line,
lr_partner type range of but000-name_org1 with header line.
data: l_selopt like line of shlp-selopt.
loop at shlp-selopt into l_selopt.
if l_selopt-shlpfield = 'NAME1'.
lr_name1-sign = l_selopt-sign.
lr_name1-option = l_selopt-option.
lr_name1-low = l_selopt-low.
lr_name1-high = l_selopt-high.
append lr_name1.
elseif l_selopt-shlpfield = 'NAME2'.
lr_name2-sign = l_selopt-sign.
lr_name2-option = l_selopt-option.
lr_name2-low = l_selopt-low.
lr_name2-high = l_selopt-high.
append lr_name2.
elseif l_selopt-shlpfield = 'NAME3'.
lr_name3-sign = l_selopt-sign.
lr_name3-option = l_selopt-option.
lr_name3-low = l_selopt-low.
lr_name3-high = l_selopt-high.
append lr_name3.
elseif l_selopt-shlpfield = 'NAME4'.
lr_name4-sign = l_selopt-sign.
lr_name4-option = l_selopt-option.
lr_name4-low = l_selopt-low.
lr_name4-high = l_selopt-high.
append lr_name4.
elseif l_selopt-shlpfield = 'PARTNER'.
lr_partner-sign = l_selopt-sign.
lr_partner-option = l_selopt-option.
lr_partner-low = l_selopt-low.
lr_partner-high = l_selopt-high.
append lr_partner.
endif.
endloop.
select but000~partner,name_org1 as name1,name_org2 as name2,
adrc~name3,adrc~name4
from but000
left join but020 on but000~partner = but020~partner
left join adrc on but020~addrnumber = adrc~addrnumber
where name_org1 in @lr_name1 and name_org2 in @lr_name2 and but000~partner in @lr_partner
and name3 in @lr_name3 and name4 in @lr_name4
into corresponding fields of table @lt_help.
call function 'F4UT_RESULTS_MAP'
tables
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_help
changing
shlp = shlp
callcontrol = callcontrol
exceptions
illegal_structure = 1
others = 2.
if sy-subrc <> 0.
endif.
callcontrol-step = 'DISP'.
exit. "Don't process STEP DISP additionally in this call.
endif.
endfunction.