From 31d4245ecd012e44470e5433b824c6c19bb5a656 Mon Sep 17 00:00:00 2001 From: Christopher Graw Date: Mon, 13 Nov 2023 14:00:25 +0100 Subject: [PATCH] Initial Commit --- .abapgit.xml | 19 + CONTRIBUTING.md | 19 + LICENSE | 21 + README.md | 2 +- docs/annotations.md | 68 + docs/index.md | 13 + docs/installation_guide.md | 52 + docs/program_extensions.md | 36 + src/package.devc.xml | 16 + src/zc_cds_alv_extensionheaders.ddls.asddls | 17 + src/zc_cds_alv_extensionheaders.ddls.xml | 12 + ...zc_cds_alv_extensionparameters.ddls.asddls | 17 + src/zc_cds_alv_extensionparameters.ddls.xml | 12 + src/zc_cds_alv_navigation.ddls.asddls | 17 + src/zc_cds_alv_navigation.ddls.xml | 12 + src/zc_cds_alv_parameters.ddls.asddls | 12 + src/zc_cds_alv_parameters.ddls.xml | 12 + src/zc_cds_alv_programs.ddls.asddls | 19 + src/zc_cds_alv_programs.ddls.xml | 12 + src/zc_cds_alv_selectoptions.ddls.asddls | 16 + src/zc_cds_alv_selectoptions.ddls.xml | 12 + src/zcds_alv.msag.xml | 378 +++ src/zcds_alv_action_name.doma.xml | 22 + src/zcds_alv_action_name.dtel.xml | 36 + src/zcds_alv_activation_timestamp.dtel.xml | 37 + src/zcds_alv_active_flag.dtel.xml | 37 + src/zcds_alv_alternative_display.dtel.xml | 36 + src/zcds_alv_alternative_selection.dtel.xml | 37 + src/zcds_alv_cds_view.para.xml | 15 + src/zcds_alv_criticality.doma.xml | 77 + src/zcds_alv_criticality.dtel.xml | 36 + src/zcds_alv_demo/package.devc.xml | 10 + src/zcds_alv_demo/zc_cds_alv_demo.ddls.asddls | 51 + src/zcds_alv_demo/zc_cds_alv_demo.ddls.xml | 12 + src/zcds_alv_demo/zcds_alv_demo.prog.abap | 53 + src/zcds_alv_demo/zcds_alv_demo.prog.xml | 84 + src/zcds_alv_demo/zcds_alv_demo.tabl.xml | 179 ++ src/zcds_alv_demo/zi_cds_alv_demo.ddls.asddls | 62 + src/zcds_alv_demo/zi_cds_alv_demo.ddls.xml | 12 + ...alv_display.fugr.lzcds_alv_displayf01.abap | 29 + ..._alv_display.fugr.lzcds_alv_displayf01.xml | 21 + ...alv_display.fugr.lzcds_alv_displayi01.abap | 39 + ..._alv_display.fugr.lzcds_alv_displayi01.xml | 21 + ...alv_display.fugr.lzcds_alv_displayo01.abap | 29 + ..._alv_display.fugr.lzcds_alv_displayo01.xml | 21 + ...alv_display.fugr.lzcds_alv_displaytop.abap | 14 + ..._alv_display.fugr.lzcds_alv_displaytop.xml | 17 + ...alv_display.fugr.saplzcds_alv_display.abap | 21 + ..._alv_display.fugr.saplzcds_alv_display.xml | 18 + src/zcds_alv_display.fugr.xml | 718 +++++ ...lv_display.fugr.z_cds_alv_full_screen.abap | 19 + ...v_display.fugr.z_cds_alv_split_screen.abap | 24 + src/zcds_alv_display_text.doma.xml | 25 + src/zcds_alv_display_text.dtel.xml | 37 + src/zcds_alv_extension_parameter.tabl.xml | 72 + src/zcds_alv_extension_parameters.ttyp.xml | 18 + ...tensions.fugr.lzcds_alv_extensionsf01.abap | 75 + ...xtensions.fugr.lzcds_alv_extensionsf01.xml | 21 + ...tensions.fugr.lzcds_alv_extensionsf02.abap | 49 + ...xtensions.fugr.lzcds_alv_extensionsf02.xml | 21 + ...tensions.fugr.lzcds_alv_extensionsi01.abap | 17 + ...xtensions.fugr.lzcds_alv_extensionsi01.xml | 21 + ...tensions.fugr.lzcds_alv_extensionso01.abap | 12 + ...xtensions.fugr.lzcds_alv_extensionso01.xml | 21 + ...tensions.fugr.lzcds_alv_extensionstop.abap | 14 + ...xtensions.fugr.lzcds_alv_extensionstop.xml | 17 + ...tensions.fugr.saplzcds_alv_extensions.abap | 23 + ...xtensions.fugr.saplzcds_alv_extensions.xml | 18 + src/zcds_alv_extensions.fugr.xml | 205 ++ ...ions.fugr.z_cds_alv_extensions_dialog.abap | 21 + src/zcds_alv_exthdr.tabl.xml | 107 + src/zcds_alv_exthdrs.tobj.xml | 49 + src/zcds_alv_exthdrt.tabl.xml | 96 + src/zcds_alv_extpar.tabl.xml | 107 + src/zcds_alv_extpars.tobj.xml | 49 + src/zcds_alv_extpart.tabl.xml | 119 + src/zcds_alv_field_action.tabl.xml | 102 + src/zcds_alv_field_actions.ttyp.xml | 18 + src/zcds_alv_field_type.doma.xml | 24 + src/zcds_alv_field_type.dtel.xml | 36 + src/zcds_alv_function.tabl.xml | 67 + src/zcds_alv_functions.ttyp.xml | 18 + src/zcds_alv_generation_timestamp.dtel.xml | 37 + src/zcds_alv_grid_event_handlers.ttyp.xml | 19 + src/zcds_alv_iocclif.tabl.xml | 126 + src/zcds_alv_iocclifs.tobj.xml | 42 + ...v_launcher.fugr.lzcds_alv_launcheri01.abap | 45 + ...lv_launcher.fugr.lzcds_alv_launcheri01.xml | 21 + ...v_launcher.fugr.lzcds_alv_launchero01.abap | 20 + ...lv_launcher.fugr.lzcds_alv_launchero01.xml | 21 + ...v_launcher.fugr.lzcds_alv_launchertop.abap | 23 + ...lv_launcher.fugr.lzcds_alv_launchertop.xml | 17 + ...v_launcher.fugr.saplzcds_alv_launcher.abap | 19 + ...lv_launcher.fugr.saplzcds_alv_launcher.xml | 18 + src/zcds_alv_launcher.fugr.xml | 322 +++ ...cds_alv_launcher.fugr.z_cds_alv_start.abap | 9 + src/zcds_alv_long_attribute_name.doma.xml | 24 + src/zcds_alv_long_attribute_name.dtel.xml | 37 + src/zcds_alv_memory_id.doma.xml | 24 + src/zcds_alv_memory_id.dtel.xml | 36 + src/zcds_alv_n.nrob.xml | 20 + src/zcds_alv_nav.tabl.xml | 188 ++ src/zcds_alv_nav_mass_processing.doma.xml | 63 + src/zcds_alv_nav_mass_processing.dtel.xml | 36 + src/zcds_alv_navexit.tabl.xml | 152 ++ src/zcds_alv_navexits.tobj.xml | 42 + src/zcds_alv_navigation_exit_tab.ttyp.xml | 18 + src/zcds_alv_navigation_tab.ttyp.xml | 18 + src/zcds_alv_navs.tobj.xml | 42 + src/zcds_alv_no_generation.dtel.xml | 37 + src/zcds_alv_param_has_help.dtel.xml | 37 + src/zcds_alv_param_has_value_help.dtel.xml | 37 + src/zcds_alv_parameter.tabl.xml | 45 + src/zcds_alv_parameter_mapping.tabl.xml | 49 + src/zcds_alv_parameter_mapping_tab.ttyp.xml | 33 + src/zcds_alv_parameters.ttyp.xml | 33 + src/zcds_alv_params.tabl.xml | 63 + src/zcds_alv_progext.tabl.xml | 87 + src/zcds_alv_program.tabl.xml | 102 + src/zcds_alv_program_extension.tabl.xml | 55 + src/zcds_alv_program_extensions.ttyp.xml | 18 + src/zcds_alv_program_header.tabl.xml | 58 + src/zcds_alv_program_info.tabl.xml | 64 + src/zcds_alv_refresh_after.dtel.xml | 36 + src/zcds_alv_regenerate_reports.prog.abap | 23 + src/zcds_alv_regenerate_reports.prog.xml | 34 + src/zcds_alv_report_extension.tabl.xml | 72 + src/zcds_alv_report_extension_name.doma.xml | 25 + src/zcds_alv_report_extension_name.dtel.xml | 36 + src/zcds_alv_report_extension_text.dtel.xml | 36 + src/zcds_alv_report_extensions.ttyp.xml | 18 + src/zcds_alv_rfc_field_range.tabl.xml | 39 + src/zcds_alv_rfc_field_ranges.ttyp.xml | 19 + src/zcds_alv_rfc_selopt_tab.ttyp.xml | 19 + src/zcds_alv_rfc_where_tab.ttyp.xml | 19 + src/zcds_alv_selection_text.doma.xml | 25 + src/zcds_alv_selection_text.dtel.xml | 37 + src/zcds_alv_selopts.tabl.xml | 63 + src/zcds_alv_selopts_mapping.tabl.xml | 49 + src/zcds_alv_selopts_mapping_tab.ttyp.xml | 33 + src/zcds_alv_semantic_action.dtel.xml | 37 + src/zcds_alv_semantic_object.dtel.xml | 37 + src/zcds_alv_source_line.dtel.xml | 37 + src/zcds_alv_source_lines.ttyp.xml | 19 + src/zcds_alv_special_columns.tabl.xml | 80 + src/zcds_alv_start.tran.xml | 29 + src/zcds_alv_storage_header.tabl.xml | 42 + src/zcds_alv_storage_headers.ttyp.xml | 18 + src/zcds_alv_storage_key.tabl.xml | 56 + ...s_alv_tables.fugr.lzcds_alv_tablesf00.abap | 6 + ...ds_alv_tables.fugr.lzcds_alv_tablesf00.xml | 13 + ...s_alv_tables.fugr.lzcds_alv_tablesi00.abap | 5 + ...ds_alv_tables.fugr.lzcds_alv_tablesi00.xml | 13 + ...s_alv_tables.fugr.lzcds_alv_tablest00.abap | 51 + ...ds_alv_tables.fugr.lzcds_alv_tablest00.xml | 12 + ...s_alv_tables.fugr.lzcds_alv_tablestop.abap | 5 + ...ds_alv_tables.fugr.lzcds_alv_tablestop.xml | 17 + ...s_alv_tables.fugr.saplzcds_alv_tables.abap | 20 + ...ds_alv_tables.fugr.saplzcds_alv_tables.xml | 19 + ...ables.fugr.tableframe_zcds_alv_tables.abap | 25 + ...tables.fugr.tableproc_zcds_alv_tables.abap | 8 + src/zcds_alv_tables.fugr.xml | 2411 +++++++++++++++++ src/zcds_alv_textpool_tab.ttyp.xml | 18 + src/zcds_alv_valuehelp_binding.tabl.xml | 65 + src/zcds_alv_valuehelp_binding_tab.ttyp.xml | 18 + src/zcds_alv_valuehelp_definition.tabl.xml | 84 + src/zcds_alv_valuehelp_definitions.ttyp.xml | 18 + src/zcds_alv_view_prog_counter.doma.xml | 25 + src/zcds_alv_view_prog_counter.dtel.xml | 23 + src/zcl_cds_alv_authority_check.clas.abap | 49 + src/zcl_cds_alv_authority_check.clas.xml | 16 + src/zcl_cds_alv_base.clas.abap | 72 + src/zcl_cds_alv_base.clas.xml | 16 + src/zcl_cds_alv_bopf_handler.clas.abap | 310 +++ src/zcl_cds_alv_bopf_handler.clas.xml | 16 + src/zcl_cds_alv_ddic_access.clas.abap | 182 ++ src/zcl_cds_alv_ddic_access.clas.xml | 16 + src/zcl_cds_alv_extension_provider.clas.abap | 39 + src/zcl_cds_alv_extension_provider.clas.xml | 16 + src/zcl_cds_alv_factory.clas.abap | 258 ++ src/zcl_cds_alv_factory.clas.testclasses.abap | 41 + src/zcl_cds_alv_factory.clas.xml | 17 + src/zcl_cds_alv_grid_builder.clas.abap | 639 +++++ src/zcl_cds_alv_grid_builder.clas.xml | 16 + src/zcl_cds_alv_grid_event_handler.clas.abap | 516 ++++ src/zcl_cds_alv_grid_event_handler.clas.xml | 79 + src/zcl_cds_alv_ioc_container.clas.abap | 270 ++ src/zcl_cds_alv_ioc_container.clas.xml | 43 + src/zcl_cds_alv_memory.clas.abap | 38 + src/zcl_cds_alv_memory.clas.xml | 16 + src/zcl_cds_alv_navigation.clas.abap | 445 +++ src/zcl_cds_alv_navigation.clas.xml | 16 + src/zcl_cds_alv_persistence.clas.abap | 143 + src/zcl_cds_alv_persistence.clas.xml | 16 + src/zcl_cds_alv_report_controller.clas.abap | 290 ++ src/zcl_cds_alv_report_controller.clas.xml | 16 + src/zcl_cds_alv_report_extension.clas.abap | 81 + src/zcl_cds_alv_report_extension.clas.xml | 16 + src/zcl_cds_alv_report_generator.clas.abap | 93 + src/zcl_cds_alv_report_generator.clas.xml | 16 + src/zcl_cds_alv_report_launcher.clas.abap | 152 ++ src/zcl_cds_alv_report_launcher.clas.xml | 16 + src/zcl_cds_alv_report_strategy.clas.abap | 519 ++++ ..._alv_report_strategy.clas.testclasses.abap | 37 + src/zcl_cds_alv_report_strategy.clas.xml | 134 + src/zcl_cds_alv_sadl_mapping_prov.clas.abap | 92 + src/zcl_cds_alv_sadl_mapping_prov.clas.xml | 24 + src/zcl_cds_alv_selection.clas.abap | 204 ++ ...zcl_cds_alv_selection.clas.locals_imp.abap | 133 + src/zcl_cds_alv_selection.clas.xml | 16 + src/zcl_cds_alv_selection_screen.clas.abap | 450 +++ src/zcl_cds_alv_selection_screen.clas.xml | 49 + src/zcl_cds_alv_table_container.clas.abap | 283 ++ src/zcl_cds_alv_table_container.clas.xml | 16 + src/zcl_cds_alv_value_help.clas.abap | 358 +++ ...cl_cds_alv_value_help.clas.locals_imp.abap | 135 + src/zcl_cds_alv_value_help.clas.xml | 16 + src/zcx_cds_alv_message.clas.abap | 79 + src/zcx_cds_alv_message.clas.xml | 29 + src/zi_cds_alv_extensionheaders.ddls.asddls | 14 + src/zi_cds_alv_extensionheaders.ddls.xml | 12 + ...zi_cds_alv_extensionheadertext.ddls.asddls | 13 + src/zi_cds_alv_extensionheadertext.ddls.xml | 12 + ...zi_cds_alv_extensionparameters.ddls.asddls | 17 + src/zi_cds_alv_extensionparameters.ddls.xml | 12 + ...zi_cds_alv_extensionparamtexts.ddls.asddls | 12 + src/zi_cds_alv_extensionparamtexts.ddls.xml | 12 + src/zi_cds_alv_navigation.ddls.asddls | 17 + src/zi_cds_alv_navigation.ddls.xml | 12 + src/zi_cds_alv_parameters.ddls.asddls | 12 + src/zi_cds_alv_parameters.ddls.xml | 12 + src/zi_cds_alv_programextensions.ddls.asddls | 11 + src/zi_cds_alv_programextensions.ddls.xml | 12 + src/zi_cds_alv_programs.ddls.asddls | 14 + src/zi_cds_alv_programs.ddls.xml | 12 + src/zi_cds_alv_selectoptions.ddls.asddls | 12 + src/zi_cds_alv_selectoptions.ddls.xml | 12 + src/zif_cds_alv_authority_check.intf.abap | 25 + src/zif_cds_alv_authority_check.intf.xml | 15 + src/zif_cds_alv_bopf_handler.intf.abap | 40 + src/zif_cds_alv_bopf_handler.intf.xml | 15 + src/zif_cds_alv_condition_provider.intf.abap | 23 + src/zif_cds_alv_condition_provider.intf.xml | 15 + src/zif_cds_alv_ddic_access.intf.abap | 109 + src/zif_cds_alv_ddic_access.intf.xml | 15 + src/zif_cds_alv_display_extension.intf.abap | 17 + src/zif_cds_alv_display_extension.intf.xml | 15 + src/zif_cds_alv_extension_provider.intf.abap | 22 + src/zif_cds_alv_extension_provider.intf.xml | 15 + src/zif_cds_alv_factory.intf.abap | 135 + src/zif_cds_alv_factory.intf.xml | 15 + src/zif_cds_alv_grid_builder.intf.abap | 40 + src/zif_cds_alv_grid_builder.intf.xml | 23 + src/zif_cds_alv_grid_event_handler.intf.abap | 60 + src/zif_cds_alv_grid_event_handler.intf.xml | 15 + src/zif_cds_alv_ioc_container.intf.abap | 49 + src/zif_cds_alv_ioc_container.intf.xml | 15 + src/zif_cds_alv_memory.intf.abap | 35 + src/zif_cds_alv_memory.intf.xml | 15 + src/zif_cds_alv_navigation.intf.abap | 54 + src/zif_cds_alv_navigation.intf.xml | 29 + src/zif_cds_alv_persistence.intf.abap | 80 + src/zif_cds_alv_persistence.intf.xml | 29 + src/zif_cds_alv_report_controller.intf.abap | 60 + src/zif_cds_alv_report_controller.intf.xml | 15 + src/zif_cds_alv_report_extension.intf.abap | 53 + src/zif_cds_alv_report_extension.intf.xml | 15 + src/zif_cds_alv_report_generator.intf.abap | 11 + src/zif_cds_alv_report_generator.intf.xml | 15 + src/zif_cds_alv_report_launcher.intf.abap | 56 + src/zif_cds_alv_report_launcher.intf.xml | 15 + src/zif_cds_alv_report_strategy.intf.abap | 14 + src/zif_cds_alv_report_strategy.intf.xml | 15 + src/zif_cds_alv_select_extension.intf.abap | 31 + src/zif_cds_alv_select_extension.intf.xml | 29 + src/zif_cds_alv_selection.intf.abap | 41 + src/zif_cds_alv_selection.intf.xml | 15 + src/zif_cds_alv_selection_screen.intf.abap | 67 + src/zif_cds_alv_selection_screen.intf.xml | 15 + src/zif_cds_alv_split_screen_cntr.intf.abap | 18 + src/zif_cds_alv_split_screen_cntr.intf.xml | 15 + src/zif_cds_alv_table_container.intf.abap | 63 + src/zif_cds_alv_table_container.intf.xml | 15 + src/zif_cds_alv_value_help.intf.abap | 39 + src/zif_cds_alv_value_help.intf.xml | 15 + src/zvc_cds_alv_fw.vcls.xml | 88 + src/zvc_cds_alv_fwc.tobj.xml | 53 + 287 files changed, 18472 insertions(+), 1 deletion(-) create mode 100644 .abapgit.xml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 docs/annotations.md create mode 100644 docs/index.md create mode 100644 docs/installation_guide.md create mode 100644 docs/program_extensions.md create mode 100644 src/package.devc.xml create mode 100644 src/zc_cds_alv_extensionheaders.ddls.asddls create mode 100644 src/zc_cds_alv_extensionheaders.ddls.xml create mode 100644 src/zc_cds_alv_extensionparameters.ddls.asddls create mode 100644 src/zc_cds_alv_extensionparameters.ddls.xml create mode 100644 src/zc_cds_alv_navigation.ddls.asddls create mode 100644 src/zc_cds_alv_navigation.ddls.xml create mode 100644 src/zc_cds_alv_parameters.ddls.asddls create mode 100644 src/zc_cds_alv_parameters.ddls.xml create mode 100644 src/zc_cds_alv_programs.ddls.asddls create mode 100644 src/zc_cds_alv_programs.ddls.xml create mode 100644 src/zc_cds_alv_selectoptions.ddls.asddls create mode 100644 src/zc_cds_alv_selectoptions.ddls.xml create mode 100644 src/zcds_alv.msag.xml create mode 100644 src/zcds_alv_action_name.doma.xml create mode 100644 src/zcds_alv_action_name.dtel.xml create mode 100644 src/zcds_alv_activation_timestamp.dtel.xml create mode 100644 src/zcds_alv_active_flag.dtel.xml create mode 100644 src/zcds_alv_alternative_display.dtel.xml create mode 100644 src/zcds_alv_alternative_selection.dtel.xml create mode 100644 src/zcds_alv_cds_view.para.xml create mode 100644 src/zcds_alv_criticality.doma.xml create mode 100644 src/zcds_alv_criticality.dtel.xml create mode 100644 src/zcds_alv_demo/package.devc.xml create mode 100644 src/zcds_alv_demo/zc_cds_alv_demo.ddls.asddls create mode 100644 src/zcds_alv_demo/zc_cds_alv_demo.ddls.xml create mode 100644 src/zcds_alv_demo/zcds_alv_demo.prog.abap create mode 100644 src/zcds_alv_demo/zcds_alv_demo.prog.xml create mode 100644 src/zcds_alv_demo/zcds_alv_demo.tabl.xml create mode 100644 src/zcds_alv_demo/zi_cds_alv_demo.ddls.asddls create mode 100644 src/zcds_alv_demo/zi_cds_alv_demo.ddls.xml create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayf01.abap create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayf01.xml create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayi01.abap create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayi01.xml create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayo01.abap create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displayo01.xml create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displaytop.abap create mode 100644 src/zcds_alv_display.fugr.lzcds_alv_displaytop.xml create mode 100644 src/zcds_alv_display.fugr.saplzcds_alv_display.abap create mode 100644 src/zcds_alv_display.fugr.saplzcds_alv_display.xml create mode 100644 src/zcds_alv_display.fugr.xml create mode 100644 src/zcds_alv_display.fugr.z_cds_alv_full_screen.abap create mode 100644 src/zcds_alv_display.fugr.z_cds_alv_split_screen.abap create mode 100644 src/zcds_alv_display_text.doma.xml create mode 100644 src/zcds_alv_display_text.dtel.xml create mode 100644 src/zcds_alv_extension_parameter.tabl.xml create mode 100644 src/zcds_alv_extension_parameters.ttyp.xml create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.abap create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.xml create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.abap create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.xml create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.abap create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.xml create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.abap create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.xml create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.abap create mode 100644 src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.xml create mode 100644 src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.abap create mode 100644 src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.xml create mode 100644 src/zcds_alv_extensions.fugr.xml create mode 100644 src/zcds_alv_extensions.fugr.z_cds_alv_extensions_dialog.abap create mode 100644 src/zcds_alv_exthdr.tabl.xml create mode 100644 src/zcds_alv_exthdrs.tobj.xml create mode 100644 src/zcds_alv_exthdrt.tabl.xml create mode 100644 src/zcds_alv_extpar.tabl.xml create mode 100644 src/zcds_alv_extpars.tobj.xml create mode 100644 src/zcds_alv_extpart.tabl.xml create mode 100644 src/zcds_alv_field_action.tabl.xml create mode 100644 src/zcds_alv_field_actions.ttyp.xml create mode 100644 src/zcds_alv_field_type.doma.xml create mode 100644 src/zcds_alv_field_type.dtel.xml create mode 100644 src/zcds_alv_function.tabl.xml create mode 100644 src/zcds_alv_functions.ttyp.xml create mode 100644 src/zcds_alv_generation_timestamp.dtel.xml create mode 100644 src/zcds_alv_grid_event_handlers.ttyp.xml create mode 100644 src/zcds_alv_iocclif.tabl.xml create mode 100644 src/zcds_alv_iocclifs.tobj.xml create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.abap create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.xml create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.abap create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.xml create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.abap create mode 100644 src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.xml create mode 100644 src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.abap create mode 100644 src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.xml create mode 100644 src/zcds_alv_launcher.fugr.xml create mode 100644 src/zcds_alv_launcher.fugr.z_cds_alv_start.abap create mode 100644 src/zcds_alv_long_attribute_name.doma.xml create mode 100644 src/zcds_alv_long_attribute_name.dtel.xml create mode 100644 src/zcds_alv_memory_id.doma.xml create mode 100644 src/zcds_alv_memory_id.dtel.xml create mode 100644 src/zcds_alv_n.nrob.xml create mode 100644 src/zcds_alv_nav.tabl.xml create mode 100644 src/zcds_alv_nav_mass_processing.doma.xml create mode 100644 src/zcds_alv_nav_mass_processing.dtel.xml create mode 100644 src/zcds_alv_navexit.tabl.xml create mode 100644 src/zcds_alv_navexits.tobj.xml create mode 100644 src/zcds_alv_navigation_exit_tab.ttyp.xml create mode 100644 src/zcds_alv_navigation_tab.ttyp.xml create mode 100644 src/zcds_alv_navs.tobj.xml create mode 100644 src/zcds_alv_no_generation.dtel.xml create mode 100644 src/zcds_alv_param_has_help.dtel.xml create mode 100644 src/zcds_alv_param_has_value_help.dtel.xml create mode 100644 src/zcds_alv_parameter.tabl.xml create mode 100644 src/zcds_alv_parameter_mapping.tabl.xml create mode 100644 src/zcds_alv_parameter_mapping_tab.ttyp.xml create mode 100644 src/zcds_alv_parameters.ttyp.xml create mode 100644 src/zcds_alv_params.tabl.xml create mode 100644 src/zcds_alv_progext.tabl.xml create mode 100644 src/zcds_alv_program.tabl.xml create mode 100644 src/zcds_alv_program_extension.tabl.xml create mode 100644 src/zcds_alv_program_extensions.ttyp.xml create mode 100644 src/zcds_alv_program_header.tabl.xml create mode 100644 src/zcds_alv_program_info.tabl.xml create mode 100644 src/zcds_alv_refresh_after.dtel.xml create mode 100644 src/zcds_alv_regenerate_reports.prog.abap create mode 100644 src/zcds_alv_regenerate_reports.prog.xml create mode 100644 src/zcds_alv_report_extension.tabl.xml create mode 100644 src/zcds_alv_report_extension_name.doma.xml create mode 100644 src/zcds_alv_report_extension_name.dtel.xml create mode 100644 src/zcds_alv_report_extension_text.dtel.xml create mode 100644 src/zcds_alv_report_extensions.ttyp.xml create mode 100644 src/zcds_alv_rfc_field_range.tabl.xml create mode 100644 src/zcds_alv_rfc_field_ranges.ttyp.xml create mode 100644 src/zcds_alv_rfc_selopt_tab.ttyp.xml create mode 100644 src/zcds_alv_rfc_where_tab.ttyp.xml create mode 100644 src/zcds_alv_selection_text.doma.xml create mode 100644 src/zcds_alv_selection_text.dtel.xml create mode 100644 src/zcds_alv_selopts.tabl.xml create mode 100644 src/zcds_alv_selopts_mapping.tabl.xml create mode 100644 src/zcds_alv_selopts_mapping_tab.ttyp.xml create mode 100644 src/zcds_alv_semantic_action.dtel.xml create mode 100644 src/zcds_alv_semantic_object.dtel.xml create mode 100644 src/zcds_alv_source_line.dtel.xml create mode 100644 src/zcds_alv_source_lines.ttyp.xml create mode 100644 src/zcds_alv_special_columns.tabl.xml create mode 100644 src/zcds_alv_start.tran.xml create mode 100644 src/zcds_alv_storage_header.tabl.xml create mode 100644 src/zcds_alv_storage_headers.ttyp.xml create mode 100644 src/zcds_alv_storage_key.tabl.xml create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.abap create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.xml create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.abap create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.xml create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablest00.abap create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablest00.xml create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablestop.abap create mode 100644 src/zcds_alv_tables.fugr.lzcds_alv_tablestop.xml create mode 100644 src/zcds_alv_tables.fugr.saplzcds_alv_tables.abap create mode 100644 src/zcds_alv_tables.fugr.saplzcds_alv_tables.xml create mode 100644 src/zcds_alv_tables.fugr.tableframe_zcds_alv_tables.abap create mode 100644 src/zcds_alv_tables.fugr.tableproc_zcds_alv_tables.abap create mode 100644 src/zcds_alv_tables.fugr.xml create mode 100644 src/zcds_alv_textpool_tab.ttyp.xml create mode 100644 src/zcds_alv_valuehelp_binding.tabl.xml create mode 100644 src/zcds_alv_valuehelp_binding_tab.ttyp.xml create mode 100644 src/zcds_alv_valuehelp_definition.tabl.xml create mode 100644 src/zcds_alv_valuehelp_definitions.ttyp.xml create mode 100644 src/zcds_alv_view_prog_counter.doma.xml create mode 100644 src/zcds_alv_view_prog_counter.dtel.xml create mode 100644 src/zcl_cds_alv_authority_check.clas.abap create mode 100644 src/zcl_cds_alv_authority_check.clas.xml create mode 100644 src/zcl_cds_alv_base.clas.abap create mode 100644 src/zcl_cds_alv_base.clas.xml create mode 100644 src/zcl_cds_alv_bopf_handler.clas.abap create mode 100644 src/zcl_cds_alv_bopf_handler.clas.xml create mode 100644 src/zcl_cds_alv_ddic_access.clas.abap create mode 100644 src/zcl_cds_alv_ddic_access.clas.xml create mode 100644 src/zcl_cds_alv_extension_provider.clas.abap create mode 100644 src/zcl_cds_alv_extension_provider.clas.xml create mode 100644 src/zcl_cds_alv_factory.clas.abap create mode 100644 src/zcl_cds_alv_factory.clas.testclasses.abap create mode 100644 src/zcl_cds_alv_factory.clas.xml create mode 100644 src/zcl_cds_alv_grid_builder.clas.abap create mode 100644 src/zcl_cds_alv_grid_builder.clas.xml create mode 100644 src/zcl_cds_alv_grid_event_handler.clas.abap create mode 100644 src/zcl_cds_alv_grid_event_handler.clas.xml create mode 100644 src/zcl_cds_alv_ioc_container.clas.abap create mode 100644 src/zcl_cds_alv_ioc_container.clas.xml create mode 100644 src/zcl_cds_alv_memory.clas.abap create mode 100644 src/zcl_cds_alv_memory.clas.xml create mode 100644 src/zcl_cds_alv_navigation.clas.abap create mode 100644 src/zcl_cds_alv_navigation.clas.xml create mode 100644 src/zcl_cds_alv_persistence.clas.abap create mode 100644 src/zcl_cds_alv_persistence.clas.xml create mode 100644 src/zcl_cds_alv_report_controller.clas.abap create mode 100644 src/zcl_cds_alv_report_controller.clas.xml create mode 100644 src/zcl_cds_alv_report_extension.clas.abap create mode 100644 src/zcl_cds_alv_report_extension.clas.xml create mode 100644 src/zcl_cds_alv_report_generator.clas.abap create mode 100644 src/zcl_cds_alv_report_generator.clas.xml create mode 100644 src/zcl_cds_alv_report_launcher.clas.abap create mode 100644 src/zcl_cds_alv_report_launcher.clas.xml create mode 100644 src/zcl_cds_alv_report_strategy.clas.abap create mode 100644 src/zcl_cds_alv_report_strategy.clas.testclasses.abap create mode 100644 src/zcl_cds_alv_report_strategy.clas.xml create mode 100644 src/zcl_cds_alv_sadl_mapping_prov.clas.abap create mode 100644 src/zcl_cds_alv_sadl_mapping_prov.clas.xml create mode 100644 src/zcl_cds_alv_selection.clas.abap create mode 100644 src/zcl_cds_alv_selection.clas.locals_imp.abap create mode 100644 src/zcl_cds_alv_selection.clas.xml create mode 100644 src/zcl_cds_alv_selection_screen.clas.abap create mode 100644 src/zcl_cds_alv_selection_screen.clas.xml create mode 100644 src/zcl_cds_alv_table_container.clas.abap create mode 100644 src/zcl_cds_alv_table_container.clas.xml create mode 100644 src/zcl_cds_alv_value_help.clas.abap create mode 100644 src/zcl_cds_alv_value_help.clas.locals_imp.abap create mode 100644 src/zcl_cds_alv_value_help.clas.xml create mode 100644 src/zcx_cds_alv_message.clas.abap create mode 100644 src/zcx_cds_alv_message.clas.xml create mode 100644 src/zi_cds_alv_extensionheaders.ddls.asddls create mode 100644 src/zi_cds_alv_extensionheaders.ddls.xml create mode 100644 src/zi_cds_alv_extensionheadertext.ddls.asddls create mode 100644 src/zi_cds_alv_extensionheadertext.ddls.xml create mode 100644 src/zi_cds_alv_extensionparameters.ddls.asddls create mode 100644 src/zi_cds_alv_extensionparameters.ddls.xml create mode 100644 src/zi_cds_alv_extensionparamtexts.ddls.asddls create mode 100644 src/zi_cds_alv_extensionparamtexts.ddls.xml create mode 100644 src/zi_cds_alv_navigation.ddls.asddls create mode 100644 src/zi_cds_alv_navigation.ddls.xml create mode 100644 src/zi_cds_alv_parameters.ddls.asddls create mode 100644 src/zi_cds_alv_parameters.ddls.xml create mode 100644 src/zi_cds_alv_programextensions.ddls.asddls create mode 100644 src/zi_cds_alv_programextensions.ddls.xml create mode 100644 src/zi_cds_alv_programs.ddls.asddls create mode 100644 src/zi_cds_alv_programs.ddls.xml create mode 100644 src/zi_cds_alv_selectoptions.ddls.asddls create mode 100644 src/zi_cds_alv_selectoptions.ddls.xml create mode 100644 src/zif_cds_alv_authority_check.intf.abap create mode 100644 src/zif_cds_alv_authority_check.intf.xml create mode 100644 src/zif_cds_alv_bopf_handler.intf.abap create mode 100644 src/zif_cds_alv_bopf_handler.intf.xml create mode 100644 src/zif_cds_alv_condition_provider.intf.abap create mode 100644 src/zif_cds_alv_condition_provider.intf.xml create mode 100644 src/zif_cds_alv_ddic_access.intf.abap create mode 100644 src/zif_cds_alv_ddic_access.intf.xml create mode 100644 src/zif_cds_alv_display_extension.intf.abap create mode 100644 src/zif_cds_alv_display_extension.intf.xml create mode 100644 src/zif_cds_alv_extension_provider.intf.abap create mode 100644 src/zif_cds_alv_extension_provider.intf.xml create mode 100644 src/zif_cds_alv_factory.intf.abap create mode 100644 src/zif_cds_alv_factory.intf.xml create mode 100644 src/zif_cds_alv_grid_builder.intf.abap create mode 100644 src/zif_cds_alv_grid_builder.intf.xml create mode 100644 src/zif_cds_alv_grid_event_handler.intf.abap create mode 100644 src/zif_cds_alv_grid_event_handler.intf.xml create mode 100644 src/zif_cds_alv_ioc_container.intf.abap create mode 100644 src/zif_cds_alv_ioc_container.intf.xml create mode 100644 src/zif_cds_alv_memory.intf.abap create mode 100644 src/zif_cds_alv_memory.intf.xml create mode 100644 src/zif_cds_alv_navigation.intf.abap create mode 100644 src/zif_cds_alv_navigation.intf.xml create mode 100644 src/zif_cds_alv_persistence.intf.abap create mode 100644 src/zif_cds_alv_persistence.intf.xml create mode 100644 src/zif_cds_alv_report_controller.intf.abap create mode 100644 src/zif_cds_alv_report_controller.intf.xml create mode 100644 src/zif_cds_alv_report_extension.intf.abap create mode 100644 src/zif_cds_alv_report_extension.intf.xml create mode 100644 src/zif_cds_alv_report_generator.intf.abap create mode 100644 src/zif_cds_alv_report_generator.intf.xml create mode 100644 src/zif_cds_alv_report_launcher.intf.abap create mode 100644 src/zif_cds_alv_report_launcher.intf.xml create mode 100644 src/zif_cds_alv_report_strategy.intf.abap create mode 100644 src/zif_cds_alv_report_strategy.intf.xml create mode 100644 src/zif_cds_alv_select_extension.intf.abap create mode 100644 src/zif_cds_alv_select_extension.intf.xml create mode 100644 src/zif_cds_alv_selection.intf.abap create mode 100644 src/zif_cds_alv_selection.intf.xml create mode 100644 src/zif_cds_alv_selection_screen.intf.abap create mode 100644 src/zif_cds_alv_selection_screen.intf.xml create mode 100644 src/zif_cds_alv_split_screen_cntr.intf.abap create mode 100644 src/zif_cds_alv_split_screen_cntr.intf.xml create mode 100644 src/zif_cds_alv_table_container.intf.abap create mode 100644 src/zif_cds_alv_table_container.intf.xml create mode 100644 src/zif_cds_alv_value_help.intf.abap create mode 100644 src/zif_cds_alv_value_help.intf.xml create mode 100644 src/zvc_cds_alv_fw.vcls.xml create mode 100644 src/zvc_cds_alv_fwc.tobj.xml diff --git a/.abapgit.xml b/.abapgit.xml new file mode 100644 index 0000000..4b8a2ce --- /dev/null +++ b/.abapgit.xml @@ -0,0 +1,19 @@ + + + + + D + + E + + /src/ + FULL + + + SAP_ABA + 750 + + + + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5899960 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing to cds2alv + +Welcome and thank you for your interest in our lovely project. Your contributions are grealty appreciated. + +Please bear in mind that this is our first public Open Source ABAP project, so we are still very much in the process of figuring things out. + +## Discussions + +You are welcome to engage in discussions here on GitHub. + +## Bug Reports + +If you have found a bug or wish for a new feature, please file an issue here on GitHub. + +When reporting bugs please provide some information on how the issue can be reproduced to help us find the cause of the error. + +## Contributions + +You are welcome to contribute by means of pull requests. If a pull request aims to resolve an issue, please reference accordingly. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e5ce5ae --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 rku.it GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 524594f..028eddf 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ For information regarding installation and setup please refer to the [Installati Program Extensions will be provided in a separate repository. -Version support: The project is maintained in SAP_ABA 750 SP26, it works on newer releases with minor adjustments. +Version support: The project is maintained in SAP_ABA 750 SP26, it works on newer releases with minor adjustments. \ No newline at end of file diff --git a/docs/annotations.md b/docs/annotations.md new file mode 100644 index 0000000..2d90617 --- /dev/null +++ b/docs/annotations.md @@ -0,0 +1,68 @@ +# Annotations +The following CDS annotations are evaluated by the components of the CDS ALV framework. + +## Base +* EndUserText.label - Descriptive name of the CDS entity + +## Grid Builder +* Consumption.hidden - field is treated as technical by ALV +* Consumption.valueHelp - custom F4 help for the field in the ALV grid +* Consumption.valueHelpDefinition - custom F4 help for the field in the ALV grid +* Consumption.semanticObject - semantic object for Intent-Based Navigation (Hotspot or Button) +* DefaultAggregation - aggregation is applied to the respective column +* EndUserText.label - column heading +* EndUserText.quickInfo - column tooltip +* Semantics.email.address - column becomes hotspot, link click to send mail +* UI.hidden - field is hidden in the ALV grid by default +* UI.lineItem.position - column position in the ALV grid +* UI.lineItem.label - column heading +* UI.lineItem.type - behaviour according to type: + * #STANDARD or none: plain column + * #FOR_ACTION: button for a BOPF action + * #FOR_INTENT_BASED_NAVIGATION: button for Intent-Based Navigation + * #WITH_INTENT_BASED_NAVIGATION: hotspot for Intent-Based Navigation + * #WITH_URL: hotspot for an HTTP call + * #WITH_NAVIGATION_PATH: hotspot for calling the report of an associated CDS view with the current display as forall-table +* UI.lineItem.semanticObject - semantic object for Intent-Based Navigation (Hotspot or Button) +* UI.lineItem.semanticObjectAction - semantic action for Intent-Based Navigation (Hotspot or Button) +* UI.lineItem.targetElement - target path of the navigation via association +* UI.lineItem.dataAction - name of the BOPF action +* UI.lineItem.url - target URL for the HTTP call +* ObjectModel.semanticKey - key columns in the ALV grid +* ObjectModel.deleteEnabled - if true, adds user command DELETE to the alv grid +* ObjectModel.updateEnabled - if true, the ALV becomes editable, adds user command SAVE to the alv grid +* ObjectModel.readOnly - column remains read-only + +## Report Generation Strategy and Selection Screen +* AbapCatalog.sqlViewName - used to compose the name of the generated report +* Consumption.filter.selectionType - displays the field on the selection screen. Restrictions apply: + * #SINGLE: NO-EXTENSIONS and NO INTERVALS, only EQ allowed + * #INTERVAL: NO-EXTENSIONS, only EQ and BT allowed + * #RANGE: no restrictions +* Consumption.filter.multipleSelections - restricts the selection +* Consumption.filter.mandatory - marks the field as mandatory on the selection screen +* Consumption.filter.defaultValue - default value for a select option on the selection screen +* Consumption.defaultValue - default value for a parameter on the selection screen +* Consumption.valueHelp - custom F4 help for the field in the selection screen +* Consumption.valueHelpDefinition - custom F4 help for the field in the selection screen +* Consumption.hidden - field is not displayed on the selection screen +* EndUserText.label - label for the line on the selection screen +* UI.selectionField.position - position of the field on the selection screen +* UI.selectionField.qualifier - used to group the selection fields into separate blocks on the selection screen + +## Table Container +* ObjectModel.updateEnabled - if true, add style table field to the ALV grid +* UI.lineItem.criticality - add color table field to the ALV grid + +## Value Help +* Consumption.valueHelp - association that is used for the value help +* Consumption.valueHelpDefinition.association - association that is used for the value help +* Consumption.valueHelpDefinition.entity.name - name of the target CDS entity +* Consumption.valueHelpDefinition.entity.element - name of the target CDS element +* Consumption.valueHelpDefinition.distinctValues - selection is executed as SELECT DISTINCT +* Consumption.valueHelpDefinition.label - not yet used +* Consumption.valueHelpDefinition.additionalBinding.localParameter - name of the source parameter for an ON-condition +* Consumption.valueHelpDefinition.additionalBinding.localElement - name of the source element for an ON-condition +* Consumption.valueHelpDefinition.additionalBinding.parameter - name of the target parameter for an ON-condition +* Consumption.valueHelpDefinition.additionalBinding.element - name of the target element for an ON-condition +* Consumption.valueHelpDefinition.additionalBinding.usage - controls whether the binding is used as filter or result \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..8a8d3d7 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,13 @@ +This project offers a framework to generate List Reports using ALV Grid for CDS Views. +The features of the reports are controlled using CDS Annotations. + +**Version** + +The project is maintained on a system with Software Component SAP_ABA 750 SP26. +It runs on newer releases with minor adjustments, we plan to offer a variant for S/4HANA 2023 in the near future. + +**Resources** + +* [Installation Guide](./installation_guide.md) +* [Overview of relevant CDS annotations](./annotations.md) +* [Program extensions](./program_extensions.md) \ No newline at end of file diff --git a/docs/installation_guide.md b/docs/installation_guide.md new file mode 100644 index 0000000..912e0e3 --- /dev/null +++ b/docs/installation_guide.md @@ -0,0 +1,52 @@ +## Prerequisites + +abapGit needs to be installed and set up according to the official documentation: +* [Installation](https://docs.abapgit.org/user-guide/getting-started/install.html) +* [SSL Setup](https://docs.abapgit.org/user-guide/setup/ssl-setup.html) (SSL certificates for api.github.com) +* [Proxy Configuration](https://docs.abapgit.org/user-guide/setup/settings-global.html) + +## Installation + +Execute abapGit using the report *ZABAPGIT_STANDALONE* or transaction code *ZABAPGIT*, click on *New Online*. + +Fill the field *Git repository URL* with *https://github.com/rku-it-GmbH/cds2alv.git*. + +The default package name is *ZCDS_ALV*, create the package, if it does not already exist. + +Create the Online Repository and pull all contents to your system. + +Check if the Viewcluster *ZVC_CDS_ALV_FW* works properly, it may be necessary to generate the Maintenance Views in Function Group *ZCDS_ALV_TABLES* manually. + +## Setup + +### Maintain the Viewcluster *ZVC_CDS_ALV_FW* + +#### Intent-Based Navigation +Define the Intent-Based Navigation for the semantic objects and actions you want to use in your CDS Views. + +#### Intent-Based Navigation (Exits) +If the features offered by the framework are insufficient for ypur use case, you can use an exit class to implement the navigation for a specific CDS view. + +#### Program Extensions +These are Plugins to enhance the features of the reports generated by the framework. +They allow you to replace the steps for selection and display. + +##### Extension Parameters +Program Extensions typically need additional parameters that need to be added to the selection screen. In this view you can define these additional parameters. + +Please be aware that the parameter names must be unique globally, so two extensions using the same parameter names cannot be active at the same time. + +#### Implementation +The framework's factory class uses an Inverison of Control container to resolve the dependencies between the various classes. +This allows for replacing the default classes with other classes implementing the same interface. + +In this view you can register global alternative implementing classes for the framework's interfaces. + +Please be aware that the IoC container is not able to resolve cyclic dependencies, so you need to make sure that your collection of implementing classes does not lead to any cyclic dependencies. + +### Maintain Number Range Interval for View Entity Reports +Originally when designing the framework we decided to name the reports using a prefix and the name of the underlying database view of the CDS views. +As CDS View Entities do not have underlying database views the need for an alternative solution arose. + +As of now the solution is to create a unique name by numbering the reports. To this end the framework uses the Number Range *ZCDS_ALV_N* with interval *00*. +This interval needs to be defined in order for the framework to generate reports for CDS View entities. \ No newline at end of file diff --git a/docs/program_extensions.md b/docs/program_extensions.md new file mode 100644 index 0000000..d79e730 --- /dev/null +++ b/docs/program_extensions.md @@ -0,0 +1,36 @@ +# Program extensions + +Program extensions are plugins for the reports genereated by the framework. +They can be switched on and off for each individual CDS view in the first screen of the transaction *ZCDS_ALV_START*. + +## Defining a Program extension + +Program extensions are defined in the Viewcluster *ZVC_CDS_ALV_FW*. +The definition of a program extension consists of the following information: +* database key +* display name +* implementing class +* descriptive texts for alternative selection or display, if any of these are impemented +* addtional parameters that are added to the selection screen and bound to attributes of the implementing class + +## Implementing a Program extension + +The implementing class of a program extension must implement the interface *ZIF_CDS_ALV_REPORT_EXTENSION*, +furthermore it is recommended to inherit from the abstract class *ZCL_CDS_ALV_REPORT_EXTENSION* or a suitable subclass. + +Program extensions can enhance the following events: + +* INITIALIZATION (initialization) +* AT SELECTION-SCREEN OUTPUT (modify_screen) +* AT SELECTION-SCREEN (handle_user_command) +* AT SELECTION-SCREEN ON HELP-REQUEST (show_help) +* AT SELECTION-SCREEN ON VALUE-REQUEST (value_help) +* START-OF-SELECTION: + * alternative_selection to replace the selection via the SADL framework + * alternative_display to replace the ALV grid display + +Moreover, the method *alternative_reselection* needs to be implemented for handling the ALV user command *REFRESH*, if an alternative selection is defined + +## Collection of Program extensions + +A collection of program extensions will be made available as a separate repository in the near future. \ No newline at end of file diff --git a/src/package.devc.xml b/src/package.devc.xml new file mode 100644 index 0000000..71b089a --- /dev/null +++ b/src/package.devc.xml @@ -0,0 +1,16 @@ + + + + + + CDS ALV Framework + + + + SBOI_PUBLIC + NONE + + + + + diff --git a/src/zc_cds_alv_extensionheaders.ddls.asddls b/src/zc_cds_alv_extensionheaders.ddls.asddls new file mode 100644 index 0000000..3db57d4 --- /dev/null +++ b/src/zc_cds_alv_extensionheaders.ddls.asddls @@ -0,0 +1,17 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVEXTHDR' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Erweiterungen von Reports für CDS-Views' +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_ExtensionHeaders as select from ZI_CDS_ALV_ExtensionHeaders { + key ExtensionName, + AlternativeSelection, + AlternativeDisplay, + ImplementingClass, + _Text[ 1: Language = $session.system_language ].ExtensionText, + _Text[ 1: Language = $session.system_language ].SelectionText, + _Text[ 1: Language = $session.system_language ].DisplayText, + /* Associations */ + _Text +} diff --git a/src/zc_cds_alv_extensionheaders.ddls.xml b/src/zc_cds_alv_extensionheaders.ddls.xml new file mode 100644 index 0000000..98ff60c --- /dev/null +++ b/src/zc_cds_alv_extensionheaders.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_EXTENSIONHEADERS + D + Erweiterungen von Reports für CDS-Views + + + + diff --git a/src/zc_cds_alv_extensionparameters.ddls.asddls b/src/zc_cds_alv_extensionparameters.ddls.asddls new file mode 100644 index 0000000..c898ebe --- /dev/null +++ b/src/zc_cds_alv_extensionparameters.ddls.asddls @@ -0,0 +1,17 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVEXTPAR' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Parameter einer Programmerweiterung' +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_ExtensionParameters as select from ZI_CDS_ALV_ExtensionParameters { + key ExtensionName, + key ParameterName, + DbField, + HasValueHelp, + HasHelp, + AttributeName, + _Text[ 1: Language = $session.system_language ].ParameterText as ParameterText, + /* Associations */ + _Text +} diff --git a/src/zc_cds_alv_extensionparameters.ddls.xml b/src/zc_cds_alv_extensionparameters.ddls.xml new file mode 100644 index 0000000..523eebb --- /dev/null +++ b/src/zc_cds_alv_extensionparameters.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_EXTENSIONPARAMETERS + D + Parameter einer Programmerweiterung + + + + diff --git a/src/zc_cds_alv_navigation.ddls.asddls b/src/zc_cds_alv_navigation.ddls.asddls new file mode 100644 index 0000000..93e17a0 --- /dev/null +++ b/src/zc_cds_alv_navigation.ddls.asddls @@ -0,0 +1,17 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVNAV' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Intent-Based Navigation' +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_Navigation as select from ZI_CDS_ALV_Navigation { + key SemanticObject, + key SemanticAction, + Function, + DefaultParameter, + ConversionExit, + ObjectType, + ObjectMethod, + TransactionCode, + ParameterId +} diff --git a/src/zc_cds_alv_navigation.ddls.xml b/src/zc_cds_alv_navigation.ddls.xml new file mode 100644 index 0000000..8d73313 --- /dev/null +++ b/src/zc_cds_alv_navigation.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_NAVIGATION + D + Intent-Based Navigation + + + + diff --git a/src/zc_cds_alv_parameters.ddls.asddls b/src/zc_cds_alv_parameters.ddls.asddls new file mode 100644 index 0000000..511b29e --- /dev/null +++ b/src/zc_cds_alv_parameters.ddls.asddls @@ -0,0 +1,12 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVPARAMS' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'PARAMETERS der generierten Programme für CDS-Views' +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_Parameters as select from ZI_CDS_ALV_Parameters { + key ProgramName, + key SelectionName, + CdsView, + ParameterName +} diff --git a/src/zc_cds_alv_parameters.ddls.xml b/src/zc_cds_alv_parameters.ddls.xml new file mode 100644 index 0000000..9869842 --- /dev/null +++ b/src/zc_cds_alv_parameters.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_PARAMETERS + D + PARAMETERS der generierten Programme für CDS-Views + + + + diff --git a/src/zc_cds_alv_programs.ddls.asddls b/src/zc_cds_alv_programs.ddls.asddls new file mode 100644 index 0000000..d601d5c --- /dev/null +++ b/src/zc_cds_alv_programs.ddls.asddls @@ -0,0 +1,19 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVPROGRAM' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Programme zur Anzeige von CDS-Views' +define view ZC_CDS_ALV_Programs as select from ZI_CDS_ALV_Programs { + @UI.lineItem: [{ position: 1 }] + key CdsView, + @UI.lineItem: [{ position: 2 }] + ProgramName, + @UI.lineItem: [{ position: 3 }] + SelectionScreen, + @UI.lineItem: [{ position: 4 }] + Author, + @UI.lineItem: [{ position: 5 }] + GeneratedAt, + @UI.lineItem: [{ position: 6 }] + NoGeneration +} diff --git a/src/zc_cds_alv_programs.ddls.xml b/src/zc_cds_alv_programs.ddls.xml new file mode 100644 index 0000000..aee115f --- /dev/null +++ b/src/zc_cds_alv_programs.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_PROGRAMS + D + Programme zur Anzeige von CDS-Views + + + + diff --git a/src/zc_cds_alv_selectoptions.ddls.asddls b/src/zc_cds_alv_selectoptions.ddls.asddls new file mode 100644 index 0000000..925230f --- /dev/null +++ b/src/zc_cds_alv_selectoptions.ddls.asddls @@ -0,0 +1,16 @@ +@AbapCatalog.sqlViewName: 'ZCCDSVALVSELOPTS' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'SELECT-OPTIONS der generierten Programme für CDS-Views' +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_SelectOptions as select from ZI_CDS_ALV_SelectOptions { + @UI.lineItem: [{ position: 1 }] + key ProgramName, + @UI.lineItem: [{ position: 2 }] + key SelectionName, + @UI.lineItem: [{ position: 3 }] + CdsView, + @UI.lineItem: [{ position: 4 }] + FieldName +} diff --git a/src/zc_cds_alv_selectoptions.ddls.xml b/src/zc_cds_alv_selectoptions.ddls.xml new file mode 100644 index 0000000..d45f124 --- /dev/null +++ b/src/zc_cds_alv_selectoptions.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_SELECTOPTIONS + D + SELECT-OPTIONS der generierten Programme für CDS-Views + + + + diff --git a/src/zcds_alv.msag.xml b/src/zcds_alv.msag.xml new file mode 100644 index 0000000..4dd58e6 --- /dev/null +++ b/src/zcds_alv.msag.xml @@ -0,0 +1,378 @@ + + + + + + ZCDS_ALV + D + CDS ALV Framework + + + + D + ZCDS_ALV + 001 + Die Tabelle konnte nicht um das Style-Feld &1 erweitert werden. + + + D + ZCDS_ALV + 002 + Keine Navigation für Objekt &1, Aktion &2 definiert. + + + D + ZCDS_ALV + 003 + Bitte markieren Sie nur eine Zeile für diese Aktion. + + + D + ZCDS_ALV + 004 + Aufruf mit Tabellenparameter nur für Funktionsbausteine möglich! + + + D + ZCDS_ALV + 005 + Ungültiger Importparameter &1 für Funktionsbaustein &2. + + + D + ZCDS_ALV + 006 + Fehler beim Generieren des Reports für CDS-View &1 (Zeile &2, Wort &3) + + + D + ZCDS_ALV + 007 + Der CDS-View &1 existiert nicht. + + + D + ZCDS_ALV + 008 + Kein Programm für CDS-View &1 vorhanden. + + + D + ZCDS_ALV + 009 + Der CDS-View &1 existiert bereits. + + + D + ZCDS_ALV + 010 + Der DDIC-View &1 existiert bereits. + + + D + ZCDS_ALV + 011 + Query oder Quick-View &1 ist nicht vorhanden. + + + D + ZCDS_ALV + 012 + Query oder Quick-View &1 kann nicht gelesen werden. + + + D + ZCDS_ALV + 013 + Objekt &1 konnte nicht aktiviert werden. + + + D + ZCDS_ALV + 014 + Programminfos für CDS-View &1 konnten nicht gespeichert werden. + + + D + ZCDS_ALV + 015 + Das Objekt implementiert nicht das Interface &1. + + + D + ZCDS_ALV + 016 + Keine gültige implementierende Klasse für Interface &1 konfiguriert. + + + D + ZCDS_ALV + 017 + Für Interface &1 konnte keine Instanz der Klasse &2 instanziiert werden. + + + D + ZCDS_ALV + 018 + Die Tabelle hat nicht die passende Struktur für CDS-View &1. + + + D + ZCDS_ALV + 019 + Klasse &1 für Erweiterung &2 konnte nicht instanziiert werden. + + + D + ZCDS_ALV + 020 + Es sind keine Programmerweiterungen verfügbar. + + + D + ZCDS_ALV + 021 + Konvertierung für XML-Version &1 aktuell nicht umgesetzt. + + + D + ZCDS_ALV + 022 + Bitte geben Sie einen Dateinamen an. + + + D + ZCDS_ALV + 023 + Fehler beim Lesen der Datei &1. + + + D + ZCDS_ALV + 024 + Fehler beim Ablegen der Datei &1. + + + D + ZCDS_ALV + 025 + Fehler beim Löschen der Datei &1. + + + D + ZCDS_ALV + 026 + Datei &1 wurde abgelegt. + + + D + ZCDS_ALV + 027 + &1 ist keine gültige Klasse. + + + D + ZCDS_ALV + 028 + &1 ist kein gültiges Interface. + + + D + ZCDS_ALV + 029 + Klasse &1 implementiert nicht das Interface &2. + + + D + ZCDS_ALV + 030 + Fehler beim RFC-Aufruf: &1 + + + D + ZCDS_ALV + 031 + Mailversand an Empfängerliste &1 angestoßen. + + + D + ZCDS_ALV + 032 + Leere Empfängerliste &1 + + + + E + + + + E + ZCDS_ALV + CDS ALV Framework + + + + + E + 001 + Style field &1 could not be inserted into the table. + + + E + 002 + No navigation defined for semantic object &1, action &2. + + + E + 003 + Please select exactly one line for this action. + + + E + 004 + Only function modules may be called with tables parameters! + + + E + 005 + Invalid importing parameter &1 for function module &2. + + + E + 006 + Syntax error in generated report for CDS view &1 (Line &2, Word &3) + + + E + 007 + CDS view &1 does not exist. + + + E + 008 + No program available for CDS view &1. + + + E + 009 + CDS view &1 already exists. + + + E + 010 + DDIC view &1 already exists. + + + E + 011 + Query or quick view &1 does not exist. + + + E + 012 + Error reading query or quick view &1. + + + E + 013 + Object &1 could not be activated. + + + E + 014 + Program infos for CDS View &1 could not be saved. + + + E + 015 + The given object does not implement interface &1. + + + E + 016 + There is no valid implementing class configured for interface &1. + + + E + 017 + No instance of class &2 could be instantiated for interface &1. + + + E + 018 + The given table does not have the right line type for CDS view &1. + + + E + 019 + Class &1 could not be instantiated for extension &2. + + + E + 020 + There are no program extensions available. + + + E + 021 + Conversion is currently not implemented for XML version &1. + + + E + 022 + Please enter a file name! + + + E + 023 + Error occured reading file &1. + + + E + 024 + Error occured storing file &1. + + + E + 025 + Error occured deleting file &1. + + + E + 026 + File &1 was stored. + + + E + 027 + &1 is not a valid class. + + + E + 028 + &1 is not a valid interface. + + + E + 029 + Class &1 does not implement interface &2. + + + E + 030 + Error during RFC call: &1 + + + E + 031 + Mail delivery to receiver list &1 was triggered. + + + E + 032 + Empty receiver list &1. + + + + + diff --git a/src/zcds_alv_action_name.doma.xml b/src/zcds_alv_action_name.doma.xml new file mode 100644 index 0000000..93426f5 --- /dev/null +++ b/src/zcds_alv_action_name.doma.xml @@ -0,0 +1,22 @@ + + + + + + ZCDS_ALV_ACTION_NAME + CHAR + 000030 + 000030 + + + E + + + + E + Name + + + + + diff --git a/src/zcds_alv_action_name.dtel.xml b/src/zcds_alv_action_name.dtel.xml new file mode 100644 index 0000000..56589de --- /dev/null +++ b/src/zcds_alv_action_name.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_ACTION_NAME + D + ZCDS_ALV_ACTION_NAME + 30 + 10 + 15 + 20 + Name + Objektname + Objektname + Objektname + Objektname + E + D + + + E + + + + E + Name + Action Name + Act. Name + Action Name + Action Name + + + + + diff --git a/src/zcds_alv_activation_timestamp.dtel.xml b/src/zcds_alv_activation_timestamp.dtel.xml new file mode 100644 index 0000000..b5456bb --- /dev/null +++ b/src/zcds_alv_activation_timestamp.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_ACTIVATION_TIMESTAMP + D + SALV_TEST_TSTMP + X + 55 + 10 + 20 + 40 + Zeitstempel der Generierung + Zeitpunkt der Aktivierung + Aktiviert + Aktiviert am + Zeitpunkt der Aktivierung + D + D + + + E + + + + E + Generation Timestamp + Activation Timestamp + Activated + Activated on + Activation Timestamp + + + + + diff --git a/src/zcds_alv_active_flag.dtel.xml b/src/zcds_alv_active_flag.dtel.xml new file mode 100644 index 0000000..c1b3b2f --- /dev/null +++ b/src/zcds_alv_active_flag.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_ACTIVE_FLAG + D + XFELD + X + 55 + 10 + 20 + 40 + Kennzeichen: Aktiv + Aktiv + Aktiv + Aktiv + Aktiv + D + D + + + E + + + + E + Flag: Active + Active + Active + Active + Active + + + + + diff --git a/src/zcds_alv_alternative_display.dtel.xml b/src/zcds_alv_alternative_display.dtel.xml new file mode 100644 index 0000000..249a451 --- /dev/null +++ b/src/zcds_alv_alternative_display.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_ALTERNATIVE_DISPLAY + D + XFELD + 55 + 10 + 20 + 40 + Kennzeichen: Alternative Anzeige + Alternative Anzeige + Alt. Anz. + Alternative Anzeige + Alternative Anzeige + D + D + + + E + + + + E + Flag: Alternative Display + Alternative Display + Alt. Disp. + Alternative Display + Alternative Display + + + + + diff --git a/src/zcds_alv_alternative_selection.dtel.xml b/src/zcds_alv_alternative_selection.dtel.xml new file mode 100644 index 0000000..babac28 --- /dev/null +++ b/src/zcds_alv_alternative_selection.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_ALTERNATIVE_SELECTION + D + XFELD + X + 55 + 10 + 20 + 40 + Kennzeichen: Alternative Selektion + Alternative Selektion + Alt. Sel. + Alt. Selektion + Alternative Selektion + D + D + + + E + + + + E + Flag: Alternative Selection + Alternative Selection + Alt. Sel. + Alt. Selection + Alternative Selection + + + + + diff --git a/src/zcds_alv_cds_view.para.xml b/src/zcds_alv_cds_view.para.xml new file mode 100644 index 0000000..b1535eb --- /dev/null +++ b/src/zcds_alv_cds_view.para.xml @@ -0,0 +1,15 @@ + + + + + + ZCDS_ALV_CDS_VIEW + + + ZCDS_ALV_CDS_VIEW + D + CDS-View zur Anzeige im ALV + + + + diff --git a/src/zcds_alv_criticality.doma.xml b/src/zcds_alv_criticality.doma.xml new file mode 100644 index 0000000..acbab88 --- /dev/null +++ b/src/zcds_alv_criticality.doma.xml @@ -0,0 +1,77 @@ + + + + + + ZCDS_ALV_CRITICALITY + D + NUMC + 000001 + 000001 + X + Criticality (aus UI.LineItem.Criticality) + + + + 0001 + D + 0 + Neutral + + + 0002 + D + 1 + Negative + + + 0003 + D + 2 + Critical + + + 0004 + D + 3 + Positive + + + + E + + + + E + Criticality (from UI.LineItem.Criticality) + + + + + 0001 + E + 0 + Neutral + + + 0002 + E + 1 + Negative + + + 0003 + E + 2 + Critical + + + 0004 + E + 3 + Positive + + + + + diff --git a/src/zcds_alv_criticality.dtel.xml b/src/zcds_alv_criticality.dtel.xml new file mode 100644 index 0000000..fd4bf1e --- /dev/null +++ b/src/zcds_alv_criticality.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_CRITICALITY + D + ZCDS_ALV_CRITICALITY + 55 + 10 + 20 + 40 + Criticality (aus UI.LineItem.Criticality) + Criticality + Crit. + Criticality + Criticality + D + D + + + E + + + + E + Criticality (from UI.LineItem.Criticality) + Criticality + Crit. + Criticality + Criticality + + + + + diff --git a/src/zcds_alv_demo/package.devc.xml b/src/zcds_alv_demo/package.devc.xml new file mode 100644 index 0000000..e3d49a2 --- /dev/null +++ b/src/zcds_alv_demo/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + CDS ALV Framework: Demo- und Testobjekte + + + + diff --git a/src/zcds_alv_demo/zc_cds_alv_demo.ddls.asddls b/src/zcds_alv_demo/zc_cds_alv_demo.ddls.asddls new file mode 100644 index 0000000..815acb8 --- /dev/null +++ b/src/zcds_alv_demo/zc_cds_alv_demo.ddls.asddls @@ -0,0 +1,51 @@ +@AbapCatalog.sqlViewName: 'ZCCDSALVDEMO' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Consumption-View für Demoprogramm' +@ObjectModel.semanticKey: ['DemoKey'] +@VDM.viewType: #CONSUMPTION +define view ZC_CDS_ALV_Demo as select from ZI_CDS_ALV_Demo { + @Consumption.filter.selectionType: #RANGE + @UI.lineItem: [{ position: 1 }] + @UI.selectionField: [{ position: 1, qualifier: 'Main' }] + key demo_key as DemoKey, + @Consumption.filter.selectionType: #RANGE + @UI.lineItem: [{ position: 2, criticality: 'Criticality' }] + @UI.selectionField: [{ position: 2, qualifier: 'Main' }] + demo_text as DemoText, + @Consumption.filter.selectionType: #INTERVAL + @UI.lineItem: [{ position: 3 }] + @UI.selectionField: [{ position: 3, qualifier: 'Sub' }] + demo_integer as DemoInteger, + @UI.lineItem: [{ position: 4 }] + demo_float as DemoFloat, + @UI.lineItem: [{ position: 5 }] + @Semantics.amount.currencyCode: 'DemoCurrency' + demo_amount as DemoAmount, + @UI.hidden + demo_currency as DemoCurrency, + @UI.lineItem: [{ position: 6 }] + @Semantics.quantity.unitOfMeasure: 'DemoUnit' + demo_quantity as DemoQuantity, + @Consumption.semanticObject: 'UnitOfMeasure' + @UI.hidden + @UI.lineItem: [{ type: #FOR_INTENT_BASED_NAVIGATION, semanticObjectAction: 'Maintain', label: 'Units of Measure' }] + demo_unit as DemoUnit, + @Consumption.filter.selectionType: #RANGE + @UI.lineItem: [{ position: 8 }] + @UI.selectionField: [{ position: 4 }] + demo_email as DemoEmail, + @UI.lineItem: [{ position: 9, type: #WITH_URL, url: 'DemoUrl' }] + @Semantics.url.mimeType: 'DemoMimeType' + demo_url as DemoUrl, + @UI.lineItem: [{ position: 10 }] + demo_mime_type as DemoMimeType, + @Consumption.filter.defaultValue: '3' + @Consumption.filter.selectionType: #INTERVAL + @UI.lineItem: [{ position: 11 }] + @UI.selectionField: [{ position: 5, qualifier: 'Sub' }] + criticality as Criticality, + @Consumption.hidden: true + 'X' as Invisible +} diff --git a/src/zcds_alv_demo/zc_cds_alv_demo.ddls.xml b/src/zcds_alv_demo/zc_cds_alv_demo.ddls.xml new file mode 100644 index 0000000..666908e --- /dev/null +++ b/src/zcds_alv_demo/zc_cds_alv_demo.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZC_CDS_ALV_DEMO + D + Consumption-View für das Demoprogramm + + + + diff --git a/src/zcds_alv_demo/zcds_alv_demo.prog.abap b/src/zcds_alv_demo/zcds_alv_demo.prog.abap new file mode 100644 index 0000000..e92bbdd --- /dev/null +++ b/src/zcds_alv_demo/zcds_alv_demo.prog.abap @@ -0,0 +1,53 @@ +*&---------------------------------------------------------------------* +*& Report zcds_alv_demo +*&---------------------------------------------------------------------* +REPORT zcds_alv_demo. + +TABLES: sscrfields, zccdsalvdemo. + +CONSTANTS cds_view TYPE ddstrucobjname VALUE 'ZC_CDS_ALV_Demo'. + +DATA controller TYPE REF TO zif_cds_alv_report_controller. +DATA message TYPE REF TO zcx_cds_alv_message. + +SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN. + SELECTION-SCREEN BEGIN OF BLOCK sub. + SELECT-OPTIONS so_key FOR zccdsalvdemo-demokey. + + PARAMETERS: p_maxrec TYPE ddshmaxrec DEFAULT 500 MODIF ID max, + p_no_max TYPE xfeld DEFAULT abap_false USER-COMMAND switch_max, + p_forall TYPE xfeld DEFAULT abap_false NO-DISPLAY, + p_mem_id TYPE zcds_alv_memory_id NO-DISPLAY. + SELECTION-SCREEN END OF BLOCK sub. +SELECTION-SCREEN END OF SCREEN 1001. +SELECTION-SCREEN INCLUDE BLOCKS sub. +PARAMETERS p_split TYPE xfeld DEFAULT abap_false. + +LOAD-OF-PROGRAM. + TRY. + controller = zcl_cds_alv_factory=>get_instance( )->get_report_controller( cds_view ). + CATCH zcx_cds_alv_message INTO message. + MESSAGE message TYPE 'A'. + ENDTRY. + +INITIALIZATION. + controller->initialization( ). + +AT SELECTION-SCREEN OUTPUT. + controller->at_selection_screen_output( ). + +AT SELECTION-SCREEN. + controller->at_selection_screen( sscrfields-ucomm ). + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_key-low. + controller->at_value_request( EXPORTING i_sel_name = 'SO_KEY' + CHANGING c_value = so_key-low ). + +AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_key-high. + controller->at_value_request( EXPORTING i_sel_name = 'SO_KEY' + CHANGING c_value = so_key-high ). + +START-OF-SELECTION. + controller->start_of_selection( i_forall = p_forall + i_memory_id = p_mem_id + i_in_split_screen = p_split ). diff --git a/src/zcds_alv_demo/zcds_alv_demo.prog.xml b/src/zcds_alv_demo/zcds_alv_demo.prog.xml new file mode 100644 index 0000000..3c1c0b4 --- /dev/null +++ b/src/zcds_alv_demo/zcds_alv_demo.prog.xml @@ -0,0 +1,84 @@ + + + + + + ZCDS_ALV_DEMO + S + 1 + X + D$S + X + + + + R + Demoprogramm für das CDS ALV Framework + 38 + + + S + P_MAXREC + . + 9 + D + + + S + P_NO_MAX + Keine Beschränkung + 26 + + + S + P_SPLIT + Anzeige im Split Screen + 31 + + + S + SO_KEY + Schlüssel + 17 + + + + + E + + + R + CDS ALV demo program + 70 + + + S + P_NO_MAX + No restriction + 38 + + + S + P_SPLIT + Display in split screen + 38 + + + S + SO_KEY + Key + 38 + + + S + P_MAXREC + . + 9 + D + + + + + + + diff --git a/src/zcds_alv_demo/zcds_alv_demo.tabl.xml b/src/zcds_alv_demo/zcds_alv_demo.tabl.xml new file mode 100644 index 0000000..cb09c36 --- /dev/null +++ b/src/zcds_alv_demo/zcds_alv_demo.tabl.xml @@ -0,0 +1,179 @@ + + + + + + ZCDS_ALV_DEMO + D + TRANSP + X + Tabelle für das Demoprogramm + X + L + 4 + + + ZCDS_ALV_DEMO + A + 0 + APPL0 + N + + + + MANDT + X + MANDT + T000 + 0 + X + P + E + + + DEMO_KEY + X + 0 + C + 000060 + X + CHAR + 000030 + CHAR + Schlüssel + + + DEMO_TEXT + 0 + C + 000200 + CHAR + 000100 + CHAR + Freitext + + + DEMO_INTEGER + 0 + X + 000004 + INT4 + 000010 + INT4 + Ganze Zahl + + + DEMO_FLOAT + 0 + F + 000008 + FLTP + 000016 + 000016 + FLTP + Gleitpunktzahl + + + DEMO_AMOUNT + 0 + P + 000008 + ZCDS_ALV_DEMO + DEMO_CURRENCY + CURR + 000014 + 000002 + CURR + Betrag + + + DEMO_CURRENCY + 0 + C + 000010 + CUKY + 000005 + CUKY + Währung + + + DEMO_QUANTITY + 0 + P + 000016 + ZCDS_ALV_DEMO + DEMO_UNIT + QUAN + 000031 + 000014 + QUAN + Menge + + + DEMO_UNIT + 0 + C + 000006 + UNIT + 000003 + UNIT + Einheit + + + DEMO_EMAIL + AD_SMTPADR + 0 + E + + + DEMO_URL + W3URL + 0 + E + + + DEMO_MIME_TYPE + W3CONTTYPE + 0 + E + + + CRITICALITY + ZCDS_ALV_CRITICALITY + 0 + X + F + E + + + + + MANDT + ZCDS_ALV_DEMO + MANDT + T000 + MANDT + 0001 + MANDT + CLNT + + + + + MANDT + T000 + KEY + + + + E + + + + E + Demo database table + + + + + diff --git a/src/zcds_alv_demo/zi_cds_alv_demo.ddls.asddls b/src/zcds_alv_demo/zi_cds_alv_demo.ddls.asddls new file mode 100644 index 0000000..44b62b5 --- /dev/null +++ b/src/zcds_alv_demo/zi_cds_alv_demo.ddls.asddls @@ -0,0 +1,62 @@ +@AbapCatalog.sqlViewName: 'ZICDSALVDEMO' +@AbapCatalog.compiler.compareFilter: true +@AbapCatalog.preserveKey: true +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Demo interface view' +//@ObjectModel.compositionRoot: true +@ObjectModel.modelCategory: #BUSINESS_OBJECT +@ObjectModel.representativeKey: 'demo_key' +@ObjectModel.semanticKey: ['demo_key'] +@ObjectModel.writeActivePersistence: 'ZCDS_ALV_DEMO' +@ObjectModel.transactionalProcessingEnabled: true +@ObjectModel.deleteEnabled: true +@ObjectModel.updateEnabled: true +@VDM.viewType: #BASIC +define view ZI_CDS_ALV_Demo as select from zcds_alv_demo { + @EndUserText.label: 'Key' + @EndUserText.quickInfo: 'Key' + @ObjectModel.readOnly: true + key demo_key, + @EndUserText.label: 'Text' + @EndUserText.quickInfo: 'Text' + demo_text, + @EndUserText.label: 'Integer' + @EndUserText.quickInfo: 'Integer' + @DefaultAggregation: #MAX + demo_integer, + @EndUserText.label: 'Float' + @EndUserText.quickInfo: 'Float' + @DefaultAggregation: #AVG + demo_float, + @EndUserText.label: 'Amount' + @EndUserText.quickInfo: 'Amount' + @DefaultAggregation: #SUM + @Semantics.amount.currencyCode: 'demo_currency' + demo_amount, + @EndUserText.label: 'Currency' + @EndUserText.quickInfo: 'Currency' + @Semantics.currencyCode: true + demo_currency, + @EndUserText.label: 'Quantity' + @EndUserText.quickInfo: 'Quantity' + @DefaultAggregation: #SUM + @Semantics.quantity.unitOfMeasure: 'demo_unit' + demo_quantity, + @EndUserText.label: 'Unit' + @EndUserText.quickInfo: 'Unit' + @Semantics.unitOfMeasure: true + demo_unit, + @EndUserText.label: 'Email address' + @EndUserText.quickInfo: 'Email address' + @Semantics.eMail.address: true + demo_email, + @EndUserText.label: 'URL' + @EndUserText.quickInfo: 'URL' + @Semantics.url.mimeType: 'demo_mime_type' + demo_url, + @EndUserText.label: 'MIME-Typ' + @EndUserText.quickInfo: 'MIME-Typ' + demo_mime_type, + @DefaultAggregation: #MIN + criticality +} diff --git a/src/zcds_alv_demo/zi_cds_alv_demo.ddls.xml b/src/zcds_alv_demo/zi_cds_alv_demo.ddls.xml new file mode 100644 index 0000000..061ca7f --- /dev/null +++ b/src/zcds_alv_demo/zi_cds_alv_demo.ddls.xml @@ -0,0 +1,12 @@ + + + + + + ZI_CDS_ALV_DEMO + D + Interfaceview für das Demoprogramm + + + + diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayf01.abap b/src/zcds_alv_display.fugr.lzcds_alv_displayf01.abap new file mode 100644 index 0000000..9b83ed3 --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayf01.abap @@ -0,0 +1,29 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_DISPLAYF01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Form BUILD_GRID +*&---------------------------------------------------------------------* +FORM build_grid USING container_name RAISING zcx_cds_alv_message. + IF container IS NOT BOUND. + CREATE OBJECT container + EXPORTING + container_name = container_name + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. + + IF alv_grid IS NOT BOUND. + builder->create_alv_grid( + EXPORTING + i_container = container + i_table_container = table_container + IMPORTING + e_alv_grid = alv_grid ). + ENDIF. +ENDFORM. diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayf01.xml b/src/zcds_alv_display.fugr.lzcds_alv_displayf01.xml new file mode 100644 index 0000000..89512d5 --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayf01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_DISPLAYF01 + I + S + D + X + + + + R + Include LZCDS_ALV_DISPLAYF01 + 28 + + + + + diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayi01.abap b/src/zcds_alv_display.fugr.lzcds_alv_displayi01.abap new file mode 100644 index 0000000..abcbb26 --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayi01.abap @@ -0,0 +1,39 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_DISPLAYI01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module EXIT INPUT +*&---------------------------------------------------------------------* +MODULE exit INPUT. + IF container IS BOUND. + container->free( EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. + + FREE: container, alv_grid. + LEAVE TO SCREEN 0. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module USER_COMMAND INPUT +*&---------------------------------------------------------------------* +MODULE user_command INPUT. + TRY. + IF controller IS BOUND. + controller->handle_user_command( ok_code ). + alv_grid->refresh_table_display( EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. + + CLEAR ok_code. + CLEANUP. + CLEAR ok_code. + ENDTRY. +ENDMODULE. diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayi01.xml b/src/zcds_alv_display.fugr.lzcds_alv_displayi01.xml new file mode 100644 index 0000000..410b77d --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayi01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_DISPLAYI01 + I + S + D + X + + + + R + Include LZCDS_ALV_DISPLAYI01 + 28 + + + + + diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayo01.abap b/src/zcds_alv_display.fugr.lzcds_alv_displayo01.abap new file mode 100644 index 0000000..f0928fd --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayo01.abap @@ -0,0 +1,29 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_DISPLAYO01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module STATUS_0100 OUTPUT +*&---------------------------------------------------------------------* +MODULE status_0100 OUTPUT. + SET PF-STATUS 'STAT0100'. + SET TITLEBAR 'TITLE' WITH title. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module BUILD_GRID_0100 OUTPUT +*&---------------------------------------------------------------------* +MODULE build_grid_0100 OUTPUT. + PERFORM build_grid USING 'FULL_SCREEN_CONTAINER'. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module STATUS_0200 OUTPUT +*&---------------------------------------------------------------------* +MODULE status_0200 OUTPUT. + SET PF-STATUS 'STAT0200'. + SET TITLEBAR 'TITLE' WITH title. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module BUILD_GRID_0200 OUTPUT +*&---------------------------------------------------------------------* +MODULE build_grid_0200 OUTPUT. + PERFORM build_grid USING 'SPLIT_SCREEN_CONTAINER'. +ENDMODULE. diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displayo01.xml b/src/zcds_alv_display.fugr.lzcds_alv_displayo01.xml new file mode 100644 index 0000000..9a89f37 --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displayo01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_DISPLAYO01 + I + S + D + X + + + + R + Include LZCDS_ALV_DISPLAYO01 + 28 + + + + + diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displaytop.abap b/src/zcds_alv_display.fugr.lzcds_alv_displaytop.abap new file mode 100644 index 0000000..ba10e2e --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displaytop.abap @@ -0,0 +1,14 @@ +FUNCTION-POOL zcds_alv_display. +CONSTANTS: full_screen TYPE sydynnr VALUE '0100', + split_screen TYPE sydynnr VALUE '0200'. + +DATA: table_container TYPE REF TO zif_cds_alv_table_container, + controller TYPE REF TO zif_cds_alv_split_screen_cntr, + builder TYPE REF TO zif_cds_alv_grid_builder, + alv_grid TYPE REF TO cl_gui_alv_grid, + container TYPE REF TO cl_gui_custom_container, + ref_to_table TYPE REF TO data, + sub_repid TYPE syrepid, + sub_dynnr TYPE sydynnr, + ok_code TYPE cua_code, + title TYPE sytitle. diff --git a/src/zcds_alv_display.fugr.lzcds_alv_displaytop.xml b/src/zcds_alv_display.fugr.lzcds_alv_displaytop.xml new file mode 100644 index 0000000..ee5c0c2 --- /dev/null +++ b/src/zcds_alv_display.fugr.lzcds_alv_displaytop.xml @@ -0,0 +1,17 @@ + + + + + + LZCDS_ALV_DISPLAYTOP + S + D$ + I + S + X + D$S + X + + + + diff --git a/src/zcds_alv_display.fugr.saplzcds_alv_display.abap b/src/zcds_alv_display.fugr.saplzcds_alv_display.abap new file mode 100644 index 0000000..24ec0e5 --- /dev/null +++ b/src/zcds_alv_display.fugr.saplzcds_alv_display.abap @@ -0,0 +1,21 @@ +******************************************************************* +* System-defined Include-files. * +******************************************************************* + INCLUDE LZCDS_ALV_DISPLAYTOP. " Global Declarations + INCLUDE LZCDS_ALV_DISPLAYUXX. " Function Modules + +******************************************************************* +* User-defined Include-files (if necessary). * +******************************************************************* +* INCLUDE LZCDS_ALV_DISPLAYF... " Subroutines +* INCLUDE LZCDS_ALV_DISPLAYO... " PBO-Modules +* INCLUDE LZCDS_ALV_DISPLAYI... " PAI-Modules +* INCLUDE LZCDS_ALV_DISPLAYE... " Events +* INCLUDE LZCDS_ALV_DISPLAYP... " Local class implement. +* INCLUDE LZCDS_ALV_DISPLAYT99. " ABAP Unit tests + +INCLUDE lzcds_alv_displayi01. + +INCLUDE lzcds_alv_displayo01. + +INCLUDE lzcds_alv_displayf01. diff --git a/src/zcds_alv_display.fugr.saplzcds_alv_display.xml b/src/zcds_alv_display.fugr.saplzcds_alv_display.xml new file mode 100644 index 0000000..18bd9f7 --- /dev/null +++ b/src/zcds_alv_display.fugr.saplzcds_alv_display.xml @@ -0,0 +1,18 @@ + + + + + + SAPLZCDS_ALV_DISPLAY + S + D$ + F + S + D + X + D$S + X + + + + diff --git a/src/zcds_alv_display.fugr.xml b/src/zcds_alv_display.fugr.xml new file mode 100644 index 0000000..2ccabf8 --- /dev/null +++ b/src/zcds_alv_display.fugr.xml @@ -0,0 +1,718 @@ + + + + + Anzeige des ALV-Grids für einen CDS-View + + LZCDS_ALV_DISPLAYF01 + LZCDS_ALV_DISPLAYI01 + LZCDS_ALV_DISPLAYO01 + LZCDS_ALV_DISPLAYTOP + SAPLZCDS_ALV_DISPLAY + + + + Z_CDS_ALV_FULL_SCREEN + Anzeige des ALV-Grids im Full Screen + + + I_BUILDER + X + REF TO ZIF_CDS_ALV_GRID_BUILDER + X + + + I_TABLE_CONTAINER + X + REF TO ZIF_CDS_ALV_TABLE_CONTAINER + X + + + + + ZCX_CDS_ALV_MESSAGE + + + + + I_BUILDER + P + + + I_TABLE_CONTAINER + P + Container für Daten eines CDS-Views + + + ZCX_CDS_ALV_MESSAGE + X + + + X + + + Z_CDS_ALV_SPLIT_SCREEN + Anzeige im Split Screen + + + I_BUILDER + X + REF TO ZIF_CDS_ALV_GRID_BUILDER + X + + + I_TABLE_CONTAINER + X + REF TO ZIF_CDS_ALV_TABLE_CONTAINER + X + + + I_CONTROLLER + X + REF TO ZIF_CDS_ALV_SPLIT_SCREEN_CNTR + X + + + I_SUB_REPID + X + SYREPID + + + I_SUB_DYNNR + X + SYDYNNR + + + + + I_BUILDER + P + Aufbau eines ALV-Grids mittels CDS-Annotationen + + + I_TABLE_CONTAINER + P + Container für Daten eines CDS-Views + + + I_CONTROLLER + P + Controller für den Split Screen + + + I_SUB_REPID + P + ABAP-Programm, aktuelles Rahmenprogramm + + + I_SUB_DYNNR + P + Dynpro-Nummer + + + + + + +
+ SAPLZCDS_ALV_DISPLAY + 0100 + D + Full Screen + N + 0100 + 200 + 255 +
+ + + SCREEN + SCREEN + + + CUST_CTRL + FULL_SCREEN_CONTAINER + SCREEN + 001 + 001 + 255 + 200 + X + X + 010 + 010 + + + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE status_0100. + + + MODULE build_grid_0100. + + + + PROCESS AFTER INPUT. + + + MODULE exit AT EXIT-COMMAND. + + +
+ +
+ SAPLZCDS_ALV_DISPLAY + 0200 + D + Split Screen + N + 0200 + 200 + 255 +
+ + + SCREEN + SCREEN + + + SUBSCREEN + SELECTION_SUBSCREEN + SCREEN + 002 + 002 + 253 + 040 + X + X + 010 + 010 + + + CUST_CTRL + SPLIT_SCREEN_CONTAINER + SCREEN + 044 + 002 + 253 + 156 + X + X + 010 + 010 + + + + + SCREEN + SCREEN + FRAME + FRAME_FOR_SELECTION + Selektionskriterien_________________________________________________________________________________________________________________ + 001 + 001 + 255 + 255 + 042 + CHAR + N + + + SCREEN + SCREEN + FRAME + FRAME_FOR_ALV_GRID + Ergebnisliste_______________________________________________________________________________________________________________________ + 043 + 001 + 255 + 255 + 158 + CHAR + N + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE status_0200. + + + MODULE build_grid_0200. + + + + CALL SUBSCREEN selection_subscreen INCLUDING sub_repid sub_dynnr. + + + + PROCESS AFTER INPUT. + + + CALL SUBSCREEN selection_subscreen. + + + + MODULE exit AT EXIT-COMMAND. + + + MODULE user_command. + + +
+
+ + + 000002 + 000005 + 000002 + + + + STAT0100 + D + 000001 + 000001 + 0001 + Full Screen + + + STAT0200 + D + 000002 + 000002 + 0001 + Split Screen + + + + + BACK + 001 + E + S + Zurück + + + CANC + 001 + E + S + ICON_CANCEL + @0W@ + Abbrechen + + + EXIT + 001 + E + S + Beenden + + + SELECT + 001 + S + ICON_EXECUTE_OBJECT + @15@ + Ausführen (F8) + + + + + 000001 + 01 + F + <01> + + + 000001 + 02 + F + <02> + + + 000001 + 03 + F + <03> + + + 000001 + 04 + F + <04> + + + 000001 + 05 + F + <05> + + + 000001 + 06 + S + <S1> + + + 000001 + 07 + F + <06> + + + 000001 + 08 + S + <S1> + + + 000001 + 09 + F + <09> + + + 000001 + 10 + S + <S1> + + + 000001 + 11 + F + <10> + + + 000001 + 12 + F + <11> + + + 000002 + 01 + F + <12> + + + 000002 + 02 + F + <13> + + + 000002 + 03 + F + <24> + + + 000002 + 04 + F + <14> + + + 000002 + 05 + S + <S1> + + + 000002 + 06 + F + <16> + + + 000002 + 07 + F + <17> + + + 000002 + 08 + F + <18> + + + 000002 + 09 + S + <S1> + + + 000002 + 10 + F + <26> + + + 000002 + 11 + F + <27> + + + 000002 + 12 + F + <20> + + + 000002 + 13 + S + <S1> + + + 000002 + 14 + F + <22> + + + 000003 + 01 + S + <S1> + + + 000003 + 02 + F + <23> + + + + + 000001 + S + <Objekt> + O + Normergänzung + + + 000002 + S + Bearbeiten + B + Normergänzung + + + 000003 + S + Springen + S + Normergänzung + + + 000004 + S + Zusätze + Z + Normergänzung + + + 000005 + S + Umfeld + U + Normergänzung + + + + + 000001 + 01 + 000001 + + + 000001 + 02 + 000002 + + + 000001 + 03 + 000003 + + + 000001 + 04 + 000004 + + + 000001 + 05 + 000005 + + + + + 000002 + 0001 + 01 + 08 + + + + + 000001 + 03 + BACK + 001 + + + 000001 + 12 + CANC + 001 + + + 000001 + 15 + EXIT + 001 + + + 000002 + 03 + BACK + 001 + + + 000002 + 08 + SELECT + 001 + + + 000002 + 12 + CANC + 001 + + + 000002 + 15 + EXIT + 001 + + + + + STAT0100 + BACK + + + STAT0100 + CANC + + + STAT0100 + EXIT + + + STAT0200 + BACK + + + STAT0200 + CANC + + + STAT0200 + EXIT + + + STAT0200 + SELECT + + + + + A + 000001 + D + X + Full Screen + + + P + 000001 + D + Full Screen + + + B + 000001 + 0001 + D + Full Screen + + + A + 000002 + D + Split Screen + + + P + 000002 + D + Split Screen + + + B + 000002 + 0001 + D + Split Screen + + + + + TITLE + & + + + +
+
+
diff --git a/src/zcds_alv_display.fugr.z_cds_alv_full_screen.abap b/src/zcds_alv_display.fugr.z_cds_alv_full_screen.abap new file mode 100644 index 0000000..0eaf4f1 --- /dev/null +++ b/src/zcds_alv_display.fugr.z_cds_alv_full_screen.abap @@ -0,0 +1,19 @@ +FUNCTION z_cds_alv_full_screen. +*"---------------------------------------------------------------------- +*"*"Lokale Schnittstelle: +*" IMPORTING +*" REFERENCE(I_BUILDER) TYPE REF TO ZIF_CDS_ALV_GRID_BUILDER +*" REFERENCE(I_TABLE_CONTAINER) TYPE REF TO +*" ZIF_CDS_ALV_TABLE_CONTAINER +*" RAISING +*" ZCX_CDS_ALV_MESSAGE +*"---------------------------------------------------------------------- + + title = i_builder->get_gui_title( ). + builder = i_builder. + table_container = i_table_container. + ref_to_table = table_container->get_ref_to_table( ). + + CALL SCREEN full_screen. + +ENDFUNCTION. diff --git a/src/zcds_alv_display.fugr.z_cds_alv_split_screen.abap b/src/zcds_alv_display.fugr.z_cds_alv_split_screen.abap new file mode 100644 index 0000000..f8ab459 --- /dev/null +++ b/src/zcds_alv_display.fugr.z_cds_alv_split_screen.abap @@ -0,0 +1,24 @@ +FUNCTION z_cds_alv_split_screen. +*"---------------------------------------------------------------------- +*"*"Lokale Schnittstelle: +*" IMPORTING +*" REFERENCE(I_BUILDER) TYPE REF TO ZIF_CDS_ALV_GRID_BUILDER +*" REFERENCE(I_TABLE_CONTAINER) TYPE REF TO +*" ZIF_CDS_ALV_TABLE_CONTAINER +*" REFERENCE(I_CONTROLLER) TYPE REF TO +*" ZIF_CDS_ALV_SPLIT_SCREEN_CNTR +*" REFERENCE(I_SUB_REPID) TYPE SYREPID +*" REFERENCE(I_SUB_DYNNR) TYPE SYDYNNR +*"---------------------------------------------------------------------- + + title = i_builder->get_gui_title( ). + builder = i_builder. + controller = i_controller. + sub_repid = i_sub_repid. + sub_dynnr = i_sub_dynnr. + table_container = i_table_container. + ref_to_table = table_container->get_ref_to_table( ). + + CALL SCREEN split_screen. + +ENDFUNCTION. diff --git a/src/zcds_alv_display_text.doma.xml b/src/zcds_alv_display_text.doma.xml new file mode 100644 index 0000000..6fed7b8 --- /dev/null +++ b/src/zcds_alv_display_text.doma.xml @@ -0,0 +1,25 @@ + + + + + + ZCDS_ALV_DISPLAY_TEXT + D + CHAR + 000040 + 000040 + X + Text für alternative Anzeige + + + E + + + + E + text for alternative display mode + + + + + diff --git a/src/zcds_alv_display_text.dtel.xml b/src/zcds_alv_display_text.dtel.xml new file mode 100644 index 0000000..19321f3 --- /dev/null +++ b/src/zcds_alv_display_text.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_DISPLAY_TEXT + D + ZCDS_ALV_DISPLAY_TEXT + X + 55 + 10 + 20 + 40 + Text für alternative Anzeige + Text für alternative Anzeige + Alt. Anz. + Text f. alt. Anzeige + Text für alternative Anzeige + D + D + + + E + + + + E + text for alternative display mode + text for alternative display mode + Alt. Disp. + text f. alt. disp. + text for alternative display mode + + + + + diff --git a/src/zcds_alv_extension_parameter.tabl.xml b/src/zcds_alv_extension_parameter.tabl.xml new file mode 100644 index 0000000..f27ffc9 --- /dev/null +++ b/src/zcds_alv_extension_parameter.tabl.xml @@ -0,0 +1,72 @@ + + + + + + ZCDS_ALV_EXTENSION_PARAMETER + D + INTTAB + Parameter einer Programmerweiterung + D + 1 + + + + EXTENSION_NAME + ZCDS_ALV_REPORT_EXTENSION_NAME + 0 + E + + + PARAMETER_NAME + RSSCR_NAME + 0 + E + + + PARAMETER_TEXT + TEXTPOOLTX + 0 + E + + + DB_FIELD + RSSCR_DBFI + 0 + E + + + HAS_VALUE_HELP + ZCDS_ALV_PARAM_HAS_VALUE_HELP + 0 + X + F + E + + + HAS_HELP + ZCDS_ALV_PARAM_HAS_HELP + 0 + X + F + E + + + ATTRIBUTE_NAME + ZCDS_ALV_LONG_ATTRIBUTE_NAME + 0 + E + + + + E + + + + E + Program extension parameters + + + + + diff --git a/src/zcds_alv_extension_parameters.ttyp.xml b/src/zcds_alv_extension_parameters.ttyp.xml new file mode 100644 index 0000000..e5f8dc8 --- /dev/null +++ b/src/zcds_alv_extension_parameters.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_EXTENSION_PARAMETERS + D + ZCDS_ALV_EXTENSION_PARAMETER + S + STRU + T + D + N + Parameter einer Programmerweiterung + + + + diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.abap b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.abap new file mode 100644 index 0000000..eff8b47 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.abap @@ -0,0 +1,75 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_EXTENSIONSF01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Form BUILD_GRID +*&---------------------------------------------------------------------* +FORM build_grid RAISING zcx_cds_alv_message. + IF container IS NOT BOUND. + CREATE OBJECT container + EXPORTING + container_name = 'EXTENSIONS_CONTAINER' + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. + + IF alv_grid IS NOT BOUND. + CREATE OBJECT alv_grid + EXPORTING + i_parent = container + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + PERFORM prepare_grid. + + alv_grid->set_table_for_first_display( + EXPORTING + i_structure_name = 'ZCDS_ALV_PROGRAM_EXTENSION' + i_save = 'A' + is_layout = layout + it_toolbar_excluding = excluding + CHANGING + it_outtab = extensions + it_fieldcatalog = fieldcatalog + EXCEPTIONS + OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. +ENDFORM. +*&---------------------------------------------------------------------* +*& Form CLOSE_DISPLAY +*&---------------------------------------------------------------------* +FORM close_display RAISING zcx_cds_alv_message. + container->free( EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + FREE: container, alv_grid, extensions. +ENDFORM. +*&---------------------------------------------------------------------* +*& Form SAVE_CHANGES +*&---------------------------------------------------------------------* +FORM save_changes RAISING zcx_cds_alv_message. + alv_grid->check_changed_data( ). + persistence->set_report_extensions( + i_cds_view = cds_view + i_extensions = extensions ). + COMMIT WORK AND WAIT. +ENDFORM. diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.xml b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.xml new file mode 100644 index 0000000..56a3b22 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_EXTENSIONSF01 + I + S + D + X + + + + R + Include LZCDS_ALV_EXTENSIONSF01 + 31 + + + + + diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.abap b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.abap new file mode 100644 index 0000000..1c07fe4 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.abap @@ -0,0 +1,49 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_EXTENSIONSF02. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Form PREPARE_GRID +*&---------------------------------------------------------------------* +FORM prepare_grid RAISING zcx_cds_alv_message. + layout = VALUE #( + cwidth_opt = abap_true + col_opt = abap_true + zebra = abap_true + edit = abap_true ). + + excluding = VALUE #( + ( cl_gui_alv_grid=>mc_fc_loc_append_row ) + ( cl_gui_alv_grid=>mc_fc_loc_copy ) + ( cl_gui_alv_grid=>mc_fc_loc_copy_row ) + ( cl_gui_alv_grid=>mc_fc_loc_cut ) + ( cl_gui_alv_grid=>mc_fc_loc_delete_row ) + ( cl_gui_alv_grid=>mc_fc_loc_insert_row ) + ( cl_gui_alv_grid=>mc_fc_loc_move_row ) + ( cl_gui_alv_grid=>mc_fc_loc_paste ) + ( cl_gui_alv_grid=>mc_fc_loc_paste_new_row ) + ( cl_gui_alv_grid=>mc_fc_loc_undo ) ). + + CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' + EXPORTING + i_structure_name = 'ZCDS_ALV_PROGRAM_EXTENSION' + CHANGING + ct_fieldcat = fieldcatalog + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + LOOP AT fieldcatalog ASSIGNING FIELD-SYMBOL(). + -tech = xsdbool( -fieldname = 'ACTIVATED_ON' ). + -edit = -checkbox = xsdbool( -fieldname = 'ACTIVE' ). + -key = -key_sel = xsdbool( -fieldname = 'EXTENSION_TEXT' ). + + IF -fieldname <> 'EXTENSION_TEXT' AND -fieldname <> 'ACTIVE'. + -no_out = abap_true. + -edit = abap_false. + ENDIF. + ENDLOOP. +ENDFORM. diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.xml b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.xml new file mode 100644 index 0000000..6505237 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsf02.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_EXTENSIONSF02 + I + S + D + X + + + + R + Include LZCDS_ALV_EXTENSIONSF02 + 31 + + + + + diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.abap b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.abap new file mode 100644 index 0000000..285d751 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.abap @@ -0,0 +1,17 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_EXTENSIONSI01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module USER_COMMAND_0100 INPUT +*&---------------------------------------------------------------------* +MODULE user_command_0100 INPUT. + CASE ok_code. + WHEN 'ENTER'. + PERFORM save_changes. + PERFORM close_display. + LEAVE TO SCREEN 0. + WHEN 'CANCEL'. + PERFORM close_display. + LEAVE TO SCREEN 0. + ENDCASE. +ENDMODULE. diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.xml b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.xml new file mode 100644 index 0000000..c8cb3dd --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionsi01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_EXTENSIONSI01 + I + S + D + X + + + + R + Include LZCDS_ALV_EXTENSIONSI01 + 31 + + + + + diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.abap b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.abap new file mode 100644 index 0000000..f7156fc --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.abap @@ -0,0 +1,12 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_EXTENSIONSO01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module STATUS_0100 OUTPUT +*&---------------------------------------------------------------------* +MODULE status_0100 OUTPUT. + PERFORM build_grid. + + SET PF-STATUS 'STAT_0100'. + SET TITLEBAR 'T0100'. +ENDMODULE. diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.xml b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.xml new file mode 100644 index 0000000..892e981 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionso01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_EXTENSIONSO01 + I + S + D + X + + + + R + Include LZCDS_ALV_EXTENSIONSO01 + 31 + + + + + diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.abap b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.abap new file mode 100644 index 0000000..4b5898b --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.abap @@ -0,0 +1,14 @@ +FUNCTION-POOL zcds_alv_extensions. + +DATA: cds_view TYPE ddstrucobjname, + extensions TYPE zcds_alv_program_extensions, + persistence TYPE REF TO zif_cds_alv_persistence, + container TYPE REF TO cl_gui_custom_container, + alv_grid TYPE REF TO cl_gui_alv_grid, + layout TYPE lvc_s_layo, + fieldcatalog TYPE lvc_t_fcat, + excluding TYPE ui_functions, + ok_code TYPE cua_code. + +LOAD-OF-PROGRAM. + persistence = zcl_cds_alv_factory=>get_instance( )->get_persistence( ). diff --git a/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.xml b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.xml new file mode 100644 index 0000000..21e57a5 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.lzcds_alv_extensionstop.xml @@ -0,0 +1,17 @@ + + + + + + LZCDS_ALV_EXTENSIONSTOP + S + D$ + I + S + X + D$S + X + + + + diff --git a/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.abap b/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.abap new file mode 100644 index 0000000..89416e3 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.abap @@ -0,0 +1,23 @@ +******************************************************************* +* System-defined Include-files. * +******************************************************************* + INCLUDE LZCDS_ALV_EXTENSIONSTOP. " Global Declarations + INCLUDE LZCDS_ALV_EXTENSIONSUXX. " Function Modules + +******************************************************************* +* User-defined Include-files (if necessary). * +******************************************************************* +* INCLUDE LZCDS_ALV_EXTENSIONSF... " Subroutines +* INCLUDE LZCDS_ALV_EXTENSIONSO... " PBO-Modules +* INCLUDE LZCDS_ALV_EXTENSIONSI... " PAI-Modules +* INCLUDE LZCDS_ALV_EXTENSIONSE... " Events +* INCLUDE LZCDS_ALV_EXTENSIONSP... " Local class implement. +* INCLUDE LZCDS_ALV_EXTENSIONST99. " ABAP Unit tests + +INCLUDE lzcds_alv_extensionso01. + +INCLUDE lzcds_alv_extensionsf01. + +INCLUDE lzcds_alv_extensionsi01. + +INCLUDE lzcds_alv_extensionsf02. diff --git a/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.xml b/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.xml new file mode 100644 index 0000000..c8ebda3 --- /dev/null +++ b/src/zcds_alv_extensions.fugr.saplzcds_alv_extensions.xml @@ -0,0 +1,18 @@ + + + + + + SAPLZCDS_ALV_EXTENSIONS + S + D$ + F + S + E + X + D$S + X + + + + diff --git a/src/zcds_alv_extensions.fugr.xml b/src/zcds_alv_extensions.fugr.xml new file mode 100644 index 0000000..50337ed --- /dev/null +++ b/src/zcds_alv_extensions.fugr.xml @@ -0,0 +1,205 @@ + + + + + Dialog zur Verwaltung von Erweiterungen + + LZCDS_ALV_EXTENSIONSF01 + LZCDS_ALV_EXTENSIONSF02 + LZCDS_ALV_EXTENSIONSI01 + LZCDS_ALV_EXTENSIONSO01 + LZCDS_ALV_EXTENSIONSTOP + SAPLZCDS_ALV_EXTENSIONS + + + + Z_CDS_ALV_EXTENSIONS_DIALOG + Dialog zur Pflege der Programmerweiterungen zum CDS-View + + + I_CDS_VIEW + X + DDSTRUCOBJNAME + + + + + ZCX_CDS_ALV_MESSAGE + + + + + I_CDS_VIEW + P + DD: Name eines struktierten Objekts (z.B. Entity, Context) + + + ZCX_CDS_ALV_MESSAGE + X + + + X + + + + + E + + + + +
+ SAPLZCDS_ALV_EXTENSIONS + 0100 + E + Program extensions dialog + M + 0100 + 020 + 161 +
+ + + SCREEN + SCREEN + + + CUST_CTRL + EXTENSIONS_CONTAINER + SCREEN + 001 + 001 + 161 + 020 + X + X + 010 + 080 + + + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE status_0100. + + + + PROCESS AFTER INPUT. + + + MODULE user_command_0100. + + +
+
+ + + 000001 + + + + STAT_0100 + P + 000001 + 0001 + Status für Dialog + + + + + CANCEL + 001 + S + ICON_CANCEL + @0W@ + Abbrechen + A + + + ENTER + 001 + S + ICON_OKAY + @0V@ + Weiter + + + + + 000001 + 0001 + 01 + 00 + + + 000001 + 0001 + 02 + 12 + + + + + 000001 + 00 + ENTER + 001 + + + 000001 + 12 + CANCEL + 001 + + + + + STAT_0100 + CANCEL + + + STAT_0100 + ENTER + + + + + P + 000001 + P + Status für Dialog + + + B + 000001 + 0001 + P + Status für Dialog + + + + + T0100 + Programmerweiterungen auswählen + + + +
+
+
diff --git a/src/zcds_alv_extensions.fugr.z_cds_alv_extensions_dialog.abap b/src/zcds_alv_extensions.fugr.z_cds_alv_extensions_dialog.abap new file mode 100644 index 0000000..30f7fba --- /dev/null +++ b/src/zcds_alv_extensions.fugr.z_cds_alv_extensions_dialog.abap @@ -0,0 +1,21 @@ +FUNCTION z_cds_alv_extensions_dialog. +*"---------------------------------------------------------------------- +*"*"Lokale Schnittstelle: +*" IMPORTING +*" REFERENCE(I_CDS_VIEW) TYPE DDSTRUCOBJNAME +*" RAISING +*" ZCX_CDS_ALV_MESSAGE +*"---------------------------------------------------------------------- + + cds_view = i_cds_view. + extensions = persistence->get_report_extensions( + i_cds_view = i_cds_view + i_only_active = abap_false ). + + IF extensions IS INITIAL. + MESSAGE i020(zcds_alv). + ELSE. + CALL SCREEN '0100' STARTING AT 10 10. + ENDIF. + +ENDFUNCTION. diff --git a/src/zcds_alv_exthdr.tabl.xml b/src/zcds_alv_exthdr.tabl.xml new file mode 100644 index 0000000..87994bd --- /dev/null +++ b/src/zcds_alv_exthdr.tabl.xml @@ -0,0 +1,107 @@ + + + + + + ZCDS_ALV_EXTHDR + D + TRANSP + Erweiterungen für Reports zu CDS-Views: Kopfdaten + X + C + 2 + + + ZCDS_ALV_EXTHDR + A + 0 + APPL2 + X + X + X + + + + EXTENSION_NAME + X + ZCDS_ALV_REPORT_EXTENSION_NAME + 0 + X + E + + + ALTERNATIVE_SELECTION + ZCDS_ALV_ALTERNATIVE_SELECTION + 0 + X + F + E + + + ALTERNATIVE_DISPLAY + ZCDS_ALV_ALTERNATIVE_DISPLAY + 0 + X + F + E + + + IMPLEMENTING_CLASS + SEOCLSNAME + 0 + X + E + + + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + + + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + CLSNAME + 0002 + ZCDS_ALV_EXTHDR + IMPLEMENTING_CLASS + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + INTERFACE + 0001 + C + 'ZIF_CDS_ALV_REPORT_EXTENSION' + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + + E + + + + E + Report extensions for CDS views: header data + + + + + ZCDS_ALV_EXTHDR + &NC& + + + + + diff --git a/src/zcds_alv_exthdrs.tobj.xml b/src/zcds_alv_exthdrs.tobj.xml new file mode 100644 index 0000000..879bc39 --- /dev/null +++ b/src/zcds_alv_exthdrs.tobj.xml @@ -0,0 +1,49 @@ + + + + + + ZCDS_ALV_EXTHDR + S + X + CUSY + 2 + 3 + + + D + ZCDS_ALV_EXTHDR + S + Erweiterungen für Reports zu CDS-Views: Kopfdaten + + + + ZCDS_ALV_EXTHDR + S + ZCDS_ALV_EXTHDR + X + X + + + ZCDS_ALV_EXTHDR + S + ZCDS_ALV_EXTHDRT + X + + + + + ZCDS_ALV_EXTHDR + &NC& + + + ZCDS_ALV_EXTHDR + ZCDS_ALV_TABLES + 1 + 0002 + X + + + + + diff --git a/src/zcds_alv_exthdrt.tabl.xml b/src/zcds_alv_exthdrt.tabl.xml new file mode 100644 index 0000000..f21ba8c --- /dev/null +++ b/src/zcds_alv_exthdrt.tabl.xml @@ -0,0 +1,96 @@ + + + + + + ZCDS_ALV_EXTHDRT + D + TRANSP + Erweiterungen für Reports zu CDS-Views: Texte + X + C + 2 + + + ZCDS_ALV_EXTHDRT + A + 0 + APPL2 + X + X + X + X + + + + SPRAS + X + SPRAS + 0 + X + D + E + X + + + EXTENSION_NAME + X + ZCDS_ALV_REPORT_EXTENSION_NAME + ZCDS_ALV_EXTHDR + 0 + X + P + E + + + EXTENSION_TEXT + ZCDS_ALV_REPORT_EXTENSION_TEXT + 0 + E + + + SELECTION_TEXT + ZCDS_ALV_SELECTION_TEXT + 0 + E + + + DISPLAY_TEXT + ZCDS_ALV_DISPLAY_TEXT + 0 + E + + + + + EXTENSION_NAME + ZCDS_ALV_EXTHDRT + EXTENSION_NAME + ZCDS_ALV_EXTHDR + EXTENSION_NAME + 0001 + ZCDS_ALV_REPORT_EXTENSION_NAME + CHAR + + + + + EXTENSION_NAME + ZCDS_ALV_EXTHDR + TEXT + CN + 1 + + + + E + + + + E + Report extensions for CDS views: texts + + + + + diff --git a/src/zcds_alv_extpar.tabl.xml b/src/zcds_alv_extpar.tabl.xml new file mode 100644 index 0000000..3b5b166 --- /dev/null +++ b/src/zcds_alv_extpar.tabl.xml @@ -0,0 +1,107 @@ + + + + + + ZCDS_ALV_EXTPAR + D + TRANSP + Erweiterungen für Reports zu CDS-Views: Parameter + X + C + 2 + + + ZCDS_ALV_EXTPAR + A + 0 + APPL2 + X + X + X + + + + EXTENSION_NAME + X + ZCDS_ALV_REPORT_EXTENSION_NAME + ZCDS_ALV_EXTHDR + 0 + X + P + E + + + PARAMETER_NAME + X + RSSCR_NAME + 0 + X + E + + + DB_FIELD + RSSCR_DBFI + 0 + E + + + HAS_VALUE_HELP + ZCDS_ALV_PARAM_HAS_VALUE_HELP + 0 + X + F + E + + + HAS_HELP + ZCDS_ALV_PARAM_HAS_HELP + 0 + X + F + E + + + ATTRIBUTE_NAME + ZCDS_ALV_LONG_ATTRIBUTE_NAME + 0 + E + + + + + EXTENSION_NAME + ZCDS_ALV_EXTPAR + EXTENSION_NAME + ZCDS_ALV_EXTHDR + EXTENSION_NAME + 0001 + ZCDS_ALV_REPORT_EXTENSION_NAME + CHAR + + + + + EXTENSION_NAME + ZCDS_ALV_EXTHDR + KEY + + + + E + + + + E + Report extensions for CDS views: parameters + + + + + ZCDS_ALV_EXTPAR + &NC& + + + + + diff --git a/src/zcds_alv_extpars.tobj.xml b/src/zcds_alv_extpars.tobj.xml new file mode 100644 index 0000000..c3e2d7f --- /dev/null +++ b/src/zcds_alv_extpars.tobj.xml @@ -0,0 +1,49 @@ + + + + + + ZCDS_ALV_EXTPAR + S + X + CUSY + 2 + 3 + + + D + ZCDS_ALV_EXTPAR + S + Erweiterungen für Reports zu CDS-Views: Parameter + + + + ZCDS_ALV_EXTPAR + S + ZCDS_ALV_EXTPAR + X + X + + + ZCDS_ALV_EXTPAR + S + ZCDS_ALV_EXTPART + X + + + + + ZCDS_ALV_EXTPAR + &NC& + + + ZCDS_ALV_EXTPAR + ZCDS_ALV_TABLES + 1 + 0003 + X + + + + + diff --git a/src/zcds_alv_extpart.tabl.xml b/src/zcds_alv_extpart.tabl.xml new file mode 100644 index 0000000..8188d63 --- /dev/null +++ b/src/zcds_alv_extpart.tabl.xml @@ -0,0 +1,119 @@ + + + + + + ZCDS_ALV_EXTPART + D + TRANSP + Erweiterungen für Reports zu CDS-Views: Parametertexte + X + C + 2 + + + ZCDS_ALV_EXTPART + A + 0 + APPL2 + X + X + X + X + + + + SPRAS + X + SPRAS + 0 + X + D + E + X + + + EXTENSION_NAME + X + ZCDS_ALV_REPORT_EXTENSION_NAME + ZCDS_ALV_EXTHDR + 0 + X + P + E + + + PARAMETER_NAME + X + RSSCR_NAME + ZCDS_ALV_EXTPAR + 0 + X + P + E + + + PARAMETER_TEXT + TEXTPOOLTX + 0 + E + + + + + EXTENSION_NAME + ZCDS_ALV_EXTPART + EXTENSION_NAME + ZCDS_ALV_EXTHDR + EXTENSION_NAME + 0001 + ZCDS_ALV_REPORT_EXTENSION_NAME + CHAR + + + PARAMETER_NAME + ZCDS_ALV_EXTPART + EXTENSION_NAME + ZCDS_ALV_EXTPAR + EXTENSION_NAME + 0001 + ZCDS_ALV_REPORT_EXTENSION_NAME + CHAR + + + PARAMETER_NAME + ZCDS_ALV_EXTPART + PARAMETER_NAME + ZCDS_ALV_EXTPAR + PARAMETER_NAME + 0002 + SELCNAME + CHAR + + + + + EXTENSION_NAME + ZCDS_ALV_EXTHDR + KEY + + + PARAMETER_NAME + ZCDS_ALV_EXTPAR + TEXT + CN + 1 + + + + E + + + + E + Report extensions for CDS views: parameter texts + + + + + diff --git a/src/zcds_alv_field_action.tabl.xml b/src/zcds_alv_field_action.tabl.xml new file mode 100644 index 0000000..39b4049 --- /dev/null +++ b/src/zcds_alv_field_action.tabl.xml @@ -0,0 +1,102 @@ + + + + + + ZCDS_ALV_FIELD_ACTION + D + INTTAB + Aktion für ein Feld im CDS-View + D + 1 + + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + FIELDNAME + FIELDNAME + 0 + E + + + FIELDTYPE + ZCDS_ALV_FIELD_TYPE + 0 + E + + + SEMANTIC_OBJECT + ZCDS_ALV_SEMANTIC_OBJECT + 0 + E + + + SEMANTIC_ACTION + ZCDS_ALV_SEMANTIC_ACTION + 0 + E + + + ASSOCIATIONNAME + DDASSOCIATIONNAME + 0 + E + + + DATA_ACTION + ZCDS_ALV_ACTION_NAME + 0 + E + + + URL_FIELDNAME + FIELDNAME + 0 + E + + + USER_COMMAND + UI_FUNC + 0 + E + + + LABEL + LVC_STRING + 0 + E + + + HOTSPOT + XFELD + 0 + X + F + E + + + SEND_MAIL + XFELD + 0 + X + F + E + + + + E + + + + E + CDS view field action + + + + + diff --git a/src/zcds_alv_field_actions.ttyp.xml b/src/zcds_alv_field_actions.ttyp.xml new file mode 100644 index 0000000..72f2dc6 --- /dev/null +++ b/src/zcds_alv_field_actions.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_FIELD_ACTIONS + D + ZCDS_ALV_FIELD_ACTION + S + STRU + T + D + N + Aktionen für Felder eines CDS-Views + + + + diff --git a/src/zcds_alv_field_type.doma.xml b/src/zcds_alv_field_type.doma.xml new file mode 100644 index 0000000..7d7289c --- /dev/null +++ b/src/zcds_alv_field_type.doma.xml @@ -0,0 +1,24 @@ + + + + + + ZCDS_ALV_FIELD_TYPE + D + CHAR + 000040 + 000040 + Art eines Feldes im Consumption View (UI.lineItem.Type) + + + E + + + + E + Consumption View Field Type (UI.lineItem.Type) + + + + + diff --git a/src/zcds_alv_field_type.dtel.xml b/src/zcds_alv_field_type.dtel.xml new file mode 100644 index 0000000..b05749f --- /dev/null +++ b/src/zcds_alv_field_type.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_FIELD_TYPE + D + ZCDS_ALV_FIELD_TYPE + 40 + 10 + 20 + 40 + Art eines Feldes im Consumption View (UI.lineItem.Type) + Feldart + Feldart + Feldart + Feldart + D + D + + + E + + + + E + Consumption View Field Type (UI.lineItem.Type) + Field Type + Field Type + Field Type + Field Type + + + + + diff --git a/src/zcds_alv_function.tabl.xml b/src/zcds_alv_function.tabl.xml new file mode 100644 index 0000000..e5811ec --- /dev/null +++ b/src/zcds_alv_function.tabl.xml @@ -0,0 +1,67 @@ + + + + + + ZCDS_ALV_FUNCTION + D + INTTAB + Eigene Funktionen für ALV-Grids + D + 1 + + + + NAME + UI_FUNC + 0 + E + + + ICON + 0 + g + 000008 + STRG + STRG + Icon der Funktion + + + TEXT + 0 + g + 000008 + STRG + STRG + Text der Funktion + + + TOOLTIP + 0 + g + 000008 + STRG + STRG + Tooltip + + + BUTTON_TYPE + TB_BTYPE + 0 + X + F + E + + + + E + + + + E + Custom Functions for ALV grids + + + + + diff --git a/src/zcds_alv_functions.ttyp.xml b/src/zcds_alv_functions.ttyp.xml new file mode 100644 index 0000000..257822b --- /dev/null +++ b/src/zcds_alv_functions.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_FUNCTIONS + D + ZCDS_ALV_FUNCTION + S + STRU + T + D + N + Funktionen des ALV-Grids + + + + diff --git a/src/zcds_alv_generation_timestamp.dtel.xml b/src/zcds_alv_generation_timestamp.dtel.xml new file mode 100644 index 0000000..644c0d7 --- /dev/null +++ b/src/zcds_alv_generation_timestamp.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_GENERATION_TIMESTAMP + D + SALV_TEST_TSTMP + X + 55 + 10 + 20 + 40 + Zeitstempel der Generierung + Zeitpunkt der Generierung + Generiert + Generiert am + Zeitpunkt der Generierung + D + D + + + E + + + + E + Generation Timestamp + Generation Timestamp + Generated + Generated on + Generation Timestamp + + + + + diff --git a/src/zcds_alv_grid_event_handlers.ttyp.xml b/src/zcds_alv_grid_event_handlers.ttyp.xml new file mode 100644 index 0000000..da3bc73 --- /dev/null +++ b/src/zcds_alv_grid_event_handlers.ttyp.xml @@ -0,0 +1,19 @@ + + + + + + ZCDS_ALV_GRID_EVENT_HANDLERS + D + ZIF_CDS_ALV_GRID_EVENT_HANDLER + R + REF + T + D + N + Event Handler für das ALV-Grid + I + + + + diff --git a/src/zcds_alv_iocclif.tabl.xml b/src/zcds_alv_iocclif.tabl.xml new file mode 100644 index 0000000..7b580f9 --- /dev/null +++ b/src/zcds_alv_iocclif.tabl.xml @@ -0,0 +1,126 @@ + + + + + + ZCDS_ALV_IOCCLIF + D + TRANSP + Registrierung von Implementierungen für den IoC Container + X + C + 1 + + + ZCDS_ALV_IOCCLIF + A + 0 + APPL2 + X + X + X + + + + INTERFACE + X + SEOITFNAME + 0 + X + X + E + + + CLASS + SEOCLSNAME + 0 + X + E + + + + + CLASS + SEO_CLASSES_INTERFACES + + + INTERFACE + SEO_CLASSES_INTERFACES + + + + + CLASS + SEO_CLASSES_INTERFACES + LANGUAGE + 0002 + G + X + SPRAS + SPRAS + LANG + 000001 + SY-LANGU + S + + + CLASS + SEO_CLASSES_INTERFACES + NAME + 0001 + ZCDS_ALV_IOCCLIF + CLASS + X + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + INTERFACE + SEO_CLASSES_INTERFACES + LANGUAGE + 0002 + G + X + SPRAS + SPRAS + LANG + 000001 + SY-LANGU + S + + + INTERFACE + SEO_CLASSES_INTERFACES + NAME + 0001 + ZCDS_ALV_IOCCLIF + INTERFACE + X + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + + E + + + + E + Implementation registry for the IoC Container + + + + + ZCDS_ALV_IOCCLIF + &NC& + + + + + diff --git a/src/zcds_alv_iocclifs.tobj.xml b/src/zcds_alv_iocclifs.tobj.xml new file mode 100644 index 0000000..f209884 --- /dev/null +++ b/src/zcds_alv_iocclifs.tobj.xml @@ -0,0 +1,42 @@ + + + + + + ZCDS_ALV_IOCCLIF + S + CUSY + 2 + 3 + + + D + ZCDS_ALV_IOCCLIF + S + Registrierung von Implementierungen für den IoC Container + + + + ZCDS_ALV_IOCCLIF + S + ZCDS_ALV_IOCCLIF + X + X + + + + + ZCDS_ALV_IOCCLIF + &NC& + + + ZCDS_ALV_IOCCLIF + ZCDS_ALV_TABLES + 1 + 0004 + X + + + + + diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.abap b/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.abap new file mode 100644 index 0000000..ceed717 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.abap @@ -0,0 +1,45 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_LAUNCHERI01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module EXIT INPUT +*&---------------------------------------------------------------------* +MODULE exit INPUT. + LEAVE TO SCREEN 0. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module CHECK_VIEW INPUT +*&---------------------------------------------------------------------* +MODULE check_view INPUT. + IF NOT ddic_access->exists_view( cds_view ). + MESSAGE e007(zcds_alv) WITH cds_view. + ENDIF. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module USER_COMMAND_0100 INPUT +*&---------------------------------------------------------------------* +MODULE user_command_0100 INPUT. + TRY. + CASE ok_code. + WHEN space OR 'ENTER'. + CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD tcode. "#EC CI_CCALL + + launcher->start_report_for_view( + i_cds_view = cds_view + i_in_split_screen = mode-split_screen ). + + IF tcode <> 'ZCDS_ALV_START'. + SET SCREEN 0. + LEAVE SCREEN. + ENDIF. + + WHEN 'EXTENSIONS'. + CALL FUNCTION 'Z_CDS_ALV_EXTENSIONS_DIALOG' + EXPORTING + i_cds_view = cds_view. + ENDCASE. + + CATCH zcx_cds_alv_message INTO message. + MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. +ENDMODULE. diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.xml b/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.xml new file mode 100644 index 0000000..524d4c3 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launcheri01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_LAUNCHERI01 + I + S + D + X + + + + R + Include LZCDS_ALV_LAUNCHERI01 + 29 + + + + + diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.abap b/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.abap new file mode 100644 index 0000000..250bf85 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.abap @@ -0,0 +1,20 @@ +*----------------------------------------------------------------------* +***INCLUDE LZCDS_ALV_LAUNCHERO01. +*----------------------------------------------------------------------* +*&---------------------------------------------------------------------* +*& Module AUTH_CHECK_0100 OUTPUT +*&---------------------------------------------------------------------* +MODULE auth_check_0100 OUTPUT. + TRY. + auth_check->check_authority_for_tcode( ). + CATCH zcx_cds_alv_message INTO message. + MESSAGE message TYPE 'A'. + ENDTRY. +ENDMODULE. +*&---------------------------------------------------------------------* +*& Module STATUS_0100 OUTPUT +*&---------------------------------------------------------------------* +MODULE status_0100 OUTPUT. + SET PF-STATUS 'STAT0100'. + SET TITLEBAR 'T0100'. +ENDMODULE. diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.xml b/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.xml new file mode 100644 index 0000000..47bca5a --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launchero01.xml @@ -0,0 +1,21 @@ + + + + + + LZCDS_ALV_LAUNCHERO01 + I + S + D + X + + + + R + Include LZCDS_ALV_LAUNCHERO01 + 29 + + + + + diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.abap b/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.abap new file mode 100644 index 0000000..40541b1 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.abap @@ -0,0 +1,23 @@ +FUNCTION-POOL zcds_alv_launcher. + +DATA: tcode TYPE sytcode, + ok_code TYPE cua_code, + cds_view TYPE ddstrucobjname, + auth_check TYPE REF TO zif_cds_alv_authority_check, + ddic_access TYPE REF TO zif_cds_alv_ddic_access, + launcher TYPE REF TO zif_cds_alv_report_launcher, + message TYPE REF TO zcx_cds_alv_message. + +DATA: BEGIN OF mode, + full_screen TYPE xfeld VALUE 'X', + split_screen TYPE xfeld, + END OF mode. + +LOAD-OF-PROGRAM. + TRY. + launcher = zcl_cds_alv_factory=>get_instance( )->get_launcher( ). + ddic_access = zcl_cds_alv_factory=>get_instance( )->get_ddic_access( ). + auth_check = zcl_cds_alv_factory=>get_instance( )->get_authority_checker( ). + CATCH zcx_cds_alv_message INTO message. + MESSAGE message TYPE 'A'. + ENDTRY. diff --git a/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.xml b/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.xml new file mode 100644 index 0000000..fa42d9f --- /dev/null +++ b/src/zcds_alv_launcher.fugr.lzcds_alv_launchertop.xml @@ -0,0 +1,17 @@ + + + + + + LZCDS_ALV_LAUNCHERTOP + S + D$ + I + S + X + D$S + X + + + + diff --git a/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.abap b/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.abap new file mode 100644 index 0000000..a88e477 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.abap @@ -0,0 +1,19 @@ +******************************************************************* +* System-defined Include-files. * +******************************************************************* + INCLUDE LZCDS_ALV_LAUNCHERTOP. " Global Declarations + INCLUDE LZCDS_ALV_LAUNCHERUXX. " Function Modules + +******************************************************************* +* User-defined Include-files (if necessary). * +******************************************************************* +* INCLUDE LZCDS_ALV_LAUNCHERF... " Subroutines +* INCLUDE LZCDS_ALV_LAUNCHERO... " PBO-Modules +* INCLUDE LZCDS_ALV_LAUNCHERI... " PAI-Modules +* INCLUDE LZCDS_ALV_LAUNCHERE... " Events +* INCLUDE LZCDS_ALV_LAUNCHERP... " Local class implement. +* INCLUDE LZCDS_ALV_LAUNCHERT99. " ABAP Unit tests + +INCLUDE lzcds_alv_launchero01. + +INCLUDE lzcds_alv_launcheri01. diff --git a/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.xml b/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.xml new file mode 100644 index 0000000..2bef679 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.saplzcds_alv_launcher.xml @@ -0,0 +1,18 @@ + + + + + + SAPLZCDS_ALV_LAUNCHER + S + D$ + F + S + E + X + D$S + X + + + + diff --git a/src/zcds_alv_launcher.fugr.xml b/src/zcds_alv_launcher.fugr.xml new file mode 100644 index 0000000..603a74a --- /dev/null +++ b/src/zcds_alv_launcher.fugr.xml @@ -0,0 +1,322 @@ + + + + + Starttransaktion für generierte Reports + + LZCDS_ALV_LAUNCHERI01 + LZCDS_ALV_LAUNCHERO01 + LZCDS_ALV_LAUNCHERTOP + SAPLZCDS_ALV_LAUNCHER + + + + Z_CDS_ALV_START + Programmstart für einen CDS-View + + + + + E + + + + +
+ SAPLZCDS_ALV_LAUNCHER + 0100 + E + Startup screen + N + 0100 + 027 + 121 +
+ + + SCREEN + SCREEN + + + RADIOGROUP + %A_MODE-FULL_SCREEN + SCREEN + 004 + 003 + 029 + 002 + + + + + SCREEN + SCREEN + FRAME + FRAME + _______________________________________________________ + 001 + 001 + 056 + 056 + 006 + CHAR + N + + + SCREEN + SCREEN + TEXT + CDS_VIEW + CDS_view__ + 002 + 003 + 010 + 010 + 001 + CHAR + N + X + + + SCREEN + SCREEN + TEMPLATE + CDS_VIEW + ________________________________________ + 002 + 014 + 040 + 040 + 001 + CHAR + ZCDS_ALV_CDS_VIEW + X + X + X + X + DD_CDSVIEW + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + RADIOGROUP + %A_MODE-FULL_SCREEN + RADIO + MODE-FULL_SCREEN + Report_transaction_________ + 004 + 003 + 029 + 029 + 001 + CHAR + X + X + + + RADIOGROUP + %A_MODE-FULL_SCREEN + RADIO + MODE-SPLIT_SCREEN + Split_Screen____ + 005 + 003 + 018 + 018 + 001 + CHAR + X + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE auth_check_0100. + + + MODULE status_0100. + + + + PROCESS AFTER INPUT. + + + MODULE exit AT EXIT-COMMAND. + + + + FIELD cds_view MODULE check_view. + + + + MODULE user_command_0100. + + +
+
+ + + 000001 + 000001 + + + + STAT0100 + D + 000001 + 000001 + 0001 + Status für das Einstiegsbild + + + + + BACK + 001 + E + S + Zurück + + + CANC + 001 + E + S + ICON_CANCEL + @0W@ + Abbrechen + + + ENTER + 001 + S + ICON_OKAY + @0V@ + Weiter + + + EXIT + 001 + E + S + Beenden + + + EXTENSIONS + 001 + S + Erweiterungen auswählen + + + + + 000001 + 0001 + 01 + 05 + + + + + 000001 + 00 + ENTER + 001 + + + 000001 + 03 + BACK + 001 + + + 000001 + 05 + EXTENSIONS + 001 + + + 000001 + 08 + ENTER + 001 + + + 000001 + 12 + CANC + 001 + + + 000001 + 15 + EXIT + 001 + + + + + STAT0100 + BACK + + + STAT0100 + CANC + + + STAT0100 + ENTER + + + STAT0100 + EXIT + + + STAT0100 + EXTENSIONS + + + + + A + 000001 + D + Status für das Einstiegsbild + + + P + 000001 + D + Status für das Einstiegsbild + + + B + 000001 + 0001 + D + Status für das Einstiegsbild + + + + + T0100 + Einstieg: CDS-View anzeigen + + + +
+
+
diff --git a/src/zcds_alv_launcher.fugr.z_cds_alv_start.abap b/src/zcds_alv_launcher.fugr.z_cds_alv_start.abap new file mode 100644 index 0000000..0573811 --- /dev/null +++ b/src/zcds_alv_launcher.fugr.z_cds_alv_start.abap @@ -0,0 +1,9 @@ +FUNCTION z_cds_alv_start. +*"---------------------------------------------------------------------- +*"*"Local Interface: +*"---------------------------------------------------------------------- + + GET PARAMETER ID 'ZCDS_ALV_CDS_VIEW' FIELD cds_view. + CALL SCREEN '0100'. + +ENDFUNCTION. diff --git a/src/zcds_alv_long_attribute_name.doma.xml b/src/zcds_alv_long_attribute_name.doma.xml new file mode 100644 index 0000000..13015e4 --- /dev/null +++ b/src/zcds_alv_long_attribute_name.doma.xml @@ -0,0 +1,24 @@ + + + + + + ZCDS_ALV_LONG_ATTRIBUTE_NAME + D + CHAR + 000255 + 000255 + Name eines Klassenattributs (erlaubt Verkettung) + + + E + + + + E + Class attribute name (long field to allow chaining) + + + + + diff --git a/src/zcds_alv_long_attribute_name.dtel.xml b/src/zcds_alv_long_attribute_name.dtel.xml new file mode 100644 index 0000000..39e23e9 --- /dev/null +++ b/src/zcds_alv_long_attribute_name.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_LONG_ATTRIBUTE_NAME + D + ZCDS_ALV_LONG_ATTRIBUTE_NAME + X + 55 + 10 + 20 + 40 + Name eines Klassenattributs (erlaubt Verkettung) + Attribut + Attribut + Attribut + Attribut + D + D + + + E + + + + E + Class attribute name (long field to allow chaining) + Attribute + Attribute + Attribute + Attribute + + + + + diff --git a/src/zcds_alv_memory_id.doma.xml b/src/zcds_alv_memory_id.doma.xml new file mode 100644 index 0000000..a4a5cfb --- /dev/null +++ b/src/zcds_alv_memory_id.doma.xml @@ -0,0 +1,24 @@ + + + + + + ZCDS_ALV_MEMORY_ID + D + CHAR + 000060 + 000060 + Memory-ID + + + E + + + + E + Memory ID + + + + + diff --git a/src/zcds_alv_memory_id.dtel.xml b/src/zcds_alv_memory_id.dtel.xml new file mode 100644 index 0000000..e33b0c4 --- /dev/null +++ b/src/zcds_alv_memory_id.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_MEMORY_ID + D + ZCDS_ALV_MEMORY_ID + 55 + 10 + 20 + 40 + Memory-ID + Memory-ID + Memory-ID + Memory-ID + Memory-ID + D + D + + + E + + + + E + Memory ID + Memory ID + Memory ID + Memory ID + Memory ID + + + + + diff --git a/src/zcds_alv_n.nrob.xml b/src/zcds_alv_n.nrob.xml new file mode 100644 index 0000000..0ee6e32 --- /dev/null +++ b/src/zcds_alv_n.nrob.xml @@ -0,0 +1,20 @@ + + + + + + ZCDS_ALV_N + ZCDS_ALV_VIEW_PROG_COUNTER + 5.0 + X + 00000010 + + + D + ZCDS_ALV_N + CDS ALV: Laufende Nummer für generierte Programme + CDS ALV + + + + diff --git a/src/zcds_alv_nav.tabl.xml b/src/zcds_alv_nav.tabl.xml new file mode 100644 index 0000000..5bf79d1 --- /dev/null +++ b/src/zcds_alv_nav.tabl.xml @@ -0,0 +1,188 @@ + + + + + + ZCDS_ALV_NAV + D + TRANSP + Intent-Based Navigation für das CDS ALV-Framework + X + C + 2 + + + ZCDS_ALV_NAV + A + 0 + APPL2 + X + X + + + + SEMANTIC_OBJECT + X + ZCDS_ALV_SEMANTIC_OBJECT + 0 + X + E + + + SEMANTIC_ACTION + X + ZCDS_ALV_SEMANTIC_ACTION + 0 + X + E + + + FUNCTION + RS38L_FNAM + TFDIR + 0 + P + E + + + DEFAULT_PARAMETER + PARAMETER + 0 + E + + + CONVERSION_EXIT + CONVEXIT + 0 + E + + + OBJECT_TYPE + SWO_OBJTYP + TOJTB + 0 + P + E + + + OBJECT_METHOD + SWO_METHOD + 0 + E + + + TRANSACTION_CODE + SYTCODE + TSTC + 0 + P + E + + + PARAMETER_ID + MEMORYID + TPARA + 0 + P + E + + + MASS_PROCESSING + ZCDS_ALV_NAV_MASS_PROCESSING + 0 + X + F + E + + + REFRESH_AFTER + ZCDS_ALV_REFRESH_AFTER + 0 + X + F + E + + + + + FUNCTION + ZCDS_ALV_NAV + FUNCTION + TFDIR + FUNCNAME + 0001 + FUNCNAME + CHAR + + + OBJECT_TYPE + ZCDS_ALV_NAV + OBJECT_TYPE + TOJTB + NAME + 0001 + OJ_NAME + CHAR + + + PARAMETER_ID + ZCDS_ALV_NAV + PARAMETER_ID + TPARA + PARAMID + 0001 + MEMORYID + CHAR + + + TRANSACTION_CODE + ZCDS_ALV_NAV + TRANSACTION_CODE + TSTC + TCODE + 0001 + TCODE + CHAR + + + + + FUNCTION + TFDIR + REF + + + OBJECT_TYPE + TOJTB + REF + + + PARAMETER_ID + TPARA + REF + X + + + TRANSACTION_CODE + TSTC + REF + + + + E + + + + E + Intent-Based Navigation for the CDS ALV Framework + + + + + ZCDS_ALV_NAV + &NC& + + + + + diff --git a/src/zcds_alv_nav_mass_processing.doma.xml b/src/zcds_alv_nav_mass_processing.doma.xml new file mode 100644 index 0000000..e3fc00f --- /dev/null +++ b/src/zcds_alv_nav_mass_processing.doma.xml @@ -0,0 +1,63 @@ + + + + + + ZCDS_ALV_NAV_MASS_PROCESSING + D + CHAR + 000001 + 000001 + X + Massenverarbeitung der Intent-Based Navigation + + + + 0001 + D + Keine Massenverarbeitung + + + 0002 + D + L + Verarbeitung im Loop + + + 0003 + D + T + Übergabe als Tabellenparameter + + + + E + + + + E + Intent-Based Navigation mass processing + + + + + 0001 + E + No mass processing + + + 0002 + E + L + Mass processing via loop + + + 0003 + E + T + Mass processing using table parameter + + + + + diff --git a/src/zcds_alv_nav_mass_processing.dtel.xml b/src/zcds_alv_nav_mass_processing.dtel.xml new file mode 100644 index 0000000..3f55946 --- /dev/null +++ b/src/zcds_alv_nav_mass_processing.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_NAV_MASS_PROCESSING + D + ZCDS_ALV_NAV_MASS_PROCESSING + 55 + 10 + 20 + 40 + Massenverarbeitung der Intent-Based Navigation + Massenverarbeitung + Mass. + Massenverarbeitung + Massenverarbeitung + D + D + + + E + + + + E + Intent-Based Navigation mass processing + Mass Processing + Mass. + Mass Processing + Mass Processing + + + + + diff --git a/src/zcds_alv_navexit.tabl.xml b/src/zcds_alv_navexit.tabl.xml new file mode 100644 index 0000000..caf72d1 --- /dev/null +++ b/src/zcds_alv_navexit.tabl.xml @@ -0,0 +1,152 @@ + + + + + + ZCDS_ALV_NAVEXIT + D + TRANSP + Eigene Implementierungen (Exits) für Intent-Based Navigation + X + C + 1 + + + ZCDS_ALV_NAVEXIT + A + 0 + APPL2 + X + N + + + + SEMANTIC_OBJECT + X + ZCDS_ALV_SEMANTIC_OBJECT + 0 + X + E + + + SEMANTIC_ACTION + X + ZCDS_ALV_SEMANTIC_ACTION + 0 + X + E + + + CDS_VIEW + X + DDSTRUCOBJNAME + 0 + X + X + E + + + IMPLEMENTING_CLASS + SEOCLSNAME + 0 + X + E + + + + + CDS_VIEW + DD_CDSVIEW + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + + + + + CDS_VIEW + DD_CDSVIEW + AS4LOCAL + 0002 + C + 'A' + X + AS4LOCAL + AS4LOCAL + CHAR + 000001 + 'A' + L + + + CDS_VIEW + DD_CDSVIEW + DDTEXT + 0003 + G + X + AS4TEXT + AS4TEXT + CHAR + 000060 + + + CDS_VIEW + DD_CDSVIEW + STRUCOBJN + 0001 + ZCDS_ALV_NAVEXIT + CDS_VIEW + X + X + DDSTRUCOBJNAME + DDSTRUCOBJNAME + CHAR + 000030 + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + CLSNAME + 0002 + ZCDS_ALV_NAVEXIT + IMPLEMENTING_CLASS + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + IMPLEMENTING_CLASS + ICL_IMPL_CLASS_E + INTERFACE + 0001 + C + 'ZIF_CDS_ALV_NAVIGATION' + X + SEOCLSNAME + SEOCLSNAME + CHAR + 000030 + + + + E + + + + E + Custom Implementations (Exits) for Intent-Based Navigation + + + + + ZCDS_ALV_NAVEXIT + &NC& + + + + + diff --git a/src/zcds_alv_navexits.tobj.xml b/src/zcds_alv_navexits.tobj.xml new file mode 100644 index 0000000..a64f01f --- /dev/null +++ b/src/zcds_alv_navexits.tobj.xml @@ -0,0 +1,42 @@ + + + + + + ZCDS_ALV_NAVEXIT + S + CUSY + 2 + 3 + + + D + ZCDS_ALV_NAVEXIT + S + Eigene Implementierungen (Exits) für Intent-Based Navigation + + + + ZCDS_ALV_NAVEXIT + S + ZCDS_ALV_NAVEXIT + X + X + + + + + ZCDS_ALV_NAVEXIT + &NC& + + + ZCDS_ALV_NAVEXIT + ZCDS_ALV_TABLES + 1 + 0005 + X + + + + + diff --git a/src/zcds_alv_navigation_exit_tab.ttyp.xml b/src/zcds_alv_navigation_exit_tab.ttyp.xml new file mode 100644 index 0000000..5625dd6 --- /dev/null +++ b/src/zcds_alv_navigation_exit_tab.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_NAVIGATION_EXIT_TAB + D + ZCDS_ALV_NAVEXIT + S + STRU + T + D + N + Intent-Based Navigation (Exits) + + + + diff --git a/src/zcds_alv_navigation_tab.ttyp.xml b/src/zcds_alv_navigation_tab.ttyp.xml new file mode 100644 index 0000000..77bdbc5 --- /dev/null +++ b/src/zcds_alv_navigation_tab.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_NAVIGATION_TAB + D + ZCDS_ALV_NAV + S + STRU + T + D + N + Intent-Based Navigation + + + + diff --git a/src/zcds_alv_navs.tobj.xml b/src/zcds_alv_navs.tobj.xml new file mode 100644 index 0000000..e1db00e --- /dev/null +++ b/src/zcds_alv_navs.tobj.xml @@ -0,0 +1,42 @@ + + + + + + ZCDS_ALV_NAV + S + CUSY + 2 + 3 + + + D + ZCDS_ALV_NAV + S + Intent-Based Navigation für das CDS ALV-Framework + + + + ZCDS_ALV_NAV + S + ZCDS_ALV_NAV + X + X + + + + + ZCDS_ALV_NAV + &NC& + + + ZCDS_ALV_NAV + ZCDS_ALV_TABLES + 1 + 0001 + X + + + + + diff --git a/src/zcds_alv_no_generation.dtel.xml b/src/zcds_alv_no_generation.dtel.xml new file mode 100644 index 0000000..edb9c2c --- /dev/null +++ b/src/zcds_alv_no_generation.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_NO_GENERATION + D + XFELD + X + 55 + 10 + 20 + 40 + Kennz.: Keine Programmgenierung für den CDS-View + Keine Generierung + Keine Gen. + Keine Generierung + Keine Generierung + D + D + + + E + + + + E + Flag: No program generation for a CDS view + No generation + No Gen. + No generation + No generation + + + + + diff --git a/src/zcds_alv_param_has_help.dtel.xml b/src/zcds_alv_param_has_help.dtel.xml new file mode 100644 index 0000000..cceab2e --- /dev/null +++ b/src/zcds_alv_param_has_help.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_PARAM_HAS_HELP + D + XFELD + X + 55 + 10 + 20 + 40 + Kennzeichen: Hilfe zum Parameter vorhanden + Hilfe vorhanden + Hilfe + Hilfe vorhanden + Hilfe vorhanden + D + D + + + E + + + + E + Flag: Help available for a parameter + Help available + Help + Help available + Help available + + + + + diff --git a/src/zcds_alv_param_has_value_help.dtel.xml b/src/zcds_alv_param_has_value_help.dtel.xml new file mode 100644 index 0000000..06114dd --- /dev/null +++ b/src/zcds_alv_param_has_value_help.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_PARAM_HAS_VALUE_HELP + D + XFELD + X + 55 + 10 + 20 + 40 + Kennzeichen: Wertehilfe zum Parameter vorhanden + Wertehilfe vorhanden + Wertehilfe + Wertehilfe vorhanden + Wertehilfe vorhanden + D + D + + + E + + + + E + Flag: Value help available for a parameter + Value help available + Value help + Value help available + Value help available + + + + + diff --git a/src/zcds_alv_parameter.tabl.xml b/src/zcds_alv_parameter.tabl.xml new file mode 100644 index 0000000..8889969 --- /dev/null +++ b/src/zcds_alv_parameter.tabl.xml @@ -0,0 +1,45 @@ + + + + + + ZCDS_ALV_PARAMETER + D + INTTAB + Wert eines CDS-View-Parameters + 1 + + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + PARNAME + DDPARNAME + 0 + E + + + VALUE + 0 + g + 000008 + STRG + STRG + + + + E + + + + E + CDS view parameter value + + + + + diff --git a/src/zcds_alv_parameter_mapping.tabl.xml b/src/zcds_alv_parameter_mapping.tabl.xml new file mode 100644 index 0000000..0e2ce63 --- /dev/null +++ b/src/zcds_alv_parameter_mapping.tabl.xml @@ -0,0 +1,49 @@ + + + + + + ZCDS_ALV_PARAMETER_MAPPING + D + INTTAB + Mapping zwischen PARAMETERS und Viewparametern + 1 + + + + PROGNAME + PROGNAME + 0 + E + + + SEL_NAME + RSSCR_NAME + 0 + E + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + PARNAME + DDPARNAME + 0 + E + + + + E + + + + E + Mapping between PARAMETERS and view parameters + + + + + diff --git a/src/zcds_alv_parameter_mapping_tab.ttyp.xml b/src/zcds_alv_parameter_mapping_tab.ttyp.xml new file mode 100644 index 0000000..566f448 --- /dev/null +++ b/src/zcds_alv_parameter_mapping_tab.ttyp.xml @@ -0,0 +1,33 @@ + + + + + + ZCDS_ALV_PARAMETER_MAPPING_TAB + D + ZCDS_ALV_PARAMETER_MAPPING + S + STRU + H + K + U + 0002 + Mapping zwischen PARAMETERS und View-Parametern + + + + ZCDS_ALV_PARAMETER_MAPPING_TAB + 0001 + 0001 + PROGNAME + + + ZCDS_ALV_PARAMETER_MAPPING_TAB + 0002 + 0002 + SEL_NAME + + + + + diff --git a/src/zcds_alv_parameters.ttyp.xml b/src/zcds_alv_parameters.ttyp.xml new file mode 100644 index 0000000..de2bf2f --- /dev/null +++ b/src/zcds_alv_parameters.ttyp.xml @@ -0,0 +1,33 @@ + + + + + + ZCDS_ALV_PARAMETERS + D + ZCDS_ALV_PARAMETER + S + STRU + S + K + N + 0002 + Tabelle mit Parametern eines CDS-Views + + + + ZCDS_ALV_PARAMETERS + 0001 + 0001 + CDS_VIEW + + + ZCDS_ALV_PARAMETERS + 0002 + 0002 + PARNAME + + + + + diff --git a/src/zcds_alv_params.tabl.xml b/src/zcds_alv_params.tabl.xml new file mode 100644 index 0000000..f5b38c2 --- /dev/null +++ b/src/zcds_alv_params.tabl.xml @@ -0,0 +1,63 @@ + + + + + + ZCDS_ALV_PARAMS + D + TRANSP + PARAMETERS der generierten Programme + X + C + 1 + + + ZCDS_ALV_PARAMS + A + 0 + APPL2 + X + X + + + + PROGNAME + X + PROGNAME + 0 + X + E + + + SEL_NAME + X + RSSCR_NAME + 0 + X + E + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + PARNAME + DDPARNAME + 0 + E + + + + E + + + + E + PARAMETERS in a generated program + + + + + diff --git a/src/zcds_alv_progext.tabl.xml b/src/zcds_alv_progext.tabl.xml new file mode 100644 index 0000000..40fcdf9 --- /dev/null +++ b/src/zcds_alv_progext.tabl.xml @@ -0,0 +1,87 @@ + + + + + + ZCDS_ALV_PROGEXT + D + TRANSP + Programmerweiterungen des generierten Reports zum CDS-View + X + C + 3 + + + ZCDS_ALV_PROGEXT + A + 0 + APPL2 + X + X + X + + + + CDS_VIEW + X + DDSTRUCOBJNAME + 0 + X + E + + + EXTENSION_NAME + X + ZCDS_ALV_REPORT_EXTENSION_NAME + ZCDS_ALV_EXTHDR + 0 + X + P + E + + + ACTIVE + ZCDS_ALV_ACTIVE_FLAG + 0 + X + F + E + + + ACTIVATED_ON + ZCDS_ALV_ACTIVATION_TIMESTAMP + 0 + E + + + + + EXTENSION_NAME + ZCDS_ALV_PROGEXT + EXTENSION_NAME + ZCDS_ALV_EXTHDR + EXTENSION_NAME + 0001 + ZCDS_ALV_REPORT_EXTENSION_NAME + CHAR + + + + + EXTENSION_NAME + ZCDS_ALV_EXTHDR + KEY + + + + E + + + + E + Program extensions of a generated report for a CDS view + + + + + diff --git a/src/zcds_alv_program.tabl.xml b/src/zcds_alv_program.tabl.xml new file mode 100644 index 0000000..1ad41f5 --- /dev/null +++ b/src/zcds_alv_program.tabl.xml @@ -0,0 +1,102 @@ + + + + + + ZCDS_ALV_PROGRAM + D + TRANSP + X + Programm zur Anzeige eines CDS-Views + X + C + 1 + + + ZCDS_ALV_PROGRAM + A + 0 + APPL2 + X + X + + + + CDS_VIEW + X + DDSTRUCOBJNAME + 0 + X + X + E + + + .INCLUDE + 0 + ZCDS_ALV_PROGRAM_HEADER + S + Kopfdaten eines Programms zur Anzeige eines CDS-Views + S + + + + + CDS_VIEW + DD_CDSVIEW + + + + + CDS_VIEW + DD_CDSVIEW + AS4LOCAL + 0002 + C + 'A' + X + AS4LOCAL + AS4LOCAL + CHAR + 000001 + 'A' + L + + + CDS_VIEW + DD_CDSVIEW + DDTEXT + 0003 + G + X + AS4TEXT + AS4TEXT + CHAR + 000060 + + + CDS_VIEW + DD_CDSVIEW + STRUCOBJN + 0001 + ZCDS_ALV_PROGRAM + CDS_VIEW + X + X + DDSTRUCOBJNAME + DDSTRUCOBJNAME + CHAR + 000030 + + + + E + + + + E + Program for displaying a CDS view + + + + + diff --git a/src/zcds_alv_program_extension.tabl.xml b/src/zcds_alv_program_extension.tabl.xml new file mode 100644 index 0000000..a284412 --- /dev/null +++ b/src/zcds_alv_program_extension.tabl.xml @@ -0,0 +1,55 @@ + + + + + + ZCDS_ALV_PROGRAM_EXTENSION + D + INTTAB + X + Programmerweiterungen für einen CDS-View + D + 1 + + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + .INCLUDE + 0 + ZCDS_ALV_REPORT_EXTENSION + S + Erweiterung für Reports zu CDS-Views + S + + + ACTIVE + ZCDS_ALV_ACTIVE_FLAG + 0 + X + F + E + + + ACTIVATED_ON + ZCDS_ALV_ACTIVATION_TIMESTAMP + 0 + E + + + + E + + + + E + Program extensions for a CDS view + + + + + diff --git a/src/zcds_alv_program_extensions.ttyp.xml b/src/zcds_alv_program_extensions.ttyp.xml new file mode 100644 index 0000000..f1ccd97 --- /dev/null +++ b/src/zcds_alv_program_extensions.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_PROGRAM_EXTENSIONS + D + ZCDS_ALV_PROGRAM_EXTENSION + S + STRU + T + D + N + Programmerweiterungen für einen CDS-View + + + + diff --git a/src/zcds_alv_program_header.tabl.xml b/src/zcds_alv_program_header.tabl.xml new file mode 100644 index 0000000..5293c13 --- /dev/null +++ b/src/zcds_alv_program_header.tabl.xml @@ -0,0 +1,58 @@ + + + + + + ZCDS_ALV_PROGRAM_HEADER + D + INTTAB + Kopfdaten eines Programms zur Anzeige eines CDS-Views + D + 1 + + + + PROGNAME + PROGNAME + 0 + E + + + DYNPRO + SYDYNNR + 0 + E + + + AUTHOR + AS4USER + 0 + E + + + GENERATED_AT + ZCDS_ALV_GENERATION_TIMESTAMP + 0 + E + + + NO_GENERATION + ZCDS_ALV_NO_GENERATION + 0 + X + F + E + + + + E + + + + E + Header data of a program for display a CDS view + + + + + diff --git a/src/zcds_alv_program_info.tabl.xml b/src/zcds_alv_program_info.tabl.xml new file mode 100644 index 0000000..76042bc --- /dev/null +++ b/src/zcds_alv_program_info.tabl.xml @@ -0,0 +1,64 @@ + + + + + + ZCDS_ALV_PROGRAM_INFO + D + INTTAB + X + Alle Daten eines Programms zur Anzeige eines CDS-Views + 1 + + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + .INCLUDE + 0 + ZCDS_ALV_PROGRAM_HEADER + S + Kopfdaten eines Programms zur Anzeige eines CDS-Views + S + + + PARAMETERS + ZCDS_ALV_PARAMETER_MAPPING_TAB + 0 + TTYP + TTYPL + L + + + SELECT_OPTIONS + ZCDS_ALV_SELOPTS_MAPPING_TAB + 0 + TTYP + TTYPL + L + + + SOURCE_LINES + ZCDS_ALV_SOURCE_LINES + 0 + TTYP + TTYPL + L + + + + E + + + + E + All data of a program for displaying a CDS view + + + + + diff --git a/src/zcds_alv_refresh_after.dtel.xml b/src/zcds_alv_refresh_after.dtel.xml new file mode 100644 index 0000000..8922b31 --- /dev/null +++ b/src/zcds_alv_refresh_after.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_REFRESH_AFTER + D + XFELD + 55 + 10 + 20 + 40 + Kennzeichen: Liste nach der Aktion aktualisieren + Refresh + Refresh + Refresh + Refresh + D + D + + + E + + + + E + Flag: Refresh List after action + Refresh + Refresh + Refresh + Refresh + + + + + diff --git a/src/zcds_alv_regenerate_reports.prog.abap b/src/zcds_alv_regenerate_reports.prog.abap new file mode 100644 index 0000000..b850ca2 --- /dev/null +++ b/src/zcds_alv_regenerate_reports.prog.abap @@ -0,0 +1,23 @@ +*&------------------------------------------------------------------------------* +*& Report zcds_alv_regenerate_reports +*&------------------------------------------------------------------------------* +*& Regenerates all existing reports fpr CDS views. +*& This may be sensible when a new version of the framework was installed +*& or new extensions were added. +*&------------------------------------------------------------------------------* +REPORT zcds_alv_regenerate_reports. + +DATA cds_views TYPE TABLE OF ddstrucobjname. +DATA generator TYPE REF TO zif_cds_alv_report_generator. + +START-OF-SELECTION. + generator = zcl_cds_alv_factory=>get_instance( )->get_report_generator( ). + SELECT cds_view FROM zcds_alv_program INTO TABLE @cds_views. "#EC CI_NOWHERE + + LOOP AT cds_views INTO DATA(cds_view). + TRY. + generator->generate_report( cds_view ). + CATCH zcx_cds_alv_message INTO DATA(message). + WRITE |{ message->get_text( ) }|. + ENDTRY. + ENDLOOP. diff --git a/src/zcds_alv_regenerate_reports.prog.xml b/src/zcds_alv_regenerate_reports.prog.xml new file mode 100644 index 0000000..4f289e1 --- /dev/null +++ b/src/zcds_alv_regenerate_reports.prog.xml @@ -0,0 +1,34 @@ + + + + + + ZCDS_ALV_REGENERATE_REPORTS + S + 1 + X + D$S + X + + + + R + Erneute Generierung aller Reports zu CDS-Views + 46 + + + + + E + + + R + Regenerate all reports for CDS views + 70 + + + + + + + diff --git a/src/zcds_alv_report_extension.tabl.xml b/src/zcds_alv_report_extension.tabl.xml new file mode 100644 index 0000000..96cb4e7 --- /dev/null +++ b/src/zcds_alv_report_extension.tabl.xml @@ -0,0 +1,72 @@ + + + + + + ZCDS_ALV_REPORT_EXTENSION + D + INTTAB + Erweiterung für Reports zu CDS-Views + D + 1 + + + + EXTENSION_NAME + ZCDS_ALV_REPORT_EXTENSION_NAME + 0 + E + + + ALTERNATIVE_SELECTION + XFELD + 0 + X + F + E + + + ALTERNATIVE_DISPLAY + XFELD + 0 + X + F + E + + + IMPLEMENTING_CLASS + SEOCLSNAME + 0 + E + + + EXTENSION_TEXT + ZCDS_ALV_REPORT_EXTENSION_TEXT + 0 + E + + + SELECTION_TEXT + ZCDS_ALV_SELECTION_TEXT + 0 + E + + + DISPLAY_TEXT + ZCDS_ALV_DISPLAY_TEXT + 0 + E + + + + E + + + + E + CDS view report extension + + + + + diff --git a/src/zcds_alv_report_extension_name.doma.xml b/src/zcds_alv_report_extension_name.doma.xml new file mode 100644 index 0000000..7813596 --- /dev/null +++ b/src/zcds_alv_report_extension_name.doma.xml @@ -0,0 +1,25 @@ + + + + + + ZCDS_ALV_REPORT_EXTENSION_NAME + D + CHAR + 000010 + 000010 + ZCDS_ALV_EXTHDR + Erweiterung der Ablauflogik für Reports zu CDS-Views + + + E + + + + E + Report source code extension for CDS views + + + + + diff --git a/src/zcds_alv_report_extension_name.dtel.xml b/src/zcds_alv_report_extension_name.dtel.xml new file mode 100644 index 0000000..1e85586 --- /dev/null +++ b/src/zcds_alv_report_extension_name.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_REPORT_EXTENSION_NAME + D + ZCDS_ALV_REPORT_EXTENSION_NAME + 55 + 10 + 20 + 40 + Erweiterung der Ablauflogik für Reports zu CDS-Views + Reporterweiterung + Reporterw. + Reporterweiterung + Reporterweiterung + D + D + + + E + + + + E + Report source code extension for CDS views + Report extension + Report ext + Report extension + Report extension + + + + + diff --git a/src/zcds_alv_report_extension_text.dtel.xml b/src/zcds_alv_report_extension_text.dtel.xml new file mode 100644 index 0000000..eaa2de8 --- /dev/null +++ b/src/zcds_alv_report_extension_text.dtel.xml @@ -0,0 +1,36 @@ + + + + + + ZCDS_ALV_REPORT_EXTENSION_TEXT + D + TEXT80 + 55 + 10 + 20 + 40 + Erweiterung der Ablauflogik für Reports zu CDS-Views + Reporterweiterung + Reporterw. + Reporterweiterung + Reporterweiterung + D + D + + + E + + + + E + Report source code extension for CDS views + Report extension + Report ext + Report extension + Report extension + + + + + diff --git a/src/zcds_alv_report_extensions.ttyp.xml b/src/zcds_alv_report_extensions.ttyp.xml new file mode 100644 index 0000000..5814cd6 --- /dev/null +++ b/src/zcds_alv_report_extensions.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_REPORT_EXTENSIONS + D + ZCDS_ALV_REPORT_EXTENSION + S + STRU + T + D + N + Erweiterungen der Ablauflogik von Reports für CDS-Views + + + + diff --git a/src/zcds_alv_rfc_field_range.tabl.xml b/src/zcds_alv_rfc_field_range.tabl.xml new file mode 100644 index 0000000..1de49c0 --- /dev/null +++ b/src/zcds_alv_rfc_field_range.tabl.xml @@ -0,0 +1,39 @@ + + + + + + ZCDS_ALV_RFC_FIELD_RANGE + D + INTTAB + RSDS_FRANGE + 1 + + + + FIELDNAME + FIELDNAME + 0 + E + + + SELOPT_T + ZCDS_ALV_RFC_SELOPT_TAB + 0 + TTYP + TTYPL + L + + + + E + + + + E + RSDS_FRANGE + + + + + diff --git a/src/zcds_alv_rfc_field_ranges.ttyp.xml b/src/zcds_alv_rfc_field_ranges.ttyp.xml new file mode 100644 index 0000000..3cd86a7 --- /dev/null +++ b/src/zcds_alv_rfc_field_ranges.ttyp.xml @@ -0,0 +1,19 @@ + + + + + + ZCDS_ALV_RFC_FIELD_RANGES + D + ZCDS_ALV_RFC_FIELD_RANGE + S + STRU + T + D + N + RSDS_FRANGE_T + 00010 + + + + diff --git a/src/zcds_alv_rfc_selopt_tab.ttyp.xml b/src/zcds_alv_rfc_selopt_tab.ttyp.xml new file mode 100644 index 0000000..ac017d4 --- /dev/null +++ b/src/zcds_alv_rfc_selopt_tab.ttyp.xml @@ -0,0 +1,19 @@ + + + + + + ZCDS_ALV_RFC_SELOPT_TAB + D + RSDSSELOPT + S + STRU + T + D + N + RSDS_SELOPT_T + 00010 + + + + diff --git a/src/zcds_alv_rfc_where_tab.ttyp.xml b/src/zcds_alv_rfc_where_tab.ttyp.xml new file mode 100644 index 0000000..4913970 --- /dev/null +++ b/src/zcds_alv_rfc_where_tab.ttyp.xml @@ -0,0 +1,19 @@ + + + + + + ZCDS_ALV_RFC_WHERE_TAB + D + RSDSWHERE + S + STRU + T + D + N + RSDS_WHERE_TAB + 00005 + + + + diff --git a/src/zcds_alv_selection_text.doma.xml b/src/zcds_alv_selection_text.doma.xml new file mode 100644 index 0000000..bbfc860 --- /dev/null +++ b/src/zcds_alv_selection_text.doma.xml @@ -0,0 +1,25 @@ + + + + + + ZCDS_ALV_SELECTION_TEXT + D + CHAR + 000040 + 000040 + X + Text für alternative Selektion + + + E + + + + E + Text for alternative selection mode + + + + + diff --git a/src/zcds_alv_selection_text.dtel.xml b/src/zcds_alv_selection_text.dtel.xml new file mode 100644 index 0000000..1b38553 --- /dev/null +++ b/src/zcds_alv_selection_text.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_SELECTION_TEXT + D + ZCDS_ALV_SELECTION_TEXT + X + 55 + 10 + 20 + 40 + Text für alternative Selektion + Text für alternative Selektion + Alt. Sel. + Text f. alt. Selekt. + Text für alternative Selektion + D + D + + + E + + + + E + Text for alternative selection mode + Text for alternative selection mode + Alt. Sel. + Text f. alt. Sel. + Text for alternative selection mode + + + + + diff --git a/src/zcds_alv_selopts.tabl.xml b/src/zcds_alv_selopts.tabl.xml new file mode 100644 index 0000000..1fff246 --- /dev/null +++ b/src/zcds_alv_selopts.tabl.xml @@ -0,0 +1,63 @@ + + + + + + ZCDS_ALV_SELOPTS + D + TRANSP + SELECT-OPTIONS der generierten Programme + X + C + 1 + + + ZCDS_ALV_SELOPTS + A + 0 + APPL2 + X + X + + + + PROGNAME + X + PROGNAME + 0 + X + E + + + SEL_NAME + X + RSSCR_NAME + 0 + X + E + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + FIELDNAME + FIELDNAME + 0 + E + + + + E + + + + E + SELECT-OPTIONS in a generated program + + + + + diff --git a/src/zcds_alv_selopts_mapping.tabl.xml b/src/zcds_alv_selopts_mapping.tabl.xml new file mode 100644 index 0000000..f6f507f --- /dev/null +++ b/src/zcds_alv_selopts_mapping.tabl.xml @@ -0,0 +1,49 @@ + + + + + + ZCDS_ALV_SELOPTS_MAPPING + D + INTTAB + Mapping zwischen SELECT-OPTIONS und Viewfeldern + 1 + + + + PROGNAME + PROGNAME + 0 + E + + + SEL_NAME + RSSCR_NAME + 0 + E + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + FIELDNAME + FIELDNAME + 0 + E + + + + E + + + + E + Mapping between SELECT-OPTIONS and view fields + + + + + diff --git a/src/zcds_alv_selopts_mapping_tab.ttyp.xml b/src/zcds_alv_selopts_mapping_tab.ttyp.xml new file mode 100644 index 0000000..994c7dc --- /dev/null +++ b/src/zcds_alv_selopts_mapping_tab.ttyp.xml @@ -0,0 +1,33 @@ + + + + + + ZCDS_ALV_SELOPTS_MAPPING_TAB + D + ZCDS_ALV_SELOPTS_MAPPING + S + STRU + H + K + U + 0002 + Mapping zwischen SELECT-OPTIONS und Viewfeldern + + + + ZCDS_ALV_SELOPTS_MAPPING_TAB + 0001 + 0001 + PROGNAME + + + ZCDS_ALV_SELOPTS_MAPPING_TAB + 0002 + 0002 + SEL_NAME + + + + + diff --git a/src/zcds_alv_semantic_action.dtel.xml b/src/zcds_alv_semantic_action.dtel.xml new file mode 100644 index 0000000..dd1c52e --- /dev/null +++ b/src/zcds_alv_semantic_action.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_SEMANTIC_ACTION + D + TEXT60 + X + 55 + 10 + 20 + 40 + Semantische Aktion (für Intent-Based Navigation) + Semantische Aktion + Aktion + Semantische Aktion + Semantische Aktion + D + D + + + E + + + + E + Semantic action (for Intent-Based Navigation) + Semantic action + Action + Semantic action + Semantic action + + + + + diff --git a/src/zcds_alv_semantic_object.dtel.xml b/src/zcds_alv_semantic_object.dtel.xml new file mode 100644 index 0000000..c99db55 --- /dev/null +++ b/src/zcds_alv_semantic_object.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_SEMANTIC_OBJECT + D + TEXT30 + X + 55 + 10 + 20 + 40 + Semantisches Objekt (für Intent-Based Navigation) + Semantisches Objekt + Objekt + Semantisches Objekt + Semantisches Objekt + D + D + + + E + + + + E + Semantic Object (for Intent-Based Navigation) + Semantic Object + Object + Semantic Object + Semantic Object + + + + + diff --git a/src/zcds_alv_source_line.dtel.xml b/src/zcds_alv_source_line.dtel.xml new file mode 100644 index 0000000..09b1e78 --- /dev/null +++ b/src/zcds_alv_source_line.dtel.xml @@ -0,0 +1,37 @@ + + + + + + ZCDS_ALV_SOURCE_LINE + D + 55 + 10 + 20 + 40 + Quellcodezeile + Quellcodezeile + Codezeile + Quellcodezeile + Quellcodezeile + D + CHAR + 000255 + 000255 + + + E + + + + E + Source code line + Source code line + Code line + Source code line + Source code line + + + + + diff --git a/src/zcds_alv_source_lines.ttyp.xml b/src/zcds_alv_source_lines.ttyp.xml new file mode 100644 index 0000000..d27097d --- /dev/null +++ b/src/zcds_alv_source_lines.ttyp.xml @@ -0,0 +1,19 @@ + + + + + + ZCDS_ALV_SOURCE_LINES + D + ZCDS_ALV_SOURCE_LINE + E + CHAR + 000255 + T + D + N + Quellcodezeilen + + + + diff --git a/src/zcds_alv_special_columns.tabl.xml b/src/zcds_alv_special_columns.tabl.xml new file mode 100644 index 0000000..1b53bdc --- /dev/null +++ b/src/zcds_alv_special_columns.tabl.xml @@ -0,0 +1,80 @@ + + + + + + ZCDS_ALV_SPECIAL_COLUMNS + D + INTTAB + Besondere Spalten zur Steuerung des ALV-Grids + D + 1 + + + + INDEX_FIELDNAME + LVC_FNAME + 0 + E + + + COUNT_FIELDNAME + LVC_FNAME + 0 + E + + + STYLE_FIELDNAME + LVC_FNAME + 0 + E + + + BOX_FIELDNAME + LVC_FNAME + 0 + E + + + INFO_FIELDNAME + LVC_CIFNM + 0 + E + + + COLOR_FIELDNAME + LVC_CTFNM + 0 + E + + + EXCP_FIELDNAME + LVC_EXFNM + 0 + E + + + SYSTEM_FIELDNAME + LVC_FNAME + 0 + E + + + CLIENT_FIELDNAME + LVC_FNAME + 0 + E + + + + E + + + + E + ALV grid special admin columns + + + + + diff --git a/src/zcds_alv_start.tran.xml b/src/zcds_alv_start.tran.xml new file mode 100644 index 0000000..4c95795 --- /dev/null +++ b/src/zcds_alv_start.tran.xml @@ -0,0 +1,29 @@ + + + + + + ZCDS_ALV_START + SAPLZCDS_ALV_LAUNCHER + 0100 + + + ZCDS_ALV_START + 1 + X + X + + + D + ZCDS_ALV_START + Anzeige eines CDS-Views im ALV + + + + E + Display of a CDS view in ALV + + + + + diff --git a/src/zcds_alv_storage_header.tabl.xml b/src/zcds_alv_storage_header.tabl.xml new file mode 100644 index 0000000..12b9e42 --- /dev/null +++ b/src/zcds_alv_storage_header.tabl.xml @@ -0,0 +1,42 @@ + + + + + + ZCDS_ALV_STORAGE_HEADER + D + INTTAB + X + Kopfdaten eines abgelegten ALV-Grids + D + 1 + + + + .INCLUDE + 0 + ZCDS_ALV_STORAGE_KEY + S + Schlüssel eines abgelegten ALV-Grids + S + KEY + + + MIME_TYPE + W3CONTTYPE + 0 + E + + + + E + + + + E + ALV grid storage header data + + + + + diff --git a/src/zcds_alv_storage_headers.ttyp.xml b/src/zcds_alv_storage_headers.ttyp.xml new file mode 100644 index 0000000..8b75942 --- /dev/null +++ b/src/zcds_alv_storage_headers.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_STORAGE_HEADERS + D + ZCDS_ALV_STORAGE_HEADER + S + STRU + T + D + N + Kopfdaten abgelegter ALV-Grids + + + + diff --git a/src/zcds_alv_storage_key.tabl.xml b/src/zcds_alv_storage_key.tabl.xml new file mode 100644 index 0000000..d3abbe5 --- /dev/null +++ b/src/zcds_alv_storage_key.tabl.xml @@ -0,0 +1,56 @@ + + + + + + ZCDS_ALV_STORAGE_KEY + D + INTTAB + Schlüssel eines abgelegten ALV-Grids + D + 1 + + + + REPORT + REPID + 0 + E + + + HANDLE + SLIS_HANDL + 0 + E + + + LOG_GROUP + SLIS_LOGGR + 0 + E + + + USERNAME + SLIS_USER + 0 + E + + + FILENAME + LOCALFILE + 0 + E + + + + E + + + + E + ALV grid storage key + + + + + diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.abap b/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.abap new file mode 100644 index 0000000..722fe1a --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.abap @@ -0,0 +1,6 @@ +*---------------------------------------------------------------------* +* view related FORM routines +*---------------------------------------------------------------------* + +* base table related FORM-routines............. +INCLUDE LSVIMFTX . diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.xml b/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.xml new file mode 100644 index 0000000..32096d5 --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablesf00.xml @@ -0,0 +1,13 @@ + + + + + + LZCDS_ALV_TABLESF00 + X + I + D + + + + diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.abap b/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.abap new file mode 100644 index 0000000..c265046 --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.abap @@ -0,0 +1,5 @@ +*---------------------------------------------------------------------* +* view related PAI modules +*---------------------------------------------------------------------* + +INCLUDE LSVIMITX . "base table related PAI modules diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.xml b/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.xml new file mode 100644 index 0000000..ee6b9d3 --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablesi00.xml @@ -0,0 +1,13 @@ + + + + + + LZCDS_ALV_TABLESI00 + X + I + D + + + + diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.abap b/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.abap new file mode 100644 index 0000000..a23f28b --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.abap @@ -0,0 +1,51 @@ +*---------------------------------------------------------------------* +* view related data declarations +*---------------------------------------------------------------------* +*...processing: ZCDS_ALV_EXTHDR.................................* +DATA: BEGIN OF STATUS_ZCDS_ALV_EXTHDR . "state vector + INCLUDE STRUCTURE VIMSTATUS. +DATA: END OF STATUS_ZCDS_ALV_EXTHDR . +CONTROLS: TCTRL_ZCDS_ALV_EXTHDR + TYPE TABLEVIEW USING SCREEN '0002'. +*...processing: ZCDS_ALV_EXTPAR.................................* +DATA: BEGIN OF STATUS_ZCDS_ALV_EXTPAR . "state vector + INCLUDE STRUCTURE VIMSTATUS. +DATA: END OF STATUS_ZCDS_ALV_EXTPAR . +CONTROLS: TCTRL_ZCDS_ALV_EXTPAR + TYPE TABLEVIEW USING SCREEN '0003'. +*...processing: ZCDS_ALV_IOCCLIF................................* +DATA: BEGIN OF STATUS_ZCDS_ALV_IOCCLIF . "state vector + INCLUDE STRUCTURE VIMSTATUS. +DATA: END OF STATUS_ZCDS_ALV_IOCCLIF . +CONTROLS: TCTRL_ZCDS_ALV_IOCCLIF + TYPE TABLEVIEW USING SCREEN '0004'. +*...processing: ZCDS_ALV_NAV....................................* +DATA: BEGIN OF STATUS_ZCDS_ALV_NAV . "state vector + INCLUDE STRUCTURE VIMSTATUS. +DATA: END OF STATUS_ZCDS_ALV_NAV . +CONTROLS: TCTRL_ZCDS_ALV_NAV + TYPE TABLEVIEW USING SCREEN '0001'. +*...processing: ZCDS_ALV_NAVEXIT................................* +DATA: BEGIN OF STATUS_ZCDS_ALV_NAVEXIT . "state vector + INCLUDE STRUCTURE VIMSTATUS. +DATA: END OF STATUS_ZCDS_ALV_NAVEXIT . +CONTROLS: TCTRL_ZCDS_ALV_NAVEXIT + TYPE TABLEVIEW USING SCREEN '0005'. +*.........table declarations:.................................* +TABLES: *ZCDS_ALV_EXTHDR . +TABLES: *ZCDS_ALV_EXTHDRT . +TABLES: *ZCDS_ALV_EXTPAR . +TABLES: *ZCDS_ALV_EXTPART . +TABLES: *ZCDS_ALV_IOCCLIF . +TABLES: *ZCDS_ALV_NAV . +TABLES: *ZCDS_ALV_NAVEXIT . +TABLES: ZCDS_ALV_EXTHDR . +TABLES: ZCDS_ALV_EXTHDRT . +TABLES: ZCDS_ALV_EXTPAR . +TABLES: ZCDS_ALV_EXTPART . +TABLES: ZCDS_ALV_IOCCLIF . +TABLES: ZCDS_ALV_NAV . +TABLES: ZCDS_ALV_NAVEXIT . + +* general table data declarations.............. + INCLUDE LSVIMTDT . diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.xml b/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.xml new file mode 100644 index 0000000..b017da4 --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablest00.xml @@ -0,0 +1,12 @@ + + + + + + LZCDS_ALV_TABLEST00 + I + D + + + + diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.abap b/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.abap new file mode 100644 index 0000000..2f8da7e --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.abap @@ -0,0 +1,5 @@ +FUNCTION-POOL ZCDS_ALV_TABLES MESSAGE-ID SV. + +* INCLUDE LZCDS_ALV_TABLESD... " Local class definition + INCLUDE LSVIMDAT . "general data decl. + INCLUDE LZCDS_ALV_TABLEST00 . "view rel. data dcl. diff --git a/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.xml b/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.xml new file mode 100644 index 0000000..7f3ca06 --- /dev/null +++ b/src/zcds_alv_tables.fugr.lzcds_alv_tablestop.xml @@ -0,0 +1,17 @@ + + + + + + LZCDS_ALV_TABLESTOP + S + D$ + I + S + X + D$S + X + + + + diff --git a/src/zcds_alv_tables.fugr.saplzcds_alv_tables.abap b/src/zcds_alv_tables.fugr.saplzcds_alv_tables.abap new file mode 100644 index 0000000..868bdb1 --- /dev/null +++ b/src/zcds_alv_tables.fugr.saplzcds_alv_tables.abap @@ -0,0 +1,20 @@ +******************************************************************* +* System-defined Include-files. * +******************************************************************* + INCLUDE LZCDS_ALV_TABLESTOP. " Global Declarations + INCLUDE LZCDS_ALV_TABLESUXX. " Function Modules + +******************************************************************* +* User-defined Include-files (if necessary). * +******************************************************************* +* INCLUDE LZCDS_ALV_TABLESF... " Subroutines +* INCLUDE LZCDS_ALV_TABLESO... " PBO-Modules +* INCLUDE LZCDS_ALV_TABLESI... " PAI-Modules +* INCLUDE LZCDS_ALV_TABLESE... " Events +* INCLUDE LZCDS_ALV_TABLESP... " Local class implement. +* INCLUDE LZCDS_ALV_TABLEST99. " ABAP Unit tests + INCLUDE LZCDS_ALV_TABLESF00 . " subprograms + INCLUDE LZCDS_ALV_TABLESI00 . " PAI modules + INCLUDE LSVIMFXX . " subprograms + INCLUDE LSVIMOXX . " PBO modules + INCLUDE LSVIMIXX . " PAI modules diff --git a/src/zcds_alv_tables.fugr.saplzcds_alv_tables.xml b/src/zcds_alv_tables.fugr.saplzcds_alv_tables.xml new file mode 100644 index 0000000..4be1049 --- /dev/null +++ b/src/zcds_alv_tables.fugr.saplzcds_alv_tables.xml @@ -0,0 +1,19 @@ + + + + + + SAPLZCDS_ALV_TABLES + X + S + D$ + F + S + E + X + D$S + X + + + + diff --git a/src/zcds_alv_tables.fugr.tableframe_zcds_alv_tables.abap b/src/zcds_alv_tables.fugr.tableframe_zcds_alv_tables.abap new file mode 100644 index 0000000..34e9fc3 --- /dev/null +++ b/src/zcds_alv_tables.fugr.tableframe_zcds_alv_tables.abap @@ -0,0 +1,25 @@ +*---------------------------------------------------------------------* +* program for: TABLEFRAME_ZCDS_ALV_TABLES +*---------------------------------------------------------------------* +FUNCTION TABLEFRAME_ZCDS_ALV_TABLES . +*"---------------------------------------------------------------------- +*"*"Local Interface: +*" IMPORTING +*" VALUE(VIEW_ACTION) DEFAULT 'S' +*" VALUE(VIEW_NAME) LIKE DD02V-TABNAME +*" VALUE(CORR_NUMBER) LIKE E070-TRKORR DEFAULT ' ' +*" TABLES +*" DBA_SELLIST STRUCTURE VIMSELLIST +*" DPL_SELLIST STRUCTURE VIMSELLIST +*" EXCL_CUA_FUNCT STRUCTURE VIMEXCLFUN +*" X_HEADER STRUCTURE VIMDESC +*" X_NAMTAB STRUCTURE VIMNAMTAB +*" EXCEPTIONS +*" MISSING_CORR_NUMBER +*"---------------------------------------------------------------------- + + PERFORM TABLEFRAME TABLES X_HEADER X_NAMTAB DBA_SELLIST DPL_SELLIST + EXCL_CUA_FUNCT + USING CORR_NUMBER VIEW_ACTION VIEW_NAME. + +ENDFUNCTION. diff --git a/src/zcds_alv_tables.fugr.tableproc_zcds_alv_tables.abap b/src/zcds_alv_tables.fugr.tableproc_zcds_alv_tables.abap new file mode 100644 index 0000000..94b8583 --- /dev/null +++ b/src/zcds_alv_tables.fugr.tableproc_zcds_alv_tables.abap @@ -0,0 +1,8 @@ +*---------------------------------------------------------------------* +* program for: TABLEPROC_ZCDS_ALV_TABLES +*---------------------------------------------------------------------* +FUNCTION TABLEPROC_ZCDS_ALV_TABLES . + + PERFORM TABLEPROC. + +ENDFUNCTION. diff --git a/src/zcds_alv_tables.fugr.xml b/src/zcds_alv_tables.fugr.xml new file mode 100644 index 0000000..13898cf --- /dev/null +++ b/src/zcds_alv_tables.fugr.xml @@ -0,0 +1,2411 @@ + + + + + erweiterte Tabellenpflege (generiert) + + LZCDS_ALV_TABLESF00 + LZCDS_ALV_TABLESI00 + LZCDS_ALV_TABLEST00 + LZCDS_ALV_TABLESTOP + SAPLZCDS_ALV_TABLES + + + + TABLEFRAME_ZCDS_ALV_TABLES + erweiterte Tabellenpflege obere Ebene + + + VIEW_ACTION + 'S' + + + VIEW_NAME + DD02V-TABNAME + + + CORR_NUMBER + E070-TRKORR + ' ' + + + + + DBA_SELLIST + VIMSELLIST + + + DPL_SELLIST + VIMSELLIST + + + EXCL_CUA_FUNCT + VIMEXCLFUN + + + X_HEADER + VIMDESC + + + X_NAMTAB + VIMNAMTAB + + + + + MISSING_CORR_NUMBER + + + + + VIEW_ACTION + P + Aktion mit Tabelle: anz./änd./transp. (S/U/T) + + + VIEW_NAME + P + Name der Tabelle + + + CORR_NUMBER + P + Korrekturnummer für durchgeführte Änderungen + + + DBA_SELLIST + P + Selektionsbedingungen für den DB-Zugriff + + + DPL_SELLIST + P + Selektionsbedingungen für die Anzeige + + + EXCL_CUA_FUNCT + P + Tabelle mit dynam. zu deaktivierenden CUA-Funkt. + + + X_HEADER + P + Kontrollblocktabelle für die Tabelle + + + X_NAMTAB + P + Kontrollblocktabelle für die Tabellen-Felder + + + MISSING_CORR_NUMBER + X + Korrekturnummer fehlt + + + + + TABLEPROC_ZCDS_ALV_TABLES + X + erweiterte Tabellenpflege untere Ebene + + + FCODE + 'RDED' + + + VIEW_ACTION + 'S' + + + VIEW_NAME + DD02V-TABNAME + + + CORR_NUMBER + E070-TRKORR + ' ' + + + + + LAST_ACT_ENTRY + + + UCOMM + + + UPDATE_REQUIRED + + + + + CORR_KEYTAB + E071K + + + DBA_SELLIST + VIMSELLIST + + + DPL_SELLIST + VIMSELLIST + + + EXCL_CUA_FUNCT + VIMEXCLFUN + + + EXTRACT + + + TOTAL + + + X_HEADER + VIMDESC + + + X_NAMTAB + VIMNAMTAB + + + + + MISSING_CORR_NUMBER + + + SAVING_CORRECTION_FAILED + + + + + FCODE + P + gewünschte Funktion des Bausteins + + + VIEW_ACTION + P + Aktion mit Tabelle: anz./änd./transp. (S/U/T) + + + VIEW_NAME + P + Name der Tabelle + + + CORR_NUMBER + P + Korrekturnummer für durchgeführte Änderungen + + + LAST_ACT_ENTRY + P + Index der Cursorposition in der Anzeigetabelle + + + UCOMM + P + letztes User-command innerhalb der Viewpflege + + + UPDATE_REQUIRED + P + Flag: Einträge verändert, Sichern erforderlich + + + CORR_KEYTAB + P + Tabelle mit den Keys der zu transport. Einträge + + + DBA_SELLIST + P + Selektionsbedingungen für den DB-Zugriff + + + DPL_SELLIST + P + Selektionsbedingungen für die Anzeige + + + EXCL_CUA_FUNCT + P + Tab. der nicht zu aktivierenden CUA-Funktionen + + + EXTRACT + P + Tab. der gerade sichtbaren Daten (Anzeigetabelle + + + TOTAL + P + Tabelle, mit allen von der DB gelesenen Daten + + + X_HEADER + P + Kontrollblocktabelle für die Tabelle + + + X_NAMTAB + P + Kontrollblocktabelle für die Tabellen-Felder + + + MISSING_CORR_NUMBER + X + Korrekturnummer fehlt + + + SAVING_CORRECTION_FAILED + X + Fehler beim Sichern der Korrektureinträge + + + + + + + E + + + + +
+ SAPLZCDS_ALV_TABLES + 0001 + E + View Maintenance: Overview screen for ZCDS_ALV_NAV + N + 0001 + 061 + 246 +
+ + + SCREEN + SCREEN + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + SCREEN + 001 + 001 + 245 + 059 + X + X + X + X + ENTRY + X + X + X + X + X + MULTIPLE + NONE + X + 002 + + + + + SCREEN + SCREEN + PUSH_TMPL + VIM_POSI_PUSH + ____________________ + 061 + 019 + 020 + 020 + 001 + POSI + CHAR + X + N + + + SCREEN + SCREEN + TEMPLATE + VIM_POSITION_INFO + ______________________________ + 061 + 040 + 030 + 030 + 001 + CHAR + X + X + X + N + <_--32_DIMENS>X + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + VIM_FRAME_FIELD + ____________________________________________________________ + 001 + 060 + 060 + 001 + CHAR + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-SEMANTIC_OBJECT + 001 + 001 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-SEMANTIC_ACTION + 001 + 002 + 040 + 060 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-FUNCTION + 001 + 003 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-DEFAULT_PARAMETER + 001 + 004 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-CONVERSION_EXIT + 001 + 005 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-OBJECT_TYPE + 001 + 006 + 040 + 015 + 001 + CHAR + X + 2 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-OBJECT_METHOD + 001 + 007 + 040 + 032 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-TRANSACTION_CODE + 001 + 008 + 040 + 020 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-PARAMETER_ID + 001 + 009 + 040 + 020 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-MASS_PROCESSING + 001 + 010 + 040 + 030 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEXT + *ZCDS_ALV_NAV-REFRESH_AFTER + 001 + 011 + 020 + 010 + 001 + CHAR + X + 2 + N + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + CHECK + VIM_MARKED + 001 + 001 + 001 + 001 + CHAR + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-SEMANTIC_OBJECT + ______________________________ + X + 001 + 001 + 030 + 015 + 001 + KEY + CHAR + X + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-SEMANTIC_ACTION + ____________________________________________________________ + X + 001 + 002 + 060 + 030 + 001 + KEY + CHAR + X + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-FUNCTION + ______________________________ + 001 + 003 + 030 + 030 + 001 + CHAR + X + X + LIB + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-DEFAULT_PARAMETER + ______________________________ + 001 + 004 + 030 + 030 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-CONVERSION_EXIT + _____ + 001 + 005 + 005 + 010 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-OBJECT_TYPE + __________ + 001 + 006 + 010 + 015 + 001 + CHAR + X + X + OBJ + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-OBJECT_METHOD + ________________________________ + 001 + 007 + 032 + 032 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-TRANSACTION_CODE + ____________________ + 001 + 008 + 020 + 020 + 001 + CHAR + X + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-PARAMETER_ID + ____________________ + 001 + 009 + 020 + 020 + 001 + CHAR + X + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + TEMPLATE + ZCDS_ALV_NAV-MASS_PROCESSING + _ + L + 001 + 010 + 001 + 030 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAV + CHECK + ZCDS_ALV_NAV-REFRESH_AFTER + 001 + 011 + 001 + 010 + 001 + CHAR + X + X + X + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE LISTE_INITIALISIEREN. + + + LOOP AT EXTRACT WITH CONTROL + + + TCTRL_ZCDS_ALV_NAV CURSOR NEXTLINE. + + + MODULE LISTE_SHOW_LISTE. + + + ENDLOOP. + + + * + + + PROCESS AFTER INPUT. + + + MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND. + + + MODULE LISTE_BEFORE_LOOP. + + + LOOP AT EXTRACT. + + + MODULE LISTE_INIT_WORKAREA. + + + CHAIN. + + + FIELD ZCDS_ALV_NAV-SEMANTIC_OBJECT . + + + FIELD ZCDS_ALV_NAV-SEMANTIC_ACTION . + + + FIELD ZCDS_ALV_NAV-FUNCTION . + + + FIELD ZCDS_ALV_NAV-DEFAULT_PARAMETER . + + + FIELD ZCDS_ALV_NAV-CONVERSION_EXIT . + + + FIELD ZCDS_ALV_NAV-OBJECT_TYPE . + + + FIELD ZCDS_ALV_NAV-OBJECT_METHOD . + + + FIELD ZCDS_ALV_NAV-TRANSACTION_CODE . + + + FIELD ZCDS_ALV_NAV-PARAMETER_ID . + + + FIELD ZCDS_ALV_NAV-MASS_PROCESSING . + + + FIELD ZCDS_ALV_NAV-REFRESH_AFTER . + + + MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX. + + + CHAIN. + + + FIELD ZCDS_ALV_NAV-SEMANTIC_OBJECT . + + + FIELD ZCDS_ALV_NAV-SEMANTIC_ACTION . + + + MODULE LISTE_UPDATE_LISTE. + + + ENDCHAIN. + + + ENDLOOP. + + + MODULE LISTE_AFTER_LOOP. + + +
+ +
+ SAPLZCDS_ALV_TABLES + 0002 + E + View Maintenance: Overview screen for ZCDS_ALV_EXTHDR + N + 0002 + 061 + 201 +
+ + + SCREEN + SCREEN + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + SCREEN + 001 + 001 + 201 + 059 + X + X + X + X + ENTRY + X + X + X + X + X + MULTIPLE + NONE + X + 001 + + + + + SCREEN + SCREEN + PUSH_TMPL + VIM_POSI_PUSH + ____________________ + 061 + 019 + 020 + 020 + 001 + POSI + CHAR + X + N + + + SCREEN + SCREEN + TEMPLATE + VIM_POSITION_INFO + ______________________________ + 061 + 040 + 030 + 030 + 001 + CHAR + X + X + X + N + <_--32_DIMENS>X + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + VIM_FRAME_FIELD + ____________________________________________________________ + 001 + 060 + 060 + 001 + CHAR + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDR-EXTENSION_NAME + 001 + 001 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDRT-EXTENSION_TEXT + Description_ + 001 + 002 + 012 + 050 + 001 + CHAR + X + F + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDRT-SELECTION_TEXT + 001 + 003 + 040 + 040 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDRT-DISPLAY_TEXT + 001 + 004 + 040 + 040 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDR-ALTERNATIVE_SELECTION + 001 + 005 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDR-ALTERNATIVE_DISPLAY + 001 + 006 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEXT + *ZCDS_ALV_EXTHDR-IMPLEMENTING_CLASS + 001 + 007 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + CHECK + VIM_MARKED + 001 + 001 + 001 + 001 + CHAR + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + ZCDS_ALV_EXTHDR-EXTENSION_NAME + __________ + 001 + 001 + 010 + 010 + 001 + KEY + CHAR + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + ZCDS_ALV_EXTHDRT-EXTENSION_TEXT + ________________________________________________________________________________ + X + 001 + 002 + 080 + 050 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + ZCDS_ALV_EXTHDRT-SELECTION_TEXT + 001 + 003 + 040 + 040 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + ZCDS_ALV_EXTHDRT-DISPLAY_TEXT + 001 + 004 + 040 + 040 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + CHECK + ZCDS_ALV_EXTHDR-ALTERNATIVE_SELECTION + 001 + 005 + 001 + 010 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + CHECK + ZCDS_ALV_EXTHDR-ALTERNATIVE_DISPLAY + 001 + 006 + 001 + 010 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTHDR + TEMPLATE + ZCDS_ALV_EXTHDR-IMPLEMENTING_CLASS + ______________________________ + 001 + 007 + 030 + 030 + 001 + CHAR + X + X + CLASS + X + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE LISTE_INITIALISIEREN. + + + LOOP AT EXTRACT WITH CONTROL + + + TCTRL_ZCDS_ALV_EXTHDR CURSOR NEXTLINE. + + + MODULE LISTE_SHOW_LISTE. + + + ENDLOOP. + + + * + + + PROCESS AFTER INPUT. + + + MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND. + + + MODULE LISTE_BEFORE_LOOP. + + + LOOP AT EXTRACT. + + + MODULE LISTE_INIT_WORKAREA. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTHDR-EXTENSION_NAME . + + + FIELD ZCDS_ALV_EXTHDR-ALTERNATIVE_SELECTION . + + + FIELD ZCDS_ALV_EXTHDR-ALTERNATIVE_DISPLAY . + + + FIELD ZCDS_ALV_EXTHDR-IMPLEMENTING_CLASS . + + + MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTHDRT-EXTENSION_TEXT . + + + FIELD ZCDS_ALV_EXTHDRT-SELECTION_TEXT . + + + FIELD ZCDS_ALV_EXTHDRT-DISPLAY_TEXT . + + + MODULE SET_TXT_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTHDR-EXTENSION_NAME . + + + MODULE LISTE_UPDATE_LISTE. + + + ENDCHAIN. + + + ENDLOOP. + + + MODULE LISTE_AFTER_LOOP. + + +
+ +
+ SAPLZCDS_ALV_TABLES + 0003 + E + View Maintenance: Overview screen for ZCDS_ALV_EXTPAR + N + 0003 + 061 + 201 +
+ + + SCREEN + SCREEN + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + SCREEN + 001 + 001 + 201 + 059 + X + X + X + X + ENTRY + X + X + X + X + X + MULTIPLE + NONE + X + 002 + + + + + SCREEN + SCREEN + PUSH_TMPL + VIM_POSI_PUSH + ____________________ + 061 + 019 + 020 + 020 + 001 + POSI + CHAR + X + N + + + SCREEN + SCREEN + TEMPLATE + VIM_POSITION_INFO + ______________________________ + 061 + 040 + 030 + 030 + 001 + CHAR + X + X + X + N + <_--32_DIMENS>X + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + VIM_FRAME_FIELD + ____________________________________________________________ + 001 + 060 + 060 + 001 + CHAR + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-EXTENSION_NAME + 001 + 001 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-PARAMETER_NAME + 001 + 002 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPART-PARAMETER_TEXT + 001 + 003 + 040 + 040 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-DB_FIELD + 001 + 004 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-HAS_VALUE_HELP + 001 + 005 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-HAS_HELP + 001 + 006 + 040 + 010 + 001 + CHAR + X + 1 + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEXT + *ZCDS_ALV_EXTPAR-ATTRIBUTE_NAME + 001 + 007 + 040 + 060 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + CHECK + VIM_MARKED + 001 + 001 + 001 + 001 + CHAR + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + ZCDS_ALV_EXTPAR-EXTENSION_NAME + __________ + 001 + 001 + 010 + 010 + 001 + KEY + CHAR + X + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + ZCDS_ALV_EXTPAR-PARAMETER_NAME + ________ + 001 + 002 + 008 + 010 + 001 + KEY + CHAR + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + ZCDS_ALV_EXTPART-PARAMETER_TEXT + ____________________________________________________________________________________________________________________________________ + X + 001 + 003 + 255 + 040 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + ZCDS_ALV_EXTPAR-DB_FIELD + ____________________________________________________________________________________________________________________________________ + X + 001 + 004 + 132 + 030 + 001 + CHAR + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + CHECK + ZCDS_ALV_EXTPAR-HAS_VALUE_HELP + 001 + 005 + 001 + 010 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + CHECK + ZCDS_ALV_EXTPAR-HAS_HELP + 001 + 006 + 001 + 010 + 001 + CHAR + X + X + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_EXTPAR + TEMPLATE + ZCDS_ALV_EXTPAR-ATTRIBUTE_NAME + ____________________________________________________________________________________________________________________________________ + X + 001 + 007 + 255 + 060 + 001 + CHAR + X + X + X + X + + + + + * VCL-Modifications + + + PROCESS BEFORE OUTPUT. + + + MODULE LISTE_INITIALISIEREN. + + + LOOP AT EXTRACT WITH CONTROL + + + TCTRL_ZCDS_ALV_EXTPAR CURSOR NEXTLINE. + + + MODULE LISTE_SHOW_LISTE. + + + ENDLOOP. + + + * + + + PROCESS AFTER INPUT. + + + MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND. + + + MODULE LISTE_BEFORE_LOOP. + + + LOOP AT EXTRACT. + + + MODULE LISTE_INIT_WORKAREA. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTPAR-EXTENSION_NAME . + + + FIELD ZCDS_ALV_EXTPAR-PARAMETER_NAME . + + + FIELD ZCDS_ALV_EXTPAR-DB_FIELD . + + + FIELD ZCDS_ALV_EXTPAR-HAS_VALUE_HELP . + + + FIELD ZCDS_ALV_EXTPAR-HAS_HELP . + + + FIELD ZCDS_ALV_EXTPAR-ATTRIBUTE_NAME . + + + MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTPART-PARAMETER_TEXT . + + + MODULE SET_TXT_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX. + + + CHAIN. + + + FIELD ZCDS_ALV_EXTPAR-EXTENSION_NAME . + + + FIELD ZCDS_ALV_EXTPAR-PARAMETER_NAME . + + + MODULE LISTE_UPDATE_LISTE. + + + ENDCHAIN. + + + ENDLOOP. + + + MODULE LISTE_AFTER_LOOP. + + + * + + + PROCESS ON VALUE-REQUEST. + + + FIELD ZCDS_ALV_EXTPAR-EXTENSION_NAME MODULE VCL_HELP_VALUES. + + +
+ +
+ SAPLZCDS_ALV_TABLES + 0004 + E + View Maintenance: Overview screen for ZCDS_ALV_IOCCLIF + N + 0004 + 061 + 083 +
+ + + SCREEN + SCREEN + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + SCREEN + 001 + 001 + 068 + 059 + X + X + X + X + ENTRY + X + X + X + X + X + MULTIPLE + NONE + X + 001 + + + + + SCREEN + SCREEN + PUSH_TMPL + VIM_POSI_PUSH + ____________________ + 061 + 019 + 020 + 020 + 001 + POSI + CHAR + X + N + + + SCREEN + SCREEN + TEMPLATE + VIM_POSITION_INFO + ______________________________ + 061 + 040 + 030 + 030 + 001 + CHAR + X + X + X + N + <_--32_DIMENS>X + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + TEMPLATE + VIM_FRAME_FIELD + ____________________________________________________________ + 001 + 060 + 060 + 001 + CHAR + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + TEXT + *ZCDS_ALV_IOCCLIF-INTERFACE + 001 + 001 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + TEXT + *ZCDS_ALV_IOCCLIF-CLASS + 001 + 002 + 040 + 030 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + CHECK + VIM_MARKED + 001 + 001 + 001 + 001 + CHAR + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + TEMPLATE + ZCDS_ALV_IOCCLIF-INTERFACE + ______________________________ + 001 + 001 + 030 + 030 + 001 + KEY + CHAR + X + X + CLASS + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_IOCCLIF + TEMPLATE + ZCDS_ALV_IOCCLIF-CLASS + ______________________________ + 001 + 002 + 030 + 030 + 001 + CHAR + X + X + CLASS + X + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE LISTE_INITIALISIEREN. + + + LOOP AT EXTRACT WITH CONTROL + + + TCTRL_ZCDS_ALV_IOCCLIF CURSOR NEXTLINE. + + + MODULE LISTE_SHOW_LISTE. + + + ENDLOOP. + + + * + + + PROCESS AFTER INPUT. + + + MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND. + + + MODULE LISTE_BEFORE_LOOP. + + + LOOP AT EXTRACT. + + + MODULE LISTE_INIT_WORKAREA. + + + CHAIN. + + + FIELD ZCDS_ALV_IOCCLIF-INTERFACE . + + + FIELD ZCDS_ALV_IOCCLIF-CLASS . + + + MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX. + + + CHAIN. + + + FIELD ZCDS_ALV_IOCCLIF-INTERFACE . + + + MODULE LISTE_UPDATE_LISTE. + + + ENDCHAIN. + + + ENDLOOP. + + + MODULE LISTE_AFTER_LOOP. + + +
+ +
+ SAPLZCDS_ALV_TABLES + 0005 + E + View maintainance: Overview Screen ZCDS_ALV_NAVEXIT + N + 0005 + 061 + 123 +
+ + + SCREEN + SCREEN + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + SCREEN + 001 + 001 + 123 + 059 + X + X + X + X + ENTRY + X + X + X + X + X + MULTIPLE + NONE + X + 003 + + + + + SCREEN + SCREEN + PUSH_TMPL + VIM_POSI_PUSH + ____________________ + 061 + 019 + 020 + 020 + 001 + POSI + CHAR + X + N + + + SCREEN + SCREEN + TEMPLATE + VIM_POSITION_INFO + ______________________________ + 061 + 040 + 030 + 030 + 001 + CHAR + X + X + X + N + <_--32_DIMENS>X + + + SCREEN + SCREEN + OKCODE + OK_CODE + ____________________ + 020 + 020 + 001 + CHAR + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEMPLATE + VIM_FRAME_FIELD + ____________________________________________________________ + 001 + 060 + 060 + 001 + CHAR + X + X + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEXT + *ZCDS_ALV_NAVEXIT-SEMANTIC_OBJECT + 001 + 001 + 040 + 020 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEXT + *ZCDS_ALV_NAVEXIT-SEMANTIC_ACTION + 001 + 002 + 040 + 020 + 001 + CHAR + X + V + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEXT + *ZCDS_ALV_NAVEXIT-CDS_VIEW + CDS_view + 001 + 003 + 008 + 030 + 001 + CHAR + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEXT + *ZCDS_ALV_NAVEXIT-IMPLEMENTING_CLASS + Implementaning_class___________________________ + 001 + 004 + 047 + 030 + 001 + CHAR + X + F + N + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + CHECK + VIM_MARKED + 001 + 001 + 001 + 001 + CHAR + X + X + X + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEMPLATE + ZCDS_ALV_NAVEXIT-SEMANTIC_OBJECT + ______________________________ + X + 001 + 001 + 030 + 020 + 001 + KEY + CHAR + X + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEMPLATE + ZCDS_ALV_NAVEXIT-SEMANTIC_ACTION + ____________________________________________________________ + X + 001 + 002 + 060 + 020 + 001 + KEY + CHAR + X + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEMPLATE + ZCDS_ALV_NAVEXIT-CDS_VIEW + ______________________________ + 001 + 003 + 030 + 030 + 001 + KEY + CHAR + X + X + X + N + + + TABLE_CTRL + TCTRL_ZCDS_ALV_NAVEXIT + TEMPLATE + ZCDS_ALV_NAVEXIT-IMPLEMENTING_CLASS + ______________________________ + 001 + 004 + 030 + 030 + 001 + CHAR + X + X + CLASS + X + X + + + + + PROCESS BEFORE OUTPUT. + + + MODULE LISTE_INITIALISIEREN. + + + LOOP AT EXTRACT WITH CONTROL + + + TCTRL_ZCDS_ALV_NAVEXIT CURSOR NEXTLINE. + + + MODULE LISTE_SHOW_LISTE. + + + ENDLOOP. + + + * + + + PROCESS AFTER INPUT. + + + MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND. + + + MODULE LISTE_BEFORE_LOOP. + + + LOOP AT EXTRACT. + + + MODULE LISTE_INIT_WORKAREA. + + + CHAIN. + + + FIELD ZCDS_ALV_NAVEXIT-SEMANTIC_OBJECT . + + + FIELD ZCDS_ALV_NAVEXIT-SEMANTIC_ACTION . + + + FIELD ZCDS_ALV_NAVEXIT-CDS_VIEW . + + + FIELD ZCDS_ALV_NAVEXIT-IMPLEMENTING_CLASS . + + + MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST. + + + ENDCHAIN. + + + FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX. + + + CHAIN. + + + FIELD ZCDS_ALV_NAVEXIT-SEMANTIC_OBJECT . + + + FIELD ZCDS_ALV_NAVEXIT-SEMANTIC_ACTION . + + + FIELD ZCDS_ALV_NAVEXIT-CDS_VIEW . + + + MODULE LISTE_UPDATE_LISTE. + + + ENDCHAIN. + + + ENDLOOP. + + + MODULE LISTE_AFTER_LOOP. + + +
+
+
+
+
diff --git a/src/zcds_alv_textpool_tab.ttyp.xml b/src/zcds_alv_textpool_tab.ttyp.xml new file mode 100644 index 0000000..e479c7a --- /dev/null +++ b/src/zcds_alv_textpool_tab.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_TEXTPOOL_TAB + D + TEXTPOOL + S + STRU + T + D + N + Tabelle mit Einträgen eines Textpools + + + + diff --git a/src/zcds_alv_valuehelp_binding.tabl.xml b/src/zcds_alv_valuehelp_binding.tabl.xml new file mode 100644 index 0000000..7828949 --- /dev/null +++ b/src/zcds_alv_valuehelp_binding.tabl.xml @@ -0,0 +1,65 @@ + + + + + + ZCDS_ALV_VALUEHELP_BINDING + D + INTTAB + Zusätzliche Parameter für Suchhilfeanbindung + 1 + + + + INDEX + SYTABIX + 0 + E + + + TARGET_PARAMETER + DDPARNAME + 0 + E + + + TARGET_ELEMENT + FIELDNAME + 0 + E + + + SOURCE_PARAMETER + DDPARNAME + 0 + E + + + SOURCE_ELEMENT + FIELDNAME + 0 + E + + + USAGE + 0 + C + 000060 + CHAR + 000030 + CHAR + Verwendung + + + + E + + + + E + Additional parameters for a value help + + + + + diff --git a/src/zcds_alv_valuehelp_binding_tab.ttyp.xml b/src/zcds_alv_valuehelp_binding_tab.ttyp.xml new file mode 100644 index 0000000..a626ec9 --- /dev/null +++ b/src/zcds_alv_valuehelp_binding_tab.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_VALUEHELP_BINDING_TAB + D + ZCDS_ALV_VALUEHELP_BINDING + S + STRU + T + D + N + Zusätzliches Binding für eine Wertehilfe + + + + diff --git a/src/zcds_alv_valuehelp_definition.tabl.xml b/src/zcds_alv_valuehelp_definition.tabl.xml new file mode 100644 index 0000000..de027f4 --- /dev/null +++ b/src/zcds_alv_valuehelp_definition.tabl.xml @@ -0,0 +1,84 @@ + + + + + + ZCDS_ALV_VALUEHELP_DEFINITION + D + INTTAB + Werthilfe über eine CDS-Assoziation + D + 1 + + + + CDS_VIEW + DDSTRUCOBJNAME + 0 + E + + + FIELDNAME + FIELDNAME + 0 + E + + + PARAMETER_NAME + DDPARNAME + 0 + E + + + ASSOCIATION_NAME + DDASSOCIATIONNAME + 0 + E + + + TARGET_ENTITY + DDSTRUCOBJNAME + 0 + E + + + TARGET_ELEMENT + FIELDNAME + 0 + E + + + DISTINCT_VALUES + KENNZX + 0 + X + F + E + + + ADDITIONAL_BINDING + ZCDS_ALV_VALUEHELP_BINDING_TAB + 0 + TTYP + TTYPL + L + + + LABEL + AS4TEXT + 0 + E + + + + E + + + + E + Value help via CDS association + + + + + diff --git a/src/zcds_alv_valuehelp_definitions.ttyp.xml b/src/zcds_alv_valuehelp_definitions.ttyp.xml new file mode 100644 index 0000000..2759814 --- /dev/null +++ b/src/zcds_alv_valuehelp_definitions.ttyp.xml @@ -0,0 +1,18 @@ + + + + + + ZCDS_ALV_VALUEHELP_DEFINITIONS + D + ZCDS_ALV_VALUEHELP_DEFINITION + S + STRU + T + D + N + Definitionen von Suchhilfen für Elemente eines CDS-Views + + + + diff --git a/src/zcds_alv_view_prog_counter.doma.xml b/src/zcds_alv_view_prog_counter.doma.xml new file mode 100644 index 0000000..e85ea02 --- /dev/null +++ b/src/zcds_alv_view_prog_counter.doma.xml @@ -0,0 +1,25 @@ + + + + + + ZCDS_ALV_VIEW_PROG_COUNTER + D + NUMC + 000016 + 000016 + ALPHA + Laufende Nummer für generierte Programme + + + E + + + + E + Counter for generated programs + + + + + diff --git a/src/zcds_alv_view_prog_counter.dtel.xml b/src/zcds_alv_view_prog_counter.dtel.xml new file mode 100644 index 0000000..62504c1 --- /dev/null +++ b/src/zcds_alv_view_prog_counter.dtel.xml @@ -0,0 +1,23 @@ + + + + + + ZCDS_ALV_VIEW_PROG_COUNTER + D + ZCDS_ALV_VIEW_PROG_COUNTER + 16 + 10 + 20 + 40 + Laufende Nummer für generierte Programme + Laufende Nummer + Nummer + Laufende Nummer + Laufende Nummer + D + D + + + + diff --git a/src/zcl_cds_alv_authority_check.clas.abap b/src/zcl_cds_alv_authority_check.clas.abap new file mode 100644 index 0000000..387d869 --- /dev/null +++ b/src/zcl_cds_alv_authority_check.clas.abap @@ -0,0 +1,49 @@ +CLASS zcl_cds_alv_authority_check DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_authority_check. + + METHODS constructor + IMPORTING i_ddic_access TYPE REF TO zif_cds_alv_ddic_access. + + PROTECTED SECTION. + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + + PRIVATE SECTION. +ENDCLASS. + + + +CLASS ZCL_CDS_ALV_AUTHORITY_CHECK IMPLEMENTATION. + METHOD constructor. + ddic_access = i_ddic_access. + ENDMETHOD. + + METHOD zif_cds_alv_authority_check~check_authority_for_assoc. + " No implementation yet; might be added at a later date... + ENDMETHOD. + + METHOD zif_cds_alv_authority_check~check_authority_for_tcode. + DATA tcode TYPE sytcode. + + CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD tcode. "#EC CI_CCALL + + IF tcode <> 'ZCDS_ALV_START'. + RETURN. + ENDIF. + + CALL FUNCTION 'AUTHORITY_CHECK_TCODE' + EXPORTING tcode = 'ZCDS_ALV_START' + EXCEPTIONS ok = 0 + not_ok = 1 + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_authority_check~check_authority_for_view. + " No implementation yet; might be added at a later date... + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_authority_check.clas.xml b/src/zcl_cds_alv_authority_check.clas.xml new file mode 100644 index 0000000..58f6615 --- /dev/null +++ b/src/zcl_cds_alv_authority_check.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_AUTHORITY_CHECK + D + Berechtigungsprüfungen zum CDS ALV Framework + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_base.clas.abap b/src/zcl_cds_alv_base.clas.abap new file mode 100644 index 0000000..32f4323 --- /dev/null +++ b/src/zcl_cds_alv_base.clas.abap @@ -0,0 +1,72 @@ +CLASS zcl_cds_alv_base DEFINITION PUBLIC ABSTRACT CREATE PUBLIC. + PUBLIC SECTION. + DATA cds_view TYPE ddstrucobjname READ-ONLY. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + CONSTANTS: BEGIN OF field_type, + standard TYPE zcds_alv_field_type VALUE '#STANDARD', + for_action TYPE zcds_alv_field_type VALUE '#FOR_ACTION', + for_intent_based_navigation TYPE zcds_alv_field_type VALUE '#FOR_INTENT_BASED_NAVIGATION', + with_intent_based_navigation TYPE zcds_alv_field_type VALUE '#WITH_INTENT_BASED_NAVIGATION', + with_navigation_path TYPE zcds_alv_field_type VALUE '#WITH_NAVIGATION_PATH', + with_url TYPE zcds_alv_field_type VALUE '#WITH_URL', + END OF field_type. + + DATA description TYPE ddtext . + DATA ddfields TYPE ddfields . + DATA parameter_annotations TYPE cl_dd_ddl_annotation_service=>ty_t_para_anno_val_src_dtel . + DATA element_annotations TYPE cl_dd_ddl_annotation_service=>ty_t_elmnt_anno_val_src_dtel . + DATA entity_annotations TYPE cl_dd_ddl_annotation_service=>ty_t_anno_value . + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + DATA persistence TYPE REF TO zif_cds_alv_persistence. + DATA memory TYPE REF TO zif_cds_alv_memory. + DATA factory TYPE REF TO zif_cds_alv_factory. + + METHODS evaluate_annotations ABSTRACT + RAISING + zcx_cds_alv_message. + + METHODS remove_quotes + IMPORTING + i_string TYPE clike + RETURNING + VALUE(r_string) TYPE string. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS ZCL_CDS_ALV_BASE IMPLEMENTATION. + METHOD constructor. + cds_view = to_upper( i_cds_view ). + ddic_access = i_ddic_access. + persistence = i_persistence. + memory = i_memory. + factory = i_factory. + + ddic_access->get_annotations_for_cds_view( EXPORTING i_cds_view = cds_view + IMPORTING e_entity_annotations = entity_annotations + e_element_annotations = element_annotations + e_parameter_annotations = parameter_annotations ). + + TRY. + description = entity_annotations[ annoname = 'ENDUSERTEXT.LABEL' ]-value. + CATCH cx_sy_itab_line_not_found. + description = cds_view. + ENDTRY. + + ddfields = ddic_access->get_ddic_fields_for_cds_view( cds_view ). + ENDMETHOD. + + METHOD remove_quotes. + r_string = replace( val = i_string sub = `'` with = `` occ = 0 ). + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_base.clas.xml b/src/zcl_cds_alv_base.clas.xml new file mode 100644 index 0000000..2703ef1 --- /dev/null +++ b/src/zcl_cds_alv_base.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_BASE + D + Abstrakte Oberklasse für Objekte mit annotierten CDS-Views + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_bopf_handler.clas.abap b/src/zcl_cds_alv_bopf_handler.clas.abap new file mode 100644 index 0000000..0c045d9 --- /dev/null +++ b/src/zcl_cds_alv_bopf_handler.clas.abap @@ -0,0 +1,310 @@ +CLASS zcl_cds_alv_bopf_handler DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_bopf_handler. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + METHODS: evaluate_annotations REDEFINITION. + + PRIVATE SECTION. + DATA sadl_definition TYPE if_sadl_types=>ty_sadl_definition. + DATA entity TYPE REF TO if_sadl_entity. + DATA runtime TYPE REF TO if_sadl_entity_transactional. + DATA transaction_manager TYPE REF TO cl_sadl_transaction_manager. + + METHODS ask_for_parameters + CHANGING c_parameters TYPE any + RAISING zcx_cds_alv_message. + + METHODS map_attributes_single + IMPORTING i_entity_key TYPE any OPTIONAL + i_attributes TYPE if_sadl_types=>tt_sadl_attributes + EXPORTING e_source_key TYPE any + RAISING zcx_cds_alv_message. + + METHODS map_attributes_table + IMPORTING i_entity_keys TYPE STANDARD TABLE OPTIONAL + i_attributes TYPE if_sadl_types=>tt_sadl_attributes + EXPORTING e_source_keys TYPE STANDARD TABLE + RAISING zcx_cds_alv_message. + + METHODS instantiate + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_bopf_handler IMPLEMENTATION. + METHOD ask_for_parameters. + DATA fields TYPE STANDARD TABLE OF sval. + + DATA(descriptor) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( c_parameters ) ). + IF descriptor->is_ddic_type( ). + fields = VALUE #( FOR x_ddic_field IN descriptor->get_ddic_field_list( ) + ( tabname = x_ddic_field-tabname + fieldname = x_ddic_field-fieldname + fieldtext = x_ddic_field-scrtext_m ) ). + ELSE. + fields = VALUE #( FOR x_component IN descriptor->components + ( tabname = descriptor->get_relative_name( ) + fieldname = x_component-name + fieldtext = x_component-name ) ). + ENDIF. + + CALL FUNCTION 'POPUP_GET_VALUES' + EXPORTING popup_title = 'Parameter eingeben' + TABLES fields = fields + EXCEPTIONS error_in_fields = 1 + OTHERS = 2. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + LOOP AT fields INTO DATA(field). + ASSIGN COMPONENT field-fieldname OF STRUCTURE c_parameters TO FIELD-SYMBOL(). + IF sy-subrc = 0. + = field-value. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + " not used yet + ENDMETHOD. + + METHOD instantiate. + TRY. + DATA(entity_id) = CONV sadl_entity_id( cds_view ). + entity = cl_sadl_entity_factory=>get_instance( )->get_entity( iv_type = cl_sadl_entity_factory=>co_type-cds + iv_id = entity_id ). + + " This gets the correct entity, when ObjectModel.transactionalProcessingDelegated is used! + DATA(source_id) = ddic_access->get_source_id( entity ). + + runtime = cl_sadl_crud_runtime_util=>get_ta_runtime( + iv_entity_id = COND #( WHEN source_id IS NOT INITIAL THEN source_id ELSE entity_id ) + iv_entity_type = cl_sadl_entity_factory=>co_type-cds ). + + transaction_manager = cl_sadl_transaction_manager=>get_transaction_manager( ). + + IF source_id IS NOT INITIAL. + DATA(mp) = ddic_access->get_mp_for_entity( entity ). + + DATA(entity_type_trans_manager) = + cl_sadl_entity_trans_factory=>get_transactional_provider( cl_sadl_entity_factory=>co_type-bopf + )->get_transaction_manager( cl_sadl_entity_factory=>co_type-bopf ). + + transaction_manager->register_entity_transaction( + io_entity_transaction = entity_type_trans_manager + iv_entity_type = cl_sadl_entity_factory=>co_type-bopf + io_mdp = cl_sadl_metadata_provider=>get( mp ) ). + ENDIF. + + CATCH cx_sadl_static cx_sadl_contract_violation INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD map_attributes_single. + CLEAR e_source_key. + + " Use Mapping, if it exists, else MOVE-CORRESPONDING + LOOP AT i_attributes ASSIGNING FIELD-SYMBOL(). + ASSIGN COMPONENT -name OF STRUCTURE i_entity_key TO FIELD-SYMBOL(). + ASSIGN COMPONENT -binding OF STRUCTURE e_source_key TO FIELD-SYMBOL(). + + IF IS ASSIGNED AND IS ASSIGNED. + = . + ENDIF. + + UNASSIGN: , . + ENDLOOP. + IF sy-subrc <> 0. + MOVE-CORRESPONDING i_entity_key TO e_source_key. + ENDIF. + ENDMETHOD. + + METHOD map_attributes_table. + CLEAR e_source_keys. + + LOOP AT i_entity_keys ASSIGNING FIELD-SYMBOL(). + APPEND INITIAL LINE TO e_source_keys ASSIGNING FIELD-SYMBOL(). + map_attributes_single( EXPORTING i_entity_key = + i_attributes = i_attributes + IMPORTING e_source_key = ). + ENDLOOP. + ENDMETHOD. + + METHOD zif_cds_alv_bopf_handler~delete. + DATA key_values TYPE REF TO data. + + TRY. + instantiate( ). + key_values = runtime->create_entity_table_ref( ). + ASSIGN key_values->* TO FIELD-SYMBOL(). + map_attributes_table( EXPORTING i_entity_keys = i_selected_rows + i_attributes = sadl_definition-attributes + IMPORTING e_source_keys = ). + + runtime->delete( EXPORTING it_key_values = + IMPORTING et_failed = DATA(failed_keys) ). + + DATA(failed) = xsdbool( failed_keys IS NOT INITIAL ). + + IF failed = abap_false. + failed = transaction_manager->if_sadl_transaction_manager~save( ). + ENDIF. + + IF failed = abap_true. + transaction_manager->if_sadl_transaction_manager~discard_changes( ). + ENDIF. + + CATCH cx_sadl_contract_violation cx_sadl_static INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_bopf_handler~execute_action. + DATA parameters TYPE REF TO data. + DATA key_values TYPE REF TO data. + DATA key_values_tab TYPE REF TO data. + DATA return TYPE REF TO data. + DATA failed TYPE abap_bool. + + FIELD-SYMBOLS TYPE any. + FIELD-SYMBOLS TYPE STANDARD TABLE. + + TRY. + instantiate( ). + DATA(action) = entity->get_action( to_upper( i_action ) ). + + " Parameters + IF action-data_type IS NOT INITIAL. + parameters = runtime->create_action_parameter_ref( action-name ). + ASSIGN parameters->* TO . + ask_for_parameters( CHANGING c_parameters = ). + ELSE. + CREATE DATA parameters TYPE char1. + ASSIGN parameters->* TO . + ENDIF. + + " Return Type + IF action-return_entity_id IS NOT INITIAL. + return = cl_sadl_crud_runtime_util=>get_ta_runtime( + iv_entity_id = CONV sadl_entity_id( action-return_entity_id ) + iv_entity_type = cl_sadl_entity_factory=>co_type-cds )->create_entity_table_ref( ). + ASSIGN return->* TO . + ELSEIF action-return_table_type IS NOT INITIAL. + CREATE DATA return TYPE STANDARD TABLE OF (action-return_table_type). + ASSIGN return->* TO . + ELSE. + CREATE DATA return TYPE STANDARD TABLE OF char1. + ASSIGN return->* TO . + ENDIF. + + " Execution + CASE action-static. + WHEN abap_false. + LOOP AT i_selected_rows ASSIGNING FIELD-SYMBOL(). + key_values = runtime->create_entity_structure_ref( ). + ASSIGN key_values->* TO FIELD-SYMBOL(). + map_attributes_single( EXPORTING i_entity_key = + i_attributes = sadl_definition-attributes + IMPORTING e_source_key = ). + + runtime->execute_single( EXPORTING iv_action_name = action-name + i_action_parameters = + is_key_values = + IMPORTING ev_failed = failed + et_data = ). + + IF failed = abap_false. + failed = transaction_manager->if_sadl_transaction_manager~save( ). + ENDIF. + + IF failed = abap_true. + transaction_manager->if_sadl_transaction_manager~discard_changes( ). + ENDIF. + ENDLOOP. + + WHEN abap_true. + key_values_tab = runtime->create_entity_table_ref( ). + ASSIGN key_values_tab->* TO FIELD-SYMBOL(). + map_attributes_table( EXPORTING i_entity_keys = i_selected_rows + i_attributes = sadl_definition-attributes + IMPORTING e_source_keys = ). + + runtime->execute( EXPORTING iv_action_name = action-name + i_action_parameters = + it_key_values = + IMPORTING ev_static_action_failed = failed + et_data = ). + + IF failed = abap_false. + failed = transaction_manager->if_sadl_transaction_manager~save( ). + ENDIF. + + IF failed = abap_true. + transaction_manager->if_sadl_transaction_manager~discard_changes( ). + ENDIF. + ENDCASE. + + e_refresh_after = abap_true. + + CATCH cx_sadl_contract_violation cx_sadl_static INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_bopf_handler~update. + DATA entity_data TYPE REF TO data. + + TRY. + instantiate( ). + entity_data = runtime->create_entity_table_ref( ). + ASSIGN entity_data->* TO FIELD-SYMBOL(). + map_attributes_table( EXPORTING i_entity_keys = i_selected_rows + i_attributes = sadl_definition-attributes + IMPORTING e_source_keys = ). + + runtime->update( EXPORTING it_entity_data = + IMPORTING et_failed = DATA(failed_keys) ). + + DATA(failed) = xsdbool( failed_keys IS NOT INITIAL ). + + IF failed = abap_false. + failed = transaction_manager->if_sadl_transaction_manager~save( ). + ENDIF. + + IF failed = abap_true. + transaction_manager->if_sadl_transaction_manager~discard_changes( ). + ENDIF. + + CATCH cx_sadl_contract_violation cx_sadl_static INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_bopf_handler.clas.xml b/src/zcl_cds_alv_bopf_handler.clas.xml new file mode 100644 index 0000000..eee8ac8 --- /dev/null +++ b/src/zcl_cds_alv_bopf_handler.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_BOPF_HANDLER + D + BOPF-Handler + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_ddic_access.clas.abap b/src/zcl_cds_alv_ddic_access.clas.abap new file mode 100644 index 0000000..70cbd8a --- /dev/null +++ b/src/zcl_cds_alv_ddic_access.clas.abap @@ -0,0 +1,182 @@ +CLASS zcl_cds_alv_ddic_access DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_ddic_access. + + PROTECTED SECTION. + + PRIVATE SECTION. + ALIASES exists_view FOR zif_cds_alv_ddic_access~exists_view. + ALIASES get_annotations_for_cds_view FOR zif_cds_alv_ddic_access~get_annotations_for_cds_view. + ALIASES get_conditions_for_association FOR zif_cds_alv_ddic_access~get_conditions_for_association. + ALIASES get_ddic_fields_for_cds_view FOR zif_cds_alv_ddic_access~get_ddic_fields_for_cds_view. + ALIASES get_last_modified_at FOR zif_cds_alv_ddic_access~get_last_modified_at. + ALIASES get_parameters_for_cds_view FOR zif_cds_alv_ddic_access~get_parameters_for_cds_view. + ALIASES get_sadl_runtime FOR zif_cds_alv_ddic_access~get_sadl_runtime. + ALIASES get_target_for_association FOR zif_cds_alv_ddic_access~get_target_for_association. + ALIASES get_mp_for_entity FOR zif_cds_alv_ddic_access~get_mp_for_entity. + +ENDCLASS. + + + +CLASS zcl_cds_alv_ddic_access IMPLEMENTATION. + METHOD zif_cds_alv_ddic_access~exists_view. + SELECT SINGLE @abap_true FROM dd02b + WHERE strucobjn = @i_cds_view + INTO @r_exists. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_annotations_for_cds_view. + cl_dd_ddl_annotation_service=>get_annos( EXPORTING entityname = to_upper( i_cds_view ) + IMPORTING entity_annos = e_entity_annotations + element_annos = e_element_annotations + parameter_annos = e_parameter_annotations ). + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_conditions_for_association. + TRY. + DATA dd_object TYPE REF TO if_dd_sobject. + + dd_object = NEW cl_dd_sobject( ). + dd_object->read( EXPORTING sobjnames = VALUE #( ( i_source_view ) ) + IMPORTING dd08bv_tab = e_dd08bv_tab + dd05bv_tab = e_dd05bv_tab ). + + READ TABLE e_dd08bv_tab INTO DATA(dd08bv) + WITH KEY assocname_raw = i_association_name. + + e_target_view = dd08bv-strucobjn_t. + DELETE e_dd08bv_tab WHERE associationname <> dd08bv-associationname. + DELETE e_dd05bv_tab WHERE associationname <> dd08bv-associationname. + + " This removes conditions on the source and target view to allow + " Navigation via association in cases where no FORALL table is available. + " The implementation is somewhat ad hoc and may well need future adjustment + " for complex conditions that are not correctly rearranged by it. + IF i_only_constants = abap_true. + SORT e_dd05bv_tab BY fdposition DESCENDING. + LOOP AT e_dd05bv_tab ASSIGNING FIELD-SYMBOL(). + DATA(curr_tabix) = sy-tabix. + + IF -side_info CO 'LPS'. + CONTINUE. + ENDIF. + + READ TABLE e_dd05bv_tab INDEX ( curr_tabix + 1 ) ASSIGNING FIELD-SYMBOL(). + IF sy-subrc = 0. + IF -and_or = 'AND' AND -and_or = 'OR'. + -and_or = 'AND'. + ELSEIF -and_or IS INITIAL. + CLEAR -and_or. + ENDIF. + ENDIF. + + DELETE e_dd05bv_tab INDEX curr_tabix. + CONTINUE. + ENDLOOP. + ENDIF. + + CATCH cx_dd_sobject_get INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_ddic_fields_for_cds_view. + CALL FUNCTION 'DDIF_FIELDINFO_GET' + EXPORTING tabname = i_cds_view + TABLES dfies_tab = r_ddfields + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + DELETE r_ddfields WHERE fieldname = '.NODE1'. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_last_modified_at. + SELECT SINGLE chgdate, chgtime FROM dd02b + WHERE strucobjn = @i_cds_view + INTO @DATA(dd_date_time). "#EC CI_NOORDER + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e007(zisu_salv) WITH i_cds_view. + ENDIF. + + CONVERT DATE dd_date_time-chgdate TIME dd_date_time-chgtime + INTO TIME STAMP r_modified_at TIME ZONE sy-zonlo. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_mp_for_entity. + TRY. + r_mp = NEW zcl_cds_alv_sadl_mapping_prov( i_entity ). + + CATCH cx_bsa_compile_time INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_parameters_for_cds_view. + TRY. + DATA dd_object TYPE REF TO if_dd_sobject. + + dd_object = NEW cl_dd_sobject( ). + dd_object->read( EXPORTING sobjnames = VALUE #( ( i_cds_view ) ) + IMPORTING dd10bv_tab = r_dd10bv_tab ). + + CATCH cx_dd_sobject_get INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_sadl_runtime. + TRY. + DATA(sadl_entity) = cl_sadl_entity_factory=>get_instance( )->get_entity( + iv_type = cl_sadl_entity_factory=>co_type-cds + iv_id = CONV sadl_entity_id( i_cds_view ) ). + + DATA(mp) = get_mp_for_entity( sadl_entity ). + DATA(api_factory) = cl_sadl_entity_api_factory=>create( CAST cl_sadl_mp_entity( mp ) ). + r_sadl_runtime = api_factory->get_runtime( ). + + CATCH cx_sadl_contract_violation cx_sadl_static cx_uuid_error INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_source_id. + TRY. + " This gets the correct entity ID, when ObjectModel.transactionalProcessingDelegated is used! + " Parameter type is changed to RETURNING in newer releases! + CAST cl_sadl_entity_cds( i_entity )->get_consumption_view_def( IMPORTING ev_source_id = r_source_id ). + + CATCH cx_sadl_static INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_ddic_access~get_target_for_association. + TRY. + DATA dd_object TYPE REF TO if_dd_sobject. + + dd_object = NEW cl_dd_sobject( ). + dd_object->read( EXPORTING sobjnames = VALUE #( ( i_source_view ) ) + IMPORTING dd08bv_tab = DATA(dd08bv_tab) ). + + READ TABLE dd08bv_tab INTO DATA(dd08bv) + WITH KEY assocname_raw = i_association_name. + + r_target_view = dd08bv-strucobjn_t. + + CATCH cx_dd_sobject_get INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_ddic_access.clas.xml b/src/zcl_cds_alv_ddic_access.clas.xml new file mode 100644 index 0000000..1f8b9fc --- /dev/null +++ b/src/zcl_cds_alv_ddic_access.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_DDIC_ACCESS + D + DDIC-Zugriffe für CDS-Views + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_extension_provider.clas.abap b/src/zcl_cds_alv_extension_provider.clas.abap new file mode 100644 index 0000000..176929b --- /dev/null +++ b/src/zcl_cds_alv_extension_provider.clas.abap @@ -0,0 +1,39 @@ +CLASS zcl_cds_alv_extension_provider DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_extension_provider. + + METHODS constructor + IMPORTING i_persistence TYPE REF TO zif_cds_alv_persistence. + + PROTECTED SECTION. + + PRIVATE SECTION. + DATA persistence TYPE REF TO zif_cds_alv_persistence. +ENDCLASS. + + + +CLASS zcl_cds_alv_extension_provider IMPLEMENTATION. + METHOD constructor. + persistence = i_persistence. + ENDMETHOD. + + METHOD zif_cds_alv_extension_provider~get_report_extensions. + LOOP AT persistence->get_report_extensions( i_cds_view ) INTO DATA(extension). + DATA(extension_parameters) = persistence->get_extension_parameters( extension-extension_name ). + + INSERT VALUE #( extension = extension-extension_name ) INTO TABLE r_report_extensions + ASSIGNING FIELD-SYMBOL(). + + TRY. + CREATE OBJECT -instance TYPE (extension-implementing_class) + EXPORTING i_extension_name = extension-extension_name + i_extension_parameters = extension_parameters. + + CATCH cx_sy_create_object_error. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e019(zcds_alv) WITH extension-implementing_class extension-extension_name. + ENDTRY. + ENDLOOP. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_extension_provider.clas.xml b/src/zcl_cds_alv_extension_provider.clas.xml new file mode 100644 index 0000000..344711b --- /dev/null +++ b/src/zcl_cds_alv_extension_provider.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_EXTENSION_PROVIDER + D + Factory für Erweiterungen + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_factory.clas.abap b/src/zcl_cds_alv_factory.clas.abap new file mode 100644 index 0000000..d34ab70 --- /dev/null +++ b/src/zcl_cds_alv_factory.clas.abap @@ -0,0 +1,258 @@ +CLASS zcl_cds_alv_factory DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_factory. + + CLASS-METHODS get_instance + RETURNING + VALUE(r_factory) TYPE REF TO zif_cds_alv_factory. + + CLASS-METHODS set_instance + IMPORTING + !i_factory TYPE REF TO zif_cds_alv_factory. + + PROTECTED SECTION. + TYPES: + BEGIN OF ty_ioc_container, + cds_view TYPE ddstrucobjname, + ioc_container TYPE REF TO zif_cds_alv_ioc_container, + END OF ty_ioc_container. + TYPES: + tt_ioc_containers TYPE HASHED TABLE OF ty_ioc_container WITH UNIQUE KEY cds_view . + + DATA ioc_containers TYPE tt_ioc_containers. + + METHODS get_container_for_cds_view + IMPORTING + !i_cds_view TYPE ddstrucobjname + RETURNING + VALUE(r_ioc_container) TYPE REF TO zif_cds_alv_ioc_container + RAISING + zcx_cds_alv_message. + METHODS get_fallback + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. + METHODS get_from_customizing + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. + METHODS get_implementation + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. + METHODS get_parent_container + RETURNING + VALUE(r_ioc_container) TYPE REF TO zif_cds_alv_ioc_container + RAISING + zcx_cds_alv_message. + + PRIVATE SECTION. + CLASS-DATA singleton TYPE REF TO zif_cds_alv_factory. + + CLASS-METHODS get_fallback_static + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. + CLASS-METHODS get_from_customizing_static + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. + CLASS-METHODS get_implementation_static + IMPORTING + !i_interface TYPE seoitfname + RETURNING + VALUE(r_class) TYPE seoclsname. +ENDCLASS. + + + +CLASS zcl_cds_alv_factory IMPLEMENTATION. + + METHOD get_container_for_cds_view. + TRY. + r_ioc_container = ioc_containers[ cds_view = i_cds_view ]-ioc_container. + CATCH cx_sy_itab_line_not_found. + DATA(ioc_container) = NEW zcl_cds_alv_ioc_container( i_cds_view = i_cds_view i_parent = get_parent_container( ) ). + DATA(parameters) = VALUE abap_parmbind_tab( ( name = 'I_CDS_VIEW' value = REF #( ioc_container->cds_view ) ) ). + r_ioc_container = ioc_container. + r_ioc_container->register_implementing_class( i_parameters = parameters: + i_interface = 'ZIF_CDS_ALV_GRID_BUILDER' i_class = get_implementation( 'ZIF_CDS_ALV_GRID_BUILDER' ) ), + i_interface = 'ZIF_CDS_ALV_SELECTION' i_class = get_implementation( 'ZIF_CDS_ALV_SELECTION' ) ), + i_interface = 'ZIF_CDS_ALV_SELECTION_SCREEN' i_class = get_implementation( 'ZIF_CDS_ALV_SELECTION_SCREEN' ) ), + i_interface = 'ZIF_CDS_ALV_CONDITION_PROVIDER' i_class = get_implementation( 'ZIF_CDS_ALV_CONDITION_PROVIDER' ) ), + i_interface = 'ZIF_CDS_ALV_VALUE_HELP' i_class = get_implementation( 'ZIF_CDS_ALV_VALUE_HELP' ) ), + i_interface = 'ZIF_CDS_ALV_REPORT_CONTROLLER' i_class = get_implementation( 'ZIF_CDS_ALV_REPORT_CONTROLLER' ) ), + i_interface = 'ZIF_CDS_ALV_REPORT_STRATEGY' i_class = get_implementation( 'ZIF_CDS_ALV_REPORT_STRATEGY' ) ), + i_interface = 'ZIF_CDS_ALV_BOPF_HANDLER' i_class = get_implementation( 'ZIF_CDS_ALV_BOPF_HANDLER' ) ), + i_interface = 'ZIF_CDS_ALV_TABLE_CONTAINER' i_class = get_implementation( 'ZIF_CDS_ALV_TABLE_CONTAINER' ) ). + INSERT VALUE #( cds_view = i_cds_view ioc_container = r_ioc_container ) INTO TABLE ioc_containers. + ENDTRY. + ENDMETHOD. + + METHOD get_fallback. + r_class = SWITCH #( i_interface + WHEN 'ZIF_CDS_ALV_FACTORY' THEN 'ZCL_CDS_ALV_FACTORY' + WHEN 'ZIF_CDS_ALV_DDIC_ACCESS' THEN 'ZCL_CDS_ALV_DDIC_ACCESS' + WHEN 'ZIF_CDS_ALV_PERSISTENCE' THEN 'ZCL_CDS_ALV_PERSISTENCE' + WHEN 'ZIF_CDS_ALV_MEMORY' THEN 'ZCL_CDS_ALV_MEMORY' + WHEN 'ZIF_CDS_ALV_REPORT_GENERATOR' THEN 'ZCL_CDS_ALV_REPORT_GENERATOR' + WHEN 'ZIF_CDS_ALV_REPORT_LAUNCHER' THEN 'ZCL_CDS_ALV_REPORT_LAUNCHER' + WHEN 'ZIF_CDS_ALV_NAVIGATION' THEN 'ZCL_CDS_ALV_NAVIGATION' + WHEN 'ZIF_CDS_ALV_GRID_BUILDER' THEN 'ZCL_CDS_ALV_GRID_BUILDER' + WHEN 'ZIF_CDS_ALV_SELECTION' THEN 'ZCL_CDS_ALV_SELECTION' + WHEN 'ZIF_CDS_ALV_SELECTION_SCREEN' THEN 'ZCL_CDS_ALV_SELECTION_SCREEN' + WHEN 'ZIF_CDS_ALV_CONDITION_PROVIDER' THEN 'ZCL_CDS_ALV_SELECTION_SCREEN' + WHEN 'ZIF_CDS_ALV_VALUE_HELP' THEN 'ZCL_CDS_ALV_VALUE_HELP' + WHEN 'ZIF_CDS_ALV_REPORT_CONTROLLER' THEN 'ZCL_CDS_ALV_REPORT_CONTROLLER' + WHEN 'ZIF_CDS_ALV_REPORT_STRATEGY' THEN 'ZCL_CDS_ALV_REPORT_STRATEGY' + WHEN 'ZIF_CDS_ALV_BOPF_HANDLER' THEN 'ZCL_CDS_ALV_BOPF_HANDLER' + WHEN 'ZIF_CDS_ALV_AUTHORITY_CHECK' THEN 'ZCL_CDS_ALV_AUTHORITY_CHECK' + WHEN 'ZIF_CDS_ALV_TABLE_CONTAINER' THEN 'ZCL_CDS_ALV_TABLE_CONTAINER' + WHEN 'ZIF_CDS_ALV_EXTENSION_PROVIDER' THEN 'ZCL_CDS_ALV_EXTENSION_PROVIDER' ). + ENDMETHOD. + + METHOD get_fallback_static. + r_class = SWITCH #( i_interface + WHEN 'ZIF_CDS_ALV_FACTORY' THEN 'ZCL_CDS_ALV_FACTORY' + WHEN 'ZIF_CDS_ALV_DDIC_ACCESS' THEN 'ZCL_CDS_ALV_DDIC_ACCESS' + WHEN 'ZIF_CDS_ALV_PERSISTENCE' THEN 'ZCL_CDS_ALV_PERSISTENCE' + WHEN 'ZIF_CDS_ALV_MEMORY' THEN 'ZCL_CDS_ALV_MEMORY' + WHEN 'ZIF_CDS_ALV_REPORT_GENERATOR' THEN 'ZCL_CDS_ALV_REPORT_GENERATOR' + WHEN 'ZIF_CDS_ALV_REPORT_LAUNCHER' THEN 'ZCL_CDS_ALV_REPORT_LAUNCHER' + WHEN 'ZIF_CDS_ALV_NAVIGATION' THEN 'ZCL_CDS_ALV_NAVIGATION' + WHEN 'ZIF_CDS_ALV_GRID_BUILDER' THEN 'ZCL_CDS_ALV_GRID_BUILDER' + WHEN 'ZIF_CDS_ALV_SELECTION' THEN 'ZCL_CDS_ALV_SELECTION' + WHEN 'ZIF_CDS_ALV_SELECTION_SCREEN' THEN 'ZCL_CDS_ALV_SELECTION_SCREEN' + WHEN 'ZIF_CDS_ALV_CONDITION_PROVIDER' THEN 'ZCL_CDS_ALV_SELECTION_SCREEN' + WHEN 'ZIF_CDS_ALV_VALUE_HELP' THEN 'ZCL_CDS_ALV_VALUE_HELP' + WHEN 'ZIF_CDS_ALV_REPORT_CONTROLLER' THEN 'ZCL_CDS_ALV_REPORT_CONTROLLER' + WHEN 'ZIF_CDS_ALV_REPORT_STRATEGY' THEN 'ZCL_CDS_ALV_REPORT_STRATEGY' + WHEN 'ZIF_CDS_ALV_BOPF_HANDLER' THEN 'ZCL_CDS_ALV_BOPF_HANDLER' + WHEN 'ZIF_CDS_ALV_AUTHORITY_CHECK' THEN 'ZCL_CDS_ALV_AUTHORITY_CHECK' + WHEN 'ZIF_CDS_ALV_TABLE_CONTAINER' THEN 'ZCL_CDS_ALV_TABLE_CONTAINER' + WHEN 'ZIF_CDS_ALV_EXTENSION_PROVIDER' THEN 'ZCL_CDS_ALV_EXTENSION_PROVIDER' ). + ENDMETHOD. + + METHOD get_from_customizing. + SELECT SINGLE class FROM zcds_alv_iocclif WHERE interface = @i_interface INTO @r_class. + ENDMETHOD. + + METHOD get_from_customizing_static. + SELECT SINGLE class FROM zcds_alv_iocclif WHERE interface = @i_interface INTO @r_class. + ENDMETHOD. + + METHOD get_implementation. + r_class = get_from_customizing( i_interface ). + IF r_class IS INITIAL. + r_class = get_fallback( i_interface ). + ENDIF. + ENDMETHOD. + + METHOD get_implementation_static. + r_class = get_from_customizing_static( i_interface ). + IF r_class IS INITIAL. + r_class = get_fallback_static( i_interface ). + ENDIF. + ENDMETHOD. + + METHOD get_instance. + IF singleton IS NOT BOUND. + DATA(class) = get_implementation_static( 'ZIF_CDS_ALV_FACTORY' ). + CREATE OBJECT singleton TYPE (class). + ENDIF. + + r_factory = singleton. + ENDMETHOD. + + METHOD get_parent_container. + TRY. + r_ioc_container = ioc_containers[ cds_view = space ]-ioc_container. + CATCH cx_sy_itab_line_not_found. + r_ioc_container = NEW zcl_cds_alv_ioc_container( ). + r_ioc_container->register_instance( i_interface = 'ZIF_CDS_ALV_FACTORY' i_instance = me ). + r_ioc_container->register_implementing_class(: + i_interface = 'ZIF_CDS_ALV_DDIC_ACCESS' i_class = get_implementation( 'ZIF_CDS_ALV_DDIC_ACCESS' ) ), + i_interface = 'ZIF_CDS_ALV_PERSISTENCE' i_class = get_implementation( 'ZIF_CDS_ALV_PERSISTENCE' ) ), + i_interface = 'ZIF_CDS_ALV_MEMORY' i_class = get_implementation( 'ZIF_CDS_ALV_MEMORY' ) ), + i_interface = 'ZIF_CDS_ALV_REPORT_GENERATOR' i_class = get_implementation( 'ZIF_CDS_ALV_REPORT_GENERATOR' ) ), + i_interface = 'ZIF_CDS_ALV_REPORT_LAUNCHER' i_class = get_implementation( 'ZIF_CDS_ALV_REPORT_LAUNCHER' ) ), + i_interface = 'ZIF_CDS_ALV_NAVIGATION' i_class = get_implementation( 'ZIF_CDS_ALV_NAVIGATION' ) ), + i_interface = 'ZIF_CDS_ALV_AUTHORITY_CHECK' i_class = get_implementation( 'ZIF_CDS_ALV_AUTHORITY_CHECK' ) ), + i_interface = 'ZIF_CDS_ALV_EXTENSION_PROVIDER' i_class = get_implementation( 'ZIF_CDS_ALV_EXTENSION_PROVIDER' ) ). + INSERT VALUE #( cds_view = space ioc_container = r_ioc_container ) INTO TABLE ioc_containers. + ENDTRY. + ENDMETHOD. + + METHOD set_instance. + singleton = i_factory. + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_authority_checker. + r_authority_checker ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_bopf_handler. + r_bopf_handler ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_builder. + r_builder ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_ddic_access. + r_ddic_access ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_extension_provider. + r_extension_provider ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_generation_strategy. + r_strategy ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_launcher. + r_launcher ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_memory. + r_memory ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_navigation. + r_navigation ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_persistence. + r_persistence ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_report_controller. + r_controller ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_report_generator. + r_generator ?= get_parent_container( )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_selection. + r_selection ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_selection_screen. + r_selection_screen ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_table_container. + r_table_container ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. + + METHOD zif_cds_alv_factory~get_value_help. + r_value_help ?= get_container_for_cds_view( i_cds_view )->resolve( ). + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_factory.clas.testclasses.abap b/src/zcl_cds_alv_factory.clas.testclasses.abap new file mode 100644 index 0000000..96e8ab3 --- /dev/null +++ b/src/zcl_cds_alv_factory.clas.testclasses.abap @@ -0,0 +1,41 @@ +*"* use this source file for your ABAP unit test classes +CLASS ltc_unit_tests DEFINITION FINAL FOR TESTING + DURATION SHORT + RISK LEVEL HARMLESS. + + PRIVATE SECTION. + DATA: cut TYPE REF TO zif_cds_alv_factory. + METHODS: + setup, + all_instantiable FOR TESTING. +ENDCLASS. + + +CLASS ltc_unit_tests IMPLEMENTATION. + + METHOD setup. + cut = zcl_cds_alv_factory=>get_instance( ). + ENDMETHOD. + + METHOD all_instantiable. + TRY. + DATA(interface) = cl_oo_interface=>get_instance( 'ZIF_CDS_ALV_FACTORY' ). + LOOP AT interface->methods INTO DATA(method). + DATA(parameter_binding_tab) = VALUE abap_parmbind_tab( ). + + IF line_exists( interface->method_parameters[ cmpname = method-cmpname sconame = 'I_CDS_VIEW' ] ). + DATA(cds_view) = CONV ddstrucobjname( 'ZC_CDS_ALV_DEMO' ). + INSERT VALUE #( name = 'I_CDS_VIEW' value = REF #( cds_view ) ) INTO TABLE parameter_binding_tab. + ENDIF. + + CALL METHOD cut->(method-cmpname) PARAMETER-TABLE parameter_binding_tab. + ENDLOOP. + + CATCH cx_class_not_existent zcx_cds_alv_message. + cl_abap_unit_assert=>fail( msg = |{ method-cmpname }| ). + ENDTRY. + ENDMETHOD. + + + +ENDCLASS. diff --git a/src/zcl_cds_alv_factory.clas.xml b/src/zcl_cds_alv_factory.clas.xml new file mode 100644 index 0000000..cc33dff --- /dev/null +++ b/src/zcl_cds_alv_factory.clas.xml @@ -0,0 +1,17 @@ + + + + + + ZCL_CDS_ALV_FACTORY + D + Factory für das CDS ALV Framework + 1 + X + X + X + X + + + + diff --git a/src/zcl_cds_alv_grid_builder.clas.abap b/src/zcl_cds_alv_grid_builder.clas.abap new file mode 100644 index 0000000..df44c02 --- /dev/null +++ b/src/zcl_cds_alv_grid_builder.clas.abap @@ -0,0 +1,639 @@ +CLASS zcl_cds_alv_grid_builder DEFINITION PUBLIC CREATE PUBLIC INHERITING FROM zcl_cds_alv_base. + PUBLIC SECTION. + INTERFACES zif_cds_alv_grid_builder. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + i_selection_screen TYPE REF TO zif_cds_alv_selection_screen + i_selection TYPE REF TO zif_cds_alv_selection + i_value_help TYPE REF TO zif_cds_alv_value_help + i_bopf_handler TYPE REF TO zif_cds_alv_bopf_handler + i_navigation TYPE REF TO zif_cds_alv_navigation + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + TYPES: BEGIN OF ty_field_properties, + fieldname TYPE fieldname, + fieldtype TYPE zcds_alv_field_type, + is_key TYPE abap_bool, + label TYPE string, + quickinfo TYPE string, + is_email TYPE abap_bool, + hidden TYPE abap_bool, + technical TYPE abap_bool, + default_aggregation TYPE string, + position TYPE i, + is_hotspot TYPE abap_bool, + has_value_help TYPE abap_bool, + is_editable TYPE abap_bool, + END OF ty_field_properties. + TYPES ty_field_properties_table TYPE STANDARD TABLE OF ty_field_properties WITH EMPTY KEY. + + DATA field_properties_table TYPE ty_field_properties_table. + DATA event_handlers TYPE zcds_alv_grid_event_handlers. + DATA table_container TYPE REF TO zif_cds_alv_table_container. + DATA selection TYPE REF TO zif_cds_alv_selection. + DATA value_help TYPE REF TO zif_cds_alv_value_help. + DATA bopf_handler TYPE REF TO zif_cds_alv_bopf_handler. + DATA navigation TYPE REF TO zif_cds_alv_navigation. + DATA selection_screen TYPE REF TO zif_cds_alv_selection_screen. + DATA alternative_selection TYPE REF TO zif_cds_alv_select_extension. + DATA alv_grid TYPE REF TO cl_gui_alv_grid. + DATA field_actions TYPE zcds_alv_field_actions. + DATA editable_fields TYPE ddfieldnames. + DATA variant TYPE disvariant. + DATA layout TYPE lvc_s_layo. + DATA exclude_functions TYPE ui_functions. + DATA fieldcatalog TYPE lvc_t_fcat. + DATA sort_order TYPE lvc_t_sort. + DATA filter TYPE lvc_t_filt. + DATA value_help_fields TYPE lvc_t_f4. + + METHODS evaluate_annotations REDEFINITION. + + METHODS build_fieldcatalog + RAISING zcx_cds_alv_message. + + METHODS build_variant. + METHODS build_layout. + METHODS build_f4. + METHODS build_exclude_functions. + METHODS build_event_handler. + METHODS register_event_handlers. + + PRIVATE SECTION. + TYPES: BEGIN OF ty_ui_annotation, + index TYPE sytabix, + key TYPE string, + value TYPE string, + END OF ty_ui_annotation. + TYPES ty_ui_annotations TYPE SORTED TABLE OF ty_ui_annotation WITH NON-UNIQUE KEY index. + + CONSTANTS function_code_prefix TYPE string VALUE 'ZZ_CDS_ALV_FC'. + + DATA update_enabled TYPE xsdboolean. + DATA delete_enabled TYPE xsdboolean. + + METHODS sort_columns. + +ENDCLASS. + + + +CLASS zcl_cds_alv_grid_builder IMPLEMENTATION. + METHOD build_event_handler. + DATA(event_handler) = NEW zcl_cds_alv_grid_event_handler( i_cds_view = cds_view + i_alv_grid = alv_grid + i_selection = selection + i_value_help = value_help + i_navigation = navigation + i_bopf_handler = bopf_handler + i_table_container = table_container + i_selection_screen = selection_screen + i_alternative_selection = alternative_selection + i_field_actions = field_actions + i_update_enabled = update_enabled + i_delete_enabled = delete_enabled + i_editable_fields = editable_fields ). + INSERT event_handler INTO TABLE event_handlers. + ENDMETHOD. + + METHOD build_exclude_functions. + exclude_functions = VALUE #( ( cl_gui_alv_grid=>mc_fc_loc_append_row ) + ( cl_gui_alv_grid=>mc_fc_loc_copy ) + ( cl_gui_alv_grid=>mc_fc_loc_copy_row ) + ( cl_gui_alv_grid=>mc_fc_loc_cut ) + ( cl_gui_alv_grid=>mc_fc_loc_delete_row ) + ( cl_gui_alv_grid=>mc_fc_loc_insert_row ) + ( cl_gui_alv_grid=>mc_fc_loc_move_row ) + ( cl_gui_alv_grid=>mc_fc_loc_paste ) + ( cl_gui_alv_grid=>mc_fc_loc_paste_new_row ) + ( cl_gui_alv_grid=>mc_fc_loc_undo ) ). + ENDMETHOD. + + METHOD build_f4. + value_help_fields = VALUE #( FOR field_properties IN field_properties_table + WHERE + ( has_value_help = abap_true ) + ( fieldname = field_properties-fieldname + register = abap_true + getbefore = abap_true + chngeafter = abap_true ) ). + ENDMETHOD. + + METHOD build_fieldcatalog. + CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' + EXPORTING + i_structure_name = cds_view + CHANGING + ct_fieldcat = fieldcatalog + EXCEPTIONS + inconsistent_interface = 1 + program_error = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + DELETE fieldcatalog WHERE fieldname = '.NODE1'. + + " Apply Annotations + LOOP AT fieldcatalog ASSIGNING FIELD-SYMBOL(). + READ TABLE field_properties_table INTO DATA(field_properties) + WITH KEY fieldname = -fieldname. + IF sy-subrc <> 0. + CONTINUE. + ENDIF. + + READ TABLE ddfields INTO DATA(ddfield) + WITH KEY fieldname = -fieldname. + IF sy-subrc <> 0. + CONTINUE. + ENDIF. + + IF field_properties-label IS NOT INITIAL. + -reptext = field_properties-label. + + IF strlen( field_properties-label ) <= 40. + -scrtext_l = field_properties-label. + ENDIF. + IF strlen( field_properties-label ) <= 20. + -scrtext_m = field_properties-label. + ENDIF. + IF strlen( field_properties-label ) <= 10. + -scrtext_s = field_properties-label. + ENDIF. + ENDIF. + + IF field_properties-quickinfo IS NOT INITIAL. + -tooltip = field_properties-quickinfo. + ENDIF. + + IF ddfield-domname = 'XFELD' OR ddfield-rollname = 'XFELD'. + -checkbox = abap_true. + ENDIF. + + -tech = field_properties-technical. + -no_out = field_properties-hidden. + -hotspot = field_properties-is_hotspot. + -edit = field_properties-is_editable. + -do_sum = SWITCH #( field_properties-default_aggregation + WHEN '#MAX' THEN 'A' + WHEN '#MIN' THEN 'B' + WHEN '#AVG' THEN 'C' + WHEN '#SUM' THEN 'X' + WHEN '#NONE' THEN ' ' ). + + IF field_properties-has_value_help = abap_true. + -f4availabl = abap_true. + ENDIF. + + " CFIELDNAME from Semantics.amount.currencyCode + " QFIELDNAME from Semantics.quantity.unitOfMeasure + " SP_GROUP map to UI.lineItem.qualifier + ENDLOOP. + + IF table_container IS BOUND. + DATA(special_columns) = table_container->get_special_columns( ). + IF special_columns-index_fieldname IS NOT INITIAL. + IF NOT line_exists( fieldcatalog[ fieldname = special_columns-index_fieldname ] ). + INSERT VALUE #( fieldname = special_columns-index_fieldname + no_out = abap_true + tech = abap_true + ref_table = 'SE16N_REF' + ref_field = 'SE16N_LONG_LINES' ) + INTO TABLE fieldcatalog. + ENDIF. + ENDIF. + + IF special_columns-count_fieldname IS NOT INITIAL. + IF NOT line_exists( fieldcatalog[ fieldname = special_columns-count_fieldname ] ). + INSERT VALUE #( fieldname = special_columns-count_fieldname + no_out = abap_true + tech = abap_true + ref_table = 'SE16N_REF' + ref_field = 'SE16N_LONG_LINES' ) + INTO TABLE fieldcatalog. + ENDIF. + ENDIF. + + IF special_columns-system_fieldname IS NOT INITIAL. + IF NOT line_exists( fieldcatalog[ fieldname = special_columns-system_fieldname ] ). + INSERT VALUE #( fieldname = special_columns-system_fieldname + no_out = abap_true + key = abap_true + ref_table = 'SYST' + ref_field = 'SYSID' ) + INTO TABLE fieldcatalog. + ENDIF. + ENDIF. + + IF special_columns-client_fieldname IS NOT INITIAL. + IF NOT line_exists( fieldcatalog[ fieldname = special_columns-client_fieldname ] ). + INSERT VALUE #( fieldname = special_columns-client_fieldname + no_out = abap_true + key = abap_true + ref_table = 'SYST' + ref_field = 'MANDT' ) + INTO TABLE fieldcatalog. + ENDIF. + ENDIF. + ENDIF. + + sort_columns( ). + ENDMETHOD. + + METHOD build_layout. + CONSTANTS row_column TYPE lvc_libox VALUE 'A' ##NO_TEXT. + + layout-col_opt = abap_true. + layout-cwidth_opt = abap_true. + layout-grid_title = description. + layout-zebra = abap_true. + + IF table_container IS NOT BOUND. + RETURN. + ENDIF. + + DATA(special_columns) = table_container->get_special_columns( ). + IF special_columns-count_fieldname IS NOT INITIAL. + layout-countfname = special_columns-count_fieldname. + ENDIF. + + IF special_columns-style_fieldname IS NOT INITIAL. + layout-stylefname = special_columns-style_fieldname. + layout-edit = abap_true. + ENDIF. + + IF special_columns-box_fieldname IS NOT INITIAL. + layout-box_fname = special_columns-box_fieldname. + layout-sel_mode = row_column. + ENDIF. + + IF special_columns-info_fieldname IS NOT INITIAL. + layout-info_fname = special_columns-info_fieldname. + ENDIF. + + IF special_columns-color_fieldname IS NOT INITIAL. + layout-ctab_fname = special_columns-color_fieldname. + ENDIF. + + IF special_columns-excp_fieldname IS NOT INITIAL. + layout-excp_fname = special_columns-excp_fieldname. + layout-excp_led = abap_true. + ENDIF. + ENDMETHOD. + + METHOD build_variant. + variant-report = sy-cprog. + variant-username = sy-uname. + + IF selection_screen IS BOUND. + selection_screen->get_dynpro_field( EXPORTING i_sel_name = 'P_VARI' + IMPORTING e_parameter = variant-variant ). + ENDIF. + ENDMETHOD. + + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + selection = i_selection. + value_help = i_value_help. + bopf_handler = i_bopf_handler. + navigation = i_navigation. + selection_screen = i_selection_screen. + + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + DATA(action_counter) = VALUE numc3( ). + " TODO: variable is assigned but never used (ABAP cleaner) + DATA(keys) = VALUE ddfieldnames( ). + + " key fields from semantic key + LOOP AT entity_annotations ASSIGNING FIELD-SYMBOL() + WHERE annoname CS 'OBJECTMODEL.SEMANTICKEY'. + INSERT CONV #( to_upper( remove_quotes( -value ) ) ) + INTO TABLE keys. + ENDLOOP. + + " Field Annotations; ReadOnly is evaluated in the end + " UI.LineItem can be repeated, therefore it needs an inner loop + LOOP AT element_annotations ASSIGNING FIELD-SYMBOL() + GROUP BY ( elementname = -elementname ). + + DATA(fieldname) = CONV fieldname( -elementname ). + DATA(field_properties) = VALUE ty_field_properties( fieldname = fieldname ). + DATA(ui_annotations) = VALUE ty_ui_annotations( ). + DATA(semantic_object) = VALUE zcds_alv_semantic_object( ). + " TODO: variable is assigned but never used (ABAP cleaner) + DATA(function) = VALUE zcds_alv_function( ). + + LOOP AT GROUP ASSIGNING FIELD-SYMBOL(). + CASE -annoname. + WHEN 'CONSUMPTION.HIDDEN'. + field_properties-technical = abap_true. + + WHEN 'CONSUMPTION.VALUEHELP' + OR 'CONSUMPTION.VALUEHELPDEFINITION.ASSOCIATION' + OR 'CONSUMPTION.VALUEHELPDEFINITION.ENTITY.NAME'. + field_properties-has_value_help = abap_true. + + WHEN 'DEFAULTAGGREGATION'. + field_properties-default_aggregation = -value. + + WHEN 'UI.HIDDEN'. + field_properties-hidden = abap_true. + + WHEN 'SEMANTICS.EMAIL.ADDRESS'. + field_properties-is_email = abap_true. + + WHEN 'CONSUMPTION.SEMANTICOBJECT'. + semantic_object = remove_quotes( -value ). + + WHEN 'ENDUSERTEXT.LABEL'. + field_properties-label = -value. + + WHEN 'ENUSERTEXT.QUICKINFO'. + field_properties-quickinfo = -value. + ENDCASE. + + IF -annoname CP 'UI.LINEITEM.*'. + INSERT VALUE #( index = 0 + key = -annoname + value = -value ) + INTO TABLE ui_annotations. + ELSEIF -annoname CP 'UI.LINEITEM$*$.*'. + SPLIT -annoname AT '$' INTO + DATA(ui_line_item) DATA(index) DATA(property). + INSERT VALUE #( index = index + key = |{ ui_line_item }{ property }| + value = -value ) + INTO TABLE ui_annotations. + ENDIF. + ENDLOOP. + + LOOP AT ui_annotations INTO DATA(ui_index) GROUP BY ui_index-index. + DATA(field_action) = VALUE zcds_alv_field_action( cds_view = cds_view + fieldname = fieldname ). + + LOOP AT GROUP ui_index INTO DATA(ui_annotation). + CASE ui_annotation-key. + WHEN 'UI.LINEITEM.POSITION'. + field_properties-position = CONV i( ui_annotation-value ). + + WHEN 'UI.LINEITEM.TYPE'. + field_action-fieldtype = ui_annotation-value. + + WHEN 'UI.LINEITEM.SEMANTICOBJECT'. + semantic_object = remove_quotes( -value ). + + WHEN 'UI.LINEITEM.SEMANTICOBJECTACTION'. + field_action-semantic_action = remove_quotes( ui_annotation-value ). + + WHEN 'UI.LINEITEM.TARGETELEMENT'. + field_action-associationname = remove_quotes( ui_annotation-value ). + + WHEN 'UI.LINEITEM.DATAACTION'. + field_action-data_action = substring_after( val = remove_quotes( ui_annotation-value ) sub = 'BOPF:' ). + + WHEN 'UI.LINEITEM.LABEL'. + field_action-label = remove_quotes( ui_annotation-value ). + + WHEN 'UI.LINEITEM.URL'. + field_action-url_fieldname = remove_quotes( ui_annotation-value ). + + ENDCASE. + ENDLOOP. + + " Navigation and actions + CASE field_action-fieldtype. + WHEN '#STANDARD' OR space. " Hotspot for mail + IF field_properties-is_email = abap_true. + field_properties-is_hotspot = abap_true. + field_action-hotspot = abap_true. + field_action-send_mail = abap_true. + INSERT field_action INTO TABLE field_actions. + ENDIF. + + WHEN '#WITH_INTENT_BASED_NAVIGATION'. " Hyperlink + IF semantic_object IS NOT INITIAL AND field_action-semantic_action IS NOT INITIAL. + field_properties-is_hotspot = abap_true. + field_action-hotspot = abap_true. + field_action-semantic_object = semantic_object. + INSERT field_action INTO TABLE field_actions. + ENDIF. + + WHEN '#WITH_URL'. " Hyperlink + IF field_action-url_fieldname IS NOT INITIAL. + field_properties-is_hotspot = abap_true. + field_action-hotspot = abap_true. + INSERT field_action INTO TABLE field_actions. + ENDIF. + + WHEN '#FOR_INTENT_BASED_NAVIGATION'. " Button + IF semantic_object IS NOT INITIAL AND field_action-semantic_action IS NOT INITIAL. + action_counter = action_counter + 1. + field_action-user_command = |{ function_code_prefix }{ action_counter }|. + field_action-semantic_object = semantic_object. + + IF field_action-label IS INITIAL. + field_action-label = |{ field_action-semantic_object }.{ field_action-semantic_action }|. + ENDIF. + + INSERT field_action INTO TABLE field_actions. + ENDIF. + + WHEN '#WITH_NAVIGATION_PATH'. " Button + IF field_action-associationname IS NOT INITIAL. + action_counter = action_counter + 1. + field_action-user_command = |{ function_code_prefix }{ action_counter }|. + + IF field_action-label IS INITIAL. + field_action-label = field_action-associationname. + ENDIF. + + INSERT field_action INTO TABLE field_actions. + ENDIF. + + WHEN '#FOR_ACTION'. " Button + IF field_action-data_action IS NOT INITIAL. + action_counter = action_counter + 1. + field_action-user_command = |{ function_code_prefix }{ action_counter }|. + + IF field_action-label IS INITIAL. + field_action-label = field_action-data_action. + ENDIF. + + INSERT field_action INTO TABLE field_actions. + ENDIF. + ENDCASE. + ENDLOOP. + + " Headers + IF field_properties-quickinfo IS INITIAL AND field_properties-label IS NOT INITIAL. + field_properties-quickinfo = field_properties-label. + ENDIF. + + INSERT field_properties INTO TABLE field_properties_table. + ENDLOOP. + + " Editable fields + update_enabled = xsdbool( line_exists( entity_annotations[ annoname = 'OBJECTMODEL.UPDATEENABLED' value = 'true' ] ) ). + delete_enabled = xsdbool( line_exists( entity_annotations[ annoname = 'OBJECTMODEL.DELETEENABLED' value = 'true' ] ) ). + + IF update_enabled = abap_true. + LOOP AT ddfields ASSIGNING FIELD-SYMBOL(). + IF line_exists( element_annotations[ elementname = -fieldname + annoname = 'OBJECTMODEL.READONLY' + value = 'true' ] ). + CONTINUE. + ENDIF. + + READ TABLE field_properties_table ASSIGNING FIELD-SYMBOL() + WITH KEY fieldname = -fieldname. + IF sy-subrc = 0. + -is_editable = abap_true. + INSERT -fieldname INTO TABLE editable_fields. + ENDIF. + ENDLOOP. + ENDIF. + ENDMETHOD. + + METHOD register_event_handlers. + LOOP AT event_handlers INTO DATA(event_handler). + SET HANDLER event_handler->on_help_request FOR alv_grid. + SET HANDLER event_handler->on_value_request FOR alv_grid. + SET HANDLER event_handler->on_data_changed FOR alv_grid. + SET HANDLER event_handler->on_before_user_command FOR alv_grid. + SET HANDLER event_handler->on_user_command FOR alv_grid. + SET HANDLER event_handler->on_after_user_command FOR alv_grid. + SET HANDLER event_handler->on_double_click FOR alv_grid. + SET HANDLER event_handler->on_context_menu_request FOR alv_grid. + SET HANDLER event_handler->on_menu_button FOR alv_grid. + SET HANDLER event_handler->on_toolbar FOR alv_grid. + SET HANDLER event_handler->on_hotspot_click FOR alv_grid. + SET HANDLER event_handler->on_after_refresh FOR alv_grid. + SET HANDLER event_handler->on_button_click FOR alv_grid. + SET HANDLER event_handler->on_data_changed_finished FOR alv_grid. + ENDLOOP. + ENDMETHOD. + + METHOD sort_columns. + TYPES: BEGIN OF ty_field_position, + fieldname TYPE fieldname, + position TYPE lvc_colpos, + END OF ty_field_position. + + DATA field_positions TYPE STANDARD TABLE OF ty_field_position. + + SORT fieldcatalog BY col_pos ASCENDING. + SORT field_properties_table BY position ASCENDING. + DATA(position) = 1. + + LOOP AT field_properties_table INTO DATA(field_properties) WHERE position IS NOT INITIAL. + INSERT VALUE #( fieldname = field_properties-fieldname position = position ) + INTO TABLE field_positions. + position = position + 1. + ENDLOOP. + + LOOP AT fieldcatalog ASSIGNING FIELD-SYMBOL(). + TRY. + DATA(field_position) = field_positions[ fieldname = -fieldname ]. + -col_pos = field_position-position. + CATCH cx_sy_itab_line_not_found. + -col_pos = position. + position = position + 1. + ENDTRY. + ENDLOOP. + ENDMETHOD. + + METHOD zif_cds_alv_grid_builder~create_alv_grid. + CONSTANTS save_all TYPE char01 VALUE 'A' ##NO_TEXT. + + table_container = i_table_container. + + CREATE OBJECT alv_grid + EXPORTING + i_parent = i_container + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + build_variant( ). + build_layout( ). + build_fieldcatalog( ). + build_f4( ). + build_exclude_functions( ). + build_event_handler( ). + + DATA(ref_to_table) = table_container->get_ref_to_table( ). + ASSIGN ref_to_table->* TO FIELD-SYMBOL(). + + register_event_handlers( ). + + alv_grid->register_f4_for_fields( value_help_fields ). + alv_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ). + + alv_grid->set_table_for_first_display( EXPORTING is_variant = variant + i_save = save_all + i_default = xsdbool( variant-variant IS INITIAL ) + is_layout = layout + it_toolbar_excluding = exclude_functions + CHANGING it_outtab =
+ it_fieldcatalog = fieldcatalog + it_sort = sort_order + it_filter = filter + EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + IF update_enabled = abap_true. + alv_grid->set_ready_for_input( ). + ENDIF. + + alv_grid->set_toolbar_interactive( ). + + e_alv_grid = alv_grid. + ENDMETHOD. + + METHOD zif_cds_alv_grid_builder~get_gui_title. + r_title = description. + ENDMETHOD. + + METHOD zif_cds_alv_grid_builder~get_metadata. + table_container = i_table_container. + + build_variant( ). + build_layout( ). + build_fieldcatalog( ). + + e_variant = variant. + e_layout = layout. + e_fieldcatalog = fieldcatalog. + e_sort_order = sort_order. + e_filters = filter. + ENDMETHOD. + + METHOD zif_cds_alv_grid_builder~register_alternative_selection. + alternative_selection = i_selection_handler. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_grid_builder.clas.xml b/src/zcl_cds_alv_grid_builder.clas.xml new file mode 100644 index 0000000..a1541b1 --- /dev/null +++ b/src/zcl_cds_alv_grid_builder.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_GRID_BUILDER + D + Aufbau eines ALV-Grids aus CDS-Annotationen + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_grid_event_handler.clas.abap b/src/zcl_cds_alv_grid_event_handler.clas.abap new file mode 100644 index 0000000..13f2fdc --- /dev/null +++ b/src/zcl_cds_alv_grid_event_handler.clas.abap @@ -0,0 +1,516 @@ +CLASS zcl_cds_alv_grid_event_handler DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_grid_event_handler. + + CLASS-METHODS class_constructor. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_alv_grid TYPE REF TO cl_gui_alv_grid + i_table_container TYPE REF TO zif_cds_alv_table_container + i_selection TYPE REF TO zif_cds_alv_selection OPTIONAL + i_value_help TYPE REF TO zif_cds_alv_value_help OPTIONAL + i_navigation TYPE REF TO zif_cds_alv_navigation OPTIONAL + i_bopf_handler TYPE REF TO zif_cds_alv_bopf_handler OPTIONAL + i_selection_screen TYPE REF TO zif_cds_alv_selection_screen OPTIONAL + i_alternative_selection TYPE REF TO zif_cds_alv_select_extension OPTIONAL + i_field_actions TYPE zcds_alv_field_actions OPTIONAL + i_update_enabled TYPE abap_bool DEFAULT abap_false + i_delete_enabled TYPE abap_bool DEFAULT abap_false + i_editable_fields TYPE ddfieldnames OPTIONAL. + + PROTECTED SECTION. + CONSTANTS: + BEGIN OF button_type, + normal TYPE tb_btype VALUE 0, + menu_default TYPE tb_btype VALUE 1, + menu TYPE tb_btype VALUE 2, + separator TYPE tb_btype VALUE 3, + radio_button TYPE tb_btype VALUE 4, + check_box TYPE tb_btype VALUE 5, + menu_entry TYPE tb_btype VALUE 6, + END OF button_type. + CONSTANTS: + BEGIN OF standard_function_code, + refresh TYPE ui_func VALUE 'REFRESH', + delete TYPE ui_func VALUE 'DELETE', + save TYPE ui_func VALUE 'SAVE', + toggle_change_mode TYPE ui_func VALUE 'DISPCHNG', + additional_functions_menu TYPE ui_func VALUE 'ADD_FUNC', + END OF standard_function_code. + + CLASS-DATA standard_function_codes TYPE ui_functions. + + DATA cds_view TYPE ddstrucobjname. + DATA ref_to_table TYPE REF TO data. + DATA alv_grid TYPE REF TO cl_gui_alv_grid. + DATA selection TYPE REF TO zif_cds_alv_selection. + DATA value_help TYPE REF TO zif_cds_alv_value_help. + DATA navigation TYPE REF TO zif_cds_alv_navigation. + DATA bopf_handler TYPE REF TO zif_cds_alv_bopf_handler. + DATA table_container TYPE REF TO zif_cds_alv_table_container. + DATA selection_screen TYPE REF TO zif_cds_alv_selection_screen. + DATA alternative_selection TYPE REF TO zif_cds_alv_select_extension. + DATA field_actions TYPE zcds_alv_field_actions. + DATA functions TYPE zcds_alv_functions. + DATA standard_functions TYPE zcds_alv_functions. + DATA additional_functions TYPE zcds_alv_functions. + DATA update_enabled TYPE abap_bool. + DATA delete_enabled TYPE abap_bool. + DATA editable_fields TYPE ddfieldnames. + + METHODS dispatch_standard_function + IMPORTING i_function TYPE ui_func + i_selected_rows TYPE STANDARD TABLE. + + METHODS dispatch_single_action + IMPORTING i_field_action TYPE zcds_alv_field_action + i_selected_row TYPE any. + + METHODS dispatch_mass_action + IMPORTING i_field_action TYPE zcds_alv_field_action + i_selected_rows TYPE STANDARD TABLE. + + METHODS build_function_table. + + METHODS toggle_change_mode + RAISING zcx_cds_alv_message. + + METHODS refresh + RAISING zcx_cds_alv_message. + + PRIVATE SECTION. + METHODS call_browser + IMPORTING i_url TYPE string + RAISING zcx_cds_alv_message. + + METHODS send_email + IMPORTING i_email TYPE ad_smtpadr + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_grid_event_handler IMPLEMENTATION. + METHOD build_function_table. + additional_functions = VALUE #( FOR field_action IN field_actions WHERE + ( user_command IS NOT INITIAL ) + ( name = field_action-user_command + text = field_action-label ) ). + + " Refresh; always first after standard functions + INSERT VALUE #( name = standard_function_code-refresh + icon = icon_refresh + tooltip = TEXT-001 ) + INTO TABLE standard_functions. + + " standard buttons for editable grids + IF update_enabled = abap_true. + INSERT VALUE #( name = standard_function_code-toggle_change_mode + icon = icon_toggle_display_change + tooltip = TEXT-002 ) + INTO TABLE standard_functions. + + INSERT VALUE #( name = standard_function_code-save + icon = icon_system_save + tooltip = TEXT-003 ) + INTO TABLE standard_functions. + ENDIF. + + IF delete_enabled = abap_true. + INSERT VALUE #( name = standard_function_code-delete + icon = icon_delete + tooltip = TEXT-004 ) + INTO TABLE standard_functions. + ENDIF. + + IF additional_functions IS NOT INITIAL. + INSERT VALUE #( name = standard_function_code-additional_functions_menu + icon = icon_context_menu + tooltip = TEXT-005 + button_type = button_type-menu ) + INTO TABLE standard_functions. + ENDIF. + ENDMETHOD. + + METHOD call_browser. + IF i_url IS INITIAL. + RETURN. + ENDIF. + + cl_gui_frontend_services=>execute( EXPORTING document = i_url + EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD class_constructor. + standard_function_codes = VALUE #( ( standard_function_code-delete ) + ( standard_function_code-refresh ) + ( standard_function_code-save ) + ( standard_function_code-toggle_change_mode ) + ( standard_function_code-additional_functions_menu ) ). + ENDMETHOD. + + METHOD constructor. + cds_view = i_cds_view. + alv_grid = i_alv_grid. + selection = i_selection. + value_help = i_value_help. + navigation = i_navigation. + bopf_handler = i_bopf_handler. + selection_screen = i_selection_screen. + table_container = i_table_container. + field_actions = i_field_actions. + update_enabled = i_update_enabled. + delete_enabled = i_delete_enabled. + editable_fields = i_editable_fields. + alternative_selection = i_alternative_selection. + + ref_to_table = table_container->get_ref_to_table( ). + build_function_table( ). + ENDMETHOD. + + METHOD dispatch_mass_action. + TRY. + DATA(refresh_after) = abap_false. + + IF i_field_action-semantic_object IS NOT INITIAL + AND i_field_action-semantic_action IS NOT INITIAL. + IF navigation IS BOUND. + navigation->navigate_to_object_mass( EXPORTING i_object = i_field_action-semantic_object + i_action = i_field_action-semantic_action + i_cds_view = i_field_action-cds_view + i_key_field = i_field_action-fieldname + i_selected_rows = i_selected_rows + IMPORTING e_refresh_after = refresh_after ). + ENDIF. + + ELSEIF i_field_action-associationname IS NOT INITIAL. + IF selection_screen IS BOUND. + DATA(source_parameters) = selection_screen->get_parameters( ). + ENDIF. + + IF navigation IS BOUND. + navigation->navigate_via_association( i_source_view = i_field_action-cds_view + i_association_name = i_field_action-associationname + i_source_parameters = source_parameters + i_selected_rows = i_selected_rows ). + ENDIF. + + ELSEIF i_field_action-data_action IS NOT INITIAL. + IF bopf_handler IS BOUND. + bopf_handler->execute_action( EXPORTING i_action = i_field_action-data_action + i_selected_rows = i_selected_rows + IMPORTING e_refresh_after = refresh_after ). + ENDIF. + ENDIF. + + IF refresh_after = abap_true. + refresh( ). + ENDIF. + + CATCH zcx_cds_alv_message INTO DATA(message). + MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD dispatch_single_action. + TRY. + DATA(refresh_after) = abap_false. + + IF i_field_action-semantic_object IS NOT INITIAL + AND i_field_action-semantic_action IS NOT INITIAL. + IF navigation IS BOUND. + navigation->navigate_to_object_single( EXPORTING i_object = i_field_action-semantic_object + i_action = i_field_action-semantic_action + i_cds_view = i_field_action-cds_view + i_key_field = i_field_action-fieldname + i_selected_row = i_selected_row + IMPORTING e_refresh_after = refresh_after ). + ENDIF. + + ELSEIF i_field_action-url_fieldname IS NOT INITIAL. + ASSIGN COMPONENT i_field_action-url_fieldname OF STRUCTURE i_selected_row TO FIELD-SYMBOL(). + call_browser( to_lower( ) ). + ELSEIF i_field_action-send_mail IS NOT INITIAL. + ASSIGN COMPONENT i_field_action-fieldname OF STRUCTURE i_selected_row TO FIELD-SYMBOL(). + send_email( CONV #( ) ). + ENDIF. + + IF refresh_after = abap_true. + refresh( ). + ENDIF. + + CATCH zcx_cds_alv_message INTO DATA(message). + MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD dispatch_standard_function. + TRY. + CASE i_function. + WHEN standard_function_code-refresh. + refresh( ). + + WHEN standard_function_code-toggle_change_mode. + toggle_change_mode( ). + + WHEN standard_function_code-delete. + IF bopf_handler IS BOUND. + bopf_handler->delete( i_selected_rows ). + refresh( ). + ENDIF. + + WHEN standard_function_code-save. + IF bopf_handler IS BOUND. + bopf_handler->update( i_selected_rows ). + refresh( ). + ENDIF. + ENDCASE. + + CATCH zcx_cds_alv_message INTO DATA(message). + MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD refresh. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + IF alternative_selection IS BOUND. + alternative_selection->alternative_reselection( EXPORTING i_cds_view = cds_view + i_selection_screen = selection_screen + i_table_container = table_container + CHANGING c_result_table =
). + + ELSEIF selection IS BOUND. + selection->perform_reselection( CHANGING c_result_table =
). + ENDIF. + + table_container->set_table(
). + + alv_grid->refresh_table_display( ). + cl_gui_cfw=>flush( ). + ENDMETHOD. + + METHOD send_email. + IF i_email IS INITIAL. + RETURN. + ENDIF. + + cl_gui_frontend_services=>execute( EXPORTING document = |mailto:{ i_email }| + EXCEPTIONS OTHERS = 1 ). + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD toggle_change_mode. + table_container->toggle_change_mode( alv_grid ). + alv_grid->refresh_table_display( ). + cl_gui_cfw=>flush( ). + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_after_refresh. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_after_user_command. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_before_user_command. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_button_click. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + READ TABLE
INDEX es_row_no-row_id ASSIGNING FIELD-SYMBOL(). + IF sy-subrc <> 0. + RETURN. + ENDIF. + + TRY. + DATA(field_action) = field_actions[ fieldname = es_col_id-fieldname hotspot = abap_true ]. + dispatch_single_action( i_field_action = field_action i_selected_row = ). + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_context_menu_request. + " no additional context menu functions yet + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_data_changed. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_data_changed_finished. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_double_click. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + READ TABLE
INDEX es_row_no-row_id ASSIGNING FIELD-SYMBOL(). + IF sy-subrc <> 0. + RETURN. + ENDIF. + + TRY. + DATA(field_action) = field_actions[ fieldname = e_column-fieldname hotspot = abap_true ]. + dispatch_single_action( i_field_action = field_action i_selected_row = ). + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_help_request. + " not yet used + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_hotspot_click. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + READ TABLE
INDEX es_row_no-row_id ASSIGNING FIELD-SYMBOL(). + IF sy-subrc <> 0. + RETURN. + ENDIF. + + TRY. + DATA(field_action) = field_actions[ fieldname = e_column_id-fieldname hotspot = abap_true ]. + dispatch_single_action( i_field_action = field_action i_selected_row = ). + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_menu_button. + IF e_ucomm = standard_function_code-additional_functions_menu. + LOOP AT additional_functions INTO DATA(function). + e_object->add_function( fcode = function-name + text = CONV #( function-text ) + icon = CONV #( function-icon ) ). + ENDLOOP. + ENDIF. + +* DATA: ref_to_selected_rows TYPE REF TO data. +* FIELD-SYMBOLS: TYPE STANDARD TABLE. +* FIELD-SYMBOLS:
TYPE STANDARD TABLE. +* ASSIGN ref_to_table->* TO
. +* +* CREATE DATA ref_to_selected_rows LIKE
. +* ASSIGN ref_to_selected_rows->* TO . +* +* alv_grid->get_selected_rows( IMPORTING et_row_no = DATA(lt_row_no) ). +* LOOP AT lt_row_no INTO DATA(row_no) WHERE row_id <> 0. +* INSERT
[ row_no-row_id ] INTO TABLE . +* ENDLOOP. +* +* IF line_exists( standard_function_codes[ table_line = e_ucomm ] ). +* dispatch_standard_function( i_function = e_ucomm i_selected_rows = ). +* RETURN. +* ENDIF. +* +* TRY. +* DATA(field_action) = field_actions[ user_command = e_ucomm ]. +* dispatch_mass_action( i_field_action = field_action i_selected_rows = ). +* CATCH cx_sy_itab_line_not_found. +* ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_toolbar. + LOOP AT standard_functions INTO DATA(function). + IF NOT line_exists( e_object->mt_toolbar[ function = function-name ] ). + INSERT VALUE #( function = function-name + icon = function-icon + text = function-text + quickinfo = function-tooltip + butn_type = function-button_type ) + INTO TABLE e_object->mt_toolbar. + ENDIF. + ENDLOOP. + + IF additional_functions IS INITIAL. + DELETE e_object->mt_toolbar WHERE function = standard_function_code-additional_functions_menu. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_user_command. + DATA ref_to_selected_rows TYPE REF TO data. + FIELD-SYMBOLS TYPE STANDARD TABLE. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + CREATE DATA ref_to_selected_rows LIKE
. + ASSIGN ref_to_selected_rows->* TO . + + alv_grid->get_selected_rows( IMPORTING et_row_no = DATA(lt_row_no) ). + LOOP AT lt_row_no INTO DATA(row_no) WHERE row_id <> 0. + INSERT
[ row_no-row_id ] INTO TABLE . + ENDLOOP. + + IF line_exists( standard_function_codes[ table_line = e_ucomm ] ). + dispatch_standard_function( i_function = e_ucomm i_selected_rows = ). + RETURN. + ENDIF. + + TRY. + DATA(field_action) = field_actions[ user_command = e_ucomm ]. + dispatch_mass_action( i_field_action = field_action i_selected_rows = ). + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_grid_event_handler~on_value_request. + FIELD-SYMBOLS TYPE lvc_t_modi. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + READ TABLE
INDEX es_row_no-row_id ASSIGNING FIELD-SYMBOL(). + IF sy-subrc <> 0. + RETURN. + ENDIF. + + TRY. + IF value_help IS BOUND. + DATA(in_edit_mode) = table_container->is_in_edit_mode( ). + DATA(field_is_editable) = xsdbool( line_exists( editable_fields[ table_line = e_fieldname ] ) ). + DATA(display) = xsdbool( in_edit_mode = abap_false OR field_is_editable = abap_false ). + + value_help->value_help_for_element( EXPORTING i_fieldname = e_fieldname + i_selected_row = + i_display = display + IMPORTING e_processed = DATA(processed) + CHANGING c_value = e_fieldvalue ). + + IF processed = abap_true AND display = abap_false. + ASSIGN er_event_data->m_data->* TO . + INSERT VALUE #( row_id = es_row_no-row_id + fieldname = e_fieldname + value = e_fieldvalue ) + INTO TABLE . + ENDIF. + + er_event_data->m_event_handled = processed. + ENDIF. + + CATCH zcx_cds_alv_message INTO DATA(message). + MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_grid_event_handler.clas.xml b/src/zcl_cds_alv_grid_event_handler.clas.xml new file mode 100644 index 0000000..b6022f5 --- /dev/null +++ b/src/zcl_cds_alv_grid_event_handler.clas.xml @@ -0,0 +1,79 @@ + + + + + + ZCL_CDS_ALV_GRID_EVENT_HANDLER + D + Event Handler für das ALV Grid + 1 + X + X + X + + + + I + 001 + Auffrischen + 21 + + + I + 002 + Anzeigen/Ändern + 25 + + + I + 003 + Speichern + 19 + + + I + 004 + Löschen + 17 + + + I + 005 + Weitere Funktionen + 28 + + + + + E + + + I + 001 + Refresh + 21 + + + I + 002 + Display/Change + 25 + + + I + 003 + Save + 19 + + + I + 004 + Delete + 17 + + + + + + + diff --git a/src/zcl_cds_alv_ioc_container.clas.abap b/src/zcl_cds_alv_ioc_container.clas.abap new file mode 100644 index 0000000..c46c3b4 --- /dev/null +++ b/src/zcl_cds_alv_ioc_container.clas.abap @@ -0,0 +1,270 @@ +CLASS zcl_cds_alv_ioc_container DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_ioc_container. + + ALIASES resolve FOR zif_cds_alv_ioc_container~resolve. + ALIASES ty_filters FOR zif_cds_alv_ioc_container~ty_filters. + + DATA cds_view TYPE ddstrucobjname READ-ONLY. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname OPTIONAL + i_parent TYPE REF TO zif_cds_alv_ioc_container OPTIONAL. + + PROTECTED SECTION. + + PRIVATE SECTION. + TYPES: + BEGIN OF ty_instance, + interface TYPE seoitfname, + filters TYPE ty_filters, + object TYPE REF TO object, + END OF ty_instance. + TYPES ty_instances TYPE SORTED TABLE OF ty_instance WITH NON-UNIQUE KEY interface. + TYPES: + BEGIN OF ty_implementation, + interface TYPE seoitfname, + filters TYPE ty_filters, + class TYPE seoclsname, + parameters TYPE abap_parmbind_tab, + END OF ty_implementation. + TYPES ty_implementations TYPE SORTED TABLE OF ty_implementation WITH NON-UNIQUE KEY interface. + + DATA parent TYPE REF TO zif_cds_alv_ioc_container. + DATA instances TYPE ty_instances. + DATA implementations TYPE ty_implementations. + + METHODS create_object + IMPORTING i_interface TYPE seoitfname + i_filters TYPE zif_cds_alv_ioc_container=>ty_filters OPTIONAL + RETURNING VALUE(r_object) TYPE REF TO object + RAISING zcx_cds_alv_message. + + METHODS store_object + IMPORTING i_interface TYPE seoitfname + i_filters TYPE zif_cds_alv_ioc_container=>ty_filters OPTIONAL + i_object TYPE REF TO object + RAISING zcx_cds_alv_message. + + METHODS is_interface + IMPORTING i_parameter_type TYPE vseoparam-type + RETURNING VALUE(r_is_interface) TYPE abap_bool. + + METHODS get_return_type + IMPORTING i_increase_depth_by TYPE i DEFAULT 0 + RETURNING VALUE(r_return_type) TYPE seoitfname + RAISING zcx_cds_alv_message. + + METHODS check_interface + IMPORTING i_interface TYPE seoitfname + RAISING zcx_cds_alv_message. + + METHODS check_class + IMPORTING i_class TYPE seoclsname + RAISING zcx_cds_alv_message. + + METHODS check_implements + IMPORTING i_class TYPE seoclsname + i_interface TYPE seoitfname + RAISING zcx_cds_alv_message. + + METHODS get_constructor_parameters + IMPORTING i_class_name TYPE seoclsname + RETURNING VALUE(r_parameters) TYPE seo_parameters. +ENDCLASS. + + + +CLASS zcl_cds_alv_ioc_container IMPLEMENTATION. + METHOD check_class. + TRY. + IF cl_oo_object=>get_instance( i_class ) IS NOT INSTANCE OF cl_oo_class. + RAISE EXCEPTION TYPE cx_class_not_existent + EXPORTING clsname = i_class. + ENDIF. + + CATCH cx_class_not_existent. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e027(zcds_alv) WITH i_class. + ENDTRY. + ENDMETHOD. + + METHOD check_implements. + DATA(if_relations) = NEW cl_oo_if_relations( clsname = i_interface ). + IF NOT line_exists( if_relations->implementing_classes[ clsname = i_class ] ) + AND NOT line_exists( if_relations->subclasses[ clsname = i_class ] ). + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e029(zcds_alv) WITH i_class i_interface. + ENDIF. + ENDMETHOD. + + + METHOD check_interface. + TRY. + IF cl_oo_object=>get_instance( i_interface ) IS NOT INSTANCE OF cl_oo_interface. + RAISE EXCEPTION TYPE cx_class_not_existent + EXPORTING clsname = i_interface. + ENDIF. + + CATCH cx_class_not_existent. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e028(zcds_alv) WITH i_interface. + ENDTRY. + ENDMETHOD. + + METHOD constructor. + cds_view = i_cds_view. + parent = i_parent. + ENDMETHOD. + + METHOD create_object. + DATA ref_to_object TYPE REF TO data. + + TRY. + DATA(implementation) = implementations[ interface = i_interface filters = i_filters ]. + DATA(parameters) = VALUE abap_parmbind_tab( ). + + LOOP AT get_constructor_parameters( implementation-class ) INTO DATA(parameter). + " Check for injected parameter + IF line_exists( implementation-parameters[ name = parameter-sconame ] ). + INSERT implementation-parameters[ name = parameter-sconame ] + INTO TABLE parameters. + CONTINUE. + ENDIF. + + IF is_interface( parameter-type ). + DATA(interface) = CONV seoitfname( parameter-type ). + CREATE DATA ref_to_object TYPE REF TO (interface). + ASSIGN ref_to_object->* TO FIELD-SYMBOL(). + + " Remind me to allow propagation of filters when needed + ?= resolve( i_interface = interface ). + + INSERT VALUE #( name = parameter-sconame value = ref_to_object ) + INTO TABLE parameters. + ENDIF. + ENDLOOP. + + CREATE OBJECT r_object TYPE (implementation-class) PARAMETER-TABLE parameters. + + CATCH cx_sy_itab_line_not_found cx_class_not_existent. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e016(zcds_alv) WITH i_interface. + CATCH cx_sy_create_object_error. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e017(zcds_alv) WITH i_interface implementation-class. + ENDTRY. + ENDMETHOD. + + METHOD get_constructor_parameters. + TRY. + DATA(class) = CAST cl_oo_class( cl_oo_class=>get_instance( i_class_name ) ). + IF line_exists( class->methods[ cmpname = 'CONSTRUCTOR' ] ). + r_parameters = VALUE #( FOR parameter IN class->method_parameters + WHERE + ( cmpname = 'CONSTRUCTOR' ) + ( parameter ) ). + ELSEIF class->superclass IS NOT INITIAL. + r_parameters = get_constructor_parameters( class->superclass ). + ENDIF. + CATCH cx_class_not_existent. + ENDTRY. + ENDMETHOD. + + METHOD get_return_type. + DATA(depth) = 2 + i_increase_depth_by. + DATA(call_stack) = cl_abap_get_call_stack=>get_call_stack( ). + DATA(formatted_call_stack) = cl_abap_get_call_stack=>format_call_stack_with_struct( call_stack ). + DATA(last_caller) = formatted_call_stack[ depth ]. + SPLIT last_caller-event_long AT '=>' INTO DATA(class_name) DATA(long_method_name). + IF long_method_name CS '~'. + SPLIT long_method_name AT '~' INTO DATA(interface_name) DATA(method_name). + ELSE. + method_name = long_method_name. + ENDIF. + + TRY. + IF interface_name IS NOT INITIAL AND method_name IS NOT INITIAL. + DATA(interface) = cl_oo_interface=>get_instance( CONV #( interface_name ) ). + r_return_type = interface->method_parameters[ cmpname = method_name pardecltyp = seos_pardecltyp_returning ]-type. + ELSEIF class_name IS NOT INITIAL AND method_name IS NOT INITIAL. + DATA(class) = cl_oo_class=>get_instance( CONV #( class_name ) ). + r_return_type = class->method_parameters[ cmpname = method_name pardecltyp = seos_pardecltyp_returning ]-type. + ENDIF. + + check_interface( r_return_type ). + CATCH cx_class_not_existent cx_sy_itab_line_not_found. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e030(zcds_alv) WITH method_name. + ENDTRY. + ENDMETHOD. + + METHOD is_interface. + TRY. + r_is_interface = xsdbool( cl_oo_object=>get_instance( CONV #( i_parameter_type ) ) IS INSTANCE OF cl_oo_interface ). + CATCH cx_class_not_existent. + r_is_interface = abap_false. + ENDTRY. + ENDMETHOD. + + METHOD store_object. + check_interface( i_interface ). + DATA(interface_descriptor) = CAST cl_abap_intfdescr( cl_abap_typedescr=>describe_by_name( i_interface ) ). + + IF NOT interface_descriptor->applies_to( i_object ). + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e015(zcds_alv) WITH i_interface. + ENDIF. + + READ TABLE instances ASSIGNING FIELD-SYMBOL() + WITH KEY interface = i_interface + filters = i_filters. + IF sy-subrc <> 0. + INSERT VALUE #( interface = i_interface filters = i_filters ) + INTO TABLE instances ASSIGNING . + ENDIF. + + -object = i_object. + ENDMETHOD. + + METHOD zif_cds_alv_ioc_container~register_implementing_class. + check_interface( i_interface ). + check_class( i_class ). + check_implements( i_class = i_class i_interface = i_interface ). + + READ TABLE implementations ASSIGNING FIELD-SYMBOL() + WITH KEY interface = i_interface + filters = i_filters. + IF sy-subrc <> 0. + INSERT VALUE #( interface = i_interface filters = i_filters ) + INTO TABLE implementations ASSIGNING . + ENDIF. + + -class = i_class. + -parameters = i_parameters. + ENDMETHOD. + + METHOD zif_cds_alv_ioc_container~register_instance. + store_object( i_interface = i_interface i_filters = i_filters i_object = i_instance ). + ENDMETHOD. + + METHOD zif_cds_alv_ioc_container~resolve. + DATA(interface) = COND #( WHEN i_interface IS NOT INITIAL + THEN i_interface + ELSE get_return_type( + i_increase_depth_by = 1 ) ). + + IF parent IS BOUND. + TRY. + r_instance = parent->resolve( i_interface = i_interface i_filters = i_filters ). + IF r_instance IS BOUND. + RETURN. + ENDIF. + + CATCH zcx_cds_alv_message. + " not resolved by parent + ENDTRY. + ENDIF. + + TRY. + r_instance = instances[ interface = interface filters = i_filters ]-object. + + CATCH cx_sy_itab_line_not_found. + r_instance = create_object( i_interface = interface i_filters = i_filters ). + store_object( i_interface = interface i_filters = i_filters i_object = r_instance ). + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_ioc_container.clas.xml b/src/zcl_cds_alv_ioc_container.clas.xml new file mode 100644 index 0000000..4bd7d10 --- /dev/null +++ b/src/zcl_cds_alv_ioc_container.clas.xml @@ -0,0 +1,43 @@ + + + + + + ZCL_CDS_ALV_IOC_CONTAINER + D + Inversion of Control Container + 1 + X + X + X + + + + CDS_VIEW + D + DD: Name eines struktierten Objekts (z.B. Entity, Context) + + + + + CONSTRUCTOR + I_CDS_VIEW + D + DD: Name eines struktierten Objekts (z.B. Entity, Context) + + + GET_CONSTRUCTOR_PARAMETERS + I_CLASS_NAME + D + Objekttypname + + + GET_CONSTRUCTOR_PARAMETERS + R_PARAMETERS + D + Parameter + + + + + diff --git a/src/zcl_cds_alv_memory.clas.abap b/src/zcl_cds_alv_memory.clas.abap new file mode 100644 index 0000000..449cc0e --- /dev/null +++ b/src/zcl_cds_alv_memory.clas.abap @@ -0,0 +1,38 @@ +CLASS zcl_cds_alv_memory DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_memory. + + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS zcl_cds_alv_memory IMPLEMENTATION. + METHOD zif_cds_alv_memory~export_forall_table. + DATA ref_to_forall_table TYPE REF TO data. + + CREATE DATA ref_to_forall_table TYPE STANDARD TABLE OF (i_source_view). + ASSIGN ref_to_forall_table->* TO FIELD-SYMBOL(). + + MOVE-CORRESPONDING i_forall_table TO . + + EXPORT source_view = i_source_view + association_name = i_association_name + source_parameters = i_source_parameters + forall_table = + TO MEMORY ID i_memory_id. + ENDMETHOD. + + METHOD zif_cds_alv_memory~import_forall_table. + IMPORT source_view = e_source_view + association_name = e_association_name + source_parameters = e_source_parameters + FROM MEMORY ID i_memory_id. + + CREATE DATA e_ref_to_forall_table TYPE STANDARD TABLE OF (e_source_view). + ASSIGN e_ref_to_forall_table->* TO FIELD-SYMBOL(). + + IMPORT forall_table = FROM MEMORY ID i_memory_id. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_memory.clas.xml b/src/zcl_cds_alv_memory.clas.xml new file mode 100644 index 0000000..b4c92cd --- /dev/null +++ b/src/zcl_cds_alv_memory.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_MEMORY + D + Zugriffe auf das ABAP-Memory + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_navigation.clas.abap b/src/zcl_cds_alv_navigation.clas.abap new file mode 100644 index 0000000..2ff3fb0 --- /dev/null +++ b/src/zcl_cds_alv_navigation.clas.abap @@ -0,0 +1,445 @@ +CLASS zcl_cds_alv_navigation DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_navigation. + + METHODS constructor + IMPORTING i_persistence TYPE REF TO zif_cds_alv_persistence + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_launcher TYPE REF TO zif_cds_alv_report_launcher. + + PROTECTED SECTION. + + PRIVATE SECTION. + CONSTANTS: BEGIN OF mass_processing, + none TYPE zcds_alv_nav_mass_processing VALUE space, + loop TYPE zcds_alv_nav_mass_processing VALUE 'L', + table TYPE zcds_alv_nav_mass_processing VALUE 'T', + END OF mass_processing. + + CONSTANTS exit_interface TYPE seoitfname VALUE 'ZIF_CDS_ALV_NAVIGATION'. + + DATA persistence TYPE REF TO zif_cds_alv_persistence. + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + DATA launcher TYPE REF TO zif_cds_alv_report_launcher. + DATA ioc_container TYPE REF TO zif_cds_alv_ioc_container. + DATA navigation_table TYPE zcds_alv_navigation_tab. + DATA navigation_exits TYPE zcds_alv_navigation_exit_tab. + + METHODS ask_for_missing_parameters + IMPORTING i_target_view TYPE ddstrucobjname + CHANGING c_parameter_values TYPE zcds_alv_parameters + RAISING zcx_cds_alv_message. + + METHODS call_bor_method + IMPORTING i_navigation TYPE zcds_alv_nav + i_key_field TYPE fieldname + i_selected_row TYPE any + RAISING zcx_cds_alv_message. + + METHODS call_function_module + IMPORTING i_navigation TYPE zcds_alv_nav + i_key_field TYPE fieldname OPTIONAL + i_selected_row TYPE any OPTIONAL + i_selected_rows TYPE STANDARD TABLE OPTIONAL + RAISING zcx_cds_alv_message. + + METHODS call_transaction + IMPORTING i_navigation TYPE zcds_alv_nav + i_key_field TYPE fieldname + i_selected_row TYPE any + RAISING zcx_cds_alv_message. + + METHODS fill_ioc_container. + + METHODS get_object_from_ioc_container + IMPORTING i_navigation_exit TYPE zcds_alv_navexit + RETURNING VALUE(r_object) TYPE REF TO zif_cds_alv_navigation + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_navigation IMPLEMENTATION. + METHOD ask_for_missing_parameters. + DATA(dd10bv_tab) = ddic_access->get_parameters_for_cds_view( i_target_view ). + + LOOP AT dd10bv_tab INTO DATA(dd10bv). + " TODO: variable is assigned but never used (ABAP cleaner) + DATA(ddfield) = VALUE dfies( ). + CALL FUNCTION 'DDIF_FIELDINFO_GET' + EXPORTING tabname = dd10bv-rollname + all_types = abap_true + IMPORTING dfies_wa = ddfield + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + READ TABLE c_parameter_values ASSIGNING FIELD-SYMBOL() + WITH KEY cds_view = dd10bv-strucobjn + parname = dd10bv-parametername. + IF sy-subrc <> 0. + INSERT VALUE #( cds_view = dd10bv-strucobjn + parname = dd10bv-parametername ) + INTO TABLE c_parameter_values ASSIGNING . + ENDIF. + + IF -value IS INITIAL. + CALL FUNCTION 'FOBU_POPUP_GET_VALUE' + EXPORTING typename = dd10bv-rollname + field_value = -value + popup_title = 'Parameter eingeben' + IMPORTING field_value_int = -value + EXCEPTIONS internal_error = 1 + cancelled = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD call_bor_method. + DATA objkey TYPE swo_typeid. + DATA object TYPE swo_objhnd. + DATA return TYPE swotreturn. + DATA container TYPE swconttab. + + ASSIGN COMPONENT i_key_field OF STRUCTURE i_selected_row TO FIELD-SYMBOL(). + objkey = . + + CALL FUNCTION 'SWO_CREATE' + EXPORTING objtype = i_navigation-object_type + objkey = objkey + IMPORTING object = object + return = return. + IF return-errortype <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'SWO_INVOKE' + EXPORTING object = object + verb = i_navigation-object_method + IMPORTING return = return + TABLES container = container. + IF return-errortype <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'SWO_FREE' + EXPORTING object = object + IMPORTING return = return. + IF return-errortype <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD call_function_module. + DATA exceptions TYPE STANDARD TABLE OF rsexc. + DATA exporting TYPE STANDARD TABLE OF rsexp. + DATA importing TYPE STANDARD TABLE OF rsimp. + DATA changing TYPE STANDARD TABLE OF rscha. + DATA tables TYPE STANDARD TABLE OF rstbl. + DATA input TYPE REF TO data. + + FIELD-SYMBOLS
TYPE ANY TABLE. + + CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE' + EXPORTING funcname = i_navigation-function + TABLES exception_list = exceptions + export_parameter = exporting + import_parameter = importing + changing_parameter = changing + tables_parameter = tables + EXCEPTIONS error_message = 1 + function_not_found = 2 + invalid_name = 3 + OTHERS = 4. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + READ TABLE importing INTO DATA(import) + WITH KEY parameter = i_navigation-default_parameter. + IF sy-subrc = 0. + IF import-dbfield IS NOT INITIAL. + CREATE DATA input TYPE (import-dbfield). + ELSEIF import-typ IS NOT INITIAL. + CREATE DATA input TYPE (import-typ). + ENDIF. + ENDIF. + + READ TABLE tables INTO DATA(table) + WITH KEY parameter = i_navigation-default_parameter. + IF sy-subrc = 0. + CREATE DATA input TYPE TABLE OF (table-dbstruct). + ENDIF. + + IF input IS NOT BOUND. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e005(zcds_alv) WITH i_navigation-default_parameter i_navigation-function. + ENDIF. + + ASSIGN input->* TO FIELD-SYMBOL(). + + IF i_navigation-conversion_exit IS NOT INITIAL. + DATA(conversion_function) = |CONVERSION_EXIT_{ i_navigation-conversion_exit }_INPUT|. + ENDIF. + + IF i_selected_row IS NOT INITIAL. + ASSIGN COMPONENT i_key_field OF STRUCTURE i_selected_row TO FIELD-SYMBOL(). + = . + + IF conversion_function IS NOT INITIAL. + CALL FUNCTION conversion_function + EXPORTING input = + IMPORTING output = . + ENDIF. + + ELSEIF i_selected_rows IS NOT INITIAL. + LOOP AT i_selected_rows ASSIGNING FIELD-SYMBOL(). + ASSIGN COMPONENT i_key_field OF STRUCTURE TO . + ASSIGN TO
. + INSERT INTO TABLE
ASSIGNING FIELD-SYMBOL(). + + IF conversion_function IS NOT INITIAL. + CALL FUNCTION conversion_function + EXPORTING input = + IMPORTING output = . + ENDIF. + ENDLOOP. + ENDIF. + + DATA(parameter_binding) = COND abap_func_parmbind_tab( + WHEN import-parameter IS NOT INITIAL THEN VALUE #( ( name = import-parameter + kind = abap_func_exporting + value = input ) ) + WHEN table-parameter IS NOT INITIAL THEN VALUE #( ( name = table-parameter + kind = abap_func_tables + value = input ) ) ). + + DATA(exception_binding) = VALUE abap_func_excpbind_tab( ( name = `OTHERS` value = 1 ) ). + + CALL FUNCTION i_navigation-function + PARAMETER-TABLE parameter_binding + EXCEPTION-TABLE exception_binding. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD call_transaction. + ASSIGN COMPONENT i_key_field OF STRUCTURE i_selected_row TO FIELD-SYMBOL(). + + IF i_navigation-parameter_id IS NOT INITIAL. + SET PARAMETER ID i_navigation-parameter_id FIELD . + ENDIF. + + CALL TRANSACTION i_navigation-transaction_code + WITH AUTHORITY-CHECK AND SKIP FIRST SCREEN. + ENDMETHOD. + + METHOD constructor. + persistence = i_persistence. + ddic_access = i_ddic_access. + launcher = i_launcher. + navigation_table = persistence->get_intent_based_navigation( ). + navigation_exits = persistence->get_navigation_exits( ). + fill_ioc_container( ). + ENDMETHOD. + + METHOD fill_ioc_container. + ioc_container = NEW zcl_cds_alv_ioc_container( ). + LOOP AT navigation_exits INTO DATA(navigation_exit). + DATA(filters) = VALUE zif_cds_alv_ioc_container=>ty_filters( + ( key = 'SEMANTIC_OBJECT' value = navigation_exit-semantic_object ) + ( key = 'SEMANTIC_ACTION' value = navigation_exit-semantic_action ) + ( key = 'CDS_VIEW' value = navigation_exit-cds_view ) ). + + TRY. + ioc_container->register_implementing_class( i_interface = exit_interface + i_filters = filters + i_class = navigation_exit-implementing_class ). + + CATCH zcx_cds_alv_message. + " TODO: log errors at this point + ENDTRY. + ENDLOOP. + ENDMETHOD. + + METHOD get_object_from_ioc_container. + DATA(filters) = VALUE zif_cds_alv_ioc_container=>ty_filters( + ( key = 'SEMANTIC_OBJECT' value = i_navigation_exit-semantic_object ) + ( key = 'SEMANTIC_ACTION' value = i_navigation_exit-semantic_action ) + ( key = 'CDS_VIEW' value = i_navigation_exit-cds_view ) ). + + r_object ?= ioc_container->resolve( i_interface = exit_interface i_filters = filters ). + ENDMETHOD. + + METHOD zif_cds_alv_navigation~navigate_to_object_mass. + e_refresh_after = abap_false. + + TRY. + DATA(exit_called) = abap_false. + DATA(navigation_exit) = navigation_exits[ semantic_object = i_object + semantic_action = i_action + cds_view = i_cds_view ]. + + DATA(exit_object) = get_object_from_ioc_container( navigation_exit ). + + exit_object->navigate_to_object_mass( EXPORTING i_object = i_object + i_action = i_action + i_cds_view = i_cds_view + i_key_field = i_key_field + i_selected_rows = i_selected_rows + IMPORTING e_refresh_after = e_refresh_after ). + + exit_called = abap_true. + CATCH cx_sy_itab_line_not_found. + exit_called = abap_false. + ENDTRY. + + IF exit_called = abap_true. + RETURN. + ENDIF. + + TRY. + DATA(navigation) = navigation_table[ semantic_object = i_object + semantic_action = i_action ]. + + IF navigation-mass_processing = mass_processing-none AND lines( i_selected_rows ) > 1. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e003(zcds_alv). + ENDIF. + + CASE navigation-mass_processing. + WHEN mass_processing-none + OR mass_processing-loop. + + LOOP AT i_selected_rows ASSIGNING FIELD-SYMBOL(). + IF navigation-function IS NOT INITIAL + AND navigation-default_parameter IS NOT INITIAL. + call_function_module( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = ). + + ELSEIF navigation-object_type IS NOT INITIAL + AND navigation-object_method IS NOT INITIAL. + call_bor_method( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = ). + + ELSEIF navigation-transaction_code IS NOT INITIAL. + call_transaction( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = ). + ENDIF. + ENDLOOP. + + WHEN mass_processing-table. + IF navigation-function IS NOT INITIAL + AND navigation-default_parameter IS NOT INITIAL. + call_function_module( i_navigation = navigation + i_key_field = i_key_field + i_selected_rows = i_selected_rows ). + ELSE. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e004(zcds_alv). + ENDIF. + ENDCASE. + + e_refresh_after = navigation-refresh_after. + + CATCH cx_sy_itab_line_not_found. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e002(zcds_alv) WITH i_object i_action. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_navigation~navigate_to_object_single. + e_refresh_after = abap_false. + + TRY. + DATA(exit_called) = abap_false. + DATA(navigation_exit) = navigation_exits[ semantic_object = i_object + semantic_action = i_action + cds_view = i_cds_view ]. + + DATA(exit_object) = get_object_from_ioc_container( navigation_exit ). + + exit_object->navigate_to_object_single( EXPORTING i_object = i_object + i_action = i_action + i_cds_view = i_cds_view + i_key_field = i_key_field + i_selected_row = i_selected_row + IMPORTING e_refresh_after = e_refresh_after ). + + exit_called = abap_true. + CATCH cx_sy_itab_line_not_found. + exit_called = abap_false. + ENDTRY. + + IF exit_called = abap_true. + RETURN. + ENDIF. + + TRY. + DATA(navigation) = navigation_table[ semantic_object = i_object + semantic_action = i_action ]. + + IF navigation-function IS NOT INITIAL + AND navigation-default_parameter IS NOT INITIAL. + call_function_module( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = i_selected_row ). + + ELSEIF navigation-object_type IS NOT INITIAL + AND navigation-object_method IS NOT INITIAL. + call_bor_method( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = i_selected_row ). + + ELSEIF navigation-transaction_code IS NOT INITIAL. + call_transaction( i_navigation = navigation + i_key_field = i_key_field + i_selected_row = i_selected_row ). + ENDIF. + + e_refresh_after = navigation-refresh_after. + + CATCH cx_sy_itab_line_not_found. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e002(zcds_alv) WITH i_object i_action. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_navigation~navigate_via_association. + DATA(target_view) = ddic_access->get_target_for_association( i_source_view = i_source_view + i_association_name = i_association_name ). + + DATA(target_parameters) = i_target_parameters. + + ask_for_missing_parameters( EXPORTING i_target_view = target_view + CHANGING c_parameter_values = target_parameters ). + + launcher->start_report_for_association( i_source_view = i_source_view + i_target_view = target_view + i_association_name = i_association_name + i_source_parameters = i_source_parameters + i_target_parameters = target_parameters + i_forall_table = i_selected_rows ). + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_navigation.clas.xml b/src/zcl_cds_alv_navigation.clas.xml new file mode 100644 index 0000000..f77ab73 --- /dev/null +++ b/src/zcl_cds_alv_navigation.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_NAVIGATION + D + Intent-Based Navigation + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_persistence.clas.abap b/src/zcl_cds_alv_persistence.clas.abap new file mode 100644 index 0000000..f0d4740 --- /dev/null +++ b/src/zcl_cds_alv_persistence.clas.abap @@ -0,0 +1,143 @@ +CLASS zcl_cds_alv_persistence DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_persistence. + + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS zcl_cds_alv_persistence IMPLEMENTATION. + METHOD zif_cds_alv_persistence~exists_report_for_cds_view. + SELECT SINGLE @abap_true FROM zcds_alv_program + WHERE cds_view = @i_cds_view + INTO @r_exists. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~get_extension_parameters. + SELECT * FROM zcds_alv_extpar AS par + JOIN zcds_alv_extpart AS text ON par~extension_name = text~extension_name + AND par~parameter_name = text~parameter_name + WHERE par~extension_name = @i_extension_name + AND text~spras = @sy-langu + INTO CORRESPONDING FIELDS OF TABLE @r_parameters. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~get_intent_based_navigation. + SELECT * FROM zcds_alv_nav INTO CORRESPONDING FIELDS OF TABLE @r_navigation_table. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~get_navigation_exits. + SELECT * FROM zcds_alv_navexit INTO CORRESPONDING FIELDS OF TABLE @r_navigation_exits. + ENDMETHOD. + + + METHOD zif_cds_alv_persistence~get_next_program_number. + DATA(object) = 'ZCDS_ALV_N'. + DATA(nr_range_nr) = '00'. + + CALL FUNCTION 'NUMBER_GET_NEXT' + EXPORTING nr_range_nr = nr_range_nr + object = object + IMPORTING number = r_number + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~get_report_extensions. + SELECT * FROM zcds_alv_exthdr AS hdr + JOIN zcds_alv_exthdrt AS text ON hdr~extension_name = text~extension_name + WHERE text~spras = @sy-langu + INTO CORRESPONDING FIELDS OF TABLE @r_extensions. + + LOOP AT r_extensions ASSIGNING FIELD-SYMBOL(). + -cds_view = i_cds_view. + SELECT SINGLE active, activated_on + FROM zcds_alv_progext + WHERE cds_view = @i_cds_view + AND extension_name = @-extension_name + INTO CORRESPONDING FIELDS OF @. + IF sy-subrc <> 0. + CLEAR: -active, + -activated_on. + ENDIF. + ENDLOOP. + + IF i_only_active = abap_true. + DELETE r_extensions WHERE active = abap_false. + ENDIF. + + IF i_only_display = abap_true. + DELETE r_extensions WHERE alternative_display = abap_false. + ENDIF. + + IF i_only_selection = abap_true. + DELETE r_extensions WHERE alternative_selection = abap_false. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~get_report_for_cds_view. + SELECT SINGLE * + FROM zcds_alv_program + WHERE cds_view = @i_cds_view + INTO CORRESPONDING FIELDS OF @r_program_info. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e008(zcds_alv) WITH i_cds_view. + ENDIF. + + IF r_program_info-progname IS NOT INITIAL. + SELECT * FROM zcds_alv_selopts + WHERE progname = @r_program_info-progname + INTO CORRESPONDING FIELDS OF TABLE @r_program_info-select_options. + + SELECT * FROM zcds_alv_params + WHERE progname = @r_program_info-progname + INTO CORRESPONDING FIELDS OF TABLE @r_program_info-parameters. + + READ REPORT r_program_info-progname INTO r_program_info-source_lines. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~save_report_for_cds_view. + DATA(program) = CORRESPONDING zcds_alv_program( i_program_info ). + program-cds_view = i_cds_view. + + MODIFY zcds_alv_program FROM @program. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e014(zcds_alv) WITH i_cds_view. + ENDIF. + + DELETE FROM zcds_alv_params WHERE progname = @i_program_info-progname. + INSERT zcds_alv_params FROM TABLE @i_program_info-parameters. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e014(zcds_alv) WITH i_cds_view. + ENDIF. + + DELETE FROM zcds_alv_selopts WHERE progname = @i_program_info-progname. + INSERT zcds_alv_selopts FROM TABLE @i_program_info-select_options. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e014(zcds_alv) WITH i_cds_view. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_persistence~set_report_extensions. + LOOP AT i_extensions INTO DATA(extension). + DATA(db_data) = CORRESPONDING zcds_alv_progext( extension ). + GET TIME STAMP FIELD db_data-activated_on. + MODIFY zcds_alv_progext FROM @db_data. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE e014(zcds_alv) WITH i_cds_view. + ENDIF. + ENDLOOP. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_persistence.clas.xml b/src/zcl_cds_alv_persistence.clas.xml new file mode 100644 index 0000000..824c382 --- /dev/null +++ b/src/zcl_cds_alv_persistence.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_PERSISTENCE + D + Persistenz für das CDS ALV Framework + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_report_controller.clas.abap b/src/zcl_cds_alv_report_controller.clas.abap new file mode 100644 index 0000000..1ca73dc --- /dev/null +++ b/src/zcl_cds_alv_report_controller.clas.abap @@ -0,0 +1,290 @@ +CLASS zcl_cds_alv_report_controller DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_report_controller. + INTERFACES zif_cds_alv_split_screen_cntr. + + ALIASES ok_code FOR zif_cds_alv_split_screen_cntr~ok_code. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + i_table_container TYPE REF TO zif_cds_alv_table_container + i_selection_screen TYPE REF TO zif_cds_alv_selection_screen + i_selection TYPE REF TO zif_cds_alv_selection + i_builder TYPE REF TO zif_cds_alv_grid_builder + i_extension_provider TYPE REF TO zif_cds_alv_extension_provider + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + DATA alternative_selection TYPE zcds_alv_report_extension_name. + DATA alternative_display TYPE zcds_alv_report_extension_name. + DATA table_container TYPE REF TO zif_cds_alv_table_container. + DATA selection_screen TYPE REF TO zif_cds_alv_selection_screen. + DATA selection TYPE REF TO zif_cds_alv_selection. + DATA builder TYPE REF TO zif_cds_alv_grid_builder. + DATA extension_provider TYPE REF TO zif_cds_alv_extension_provider. + DATA extensions TYPE zif_cds_alv_extension_provider=>ty_report_extensions. + + METHODS evaluate_annotations REDEFINITION. + + PRIVATE SECTION. + METHODS default_selection + IMPORTING i_forall TYPE abap_bool + i_memory_id TYPE memory_id + EXPORTING e_result_table TYPE STANDARD TABLE + RAISING zcx_cds_alv_message. + + METHODS default_display + IMPORTING i_in_split_screen TYPE abap_bool + RAISING zcx_cds_alv_message. + + METHODS refresh + RAISING zcx_cds_alv_message. + + METHODS select + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_report_controller IMPLEMENTATION. + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + table_container = i_table_container. + selection_screen = i_selection_screen. + selection = i_selection. + builder = i_builder. + extension_provider = i_extension_provider. + + evaluate_annotations( ). + extensions = extension_provider->get_report_extensions( cds_view ). + ENDMETHOD. + + METHOD default_display. + CASE i_in_split_screen. + WHEN abap_false. + CALL FUNCTION 'Z_CDS_ALV_FULL_SCREEN' + EXPORTING i_builder = builder + i_table_container = table_container. + + WHEN abap_true. + DATA(program) = persistence->get_report_for_cds_view( cds_view ). + + CALL FUNCTION 'Z_CDS_ALV_SPLIT_SCREEN' + EXPORTING i_builder = builder + i_table_container = table_container + i_sub_repid = program-progname + i_sub_dynnr = program-dynpro + i_controller = me. + ENDCASE. + ENDMETHOD. + + METHOD default_selection. + CASE i_forall. + WHEN abap_false. + selection->perform_selection( EXPORTING i_condition_provider = selection_screen + IMPORTING e_result_table = e_result_table ). + + WHEN abap_true. + memory->import_forall_table( EXPORTING i_memory_id = i_memory_id + IMPORTING e_source_view = DATA(source_view) + e_association_name = DATA(association_name) + e_source_parameters = DATA(source_parameters) + e_ref_to_forall_table = DATA(ref_to_forall_table) ). + + ASSIGN ref_to_forall_table->* TO FIELD-SYMBOL(). + + selection->perform_selection_forall( EXPORTING i_condition_provider = selection_screen + i_source_view = source_view + i_association_name = association_name + i_source_parameters = source_parameters + i_forall_table = + IMPORTING e_result_table = e_result_table ). + ENDCASE. + ENDMETHOD. + + METHOD evaluate_annotations. + " Nothing here yet; but the instance definitely needs to be parametrized with the CDS view + ENDMETHOD. + + METHOD refresh. + DATA ref_to_table TYPE REF TO data. + + DATA(table_descriptor) = table_container->get_table_descriptor( ). + CREATE DATA ref_to_table TYPE HANDLE table_descriptor. + ASSIGN ref_to_table->* TO FIELD-SYMBOL(). + + TRY. + DATA(selection_handler) = extensions[ extension = alternative_selection ]-instance. + selection_handler->alternative_reselection( EXPORTING i_cds_view = cds_view + i_selection_screen = selection_screen + i_table_container = table_container + CHANGING c_result_table = ). + + CATCH cx_sy_itab_line_not_found. + selection->perform_reselection( CHANGING c_result_table = ). + ENDTRY. + + table_container->set_table( ). + ENDMETHOD. + + METHOD select. + DATA ref_to_table TYPE REF TO data. + + DATA(table_descriptor) = table_container->get_table_descriptor( ). + CREATE DATA ref_to_table TYPE HANDLE table_descriptor. + ASSIGN ref_to_table->* TO FIELD-SYMBOL(). + + selection_screen->read_selection_screen( ). + + TRY. + DATA(selection_handler) = extensions[ extension = alternative_selection ]-instance. + selection_handler->alternative_selection( EXPORTING i_cds_view = cds_view + i_selection_screen = selection_screen + i_table_container = table_container + IMPORTING e_result_table = ). + + CATCH cx_sy_itab_line_not_found. + selection->perform_selection( EXPORTING i_condition_provider = selection_screen + IMPORTING e_result_table = ). + ENDTRY. + + table_container->set_table( ). + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~at_help_request. + TRY. + LOOP AT extensions INTO DATA(extension). + extension-instance->show_help( i_selection_screen = selection_screen + i_sel_name = i_sel_name ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~at_selection_screen. + TRY. + LOOP AT extensions INTO DATA(extension). + extension-instance->handle_user_command( i_selection_screen = selection_screen + i_user_command = i_ucomm ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~at_selection_screen_output. + TRY. + selection_screen->apply_restriction( ). + selection_screen->apply_selection_texts( ). + selection_screen->modify_screen( ). + + LOOP AT extensions INTO DATA(extension). + extension-instance->modify_screen( selection_screen ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~at_value_request. + TRY. + selection_screen->value_help_for_field( EXPORTING i_sel_name = i_sel_name + CHANGING c_value = c_value ). + + LOOP AT extensions INTO DATA(extension). + extension-instance->value_help( EXPORTING i_selection_screen = selection_screen + i_sel_name = i_sel_name + CHANGING c_value = c_value ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~initialization. + TRY. + LOOP AT extensions INTO DATA(extension). + extension-instance->initialization( selection_screen ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_controller~start_of_selection. + DATA ref_to_table TYPE REF TO data. + + DATA(table_descriptor) = table_container->get_table_descriptor( ). + CREATE DATA ref_to_table TYPE HANDLE table_descriptor. + ASSIGN ref_to_table->* TO FIELD-SYMBOL(). + + TRY. + selection_screen->read_selection_screen( ). + + TRY. + DATA(no_display) = abap_false. + DATA(selection_handler) = extensions[ extension = i_selection ]-instance. + alternative_selection = i_selection. + builder->register_alternative_selection( selection_handler ). + selection_handler->alternative_selection( EXPORTING i_cds_view = cds_view + i_selection_screen = selection_screen + i_table_container = table_container + IMPORTING e_result_table = + e_no_display = no_display ). + + CATCH cx_sy_itab_line_not_found. + default_selection( EXPORTING i_forall = i_forall + i_memory_id = i_memory_id + IMPORTING e_result_table = ). + ENDTRY. + + table_container->set_table( ). + + IF no_display = abap_true. + RETURN. + ENDIF. + + TRY. + DATA(display_handler) = extensions[ extension = i_display ]-instance. + alternative_display = i_display. + display_handler->alternative_display( i_selection_screen = selection_screen + i_table_container = table_container + i_builder = builder ). + + CATCH cx_sy_itab_line_not_found. + default_display( i_in_split_screen ). + ENDTRY. + + CATCH zcx_cds_alv_message INTO DATA(exception). + MESSAGE exception TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_split_screen_cntr~handle_user_command. + CASE i_ok_code. + WHEN ok_code-select. + select( ). + + WHEN OTHERS. + LOOP AT extensions INTO DATA(extension). + extension-instance->handle_user_command( i_selection_screen = selection_screen + i_user_command = CONV #( i_ok_code ) ). + ENDLOOP. + ENDCASE. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_report_controller.clas.xml b/src/zcl_cds_alv_report_controller.clas.xml new file mode 100644 index 0000000..02fd63b --- /dev/null +++ b/src/zcl_cds_alv_report_controller.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_REPORT_CONTROLLER + D + Controller für generierte Reports zu CDS-Views + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_report_extension.clas.abap b/src/zcl_cds_alv_report_extension.clas.abap new file mode 100644 index 0000000..fb803c8 --- /dev/null +++ b/src/zcl_cds_alv_report_extension.clas.abap @@ -0,0 +1,81 @@ +CLASS zcl_cds_alv_report_extension DEFINITION PUBLIC ABSTRACT. + PUBLIC SECTION. + INTERFACES zif_cds_alv_display_extension. + INTERFACES zif_cds_alv_report_extension. + INTERFACES zif_cds_alv_select_extension. + + METHODS constructor + IMPORTING i_extension_name TYPE zcds_alv_report_extension_name + i_extension_parameters TYPE zcds_alv_extension_parameters. + + PROTECTED SECTION. + ALIASES extension_name FOR zif_cds_alv_report_extension~extension_name. + + CONSTANTS: BEGIN OF main_parameters, + variant TYPE rsscr_name VALUE 'P_VARI', + alternative_selection TYPE rsscr_name VALUE 'P_SELEXT', + alternative_display TYPE rsscr_name VALUE 'P_DISEXT', + END OF main_parameters. + + DATA extension_parameters TYPE zcds_alv_extension_parameters. + + METHODS is_selection_active + IMPORTING i_selection_screen TYPE REF TO zif_cds_alv_selection_screen + RETURNING VALUE(r_is_active) TYPE abap_bool. + + METHODS is_display_active + IMPORTING i_selection_screen TYPE REF TO zif_cds_alv_selection_screen + RETURNING VALUE(r_is_active) TYPE abap_bool. + + METHODS get_attributes_from_screen + IMPORTING i_selection_screen TYPE REF TO zif_cds_alv_selection_screen. + + METHODS put_attributes_to_screen + IMPORTING i_selection_screen TYPE REF TO zif_cds_alv_selection_screen + RAISING zcx_cds_alv_message. + + PRIVATE SECTION. +ENDCLASS. + + + +CLASS zcl_cds_alv_report_extension IMPLEMENTATION. + METHOD constructor. + extension_name = i_extension_name. + extension_parameters = i_extension_parameters. + ENDMETHOD. + + METHOD get_attributes_from_screen. + LOOP AT extension_parameters INTO DATA(ls_parameter) WHERE attribute_name IS NOT INITIAL. + ASSIGN me->(ls_parameter-attribute_name) TO FIELD-SYMBOL(). + IF sy-subrc = 0. + i_selection_screen->get_dynpro_field( EXPORTING i_sel_name = ls_parameter-parameter_name + IMPORTING e_parameter = ). + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD is_display_active. + DATA(alternative_display) = VALUE zcds_alv_report_extension_name( ). + i_selection_screen->get_dynpro_field( EXPORTING i_sel_name = main_parameters-alternative_display + IMPORTING e_parameter = alternative_display ). + r_is_active = xsdbool( alternative_display = extension_name ). + ENDMETHOD. + + METHOD is_selection_active. + DATA(alternative_selection) = VALUE zcds_alv_report_extension_name( ). + i_selection_screen->get_dynpro_field( EXPORTING i_sel_name = main_parameters-alternative_selection + IMPORTING e_parameter = alternative_selection ). + r_is_active = xsdbool( alternative_selection = extension_name ). + ENDMETHOD. + + METHOD put_attributes_to_screen. + LOOP AT extension_parameters INTO DATA(ls_parameter) WHERE attribute_name IS NOT INITIAL. + ASSIGN me->(ls_parameter-attribute_name) TO FIELD-SYMBOL(). + IF sy-subrc = 0. + i_selection_screen->set_dynpro_field( i_sel_name = ls_parameter-parameter_name + i_parameter = ). + ENDIF. + ENDLOOP. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_report_extension.clas.xml b/src/zcl_cds_alv_report_extension.clas.xml new file mode 100644 index 0000000..5b90406 --- /dev/null +++ b/src/zcl_cds_alv_report_extension.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_REPORT_EXTENSION + D + Abstrakte Oberklasse für Reporterweiterungen + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_report_generator.clas.abap b/src/zcl_cds_alv_report_generator.clas.abap new file mode 100644 index 0000000..6acd6e1 --- /dev/null +++ b/src/zcl_cds_alv_report_generator.clas.abap @@ -0,0 +1,93 @@ +CLASS zcl_cds_alv_report_generator DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_report_generator. + + DATA factory TYPE REF TO zif_cds_alv_factory. + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + DATA persistence TYPE REF TO zif_cds_alv_persistence. + DATA strategy TYPE REF TO zif_cds_alv_report_strategy. + + METHODS constructor + IMPORTING i_factory TYPE REF TO zif_cds_alv_factory + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence. + + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS zcl_cds_alv_report_generator IMPLEMENTATION. + METHOD constructor. + factory = i_factory. + ddic_access = i_ddic_access. + persistence = i_persistence. + ENDMETHOD. + + METHOD zif_cds_alv_report_generator~generate_report. + strategy = factory->get_generation_strategy( i_cds_view ). + + DATA(program) = strategy->write_source( ). + DATA(textpool) = strategy->write_textpool( ). + + CALL FUNCTION 'RS_PROGRAM_CHECK_NAME' + EXPORTING progname = program-progname + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'RS_DELETE_PROGRAM' + EXPORTING program = program-progname + with_cua = abap_false + with_documentation = abap_false + with_dynpro = abap_true + with_includes = abap_false + with_textpool = abap_false + with_variants = abap_false + suppress_checks = abap_true + suppress_popup = abap_true + EXCEPTIONS object_not_found = 0 + OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + CALL FUNCTION 'PRETTY_PRINTER' + EXPORTING inctoo = abap_false + TABLES ntext = program-source_lines + otext = program-source_lines + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + + " TODO: variable is assigned but never used (ABAP cleaner) + DATA message TYPE string. + DATA line TYPE i. + DATA word TYPE string. + + SYNTAX-CHECK FOR program-source_lines MESSAGE message LINE line WORD word PROGRAM 'ZCDS_ALV_DEMO'. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message MESSAGE e006(zcds_alv) WITH i_cds_view line word. + ENDIF. + + INSERT REPORT program-progname FROM program-source_lines. + UPDATE progdir SET occurs = '1' WHERE name = @program-progname AND state = 'A'. + INSERT TEXTPOOL program-progname FROM textpool LANGUAGE sy-langu. + GET TIME STAMP FIELD program-generated_at. + program-author = cl_abap_syst=>get_user_name( ). + + persistence->save_report_for_cds_view( i_cds_view = i_cds_view + i_program_info = program ). + + COMMIT WORK AND WAIT. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_report_generator.clas.xml b/src/zcl_cds_alv_report_generator.clas.xml new file mode 100644 index 0000000..35bc656 --- /dev/null +++ b/src/zcl_cds_alv_report_generator.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_REPORT_GENERATOR + D + Reportgenerator für CDS-View + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_report_launcher.clas.abap b/src/zcl_cds_alv_report_launcher.clas.abap new file mode 100644 index 0000000..29ef1f6 --- /dev/null +++ b/src/zcl_cds_alv_report_launcher.clas.abap @@ -0,0 +1,152 @@ +CLASS zcl_cds_alv_report_launcher DEFINITION PUBLIC CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_report_launcher. + + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + DATA persistence TYPE REF TO zif_cds_alv_persistence. + DATA memory TYPE REF TO zif_cds_alv_memory. + DATA generator TYPE REF TO zif_cds_alv_report_generator. + DATA auth_checker TYPE REF TO zif_cds_alv_authority_check. + + METHODS constructor + IMPORTING i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_generator TYPE REF TO zif_cds_alv_report_generator + i_auth_checker TYPE REF TO zif_cds_alv_authority_check. + + PROTECTED SECTION. + + PRIVATE SECTION. + METHODS ensure_generation + IMPORTING i_cds_view TYPE ddstrucobjname + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_report_launcher IMPLEMENTATION. + METHOD constructor. + ddic_access = i_ddic_access. + persistence = i_persistence. + memory = i_memory. + generator = i_generator. + auth_checker = i_auth_checker. + ENDMETHOD. + + METHOD ensure_generation. + DATA(view_modified_at) = ddic_access->get_last_modified_at( i_cds_view ). + + TRY. + DATA(program) = persistence->get_report_for_cds_view( i_cds_view ). + DATA(extensions_active_since) = VALUE timestamp( ). + LOOP AT persistence->get_report_extensions( i_cds_view = i_cds_view i_only_active = abap_false ) INTO DATA(extension). + extensions_active_since = nmax( val1 = extensions_active_since val2 = extension-activated_on ). + ENDLOOP. + + CATCH zcx_cds_alv_message INTO DATA(message). + DATA(no_program) = abap_true. + IF program-no_generation = abap_true. + RAISE EXCEPTION message. + ENDIF. + ENDTRY. + + IF ( no_program = abap_true + OR ( view_modified_at > program-generated_at ) + OR ( extensions_active_since > program-generated_at ) ) + AND program-no_generation = abap_false. + + generator->generate_report( i_cds_view ). + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_report_launcher~run_in_dark_mode. + ensure_generation( i_cds_view ). + DATA(program) = persistence->get_report_for_cds_view( i_cds_view ). + + DATA(read_metadata) = xsdbool( e_layout IS SUPPLIED OR e_field_catalog IS SUPPLIED + OR e_filter IS SUPPLIED OR e_sort IS SUPPLIED ). + + DATA(read_data) = xsdbool( e_ref_to_table IS SUPPLIED OR e_table_descriptor IS SUPPLIED ). + + TRY. + cl_salv_bs_runtime_info=>set( display = abap_false + metadata = read_metadata + data = read_data ). + + IF i_variant IS NOT INITIAL. + SUBMIT (program-progname) USING SELECTION-SET i_variant AND RETURN. + ELSE. + SUBMIT (program-progname) WITH SELECTION-TABLE i_selection_table AND RETURN. + ENDIF. + + IF read_metadata = abap_true. + DATA(metadata) = cl_salv_bs_runtime_info=>get_metadata( ). + e_layout = metadata-s_layout. + e_field_catalog = metadata-t_fcat. + e_filter = metadata-t_filter. + e_sort = metadata-t_sort. + ENDIF. + + IF read_data = abap_true. + cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = DATA(ref_to_data) + r_data_descr = DATA(data_descriptor) ). + + e_ref_to_table ?= ref_to_data. + e_table_descriptor ?= data_descriptor. + ENDIF. + + cl_salv_bs_runtime_info=>clear_all( ). + CATCH cx_salv_bs_sc_runtime_info INTO DATA(previous). + cl_salv_bs_runtime_info=>clear_all( ). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_launcher~start_report_for_association. + DATA selection_table TYPE STANDARD TABLE OF rsparamsl_255. + DATA ref_to_forall_table TYPE REF TO data. + FIELD-SYMBOLS TYPE STANDARD TABLE. + + ensure_generation( i_target_view ). + + DATA(program) = persistence->get_report_for_cds_view( i_source_view ). + + LOOP AT program-parameters INTO DATA(parameter). + READ TABLE i_target_parameters INTO DATA(parameter_value) + WITH KEY parname = parameter-parname. + IF sy-subrc = 0. + INSERT VALUE #( kind = 'P' selname = parameter-sel_name low = parameter_value-value ) + INTO TABLE selection_table. + ENDIF. + ENDLOOP. + + DATA(memory_id) = CONV zcds_alv_memory_id( |{ i_source_view }\\{ i_association_name }| ). + + CREATE DATA ref_to_forall_table TYPE TABLE OF (i_source_view). + ASSIGN ref_to_forall_table->* TO . + MOVE-CORRESPONDING i_forall_table TO . + + memory->export_forall_table( i_memory_id = memory_id + i_source_view = i_source_view + i_association_name = i_association_name + i_source_parameters = i_source_parameters + i_forall_table = ). + + selection_table = VALUE #( BASE selection_table + kind = 'P' + ( selname = 'P_FORALL' low = abap_true ) + ( selname = 'P_MEM_ID' low = memory_id ) ). + + SUBMIT (program-progname) WITH SELECTION-TABLE selection_table AND RETURN. "#EC CI_SUBMIT + + FREE MEMORY ID memory_id. + ENDMETHOD. + + METHOD zif_cds_alv_report_launcher~start_report_for_view. + ensure_generation( i_cds_view ). + DATA(program) = persistence->get_report_for_cds_view( i_cds_view ). + SUBMIT (program-progname) WITH p_split = i_in_split_screen VIA SELECTION-SCREEN AND RETURN. "#EC CI_SUBMIT + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_report_launcher.clas.xml b/src/zcl_cds_alv_report_launcher.clas.xml new file mode 100644 index 0000000..b4fdd6b --- /dev/null +++ b/src/zcl_cds_alv_report_launcher.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_REPORT_LAUNCHER + D + Start eines generierten Report für einen CDS-View + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_report_strategy.clas.abap b/src/zcl_cds_alv_report_strategy.clas.abap new file mode 100644 index 0000000..2d6b21d --- /dev/null +++ b/src/zcl_cds_alv_report_strategy.clas.abap @@ -0,0 +1,519 @@ +CLASS zcl_cds_alv_report_strategy DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_report_strategy. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + METHODS evaluate_annotations REDEFINITION. + + PRIVATE SECTION. + CONSTANTS: BEGIN OF selection_type, + interval TYPE string VALUE '#INTERVAL' ##NO_TEXT, + range TYPE string VALUE '#RANGE' ##NO_TEXT, + single TYPE string VALUE '#SINGLE' ##NO_TEXT, + END OF selection_type. + + TYPES: + BEGIN OF ty_field_properties, + qualifier TYPE string, + position TYPE i, + fieldname TYPE fieldname, + sel_name TYPE rsscr_name, + selection_type TYPE string, + multiple_selections TYPE abap_bool, + mandatory TYPE abap_bool, + default_value TYPE string, + no_display TYPE abap_bool, + label TYPE string, + value_help TYPE abap_bool, + END OF ty_field_properties. + TYPES ty_field_properties_tab TYPE STANDARD TABLE OF ty_field_properties WITH EMPTY KEY. + TYPES: + BEGIN OF ty_param_properties, + parname TYPE ddparname, + sel_name TYPE rsscr_name, + data_type TYPE rollname, + system_field TYPE fieldname, + default_value TYPE string, + label TYPE string, + value_help TYPE abap_bool, + END OF ty_param_properties. + TYPES ty_param_properties_tab TYPE STANDARD TABLE OF ty_param_properties WITH EMPTY KEY. + TYPES: + BEGIN OF ty_ui_annotation, + index TYPE sytabix, + key TYPE string, + value TYPE string, + END OF ty_ui_annotation. + TYPES ty_ui_annotations TYPE SORTED TABLE OF ty_ui_annotation WITH NON-UNIQUE KEY index. + + DATA db_view TYPE viewname16. + DATA progname TYPE progname. + DATA field_properties_tab TYPE ty_field_properties_tab. + DATA param_properties_tab TYPE ty_param_properties_tab. + + METHODS get_extension_parameters + RETURNING VALUE(r_extension_parameters) TYPE zcds_alv_extension_parameters. + + METHODS get_program_name + RETURNING VALUE(r_progname) TYPE progname + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_report_strategy IMPLEMENTATION. + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + TRY. + db_view = to_upper( remove_quotes( entity_annotations[ annoname = 'ABAPCATALOG.SQLVIEWNAME' ]-value ) ). + CATCH cx_sy_itab_line_not_found. + CLEAR db_view. + ENDTRY. + + progname = get_program_name( ). + + " Parameter Annotations + LOOP AT ddic_access->get_parameters_for_cds_view( cds_view ) ASSIGNING FIELD-SYMBOL(). + DATA(param_properties) = VALUE ty_param_properties( ). + param_properties-parname = -parametername. + param_properties-data_type = -rollname. + param_properties-system_field = -systfield. + + LOOP AT parameter_annotations ASSIGNING FIELD-SYMBOL() + WHERE parametername = -parametername. + CASE -annoname. + WHEN 'CONSUMPTION.DEFAULTVALUE'. + param_properties-default_value = remove_quotes( -value ). + + WHEN 'CONSUMPTION.VALUEHELP'. + param_properties-value_help = abap_true. + + WHEN 'ENDUSERTEXT.LABEL'. + param_properties-label = remove_quotes( -value ). + ENDCASE. + + IF -annoname CP 'CONSUMPTION.VALUEHELPDEFINITION.*'. + param_properties-value_help = abap_true. + ENDIF. + ENDLOOP. + + " Selection Texts (from CDS-View-Annotation EndUser.Label or DDIC) + IF param_properties-label IS INITIAL. + CALL FUNCTION 'DDIF_FIELDLABEL_GET' + EXPORTING tabname = param_properties-data_type + IMPORTING label = param_properties-label + EXCEPTIONS OTHERS = 0. + ENDIF. + + APPEND param_properties TO param_properties_tab. + ENDLOOP. + + " Field Annotations + LOOP AT ddfields INTO DATA(ddfield) WHERE fieldname <> '.NODE1'. + " Erlaubte Datentypen für Selektionsbilder + " C Zeichenfolge (Character) + " N Zeichenfolge nur mit Ziffern + " D Datum (Date: JJJJMMTT) + " T Zeitpunkt (Time: HHMMSS) + " X Bytefolge (heXadecimal), in Ddic-Metadaten auch für INT1/2/4 + " I Ganze Zahl (4-Byte Integer mit Vorzeichen) + " b 1-Byte Integer, ganze Zahl <= 254 + " s 2-Byte Integer, nur für Längenfeld vor LCHR oder LRAW + " P Gepackte Zahl (Packed) + " 8 Ganze Zahl (8-Byte Integer mit Vorzeichen) + CONSTANTS allowed_types TYPE c LENGTH 10 VALUE 'CNDTXIbsP8'. + + IF ddfield-inttype NA allowed_types. + CONTINUE. + ENDIF. + + DATA(field_properties) = VALUE ty_field_properties( fieldname = ddfield-fieldname ). + + LOOP AT element_annotations ASSIGNING FIELD-SYMBOL() + WHERE elementname = ddfield-fieldname. + " only remove the index; should be sufficient for now + IF -annoname CP 'UI.SELECTIONFIELD$*$.*'. + SPLIT -annoname AT '$' INTO + DATA(before) DATA(index) DATA(after). + -annoname = |{ before }{ after }|. + ENDIF. + + CASE -annoname. + WHEN 'CONSUMPTION.FILTER.SELECTIONTYPE'. + field_properties-selection_type = -value. + + WHEN 'CONSUMPTION.FILTER.MULTIPLESELECTIONS'. + field_properties-multiple_selections = xsdbool( -value = 'true' ). + + WHEN 'CONSUMPTION.FILTER.MANDATORY'. + field_properties-mandatory = xsdbool( -value = 'true' ). + + WHEN 'CONSUMPTION.FILTER.DEFAULTVALUE'. + field_properties-default_value = remove_quotes( -value ). + + WHEN 'CONSUMPTION.VALUEHELP' OR 'CONSUMPTION.VALUEHELPDEFINITION'. + field_properties-value_help = abap_true. + + WHEN 'CONSUMPTION.HIDDEN'. + field_properties-no_display = xsdbool( -value = 'true' ). + + WHEN 'UI.SELECTIONFIELD.POSITION'. + field_properties-position = -value. + + WHEN 'UI.SELECTIONFIELD.QUALIFIER'. + field_properties-qualifier = -value. + + WHEN 'ENDUSERTEXT.LABEL'. + field_properties-label = remove_quotes( -value ). + ENDCASE. + ENDLOOP. + + IF field_properties-selection_type IS INITIAL. + field_properties-no_display = abap_true. + ENDIF. + + IF field_properties-label IS INITIAL. + field_properties-label = ddfield-scrtext_m. + ENDIF. + + APPEND field_properties TO field_properties_tab. + ENDLOOP. + ENDMETHOD. + + METHOD get_extension_parameters. + r_extension_parameters = VALUE #( FOR x_extension IN persistence->get_report_extensions( cds_view ) + ( LINES OF persistence->get_extension_parameters( x_extension-extension_name ) ) ). + ENDMETHOD. + + METHOD get_program_name. + TRY. + " Vorhandenes Programm suchen + r_progname = persistence->get_report_for_cds_view( cds_view )-progname. + + CATCH zcx_cds_alv_message. + " Noch kein Programm vorhanden + IF db_view IS NOT INITIAL. + r_progname = replace( val = |ZCDS_ALV_V_{ db_view }| sub = '/' with = '_' occ = 0 ). + ELSE. + DATA(number) = persistence->get_next_program_number( cds_view ). + r_progname = |ZCDS_ALV_N_{ sy-mandt }{ number }|. + ENDIF. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_report_strategy~write_source. + DEFINE append_initial_line. + APPEND | | TO r_program-source_lines. + END-OF-DEFINITION. + + DATA source_line LIKE LINE OF r_program-source_lines. + DATA template_name TYPE fieldname. + + " Program Header Info + r_program-progname = progname. + r_program-dynpro = '1001'. + template_name = |_{ cds_view }|. + + " TOP Section + APPEND LINES OF VALUE zcds_alv_source_lines( ( |REPORT { progname }.| ) + ( |TABLES: sscrfields.| ) + ( |DATA: { template_name } TYPE { cds_view }.| ) ) + TO r_program-source_lines. + append_initial_line. + + APPEND LINES OF VALUE zcds_alv_source_lines( ( |CONSTANTS cds_view TYPE ddstrucobjname VALUE '{ cds_view }'.| ) + ( |CONSTANTS title TYPE sytitle VALUE '{ description }'.| ) ) TO r_program-source_lines. + append_initial_line. + + APPEND LINES OF VALUE zcds_alv_source_lines( ( |DATA factory TYPE REF TO zif_cds_alv_factory. | ) + ( |DATA controller TYPE REF TO zif_cds_alv_report_controller.| ) + ( |DATA message TYPE REF TO zcx_cds_alv_message. | ) ) TO r_program-source_lines. + append_initial_line. + + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |SELECTION-SCREEN BEGIN OF SCREEN { r_program-dynpro } AS SUBSCREEN.| ) + ( |SELECTION-SCREEN BEGIN OF BLOCK sub. | ) ) TO r_program-source_lines. + + " View Parameters + DATA parameter_counter TYPE n LENGTH 5. + LOOP AT param_properties_tab ASSIGNING FIELD-SYMBOL(). + parameter_counter = parameter_counter + 1. + -sel_name = CONV rsscr_name( |P__{ parameter_counter }| ). + + source_line = |PARAMETERS { -sel_name } TYPE { -data_type } OBLIGATORY|. + + IF -default_value IS NOT INITIAL. + source_line = |{ source_line } DEFAULT '{ -default_value }'|. + ELSEIF -system_field IS NOT INITIAL. + source_line = |{ source_line } DEFAULT sy-{ -system_field }|. + ENDIF. + + source_line = |{ source_line }.|. + APPEND source_line TO r_program-source_lines. + + INSERT VALUE #( progname = progname + sel_name = -sel_name + cds_view = cds_view + parname = -parname ) + INTO TABLE r_program-parameters. + ENDLOOP. + + " Selection Criteria (from CDS-View-Annotation Consumption.Filter) + DATA(skip) = abap_false. + DATA selection_counter TYPE n LENGTH 5. + SORT field_properties_tab STABLE BY qualifier DESCENDING + position ASCENDING. + LOOP AT field_properties_tab ASSIGNING FIELD-SYMBOL(). + selection_counter = selection_counter + 1. + -sel_name = CONV rsscr_name( |SO_{ selection_counter }| ). + + source_line = |SELECT-OPTIONS { -sel_name } FOR { template_name }-{ -fieldname }|. + + IF -selection_type = selection_type-single. + source_line = |{ source_line } NO INTERVALS|. + ENDIF. + + IF -mandatory = abap_true. + source_line = |{ source_line } OBLIGATORY|. + ENDIF. + + IF -default_value IS NOT INITIAL. + source_line = |{ source_line } DEFAULT '{ -default_value }'|. + ENDIF. + + IF -no_display = abap_true. + source_line = |{ source_line } NO-DISPLAY|. + ELSE. + skip = abap_true. + ENDIF. + + source_line = |{ source_line }.|. + APPEND source_line TO r_program-source_lines. + + AT END OF qualifier. + IF skip = abap_true. + source_line = |SELECTION-SCREEN SKIP.|. + APPEND source_line TO r_program-source_lines. + skip = abap_false. + ENDIF. + ENDAT. + + INSERT VALUE #( progname = progname + sel_name = -sel_name + cds_view = cds_view + fieldname = -fieldname ) + INTO TABLE r_program-select_options. + ENDLOOP. + + " Default parameters + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |PARAMETERS p_maxrec TYPE ddshmaxrec DEFAULT 500 MODIF ID max.| ) + ( |PARAMETERS p_no_max TYPE xfeld USER-COMMAND no_max. | ) + ( |SELECTION-SCREEN SKIP. | ) + ( |PARAMETERS p_selext TYPE zcds_alv_report_extension_name AS LISTBOX visible length 40 USER-COMMAND switch_sel MODIF ID sel.| ) + ( |PARAMETERS p_disext TYPE zcds_alv_report_extension_name AS LISTBOX visible length 40 USER-COMMAND switch_dis MODIF ID dis.| ) + ( |SELECTION-SCREEN SKIP. | ) + ( |PARAMETERS p_vari TYPE slis_vari. | ) + ( |PARAMETERS p_split TYPE xfeld DEFAULT abap_false. | ) + ( |PARAMETERS p_forall TYPE xfeld NO-DISPLAY. | ) + ( |PARAMETERS p_mem_id TYPE zcds_alv_memory_id NO-DISPLAY. | ) + ( |SELECTION-SCREEN SKIP. | ) ) TO r_program-source_lines. + + " Extension parameters + LOOP AT get_extension_parameters( ) INTO DATA(ext_parameter). + APPEND |PARAMETERS { ext_parameter-parameter_name } TYPE { ext_parameter-db_field }.| TO r_program-source_lines. + ENDLOOP. + + " End of Subscreen + APPEND LINES OF VALUE zcds_alv_source_lines( ( |SELECTION-SCREEN END OF BLOCK sub. | ) + ( |SELECTION-SCREEN END OF SCREEN { r_program-dynpro }.| ) ) TO r_program-source_lines. + append_initial_line. + + " Include in main selection screen + APPEND LINES OF VALUE zcds_alv_source_lines( ( |SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-sub.| ) + ( |SELECTION-SCREEN INCLUDE BLOCKS sub. | ) + ( |SELECTION-SCREEN END OF BLOCK main. | ) ) TO r_program-source_lines. + append_initial_line. + + " LOAD-OF-PROGRAM + APPEND LINES OF VALUE zcds_alv_source_lines( ( |LOAD-OF-PROGRAM. | ) + ( | TRY. | ) + ( | factory = zcl_cds_alv_factory=>get_instance( ). | ) + ( | controller = factory->get_report_controller( cds_view ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'A'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + + " INITIALIZATION + APPEND LINES OF VALUE zcds_alv_source_lines( ( |INITIALIZATION. | ) + ( | sy-title = title. | ) + ( | | ) + ( | TRY. | ) + ( | controller->initialization( ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'.| ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + + " AT SELECTION-SCREEN OUTPUT + APPEND LINES OF VALUE zcds_alv_source_lines( ( |AT SELECTION-SCREEN OUTPUT. | ) + ( | TRY. | ) + ( | controller->at_selection_screen_output( ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + + " AT-SELECTION-SCREEN + APPEND LINES OF VALUE zcds_alv_source_lines( ( |AT SELECTION-SCREEN. | ) + ( | TRY. | ) + ( | controller->at_selection_screen( sscrfields-ucomm ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + + " Value help for the initial layout + APPEND LINES OF VALUE zcds_alv_source_lines( ( |AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari. | ) + ( | p_vari = cl_salv_layout_service=>f4_layouts( | ) + ( | s_key = VALUE #( report = sy-repid ) | ) + ( | layout = p_vari )-layout. | ) ) TO r_program-source_lines. + + " Value help (from CDS-View-Annotation Consumption.ValueHelp) + LOOP AT param_properties_tab INTO DATA(param_properties) + WHERE value_help = abap_true. + + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |AT SELECTION-SCREEN ON VALUE-REQUEST FOR { param_properties-sel_name }. | ) + ( | TRY. | ) + ( | controller->at_value_request( | ) + ( | EXPORTING | ) + ( | i_sel_name = '{ param_properties-sel_name }' | ) + ( | CHANGING | ) + ( | c_value = { param_properties-sel_name } ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + ENDLOOP. + + LOOP AT field_properties_tab INTO DATA(field_properties) + WHERE value_help = abap_true AND no_display = abap_false. + + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |AT SELECTION-SCREEN ON VALUE-REQUEST FOR { field_properties-sel_name }-low. | ) + ( | TRY. | ) + ( | controller->at_value_request( | ) + ( | EXPORTING | ) + ( | i_sel_name = '{ field_properties-sel_name }' | ) + ( | CHANGING | ) + ( | c_value = { field_properties-sel_name }-low ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) + ( | | ) + ( |AT SELECTION-SCREEN ON VALUE-REQUEST FOR { field_properties-sel_name }-high.| ) + ( | TRY. | ) + ( | controller->at_value_request( | ) + ( | EXPORTING | ) + ( | i_sel_name = '{ field_properties-sel_name }' | ) + ( | CHANGING | ) + ( | c_value = { field_properties-sel_name }-high ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + ENDLOOP. + + " Help and value help for extension parameters + LOOP AT get_extension_parameters( ) INTO ext_parameter WHERE has_value_help = abap_true. + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |AT SELECTION-SCREEN ON VALUE-REQUEST FOR { ext_parameter-parameter_name }.| ) + ( | TRY. | ) + ( | controller->at_value_request( | ) + ( | EXPORTING | ) + ( | i_sel_name = '{ ext_parameter-parameter_name }' | ) + ( | CHANGING | ) + ( | c_value = { ext_parameter-parameter_name } ). | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + ENDLOOP. + + LOOP AT get_extension_parameters( ) INTO ext_parameter WHERE has_help = abap_true. + APPEND LINES OF VALUE zcds_alv_source_lines( + ( |AT SELECTION-SCREEN ON HELP-REQUEST FOR { ext_parameter-parameter_name }.| ) + ( | TRY. | ) + ( | controller->at_help_request( | ) + ( | i_sel_name = '{ ext_parameter-parameter_name }' | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + append_initial_line. + ENDLOOP. + + " START-OF-SELECTION + APPEND LINES OF VALUE zcds_alv_source_lines( ( |START-OF-SELECTION. | ) + ( | TRY. | ) + ( | controller->start_of_selection( | ) + ( | i_selection = p_selext | ) + ( | i_display = p_disext | ) + ( | i_forall = p_forall | ) + ( | i_memory_id = p_mem_id | ) + ( | i_in_split_screen = p_split ). | ) + ( | | ) + ( | CATCH zcx_cds_alv_message INTO message. | ) + ( | MESSAGE message TYPE 'I' DISPLAY LIKE 'E'. | ) + ( | ENDTRY. | ) ) TO r_program-source_lines. + ENDMETHOD. + + METHOD zif_cds_alv_report_strategy~write_textpool. + LOOP AT field_properties_tab INTO DATA(field_properties). + APPEND VALUE #( id = 'S' + key = field_properties-sel_name + entry = | { condense( field_properties-label ) }| ) + TO r_textpool. + ENDLOOP. + + LOOP AT param_properties_tab INTO DATA(param_properties). + APPEND VALUE #( id = 'S' + key = param_properties-sel_name + entry = | { condense( param_properties-label ) }| ) + TO r_textpool. + ENDLOOP. + + APPEND VALUE #( id = 'I' key = 'SUB' entry = text-i01 ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_MAXREC' entry = | { text-s01 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_NO_MAX' entry = | { text-s02 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_FORALL' entry = | { text-s03 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_MEM_ID' entry = | { text-s04 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_SPLIT' entry = | { text-s05 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_SELEXT' entry = | { text-s06 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_DISEXT' entry = | { text-s07 }| ) TO r_textpool. + APPEND VALUE #( id = 'S' key = 'P_VARI' entry = | { text-s08 }| ) TO r_textpool. + + LOOP AT get_extension_parameters( ) INTO DATA(parameter). + INSERT VALUE #( id = 'S' key = parameter-parameter_name entry = | { parameter-parameter_text }| ) + INTO TABLE r_textpool. + ENDLOOP. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_report_strategy.clas.testclasses.abap b/src/zcl_cds_alv_report_strategy.clas.testclasses.abap new file mode 100644 index 0000000..e7e620d --- /dev/null +++ b/src/zcl_cds_alv_report_strategy.clas.testclasses.abap @@ -0,0 +1,37 @@ +*"* use this source file for your ABAP unit test classes +CLASS ltcl_unit_tests DEFINITION FINAL FOR TESTING + DURATION SHORT + RISK LEVEL HARMLESS. + + PRIVATE SECTION. + CONSTANTS cds_view TYPE ddstrucobjname VALUE 'ZC_CDS_ALV_DEMO'. + + DATA factory TYPE REF TO zif_cds_alv_factory. + DATA cut TYPE REF TO zif_cds_alv_report_strategy. + + METHODS setup. + METHODS write_source_for_demo_view FOR TESTING. +ENDCLASS. + + +CLASS ltcl_unit_tests IMPLEMENTATION. + METHOD setup. + factory = zcl_cds_alv_factory=>get_instance( ). + ENDMETHOD. + + METHOD write_source_for_demo_view. + DATA: message TYPE string, + line TYPE i, + word TYPE string. + + TRY. + cut = factory->get_generation_strategy( i_cds_view = cds_view ). + DATA(program) = cut->write_source( ). + SYNTAX-CHECK FOR program-source_lines MESSAGE message LINE line WORD word PROGRAM 'ZCDS_ALV_DEMO'. + cl_abap_unit_assert=>assert_initial( act = message msg = message ). + CATCH zcx_cds_alv_message INTO DATA(exception). + cl_abap_unit_assert=>fail( msg = exception->get_text( ) ). + ENDTRY. + ENDMETHOD. + +ENDCLASS. diff --git a/src/zcl_cds_alv_report_strategy.clas.xml b/src/zcl_cds_alv_report_strategy.clas.xml new file mode 100644 index 0000000..e29ac0a --- /dev/null +++ b/src/zcl_cds_alv_report_strategy.clas.xml @@ -0,0 +1,134 @@ + + + + + + ZCL_CDS_ALV_REPORT_STRATEGY + D + Standardgenerierungsstrategie für Reports zu CDS-Views + 1 + X + X + X + X + + + + I + I01 + Selektionskriterien + 29 + + + I + S01 + Anzahl beschränken auf + 44 + + + I + S02 + Keine Beschränkung + 28 + + + I + S03 + Aufruf mit FORALL-Tabelle + 50 + + + I + S04 + Memory-ID + 19 + + + I + S05 + Anzeige im Split-Screen + 46 + + + I + S06 + Selektionsmodus + 25 + + + I + S07 + Anzeigemodus + 22 + + + I + S08 + Layout + 16 + + + + + E + + + I + I01 + Selection criteria + 29 + + + I + S01 + Maximum number of records + 44 + + + I + S02 + No restriction + 28 + + + I + S03 + called with FORALL table + 50 + + + I + S04 + Memory ID + 19 + + + I + S05 + Display in split screen + 46 + + + I + S06 + Selection mode + 25 + + + I + S07 + Display mode + 22 + + + I + S08 + Layout + 16 + + + + + + + diff --git a/src/zcl_cds_alv_sadl_mapping_prov.clas.abap b/src/zcl_cds_alv_sadl_mapping_prov.clas.abap new file mode 100644 index 0000000..83d7c06 --- /dev/null +++ b/src/zcl_cds_alv_sadl_mapping_prov.clas.abap @@ -0,0 +1,92 @@ +CLASS zcl_cds_alv_sadl_mapping_prov DEFINITION PUBLIC INHERITING FROM cl_sadl_mp_entity FINAL CREATE PUBLIC. + PUBLIC SECTION. + METHODS constructor + IMPORTING i_entity TYPE REF TO if_sadl_entity + RAISING cx_bsa_compile_time. + + PROTECTED SECTION. + METHODS get_sadl_definition REDEFINITION. + + PRIVATE SECTION. + DATA entity TYPE REF TO if_sadl_entity. + + METHODS build_sadl_definition + RAISING cx_bsa_compile_time. + + METHODS convert_id + IMPORTING i_name TYPE string + RETURNING VALUE(r_name) TYPE string. +ENDCLASS. + + + +CLASS ZCL_CDS_ALV_SADL_MAPPING_PROV IMPLEMENTATION. + + + METHOD build_sadl_definition. + TRY. + " The Mapping Provider is the key to gaining access to the SADL framework. + " This method encapsulates the definition of the mapping provider. + " It is meant to be the single point of truth that needs to be maintained to ensure access th the SADL framework. + " This particular implementation was initially created as copy of the method CL_SADL_ENTITY_UTIL=>GET_SADL_FOR_ENTITY. + " That method served as a reliable way to access the SADL framework in SAP Release 7.50, but does not exist in later releases. + DATA(entity_id) = entity->get_id( ). + DATA(entity_type) = entity->get_type( ). + DATA(id) = convert_id( CONV #( entity_id ) ). + +* " There is a known incompatibility between CDS View with parameters and virtual elements +* " Therefore the property 'exposure' is only set when the CDS view has no parameters +* entity->get_parameters( IMPORTING et_parameters = DATA(parameters) ). +* IF lines( parameters ) = 0. +* DATA(exposure) = 'TRUE'. +* ENDIF. + + " SADL definition according to CL_SADL_ENTITY_UTIL=>GET_SADL_FOR_ENTITY. + INSERT VALUE #( name = id type = entity_type binding = entity_id ) INTO TABLE ms_sadl_definition-data_sources. + INSERT VALUE #( name = id anchor = abap_true data_source = id max_edit_mode = 'RO' id = id ) INTO TABLE ms_sadl_definition-structures. + INSERT VALUE #( name = 'SADL_QUERY' structure_id = id id = 'QUERY' ) INTO TABLE ms_sadl_definition-mapped_queries ASSIGNING FIELD-SYMBOL(). + DATA(entity_consumption_info) = cl_sadl_entity_factory=>get_instance( )->get_entity_consumption_info( iv_id = entity_id iv_type = entity_type ). + entity_consumption_info->get_elements( IMPORTING et_elements = DATA(elements) ). + LOOP AT elements ASSIGNING FIELD-SYMBOL(). + DATA(tabix) = sy-tabix. + INSERT VALUE #( name = -name binding = -name structure_id = id id = 'X' && tabix ) INTO TABLE ms_sadl_definition-attributes. + IF -text_search-allowed = abap_true. + READ TABLE -input_parameters WITH KEY type = 'SEARCH_TEXT' ASSIGNING FIELD-SYMBOL(). + IF sy-subrc <> 0. + APPEND VALUE #( id = 'SEARCH' name = 'SEARCH_TEXT' type = 'SEARCH_TEXT' ) TO -input_parameters ASSIGNING . + ENDIF. + APPEND VALUE #( ip_id = 'SEARCH' binding = -name ) TO -attributes. + ENDIF. + ENDLOOP. + + CATCH cx_sadl_static INTO DATA(previous). + RAISE EXCEPTION TYPE cx_bsa_compile_time + EXPORTING textid = cx_bsa_compile_time=>cx_previous + previous = previous. + ENDTRY. + ENDMETHOD. + + + METHOD constructor. + GET TIME STAMP FIELD DATA(timestamp). + DATA(uuid) = CONV if_sadl_types=>ty_uuid( |ZCDS_ALV:{ i_entity->get_id( ) }| ). + super->constructor( iv_uuid = uuid iv_timestamp = timestamp ). + entity = i_entity. + ENDMETHOD. + + + METHOD convert_id. + r_name = i_name. + REPLACE '~' IN r_name WITH '_'. + REPLACE ALL OCCURRENCES OF '/' IN r_name WITH 'x'. + ENDMETHOD. + + + METHOD get_sadl_definition. + IF ms_sadl_definition IS INITIAL. + build_sadl_definition( ). + ENDIF. + + rs_sadl_definition = ms_sadl_definition. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_sadl_mapping_prov.clas.xml b/src/zcl_cds_alv_sadl_mapping_prov.clas.xml new file mode 100644 index 0000000..7ae2f3b --- /dev/null +++ b/src/zcl_cds_alv_sadl_mapping_prov.clas.xml @@ -0,0 +1,24 @@ + + + + + + ZCL_CDS_ALV_SADL_MAPPING_PROV + D + SADL Mapping Provider + 1 + X + X + X + + + + CONSTRUCTOR + CX_BSA_COMPILE_TIME + D + Design time exception during SADL load generation + + + + + diff --git a/src/zcl_cds_alv_selection.clas.abap b/src/zcl_cds_alv_selection.clas.abap new file mode 100644 index 0000000..43fd71f --- /dev/null +++ b/src/zcl_cds_alv_selection.clas.abap @@ -0,0 +1,204 @@ +CLASS zcl_cds_alv_selection DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_selection. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + TYPES ty_sadl_condition_providers TYPE STANDARD TABLE OF REF TO if_sadl_condition_provider WITH EMPTY KEY. + + DATA: BEGIN OF last_request, + exists TYPE abap_bool, + parameters TYPE if_sadl_query_engine_types=>ty_parameters, + paging TYPE if_sadl_query_engine_types=>ty_paging, + requested TYPE if_sadl_query_engine_types=>ty_requested, + sadl_condition_providers TYPE ty_sadl_condition_providers, + END OF last_request. + + METHODS evaluate_annotations REDEFINITION. + + METHODS save_request + IMPORTING i_parameters TYPE if_sadl_query_engine_types=>ty_parameters OPTIONAL + i_paging TYPE if_sadl_query_engine_types=>ty_paging OPTIONAL + i_requested TYPE if_sadl_query_engine_types=>ty_requested OPTIONAL + i_sadl_condition_providers TYPE ty_sadl_condition_providers OPTIONAL. + + METHODS get_last_request + EXPORTING e_exists TYPE abap_bool + e_parameters TYPE if_sadl_query_engine_types=>ty_parameters + e_paging TYPE if_sadl_query_engine_types=>ty_paging + e_requested TYPE if_sadl_query_engine_types=>ty_requested + e_sadl_condition_providers TYPE ty_sadl_condition_providers. + + PRIVATE SECTION. +ENDCLASS. + + + +CLASS zcl_cds_alv_selection IMPLEMENTATION. + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + " TODO: Custom implementation for virtual elements + ENDMETHOD. + + METHOD get_last_request. + e_exists = last_request-exists. + e_parameters = last_request-parameters. + e_paging = last_request-paging. + e_requested = last_request-requested. + e_sadl_condition_providers = last_request-sadl_condition_providers. + ENDMETHOD. + + METHOD save_request. + last_request-exists = abap_true. + last_request-parameters = i_parameters. + last_request-paging = i_paging. + last_request-requested = i_requested. + last_request-sadl_condition_providers = i_sadl_condition_providers. + ENDMETHOD. + + METHOD zif_cds_alv_selection~perform_reselection. + get_last_request( IMPORTING e_exists = DATA(exists) + e_parameters = DATA(parameters) + e_paging = DATA(paging) + e_requested = DATA(requested) + e_sadl_condition_providers = DATA(sadl_condition_providers) ). + + IF exists = abap_false. + RETURN. + ENDIF. + + TRY. + DATA(sadl_runtime) = ddic_access->get_sadl_runtime( cds_view ). + + LOOP AT sadl_condition_providers INTO DATA(sadl_condition_provider). + sadl_runtime->if_sadl_query_fetch~register_condition_provider( sadl_condition_provider ). + ENDLOOP. + + sadl_runtime->fetch( EXPORTING is_requested = requested + is_paging = paging + is_parameters = parameters + IMPORTING et_data_rows = c_result_table ). + + CATCH cx_sadl_static cx_sadl_contract_violation INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_selection~perform_selection. + CLEAR: e_result_table, + e_number_all_hits. + + TRY. + DATA(alv_parameters) = i_condition_provider->get_parameters( ). + IF alv_parameters IS NOT INITIAL. + DATA(parameters) = VALUE if_sadl_query_engine_types=>ty_parameters( + entity = VALUE #( ( entity_alias = cl_sadl_entity_util=>convert( CONV #( cds_view ) ) + parameters = CORRESPONDING #( alv_parameters MAPPING name = parname ) ) ) ). + ENDIF. + + i_condition_provider->get_selections( IMPORTING e_field_ranges = DATA(field_ranges) + e_maxrec = DATA(max_records) ). + + DATA(sadl_condition_providers) = VALUE ty_sadl_condition_providers( + FOR field_range IN field_ranges + ( cl_sadl_cond_prov_factory_pub=>create_basic_condition_factory( + )->in_range( + name = CONV #( field_range-fieldname ) + t_ranges = CORRESPONDING #( field_range-selopt_t ) ) ) ). + + DATA(paging) = VALUE if_sadl_query_engine_types=>ty_paging( maximum_rows = max_records ). + + DATA(ddfields) = ddic_access->get_ddic_fields_for_cds_view( cds_view ). + DATA(elements) = VALUE if_sadl_query_engine_types=>tt_requested_elements( FOR ddfield IN ddfields + ( CONV #( ddfield-fieldname ) ) ). + + DATA(requested) = VALUE if_sadl_query_engine_types=>ty_requested( elements = elements + fill_data = abap_true + fill_number_all_hits = abap_true ). + + " Selection via Runtime + DATA(sadl_runtime) = ddic_access->get_sadl_runtime( cds_view ). + + LOOP AT sadl_condition_providers INTO DATA(sadl_condition_provider). + sadl_runtime->if_sadl_query_fetch~register_condition_provider( sadl_condition_provider ). + ENDLOOP. + + sadl_runtime->fetch( EXPORTING is_paging = paging + is_parameters = parameters + is_requested = requested + IMPORTING et_data_rows = e_result_table + ev_number_all_hits = e_number_all_hits ). + + " save parameters for reselection + save_request( i_parameters = parameters + i_paging = paging + i_requested = requested + i_sadl_condition_providers = sadl_condition_providers ). + + CATCH cx_sadl_static cx_sadl_contract_violation INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. + + METHOD zif_cds_alv_selection~perform_selection_forall. + TRY. + DATA(parameters) = VALUE if_sadl_query_engine_types=>ty_parameters( + entity = VALUE #( + ( entity_alias = cl_sadl_entity_util=>convert( CONV #( cds_view ) ) + parameters = CORRESPONDING #( i_condition_provider->get_parameters( ) MAPPING name = parname ) ) ) ). + + DATA(sadl_condition_provider) = NEW lcl_sadl_cond_provider_forall( i_ddic_access = ddic_access + i_source_view = i_source_view + i_association_name = i_association_name + i_source_parameters = i_source_parameters + i_forall_table = i_forall_table ). + + DATA(sadl_condition_providers) = VALUE ty_sadl_condition_providers( ( sadl_condition_provider ) ). + + DATA(ddfields) = ddic_access->get_ddic_fields_for_cds_view( cds_view ). + DATA(elements) = VALUE if_sadl_query_engine_types=>tt_requested_elements( FOR ddfield IN ddfields + ( CONV #( ddfield-fieldname ) ) ). + + DATA(requested) = VALUE if_sadl_query_engine_types=>ty_requested( elements = elements + fill_data = abap_true + fill_number_all_hits = abap_true ). + + " Selection via Runtime + DATA(sadl_runtime) = ddic_access->get_sadl_runtime( cds_view ). + + sadl_runtime->if_sadl_query_fetch~register_condition_provider( sadl_condition_provider ). + + sadl_runtime->fetch( EXPORTING is_parameters = parameters + is_requested = requested + IMPORTING et_data_rows = e_result_table + ev_number_all_hits = e_number_all_hits ). + + " save parameters for reselection + save_request( i_parameters = parameters + i_requested = requested + i_sadl_condition_providers = sadl_condition_providers ). + + CATCH cx_sadl_static cx_sadl_contract_violation INTO DATA(previous). + RAISE EXCEPTION TYPE zcx_cds_alv_message + EXPORTING previous = previous. + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_selection.clas.locals_imp.abap b/src/zcl_cds_alv_selection.clas.locals_imp.abap new file mode 100644 index 0000000..8bd54f7 --- /dev/null +++ b/src/zcl_cds_alv_selection.clas.locals_imp.abap @@ -0,0 +1,133 @@ +CLASS lcl_sadl_cond_provider_forall DEFINITION + FINAL + CREATE PUBLIC . + + PUBLIC SECTION. + INTERFACES if_sadl_condition_provider . + + METHODS constructor + IMPORTING + !i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + !i_source_view TYPE ddstrucobjname + !i_association_name TYPE ddassociationname + !i_source_parameters TYPE zcds_alv_parameters + !i_forall_table TYPE STANDARD TABLE . + + PROTECTED SECTION. + PRIVATE SECTION. + DATA ddic_access TYPE REF TO zif_cds_alv_ddic_access. + DATA source_view TYPE ddstrucobjname . + DATA association_name TYPE ddassociationname . + DATA source_parameters TYPE zcds_alv_parameters . + DATA forall_table TYPE REF TO data . +ENDCLASS. + +CLASS lcl_sadl_cond_provider_forall IMPLEMENTATION. + METHOD constructor. + ddic_access = i_ddic_access. + source_view = i_source_view. + association_name = i_association_name. + source_parameters = i_source_parameters. + forall_table = REF #( i_forall_table ). + ENDMETHOD. + + + METHOD if_sadl_condition_provider~get_condition. + FIELD-SYMBOLS: TYPE STANDARD TABLE, + TYPE dd05bv, + TYPE dd05bv. + + CLEAR et_sadl_condition. + + ASSIGN forall_table->* TO . + + TRY. + ddic_access->get_conditions_for_association( + EXPORTING + i_source_view = source_view + i_association_name = association_name + IMPORTING + e_target_view = DATA(target_view) + e_dd05bv_tab = DATA(dd05bv_tab) ). + + CATCH zcx_cds_alv_message. + RAISE EXCEPTION TYPE cx_sadl_contract_violation + EXPORTING + textid = cx_sadl_contract_violation=>entity_not_found + name = CONV #( source_view ). + ENDTRY. + + LOOP AT ASSIGNING FIELD-SYMBOL(). + DATA(outer_tabix) = sy-tabix. + SORT dd05bv_tab BY fdposition ASCENDING. + UNASSIGN . + + LOOP AT dd05bv_tab ASSIGNING . + DATA(inner_tabix) = sy-tabix. + DATA(range) = VALUE sabp_s_range_option( ). + + CASE -side_info. + WHEN '01'. " Source element + ASSIGN COMPONENT -fieldname OF STRUCTURE TO FIELD-SYMBOL(). + range-sign = 'I'. + range-option = -operator. + range-low = . + + WHEN '11'. " Target element + + WHEN 'L1'. " Literal + range-sign = 'I'. + range-option = -operator. + range-low = -fieldname. + range-low = replace( val = range-low sub = `'` with = `` occ = 1 ). + range-low = replace( val = range-low sub = `'` with = `` occ = -1 ). + + WHEN 'P1'. " Parameter + DATA(parname) = substring_after( val = -fieldname sub = '$' ). + READ TABLE source_parameters INTO DATA(source_parameter) + WITH TABLE KEY cds_view = source_view parname = parname. + IF sy-subrc = 0. + range-sign = 'I'. + range-option = -operator. + range-low = source_parameter-value. + ENDIF. + + WHEN 'S1'. " Session variable + DATA(session_variable) = substring_after( val = -fieldname sub = `$SESSION.` ). + range-sign = 'I'. + range-option = -operator. + range-low = SWITCH #( session_variable + WHEN `SYSTEM_DATE` THEN sy-datum + WHEN `SYSTEM_TIME` THEN sy-uzeit + WHEN `SYSTEM_LANGUAGE` THEN sy-langu + WHEN `CLIENT` THEN sy-mandt + WHEN `USER` THEN sy-uname ). + ENDCASE. + + IF range IS INITIAL. + CONTINUE. + ENDIF. + + cl_sadl_condition_generator=>append_sadl_condition( + EXPORTING + iv_attribute = CONV #( -fieldname_t ) + iv_option = range-option + iv_low = range-low + CHANGING + ct_sadl_conditions = et_sadl_condition ). + + IF IS ASSIGNED AND -and_or = 'AND'. + APPEND VALUE #( type = if_sadl_query_engine_types=>co_condition_types-and ) TO et_sadl_condition. + ELSEIF IS ASSIGNED AND -and_or = 'OR'. + APPEND VALUE #( type = if_sadl_query_engine_types=>co_condition_types-or ) TO et_sadl_condition. + ENDIF. + + READ TABLE dd05bv_tab INDEX inner_tabix ASSIGNING . + ENDLOOP. + + IF outer_tabix > 1. + APPEND VALUE #( type = if_sadl_query_engine_types=>co_condition_types-or ) TO et_sadl_condition. + ENDIF. + ENDLOOP. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_selection.clas.xml b/src/zcl_cds_alv_selection.clas.xml new file mode 100644 index 0000000..d340300 --- /dev/null +++ b/src/zcl_cds_alv_selection.clas.xml @@ -0,0 +1,16 @@ + + + + + + ZCL_CDS_ALV_SELECTION + D + Selektion aus einem CDS-View + 1 + X + X + X + + + + diff --git a/src/zcl_cds_alv_selection_screen.clas.abap b/src/zcl_cds_alv_selection_screen.clas.abap new file mode 100644 index 0000000..95a5675 --- /dev/null +++ b/src/zcl_cds_alv_selection_screen.clas.abap @@ -0,0 +1,450 @@ +CLASS zcl_cds_alv_selection_screen DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_condition_provider. + INTERFACES zif_cds_alv_selection_screen. + + ALIASES read_selection_screen FOR zif_cds_alv_selection_screen~read_selection_screen. + ALIASES get_dynpro_field FOR zif_cds_alv_selection_screen~get_dynpro_field. + ALIASES get_selections FOR zif_cds_alv_selection_screen~get_selections. + ALIASES get_parameters FOR zif_cds_alv_selection_screen~get_parameters. + + CLASS-METHODS class_constructor. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + i_value_help TYPE REF TO zif_cds_alv_value_help OPTIONAL + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + TYPES ty_rsparamsl_255_tab TYPE STANDARD TABLE OF rsparamsl_255 WITH EMPTY KEY. + TYPES ty_selection_texts TYPE STANDARD TABLE OF rsseltexts WITH NON-UNIQUE DEFAULT KEY. + + CONSTANTS: BEGIN OF kind, + parameter TYPE rsscr_kind VALUE 'P' ##NO_TEXT, + select_option TYPE rsscr_kind VALUE 'S' ##NO_TEXT, + END OF kind. + CONSTANTS: BEGIN OF sign, + no_extensions TYPE raldb_sign VALUE 'N' ##NO_TEXT, + all TYPE raldb_sign VALUE '*' ##NO_TEXT, + include TYPE raldb_sign VALUE 'I' ##NO_TEXT, + exclude TYPE raldb_sign VALUE 'E' ##NO_TEXT, + END OF sign. + CONSTANTS: BEGIN OF selection_type, + interval TYPE rsrest_opl VALUE '#INTERVAL' ##NO_TEXT, + range TYPE rsrest_opl VALUE '#RANGE' ##NO_TEXT, + single TYPE rsrest_opl VALUE '#SINGLE' ##NO_TEXT, + END OF selection_type. + + CLASS-DATA st_options_tab TYPE sscr_opt_list_tab. + + DATA title TYPE sytitle. + DATA progname TYPE progname. + DATA selection_table TYPE ty_rsparamsl_255_tab. + DATA selection_mappings TYPE zcds_alv_selopts_mapping_tab. + DATA parameter_mappings TYPE zcds_alv_parameter_mapping_tab. + DATA restriction TYPE sscr_restrict. + DATA selection_texts TYPE ty_selection_texts. + DATA value_help TYPE REF TO zif_cds_alv_value_help. + + METHODS evaluate_annotations REDEFINITION. + + PRIVATE SECTION. + CONSTANTS: BEGIN OF fixed_parameters, + max_records TYPE rsscr_name VALUE 'P_MAXREC', + no_max TYPE rsscr_name VALUE 'P_NO_MAX', + selection TYPE rsscr_name VALUE 'P_SELEXT', + display TYPE rsscr_name VALUE 'P_DISEXT', + split TYPE rsscr_name VALUE 'P_SPLIT', + END OF fixed_parameters. + + CONSTANTS: BEGIN OF modif_id, + max TYPE screen-group1 VALUE 'MAX' ##NO_TEXT, + sel TYPE screen-group1 VALUE 'SEL' ##NO_TEXT, + dis TYPE screen-group1 VALUE 'DIS' ##NO_TEXT, + END OF modif_id. + + CONSTANTS default_maxrec TYPE ddshmaxrec VALUE 500 ##NO_TEXT. + + METHODS set_new_selections + RAISING zcx_cds_alv_message. +ENDCLASS. + + + +CLASS zcl_cds_alv_selection_screen IMPLEMENTATION. + METHOD class_constructor. + st_options_tab = VALUE #( ( name = selection_type-single + options = VALUE #( eq = abap_true ) ) + + ( name = selection_type-interval + options = VALUE #( eq = abap_true + bt = abap_true ) ) + + ( name = selection_type-range + options = VALUE #( bt = abap_true + cp = abap_true + eq = abap_true + ge = abap_true + gt = abap_true + le = abap_true + lt = abap_true + nb = abap_true + ne = abap_true + np = abap_true ) ) ). + ENDMETHOD. + + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + + value_help = i_value_help. + + DATA(program) = persistence->get_report_for_cds_view( cds_view ). + + progname = program-progname. + parameter_mappings = program-parameters. + selection_mappings = program-select_options. + + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + title = description. + + LOOP AT element_annotations ASSIGNING FIELD-SYMBOL() + GROUP BY -elementname. + + TYPES: BEGIN OF ty_field_properties, + selection_type TYPE string, + multiple_selections TYPE abap_bool, + mandatory TYPE abap_bool, + default_value TYPE string, + label TYPE string, + END OF ty_field_properties. + + DATA(fieldname) = CONV fieldname( -elementname ). + DATA(properties) = VALUE ty_field_properties( ). + + LOOP AT GROUP ASSIGNING FIELD-SYMBOL(). + CASE -annoname. + WHEN 'CONSUMPTION.FILTER.SELECTIONTYPE'. + properties-selection_type = -value. + + WHEN 'CONSUMPTION.FILTER.MULTIPLESELECTIONS'. + properties-multiple_selections = xsdbool( -value = 'true' ). + + WHEN 'CONSUMPTION.FILTER.MANDATORY'. + properties-mandatory = xsdbool( -value = 'true' ). + + WHEN 'CONSUMPTION.FILTER.DEFAULTVALUE'. + properties-default_value = -value. + + WHEN 'ENDUSERTEXT.LABEL'. + properties-label = remove_quotes( -value ). + ENDCASE. + ENDLOOP. + + TRY. + DATA(sel_name) = selection_mappings[ cds_view = cds_view fieldname = fieldname ]-sel_name. "#EC CI_HASHSEQ + + IF properties-selection_type IS NOT INITIAL. + INSERT VALUE #( name = sel_name kind = kind-select_option ) + INTO TABLE restriction-ass_tab ASSIGNING FIELD-SYMBOL(). + + " The options list are named after the annotation values + -op_addy = properties-selection_type. + -op_main = properties-selection_type. + + IF properties-selection_type = selection_type-range. + -sg_addy = sign-all. + -sg_main = sign-all. + ELSE. + -sg_addy = sign-include. + -sg_main = sign-include. + ENDIF. + + IF properties-multiple_selections = abap_false. + -sg_addy = sign-no_extensions. + ENDIF. + ENDIF. + + " Labels (from annotation EndUserText.Label) + IF properties-label IS NOT INITIAL. + INSERT VALUE #( kind = 'S' + name = sel_name + text = condense( properties-label ) ) + INTO TABLE selection_texts. + ELSE. + READ TABLE ddfields INTO DATA(ddfield) + WITH KEY fieldname = fieldname. + IF sy-subrc = 0. + INSERT VALUE #( kind = 'S' + name = sel_name + text = condense( ddfield-scrtext_m ) ) + INTO TABLE selection_texts. + ENDIF. + ENDIF. + + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDLOOP. + ENDMETHOD. + + METHOD set_new_selections. + CALL FUNCTION 'SELTAB_2_SELOPTS_255' + EXPORTING program = progname + TABLES seltab = selection_table + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_condition_provider~get_parameters. + LOOP AT parameter_mappings INTO DATA(parameter_mapping). + READ TABLE selection_table INTO DATA(selection) + WITH KEY selname = parameter_mapping-sel_name. + IF sy-subrc = 0. + INSERT VALUE #( cds_view = cds_view + parname = parameter_mapping-parname + value = selection-low ) + INTO TABLE r_parameters. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD zif_cds_alv_condition_provider~get_selections. + CLEAR: e_where_tab, + e_field_ranges, + e_maxrec, + e_no_max. + + LOOP AT selection_table INTO DATA(selection) WHERE kind = kind-select_option. + READ TABLE selection_mappings INTO DATA(selection_mapping) + WITH TABLE KEY progname = progname sel_name = selection-selname. + IF sy-subrc <> 0. + CONTINUE. + ENDIF. + + READ TABLE e_field_ranges ASSIGNING FIELD-SYMBOL() + WITH KEY fieldname = selection_mapping-fieldname. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO e_field_ranges ASSIGNING . + -fieldname = selection_mapping-fieldname. + ENDIF. + + IF selection-sign IS NOT INITIAL AND selection-option IS NOT INITIAL. + APPEND CORRESPONDING #( selection ) TO -selopt_t. + ENDIF. + ENDLOOP. + + DATA(field_ranges) = VALUE rsds_trange( ( tablename = cds_view frange_t = e_field_ranges ) ). + DATA(where_clauses) = VALUE rsds_twhere( ). + + CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE' + EXPORTING field_ranges = field_ranges + IMPORTING where_clauses = where_clauses. + + TRY. + e_where_tab = where_clauses[ tablename = cds_view ]-where_tab. + CATCH cx_sy_itab_line_not_found. + CLEAR e_where_tab. + ENDTRY. + + TRY. + e_no_max = selection_table[ kind = kind-parameter selname = fixed_parameters-no_max ]-low. + CATCH cx_sy_itab_line_not_found. + e_no_max = abap_false. + ENDTRY. + + IF e_no_max = abap_true. + e_maxrec = 0. + ELSE. + TRY. + e_maxrec = selection_table[ kind = kind-parameter selname = fixed_parameters-max_records ]-low. + CATCH cx_sy_itab_line_not_found. + e_maxrec = default_maxrec. + ENDTRY. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~apply_restriction. + CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' + EXPORTING program = progname + restriction = restriction + EXCEPTIONS too_late = 0 + repeated = 0 + selopt_without_options = 1 + selopt_without_signs = 2 + invalid_sign = 3 + empty_option_list = 4 + invalid_kind = 5 + repeated_kind_a = 6 + OTHERS = 7. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~apply_selection_texts. + CALL FUNCTION 'SELECTION_TEXTS_MODIFY' + EXPORTING program = progname + TABLES seltexts = selection_texts + EXCEPTIONS program_not_found = 1 + program_cannot_be_generated = 2 + OTHERS = 3. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~get_dynpro_field. + CLEAR: e_parameter, + e_select_options. + + LOOP AT selection_table INTO DATA(selection) + WHERE selname = i_sel_name. + + CASE selection-kind. + WHEN kind-parameter. + e_parameter = selection-low. + WHEN kind-select_option. + APPEND CORRESPONDING #( selection ) TO e_select_options. + ENDCASE. + ENDLOOP. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~modify_screen. + read_selection_screen( ). + + DATA(selection_values) = VALUE vrm_values( FOR x_selection IN persistence->get_report_extensions( i_cds_view = cds_view i_only_selection = abap_true ) + ( key = x_selection-extension_name text = x_selection-selection_text ) ). + + IF selection_values IS NOT INITIAL. + INSERT VALUE #( key = space text = text-sel ) INTO selection_values INDEX 1. + ENDIF. + + CALL FUNCTION 'VRM_SET_VALUES' + EXPORTING id = CONV vrm_id( fixed_parameters-selection ) + values = selection_values + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + CLEAR selection_values. + ENDIF. + + DATA(display_values) = VALUE vrm_values( FOR x_display IN persistence->get_report_extensions( i_cds_view = cds_view i_only_display = abap_true ) + ( key = x_display-extension_name text = x_display-display_text ) ). + + IF display_values IS NOT INITIAL. + INSERT VALUE #( key = space text = text-dis ) INTO display_values INDEX 1. + ENDIF. + + CALL FUNCTION 'VRM_SET_VALUES' + EXPORTING id = CONV vrm_id( fixed_parameters-display ) + values = display_values + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + CLEAR display_values. + ENDIF. + + TRY. + DATA(no_max) = CONV abap_bool( selection_table[ selname = fixed_parameters-no_max ]-low ). + CATCH cx_sy_itab_line_not_found. + no_max = abap_false. + ENDTRY. + + DATA(alternative_display) = VALUE zcds_alv_report_extension_name( ). + get_dynpro_field( EXPORTING i_sel_name = fixed_parameters-display + IMPORTING e_parameter = alternative_display ). + + LOOP AT SCREEN. + CASE screen-group1. + WHEN modif_id-max. + screen-input = SWITCH #( no_max + WHEN abap_true THEN '0' + WHEN abap_false THEN '1' ). + WHEN modif_id-sel. + screen-active = COND #( WHEN selection_values IS INITIAL THEN '0' ELSE '1' ). + WHEN modif_id-dis. + screen-active = COND #( WHEN display_values IS INITIAL THEN '0' ELSE '1' ). + ENDCASE. + + IF screen-name = fixed_parameters-split. + screen-input = COND #( WHEN alternative_display IS INITIAL THEN '1' ELSE '0' ). + ENDIF. + + MODIFY SCREEN. + ENDLOOP. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~read_selection_screen. + DATA rsparams_tab TYPE rsparams_tt. + + rsparams_tab = CORRESPONDING #( selection_table ). + CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS' + EXPORTING curr_report = progname + TABLES selection_table = rsparams_tab + selection_table_255 = selection_table + EXCEPTIONS OTHERS = 1. + IF sy-subrc <> 0. + RAISE EXCEPTION TYPE zcx_cds_alv_message + MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno + WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. + ENDIF. + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~set_dynpro_field. + IF i_parameter IS NOT INITIAL. + selection_table[ selname = i_sel_name ]-low = i_parameter. + ELSEIF i_select_options IS NOT INITIAL. + DELETE selection_table WHERE selname = i_sel_name. + LOOP AT i_select_options INTO DATA(select_option). + INSERT CORRESPONDING #( BASE ( VALUE #( selname = i_sel_name kind = 'S' ) ) select_option ) + INTO TABLE selection_table. + ENDLOOP. + ENDIF. + + set_new_selections( ). + ENDMETHOD. + + METHOD zif_cds_alv_selection_screen~value_help_for_field. + IF value_help IS NOT BOUND. + RETURN. + ENDIF. + + TRY. + DATA(fieldname) = selection_mappings[ progname = progname sel_name = i_sel_name ]-fieldname. + + get_selections( IMPORTING e_field_ranges = DATA(field_ranges) ). + DATA(parameters) = get_parameters( ). + + value_help->value_help_for_element( EXPORTING i_fieldname = fieldname + i_parameters = parameters + i_field_ranges = field_ranges + CHANGING c_value = c_value ). + CATCH cx_sy_itab_line_not_found. + ENDTRY. + + TRY. + DATA(parameter_name) = parameter_mappings[ progname = progname sel_name = i_sel_name ]-parname. + + value_help->value_help_for_parameter( EXPORTING i_parname = parameter_name + CHANGING c_value = c_value ). + + CATCH cx_sy_itab_line_not_found. + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_cds_alv_selection_screen.clas.xml b/src/zcl_cds_alv_selection_screen.clas.xml new file mode 100644 index 0000000..d87aee2 --- /dev/null +++ b/src/zcl_cds_alv_selection_screen.clas.xml @@ -0,0 +1,49 @@ + + + + + + ZCL_CDS_ALV_SELECTION_SCREEN + D + Viewklasse für Selection-Screens + 1 + X + X + X + + + + I + DIS + Anzeige im ALV-Grid + 100 + + + I + SEL + Selektion von der Datenbank + 100 + + + + + E + + + I + DIS + Display in alv grid + 100 + + + I + SEL + Select from database + 100 + + + + + + + diff --git a/src/zcl_cds_alv_table_container.clas.abap b/src/zcl_cds_alv_table_container.clas.abap new file mode 100644 index 0000000..08bf4bd --- /dev/null +++ b/src/zcl_cds_alv_table_container.clas.abap @@ -0,0 +1,283 @@ +CLASS zcl_cds_alv_table_container DEFINITION PUBLIC INHERITING FROM zcl_cds_alv_base CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES zif_cds_alv_table_container. + + METHODS constructor + IMPORTING i_cds_view TYPE ddstrucobjname + i_ddic_access TYPE REF TO zif_cds_alv_ddic_access + i_persistence TYPE REF TO zif_cds_alv_persistence + i_memory TYPE REF TO zif_cds_alv_memory + i_factory TYPE REF TO zif_cds_alv_factory + RAISING zcx_cds_alv_message. + + PROTECTED SECTION. + CONSTANTS: BEGIN OF default_fieldname, + box TYPE fieldname VALUE 'ALV_MARK', + style TYPE fieldname VALUE 'ALV_STYLE', + color TYPE fieldname VALUE 'ALV_COLOR', + count TYPE fieldname VALUE 'ALV_COUNT', + index TYPE fieldname VALUE 'ALV_INDEX', + system TYPE fieldname VALUE 'ALV_SYSTEM', + client TYPE fieldname VALUE 'ALV_CLIENT', + END OF default_fieldname. + + CONSTANTS: BEGIN OF criticality, + neutral TYPE c LENGTH 1 VALUE '0', " no LED + negative TYPE c LENGTH 1 VALUE '1', " red LED + critical TYPE c LENGTH 1 VALUE '2', " yellow LED + positive TYPE c LENGTH 1 VALUE '3', " green LED + END OF criticality. + + TYPES: BEGIN OF ty_criticality_mapping, + data_field TYPE fieldname, + crit_field TYPE fieldname, + END OF ty_criticality_mapping. + TYPES ty_criticality_mapping_table TYPE STANDARD TABLE OF ty_criticality_mapping WITH EMPTY KEY. + + DATA in_edit_mode TYPE abap_bool. + DATA ref_to_table TYPE REF TO data. + DATA line_descriptor TYPE REF TO cl_abap_structdescr. + DATA table_descriptor TYPE REF TO cl_abap_tabledescr. + DATA ddic_structure_descriptor TYPE REF TO cl_abap_structdescr. + DATA special_columns TYPE zcds_alv_special_columns. + DATA criticality_mapping_table TYPE ty_criticality_mapping_table. + DATA read_only_fields TYPE ddfieldnames. + + METHODS evaluate_annotations REDEFINITION. + + METHODS get_unique_fieldname + IMPORTING i_components TYPE abap_component_tab + i_fieldname TYPE fieldname + RETURNING VALUE(r_fieldname) TYPE fieldname. + + METHODS adjust_table + RAISING zcx_cds_alv_message. + + METHODS update_style_info. + + PRIVATE SECTION. +ENDCLASS. + + +CLASS zcl_cds_alv_table_container IMPLEMENTATION. + METHOD adjust_table. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + FIELD-SYMBOLS TYPE lvc_t_scol. + + ASSIGN ref_to_table->* TO
. + LOOP AT
ASSIGNING FIELD-SYMBOL(). + DATA(index) = sy-tabix. + ASSIGN COMPONENT special_columns-index_fieldname OF STRUCTURE TO FIELD-SYMBOL(). + IF sy-subrc = 0. + = index. + ENDIF. + + ASSIGN COMPONENT special_columns-system_fieldname OF STRUCTURE TO FIELD-SYMBOL(). + IF sy-subrc = 0 AND IS INITIAL. + = sy-sysid. + ENDIF. + + ASSIGN COMPONENT special_columns-client_fieldname OF STRUCTURE TO FIELD-SYMBOL(). + IF sy-subrc = 0 AND IS INITIAL. + = sy-mandt. + ENDIF. + + " Setting the cell colors for criticality + ASSIGN COMPONENT special_columns-color_fieldname OF STRUCTURE TO . + IF sy-subrc = 0. + LOOP AT criticality_mapping_table INTO DATA(mapping). + ASSIGN COMPONENT mapping-crit_field OF STRUCTURE TO FIELD-SYMBOL(). + IF sy-subrc <> 0. + CONTINUE. + ENDIF. + + READ TABLE ASSIGNING FIELD-SYMBOL() + WITH KEY fname = mapping-data_field. + IF sy-subrc <> 0. + INSERT VALUE #( fname = mapping-data_field ) INTO TABLE ASSIGNING . + ENDIF. + + -nokeycol = abap_true. + -color-col = SWITCH #( + WHEN criticality-neutral THEN cl_gui_resources=>list_col_normal + WHEN criticality-negative THEN cl_gui_resources=>list_col_negative + WHEN criticality-critical THEN cl_gui_resources=>list_col_total + WHEN criticality-positive THEN cl_gui_resources=>list_col_positive ). + ENDLOOP. + ENDIF. + ENDLOOP. + + update_style_info( ). + ENDMETHOD. + + METHOD constructor. + super->constructor( i_cds_view = i_cds_view + i_ddic_access = i_ddic_access + i_persistence = i_persistence + i_memory = i_memory + i_factory = i_factory ). + evaluate_annotations( ). + ENDMETHOD. + + METHOD evaluate_annotations. + " Create Table: All elements of the CDS view + special fields (box, style, color, etc.) + ddic_structure_descriptor = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( cds_view ) ). + DATA(components) = ddic_structure_descriptor->get_components( ). + + special_columns = VALUE zcds_alv_special_columns( ). + criticality_mapping_table = VALUE ty_criticality_mapping_table( ). + + special_columns-index_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-index ). + INSERT VALUE #( name = special_columns-index_fieldname type = CAST #( cl_abap_elemdescr=>get_i( ) ) ) INTO TABLE components. + + special_columns-count_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-count ). + INSERT VALUE #( name = special_columns-count_fieldname type = CAST #( cl_abap_elemdescr=>get_i( ) ) ) INTO TABLE components. + + special_columns-box_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-box ). + INSERT VALUE #( name = special_columns-box_fieldname type = CAST #( cl_abap_typedescr=>describe_by_name( 'XFELD' ) ) ) INTO TABLE components. + + special_columns-system_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-system ). + INSERT VALUE #( name = special_columns-system_fieldname type = CAST #( cl_abap_typedescr=>describe_by_name( 'SYST_SYSID' ) ) ) INTO TABLE components. + + special_columns-client_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-client ). + INSERT VALUE #( name = special_columns-client_fieldname type = CAST #( cl_abap_typedescr=>describe_by_name( 'MANDT' ) ) ) INTO TABLE components. + + DATA(update_enabled) = xsdbool( line_exists( entity_annotations[ annoname = 'OBJECTMODEL.UPDATEENABLED' value = 'true' ] ) ). + " TODO: variable is assigned but never used (ABAP cleaner) + DATA(delete_enabled) = xsdbool( line_exists( entity_annotations[ annoname = 'OBJECTMODEL.DELETEENABLED' value = 'true' ] ) ). + + IF update_enabled = abap_true. + special_columns-style_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-style ). + INSERT VALUE #( name = special_columns-style_fieldname type = CAST #( cl_abap_typedescr=>describe_by_name( 'LVC_T_STYL' ) ) ) INTO TABLE components. + ENDIF. + + LOOP AT element_annotations INTO DATA(element_annotation). + IF element_annotation-annoname CP 'UI.LINEITEM*.CRITICALITY'. + IF special_columns-color_fieldname IS INITIAL. + special_columns-color_fieldname = get_unique_fieldname( i_components = components i_fieldname = default_fieldname-color ). + INSERT VALUE #( name = special_columns-color_fieldname type = CAST #( cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ) ) ) INTO TABLE components. + ENDIF. + + INSERT INITIAL LINE INTO TABLE criticality_mapping_table ASSIGNING FIELD-SYMBOL(). + -data_field = element_annotation-elementname. + -crit_field = remove_quotes( element_annotation-value ). + ENDIF. + + IF element_annotation-annoname = 'OBJECTMODEL.READONLY' AND element_annotation-value = 'true'. + INSERT CONV #( element_annotation-elementname ) INTO TABLE read_only_fields. + ENDIF. + ENDLOOP. + + DATA ref_to_line TYPE REF TO data. + line_descriptor = cl_abap_structdescr=>get( components ). + CREATE DATA ref_to_line TYPE HANDLE line_descriptor. + ASSIGN ref_to_line->* TO FIELD-SYMBOL(). + + CREATE DATA ref_to_table LIKE STANDARD TABLE OF WITH EMPTY KEY. + table_descriptor = CAST cl_abap_tabledescr( cl_abap_typedescr=>describe_by_data_ref( ref_to_table ) ). + ENDMETHOD. + + METHOD get_unique_fieldname. + IF line_exists( i_components[ name = i_fieldname ] ). + r_fieldname = get_unique_fieldname( i_components = i_components i_fieldname = |_{ i_fieldname }| ). + ELSE. + r_fieldname = i_fieldname. + ENDIF. + ENDMETHOD. + + METHOD update_style_info. + FIELD-SYMBOLS TYPE lvc_t_styl. + FIELD-SYMBOLS
TYPE STANDARD TABLE. + + ASSIGN ref_to_table->* TO
. + + LOOP AT
ASSIGNING FIELD-SYMBOL(). + ASSIGN COMPONENT special_columns-style_fieldname OF STRUCTURE TO . + IF sy-subrc <> 0. + RETURN. + ENDIF. + + LOOP AT ddfields INTO DATA(ddfield). + ASSIGN [ fieldname = ddfield-fieldname ] TO FIELD-SYMBOL(