ABPA-报表开发-自定义选择屏幕搜索帮助
1.定义选择屏幕
例子:
*-----------------------------------------------------------------------* * 选择屏幕 *-----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001. SELECT-OPTIONS: s_werks FOR afru-werks OBLIGATORY NO INTERVALS NO-EXTENSION ,"工厂 s_date FOR afru-ersda ," s_arbpl FOR crhd-arbpl ." SELECTION-SCREEN END OF BLOCK b1.
2.自定义搜索帮助
如果需要输入字段后,带出对应值,如选择屏幕输入工厂S_WERKS,搜索出工厂下的所有满足条件的S_ARBPL,则需先获取选择屏幕输入值,再根据条件查出对应字段在该条件下的所有数据存入内表。调用函数
F4IF_INT_TABLE_VALUE_REQUEST
进行展示。
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_arbpl-low. "搜索帮助 “获取选择屏幕值输入的值 DATA: dynpfields TYPE TABLE OF dynpread WITH HEADER LINE CLEAR: dynpfields, dynpfields[]. dynpfields-fieldname = 'S_WERKS-LOW'. "填入需要读值的字段名 APPEND dynpfields. CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING dyname = sy-repid "当前程序 dynumb = sy-dynnr"ABAP 系统字段:当前 Dynpro 编号 translate_to_upper = 'X' TABLES dynpfields = dynpfields "返回输入的数值 EXCEPTIONS invalid_abapworkarea = 1 invalid_dynprofield = 2 invalid_dynproname = 3 invalid_dynpronummer = 4 invalid_request = 5 no_fielddescription = 6 invalid_parameter = 7 undefind_error = 8 double_conversion = 9 stepl_not_found = 10 OTHERS = 11. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CLEAR :s_werks[]. "将输入的值更新到RANGE表 LOOP AT dynpfields. s_werks-sign = 'I'. s_werks-option = 'EQ'. s_werks-low = dynpfields-fieldvalue. APPEND s_werks. ENDLOOP. "选择屏幕-查询搜索帮助字段的值 SELECT crhd~werks,"工厂 crhd~arbpl,"工作中心 crtx~ktext "工作中心描述 FROM crhd INNER JOIN afru ON afru~arbid = crhd~objid INNER JOIN crtx ON crtx~objid = afru~arbid INTO TABLE @DATA(lt_arbpl) WHERE crhd~verwe = '0001' AND crhd~werks IN @s_werks. SORT lt_arbpl BY werks arbpl. DELETE ADJACENT DUPLICATES FROM lt_arbpl COMPARING werks arbpl. “显示搜索帮助 CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'ARBPL' “字段名 dynpprog = sy-repid “当前程序名 dynpnr = sy-dynnr dynprofield = 'S_ARBPL' “选择屏幕字段名 value_org = 'S' TABLES value_tab = lt_arbpl “搜索帮助查出的数据 EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF.