当一个表视图se54,se55创建好表维护功能后, 可以使用SM30来进行表维护操作,或者直接se93生成事务来使用,但我们也可以使用函数 VIEW_MAINTENANCE_CALL 在程序中调用此表维护功能程序,
以下例子还调用了函数 VIEW_RANGETAB_TO_SELLIST 使用内表内容,生成一个RANGES。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
REPORT zbsf003. TABLES: zxxxx. "内表,接受按筛选条件查询出来的数据 DATA: lt_zxxxx TYPE TABLE OF zxxxx. "内表,调用表格时传给函数的选择条件及输入的数据 DATA: lt_vimsellist TYPE TABLE OF vimsellist. "选择屏幕 SELECT-OPTIONS: s_uname FOR zxxxx-uname, s_pernr FOR zxxxx-pernr. "-查询数据 SELECT * INTO TABLE lt_zxxxx FROM zxxxx WHERE uname IN s_uname AND pernr IN s_pernr. IF lt_zxxxx[] IS NOT INITIAL. "-组合选择条件放入内表lt_vimsellist CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST' EXPORTING fieldname = 'UNAME' append_conjunction = 'AND' "条件之间是AND连接 TABLES sellist = lt_vimsellist rangetab = s_uname. CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST' EXPORTING fieldname = 'PERNR' append_conjunction = 'AND' TABLES sellist = lt_vimsellist rangetab = s_pernr. "-调用表格维护生成器 CALL FUNCTION 'VIEW_MAINTENANCE_CALL' EXPORTING action = 'U' "U更改 view_name = 'ZXXXX' TABLES dba_sellist = lt_vimsellist EXCEPTIONS client_reference = 1 foreign_lock = 2 invalid_action = 3 no_clientindependent_auth = 4 no_database_function = 5 no_editor_function = 6 no_show_auth = 7 no_tvdir_entry = 8 no_upd_auth = 9 only_show_allowed = 10 system_failure = 11 unknown_field_in_dba_sellist = 12 view_not_found = 13 maintenance_prohibited = 14 OTHERS = 15. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDIF. |