* _ _ _ _ _ * /_\ | |__ __ _ _ __ ___ __ _ __| | __ _| |__ _ __ /_\ * //_\\| '_ \ / _` | '_ \ / __/ _` |/ _` |/ _` | '_ \| '__//_\\ * / _ \ |_) | (_| | |_) | (_| (_| | (_| | (_| | |_) | | / _ \ * \_/ \_/_.__/ \__,_| .__/ \___\__,_|\__,_|\__,_|_.__/|_| \_/ \_/ * |_| www.abapcadabra.com *--------------------------------------------------------------------- * Program : ZABAPCADABRA_DATAFILE_TRACKING * Title : Datafile change tracking application * Functional area : Cross modules * Environment : 4.7 * Program Function : * * This report transforms an input file into an output file which contains * changed records only. Change tracking is done though SAP datasets. * The purpose of this setup is to allow "migration of changes". First * prepare the migration steps that you need, feed the result files to * this report and do the migration. So far nothing new. After a month, * the whole process (creating files, feed them through file shadowing) * is repeated, this time only changes will need to be migrated. * Repeat as often as needed - the shadow of the file (files?) will be * updated every time. * * When no output file is supplied, the changes are reported (output is * dumped in a report). * * Note that logical file paths Z_DATAFILE_TRACKING_IN and * Z_DATAFILE_TRACKING_OUT can be used (trx FILE). * * Documentation : Search for "datafile tracking" on AbapcadabrA.com * Previous version : This is the initial version * Developer name : Wim Maasdam * Development date : 07/09/2018 * Version : 0.1 *--------------------------------------------------------------------- * _ _ _ _ * ___| |__ __ _ _ __ __ _ ___ | |__ (_)___| |_ ___ _ __ _ _ * / __| '_ \ / _` | '_ \ / _` |/ _ \ | '_ \| / __| __/ _ \| '__| | | | * | (__| | | | (_| | | | | (_| | __/ | | | | \__ \ || (_) | | | |_| | * \___|_| |_|\__,_|_| |_|\__, |\___| |_| |_|_|___/\__\___/|_| \__, | * |___/ (new entries at the bottom please)|___/ * Date Description * 07/09/2018 Initial release * *--------------------------------------------------------------------- * _ * _ __ __ _ _ __ ___ (_)_ __ __ _ * | '_ \ / _` | '_ ` _ \| | '_ \ / _` | Please make the effort to * | | | | (_| | | | | | | | | | | (_| | uphold these conventions * |_| |_|\__,_|_| |_| |_|_|_| |_|\__, |_ _ - thank you in advance * ___ ___ _ ____ _____ |___/| |_(_) ___ _ __ ___ * / __/ _ \| '_ \ \ / / _ \ '_ \| __| |/ _ \| '_ \/ __| * | (_| (_) | | | \ V / __/ | | | |_| | (_) | | | \__ \ * \___\___/|_| |_|\_/ \___|_| |_|\__|_|\___/|_| |_|___/ * * Selection screen variables: * PA_ Parameter field * SO_ Select-option field * Globally defined variables: Locally defined variables: * TY_ Type definition | LTY_ Locally defined Type definition (types: begin of lty_...) * GC_ Constant | LC_ Constant * GV_ Variable | LV_ Variable * GW_ Work Area | LW_ Work Area (holding multiple fields) * GT_ internal Table | LT_ internal Table * GR_ Range variable | LR_ Range variable (type range of) * GO_ Object variable | LO_ Object variable (type ref to ..) * LCL_ Local class definition/implementation * Field-symbols: * - Field symbol definitions have no naming convention, but * should be used for a single data type only * Local classes: * - A local class can hold globally defined variables as well as * locally defined variables * - Instance and static variables use the same naming convention * - Parameters on a method have no naming convention * - Exceptions have no naming convention *--------------------------------------------------------------------- REPORT ZABAPCADABRA_DATAFILE_TRACKING NO STANDARD PAGE HEADING LINE-SIZE 650. CLASS lcl_SETTINGS definition. PUBLIC SECTION. constants: gc_slg0_object TYPE balobj_d VALUE 'ALERT', gc_slg0_subobject TYPE balsubobj VALUE 'PROCESSING', gc_FILE_inbound TYPE FILEINTERN value 'Z_DATAFILE_TRACKING_IN', gc_FILE_outbound TYPE FILEINTERN value 'Z_DATAFILE_TRACKING_OUT', gc_SERVERFILE_BLINK_report TYPE sy-repid value 'ZABAPCADABRA_BLINK_SERVERFILES'. ENDCLASS. * ___ _ _ __ _ _ _ _ * / __\ | __ _ ___ ___ __| | ___ / _(_)_ __ (_) |_(_) ___ _ __ ___ * / / | |/ _` / __/ __| / _` |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \/ __| * / /___| | (_| \__ \__ \ | (_| | __/ _| | | | | | |_| | (_) | | | \__ \ * \____/|_|\__,_|___/___/ \__,_|\___|_| |_|_| |_|_|\__|_|\___/|_| |_|___/ * CLASS lcl_f4_processing DEFINITION. PUBLIC SECTION. CLASS-DATA: gv_shadow_object type c length 6. CLASS-METHODS: f4_presentation_file IMPORTING title TYPE any CHANGING filepath TYPE any, f4_server_file CHANGING filepath TYPE any, extract_from_filename IMPORTING filepath TYPE any, f4_shadow_object IMPORTING screen_field type DYNFNAM, prep_filename changing filename type any, call_server_blink importing tracking_object type any default space pathname type any filename type any. ENDCLASS. "lcl_f4_processing DEFINITION * || _ DEFINITION * LCL_LOGGING || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_logging DEFINITION. PUBLIC SECTION. CLASS-DATA: go_log TYPE REF TO cl_ishmed_bal, gv_errors_were_logged TYPE boolean VALUE space. CLASS-METHODS: initialize IMPORTING object TYPE balobj_d DEFAULT 'ALERT' subobject TYPE balsubobj DEFAULT 'PROCESSING', set_message IMPORTING message TYPE any OPTIONAL par1 TYPE any DEFAULT space par2 TYPE any DEFAULT space par3 TYPE any DEFAULT space msgty TYPE symsgty DEFAULT 'I' pass_to_joblog type boolean DEFAULT space PREFERRED PARAMETER message, set_subject IMPORTING subject TYPE any, set_error IMPORTING message TYPE any OPTIONAL par1 TYPE any DEFAULT space par2 TYPE any DEFAULT space PREFERRED PARAMETER message, formatter IMPORTING input type any format type any default 'DATE' returning value(result) type char80. ENDCLASS. "lcl_logging DEFINITION * || _ DEFINITION * LCL_SHADOW || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_shadow DEFINITION FINAL. PUBLIC SECTION. types: begin of ty_shadow_object, id type c length 6, description type c length 50, key_fields type n length 2, header_lines type n length 2, separator type c length 1, controls_allowed type boolean, changed_since_allowed type boolean, logging_controls type boolean, key_check type boolean, burn_after_reading type boolean, mass_processing type boolean, "Mask processing end of ty_shadow_object, begin of ty_record, hashkey type c length 80, contentline type c length 1200, end of ty_record, begin of ty_shadow, records type standard table of ty_record with default key, end of ty_shadow. CLASS-DATA: gt_shadow_objects type standard table of ty_shadow_object, gw_shadow_object type ty_shadow_object, gv_CHECK type boolean, gv_UPDATE type boolean, gv_RESEND_DATE type d, gv_RESEND_TIME type sy-uzeit, gv_shadow_hashkey type zshadow_indx-SRTFD, gv_shadow_hashkey_full type c length 80, gw_record type ty_record, "Work area (detailed) gw_shadow type ty_shadow, "Work area (hash key level) gw_shadow_indx type zshadow_indx. CLASS-METHODS: read_objects, save_object importing id type any description type any key_fields type any header_lines type any separator type any controls_allowed type any allow_since type any logging_controls type any keycheck type any burn_after_reading type any mass_processing type any, clear_object importing id type any, delete_object importing id type any, read importing hashkey type any, save, view_shadow importing id type any key_values type any list_keys type any. ENDCLASS. * || _ DEFINITION * LCL_FILE_PROCESSOR || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_file_processor DEFINITION. PUBLIC SECTION. CONSTANTS: gc_all(1) TYPE c VALUE 'A', gc_directories_only(1) TYPE c VALUE 'D', gc_files_only(1) TYPE c VALUE 'F'. TYPES: BEGIN OF ty_dir_entry, name(75), " name of entry type(15), " type of entry len(4) TYPE p DECIMALS 0, " length in bytes owner(8), " owner of the entry mtime(6) TYPE p DECIMALS 0, " last mod. date, seconds since 1970 mode(9), " like "rwx-r-x--x": protection mode. subrc(4), errno(3), errmsg(40), END OF ty_dir_entry, ty_dir_entry_tt TYPE STANDARD TABLE OF ty_dir_entry. TYPES: begin of ty_keycontrol, key type c length 80, end of ty_keycontrol. CLASS-DATA: gv_selscreen_tab type sy-ucomm, gv_path_editable_inbound type boolean, gv_path_editable_outbound type boolean, gv_filename_in type c length 150, gv_filename_out type c length 150, gv_key_counter type n length 2, gv_headerlines type n length 2, gt_headerlines type standard table of string, gt_keytable type sorted table of ty_keycontrol with unique key key, gv_first_output type boolean, gv_line_counter type sy-tabix, gv_difference_counter type sy-tabix, gv_separator type c length 1, gv_contentline type lcl_shadow=>ty_record-contentline, gv_wildcard_mode type boolean. CLASS-METHODS: open importing tracking_object type any filename_in type any filename_out type any, read, process_record importing linecounter type sy-tabix, set_default_paths exporting pathIN type any pathOUT type any, check_wildcards importing filenameIn type any filenameOut type any returning value(passed) type boolean, determine_targetname importing infile_mask type any infile type any outfile_mask type any returning value(outfile) type EPSPATH, recursive_submitter importing tracking_object type any pathIN type any fileIN type any pathOUT type any fileOUT type any, get_directory_listing IMPORTING directory TYPE any mask TYPE any default '*' filter TYPE c DEFAULT 'A' "A=All, D=Directory only, F=File only EXPORTING listing TYPE ty_dir_entry_tt returncode TYPE sy-subrc. ENDCLASS. *--------------------------------------------------------------------- * S E L E C T I O N - S C R E E N *--------------------------------------------------------------------- tables: sscrfields. data: gv_PS_FACTS_SET type PS_FACTS_SET. * _ _ _ * ___ ___| | ___ ___| |_(_) ___ _ __ ___ ___ _ __ ___ ___ _ __ * / __|/ _ \ |/ _ \/ __| __| |/ _ \| '_ \ / __|/ __| '__/ _ \/ _ \ '_ \ * \__ \ __/ | __/ (__| |_| | (_) | | | | \__ \ (__| | | __/ __/ | | | * |___/\___|_|\___|\___|\__|_|\___/|_| |_| |___/\___|_| \___|\___|_| |_| * SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_00 FOR FIELD pa_SRTFD. PARAMETERS: pa_SRTFD type PS_FACTS_SET. SELECTION-SCREEN POSITION 32. PARAMETERS: pa_SRTTX type c length 60. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 32. PARAMETERS: pa_SRTT2 type c length 60. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_01 FOR FIELD pa_pthIN. PARAMETERS: pa_pthIN TYPE c LENGTH 100 LOWER CASE VISIBLE LENGTH 56. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_02 FOR FIELD pa_filIN. PARAMETERS: pa_MASK TYPE C LENGTH 5. PARAMETERS: pa_filIN TYPE c LENGTH 40 LOWER CASE. SELECTION-SCREEN PUSHBUTTON 71(10) but_b1 USER-COMMAND server_in visible length 4. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 22(68) lbl_02a. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_03 FOR FIELD pa_pthOU. PARAMETERS: pa_pthOU TYPE c LENGTH 100 LOWER CASE VISIBLE LENGTH 56. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_04 FOR FIELD pa_filOU. PARAMETERS: pa_filOU TYPE c LENGTH 100 LOWER CASE VISIBLE LENGTH 56. SELECTION-SCREEN PUSHBUTTON 71(10) but_b2 USER-COMMAND server_out visible length 4. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 22(68) lbl_04a modif id C3A. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 22(68) lbl_04b modif id C3B. SELECTION-SCREEN END OF LINE. *SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_s1 modif id CNT. PARAMETERS: pa_shaco AS CHECKBOX default abap_true USER-COMMAND dummy modif id CNT. SELECTION-SCREEN: COMMENT 25(8) lbl_s2 FOR FIELD pa_shaco modif id CNT. SELECTION-SCREEN position 34. parameters: pa_shaup AS CHECKBOX default abap_true modif id CNT. SELECTION-SCREEN: COMMENT 56(20) lbl_s3 FOR FIELD pa_shaup, END OF LINE, BEGIN OF LINE, COMMENT 1(20) lbl_s4 modif id CHA. parameters: pa_share type sy-datum modif id CHA, pa_shati type sy-uzeit modif id CHA. SELECTION-SCREEN: COMMENT 43(20) lbl_s4b modif id CHA. SELECTION-SCREEN: END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 22(11) lbl_ts modif id CHA. parameters: pa_uzeit type sy-uzeit default sy-uzeit modif id CHA. SELECTION-SCREEN: END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 22(11) lbl_tl modif id CHA. parameters: pa_timlo type sy-timlo default sy-timlo modif id CHA. SELECTION-SCREEN: END OF LINE. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_al modif id LOG. PARAMETERS: pa_SHOWL as checkbox DEFAULT abap_true modif id LOG. SELECTION-SCREEN COMMENT 23(8) lbl_sh FOR FIELD pa_SHOWL modif id LOG. SELECTION-SCREEN position 34. PARAMETERS: pa_SAVEL as checkbox DEFAULT abap_true USER-COMMAND dummy modif id LOG. SELECTION-SCREEN COMMENT 36(8) lbl_sa FOR FIELD pa_SAVEL modif id LOG. SELECTION-SCREEN position 46. PARAMETERS: pa_ERRON as checkbox DEFAULT abap_true modif id LOG. SELECTION-SCREEN COMMENT 48(20) lbl_eo FOR FIELD pa_ERRON modif id LOG. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. *SELECTION-SCREEN POSITION 22. SELECTION-SCREEN PUSHBUTTON 22(30) but_al USER-COMMAND slg1. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 1100. SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_22 FOR FIELD pa_SHDSC. PARAMETERS: pa_SHDSC type c length 50 lower case. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_23 FOR FIELD pa_KEYS. PARAMETERS: pa_KEYS type n length 2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_24 FOR FIELD pa_HDRLN. PARAMETERS: pa_HDRLN type n length 2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_25 FOR FIELD pa_separ. PARAMETERS: pa_separ TYPE c LENGTH 1 DEFAULT ';' LOWER CASE. SELECTION-SCREEN COMMENT 25(20) lbl_25b. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(6) lbl_30. SELECTION-SCREEN POSITION 8. PARAMETERS: pa_coall as checkbox. SELECTION-SCREEN COMMENT 11(20) lbl_3a FOR FIELD pa_coall. SELECTION-SCREEN POSITION 32. PARAMETERS: pa_keych as checkbox. SELECTION-SCREEN COMMENT 34(30) lbl_3e FOR FIELD pa_keych. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 8. PARAMETERS: pa_chall as checkbox. SELECTION-SCREEN COMMENT 11(20) lbl_3b FOR FIELD pa_chall. SELECTION-SCREEN POSITION 32. PARAMETERS: pa_burna as checkbox. SELECTION-SCREEN COMMENT 34(50) lbl_3f FOR FIELD pa_burna. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 8. PARAMETERS: pa_logco as checkbox. SELECTION-SCREEN COMMENT 11(20) lbl_3c FOR FIELD pa_logco. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 8. PARAMETERS: pa_massa as checkbox. SELECTION-SCREEN COMMENT 11(30) lbl_3d FOR FIELD pa_massa. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN PUSHBUTTON 1(16) but_sa USER-COMMAND save_obj. SELECTION-SCREEN PUSHBUTTON 17(16) but_cl USER-COMMAND reset_obj. SELECTION-SCREEN PUSHBUTTON 33(16) but_dl USER-COMMAND delete_obj. SELECTION-SCREEN END OF LINE. PARAMETERS pa_RESET type c length 1 no-display. SELECTION-SCREEN END OF SCREEN 1200. SELECTION-SCREEN BEGIN OF SCREEN 1300 AS SUBSCREEN. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_33 FOR FIELD pa_KEYVA. PARAMETERS: pa_KEYVA type c length 16 lower case. PARAMETERS: pa_KEYEX type c length 25 lower case. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 22. PARAMETERS: pa_KEYXX as checkbox. SELECTION-SCREEN COMMENT 25(20) lbl_34 FOR FIELD pa_KEYXX. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 1300. SELECTION-SCREEN BEGIN OF SCREEN 1400 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(18) lbl_40 FOR FIELD so_SRTFD. SELECT-OPTIONS: so_SRTFD for gv_PS_FACTS_SET. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 4(75) lbl_40b. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_41 FOR FIELD pa_pfrom. PARAMETERS: pa_pfrom TYPE c LENGTH 100 LOWER CASE VISIBLE LENGTH 56. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) lbl_42 FOR FIELD pa_pinto. PARAMETERS: pa_pinto TYPE c LENGTH 100 LOWER CASE VISIBLE LENGTH 56. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 1400. SELECTION-SCREEN BEGIN OF TABBED BLOCK maintab FOR 16 LINES. SELECTION-SCREEN TAB (20) tab_01 USER-COMMAND tab1 DEFAULT SCREEN 1100. SELECTION-SCREEN TAB (20) tab_02 USER-COMMAND tab2 DEFAULT SCREEN 1200. SELECTION-SCREEN TAB (20) tab_03 USER-COMMAND tab3 DEFAULT SCREEN 1300. SELECTION-SCREEN TAB (20) tab_04 USER-COMMAND tab4 DEFAULT SCREEN 1400. SELECTION-SCREEN END OF BLOCK maintab. * _ _ _ _ * | | | | | | (_) * __ _| |_ ___ ___| | ___ ___| |_ _ ___ _ __ ___ ___ _ __ ___ ___ _ __ * / _` | __| / __|/ _ \ |/ _ \/ __| __| |/ _ \| '_ \___/ __|/ __| '__/ _ \/ _ \ '_ \ * | (_| | |_ \__ \ __/ | __/ (__| |_| | (_) | | | |__\__ \ (__| | | __/ __/ | | | * \__,_|\__| |___/\___|_|\___|\___|\__|_|\___/|_| |_| |___/\___|_| \___|\___|_| |_| * AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_filIN. lcl_f4_processing=>f4_server_file( CHANGING filepath = pa_filIN ). AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_filOU. lcl_f4_processing=>f4_server_file( CHANGING filepath = pa_filOU ). AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_SRTFD. lcl_f4_processing=>f4_shadow_object( 'PA_SRTFD' ). AT SELECTION-SCREEN OUTPUT. pa_UZEIT = sy-uzeit. pa_TIMLO = sy-timlo. IF pa_pthIN IS INITIAL. lcl_File_Processor=>set_default_paths( importing pathIn = pa_pthIN pathout = pa_pthOU ). ENDIF. lcl_f4_processing=>extract_from_filename( pa_filIN ). if not lcl_f4_processing=>gv_shadow_object is initial. PA_SRTFD = lcl_f4_processing=>gv_shadow_object. endif. pa_SHDSC = lcl_shadow=>gw_shadow_object-description. pa_KEYS = lcl_shadow=>gw_shadow_object-key_fields. pa_HDRLN = lcl_shadow=>gw_shadow_object-header_lines. pa_SEPAR = lcl_shadow=>gw_shadow_object-separator. pa_KEYCH = lcl_shadow=>gw_shadow_object-key_check. pa_COALL = lcl_shadow=>gw_shadow_object-controls_allowed. pa_CHALL = lcl_shadow=>gw_shadow_object-changed_since_allowed. pa_LOGCO = lcl_shadow=>gw_shadow_object-logging_controls. pa_BURNA = lcl_shadow=>gw_shadow_object-burn_after_reading. pa_MASSA = lcl_shadow=>gw_shadow_object-mass_processing. if pa_filOU is initial. LOOP AT SCREEN. IF screen-group1 = 'C3B'. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. else. LOOP AT SCREEN. IF screen-group1 = 'C3A'. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. endif. lcl_shadow=>read_objects( ). read table lcl_shadow=>gt_shadow_objects into lcl_shadow=>gw_shadow_object with key id = pa_SRTFD. if sy-subrc = 0. pa_SRTTX = lcl_shadow=>gw_shadow_object-description. if lcl_shadow=>gw_shadow_object-burn_after_reading = abap_true and lcl_shadow=>gw_shadow_object-mass_processing = abap_true. PA_SRTT2 = 'Source file is deleted, Wildcard (*) allowed'. elseif lcl_shadow=>gw_shadow_object-burn_after_reading = abap_true and lcl_shadow=>gw_shadow_object-mass_processing = abap_false. PA_SRTT2 = 'Source file is delted, Wildcard (*) NOT allowed'. elseif lcl_shadow=>gw_shadow_object-burn_after_reading = abap_false and lcl_shadow=>gw_shadow_object-mass_processing = abap_true. PA_SRTT2 = 'Source file remains, Wildcard (*) allowed'. else. PA_SRTT2 = 'Source file remains, Wildcard (*) NOT allowed'. endif. else. clear: pa_SRTTX, PA_SRTT2. * The path and file fields should be hidden LOOP AT SCREEN. IF screen-name = 'PA_PTHIN' or screen-name = 'PA_FILIN' or screen-name = 'PA_PTHOU' or screen-name = 'PA_FILOU' or screen-name = 'BUT_B1' or screen-name = 'BUT_B2'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. endif. if NOT PA_KEYVA is initial. concatenate pa_SRTFD '~' PA_KEYVA '*' into PA_KEYEX. replace all occurrences of '**' in PA_KEYEX with '*'. replace all occurrences of lcl_shadow=>gw_shadow_object-separator in PA_KEYEX with '~'. else. clear: PA_KEYEX. endif. LOOP AT SCREEN. IF screen-name = 'PA_SRTTX' or screen-name = 'PA_SRTT2'. screen-input = 0. screen-DISPLAY_3D = 0. MODIFY SCREEN. ENDIF. ENDLOOP. if pa_SRTFD is initial. clear pa_MASK. else. concatenate pa_SRTFD '.'into PA_MASK. endif. LOOP AT SCREEN. IF screen-name = 'PA_MASK'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. IF lcl_FILE_processor=>gv_path_editable_inbound = abap_false. LOOP AT SCREEN. IF screen-name = 'PA_PTHIN'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF lcl_FILE_processor=>gv_path_editable_outbound = abap_false. LOOP AT SCREEN. IF screen-name = 'PA_PTHOU'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF lcl_shadow=>gw_shadow_object-controls_allowed = abap_false. LOOP AT SCREEN. IF screen-group1 = 'CNT'. screen-input = 0. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF lcl_shadow=>gw_shadow_object-changed_since_allowed = abap_false. LOOP AT SCREEN. IF screen-group1 = 'CHA'. screen-input = 0. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF lcl_shadow=>gw_shadow_object-logging_controls = abap_false. LOOP AT SCREEN. IF screen-group1 = 'LOG'. screen-input = 0. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF pa_SRTFD IS INITIAL. LOOP AT SCREEN. IF screen-name = 'PA_SHDSC' or screen-name = 'PA_KEYS' or screen-name = 'PA_HDRLN' or screen-name = 'PA_SEPAR' or screen-name = 'PA_KEYCH' or screen-name = 'PA_COALL' or screen-name = 'PA_CHALL' or screen-name = 'PA_LOGCO' or screen-name = 'BUT_SA' or screen-name = 'BUT_CL' or screen-name = 'BUT_DL' or screen-name = 'PA_BURNA' or screen-name = 'PA_MASSA' or screen-name = 'PA_KEYVA' or screen-name = 'PA_KEYXX'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. LOOP AT SCREEN. IF screen-name = 'PA_UZEIT' or screen-name = 'PA_TIMLO' or screen-name = 'PA_SRTF2' or screen-name = 'PA_KEYEX'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. IF pa_shaco IS INITIAL. LOOP AT SCREEN. IF screen-name = 'PA_SHARE' or screen-name = 'PA_SHATI'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. clear: PA_SHARE, PA_SHATI. ENDIF. IF PA_SHARE IS INITIAL. LOOP AT SCREEN. IF screen-name = 'PA_SHATI'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. clear: PA_SHATI. ENDIF. IF pa_savel IS INITIAL. LOOP AT SCREEN. IF screen-name = 'PA_ERRON'. screen-input = 0. screen-output = 0. MODIFY SCREEN. ENDIF. ENDLOOP. clear PA_ERRON. ENDIF. IF lcl_file_processor=>gv_selscreen_tab = 'TAB4'. LOOP AT SCREEN. IF screen-name = 'PA_SRTFD'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. *--------------------------------------------------------------------- AT SELECTION-SCREEN. CASE sscrfields-ucomm. WHEN 'ABAPCADABRA'. CALL FUNCTION 'CALL_BROWSER' EXPORTING URL = 'http://abapcadabra.com/index.php' EXCEPTIONS OTHERS = 0. clear: sscrfields-ucomm. WHEN 'SLG1'. SET PARAMETER ID 'BALOBJ' FIELD lcl_SETTINGS=>gc_slg0_object. SET PARAMETER ID 'BALSUBOBJ' FIELD lcl_SETTINGS=>gc_slg0_subobject. SET PARAMETER ID 'BALEXT' FIELD sy-repid. CALL TRANSACTION 'SLG1'. clear: sscrfields-ucomm. WHEN 'TAB1' or 'TAB2' or 'TAB3' or 'TAB4'. * Keep track of the TAB movements lcl_file_processor=>gv_selscreen_tab = sscrfields-ucomm. clear pa_RESET. lcl_f4_processing=>gv_shadow_object = PA_SRTFD. WHEN 'SERVER_IN'. lcl_f4_processing=>call_server_blink( exporting tracking_object = PA_SRTFD pathname = pa_pthin filename = pa_filin ). clear: sscrfields-ucomm. WHEN 'SERVER_OUT'. lcl_f4_processing=>call_server_blink( exporting pathname = pa_pthou filename = pa_filou ). clear: sscrfields-ucomm. WHEN 'SAVE_OBJ'. lcl_shadow=>save_object( id = pa_SRTFD description = pa_SHDSC key_fields = pa_KEYS header_lines = pa_HDRLN separator = pa_separ controls_allowed = pa_coall allow_since = pa_chall logging_controls = pa_logco keycheck = pa_keych burn_after_reading = pa_burna mass_processing = pa_massa ). clear: sscrfields-ucomm. WHEN 'RESET_OBJ'. pa_RESET = abap_true. message 'Please schedule this report in the background (now) to reset' type 'S'. clear: sscrfields-ucomm. WHEN 'DELETE_OBJ'. lcl_shadow=>delete_object( pa_SRTFD ). clear: sscrfields-ucomm. ENDCASE. * ___ _ * / __\ | __ _ ___ ___ * / / | |/ _` / __/ __| ___ * / /___| | (_| \__ \__ \ |___| * \____/|_|\__,_|___/___/ _ _ _ * (_)_ __ ___ _ __ | | ___ _ __ ___ ___ _ __ | |_ __ _| |_(_) ___ _ __ ___ * | | '_ ` _ \| '_ \| |/ _ \ '_ ` _ \ / _ \ '_ \| __/ _` | __| |/ _ \| '_ \/ __| * | | | | | | | |_) | | __/ | | | | | __/ | | | || (_| | |_| | (_) | | | \__ \ * |_|_| |_| |_| .__/|_|\___|_| |_| |_|\___|_| |_|\__\__,_|\__|_|\___/|_| |_|___/ * |_| CLASS lcl_f4_processing IMPLEMENTATION. * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: F4_PRESENTATION_FILE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD f4_presentation_file. DATA: lt_files TYPE STANDARD TABLE OF sdokpath, lw_file TYPE sdokpath. CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG' EXPORTING window_title = title default_filename = filepath TABLES file_table = lt_files EXCEPTIONS OTHERS = 4. IF sy-subrc <> 0. MESSAGE 'Front end file open error' TYPE 'E'. ELSE. READ TABLE lt_files INDEX 1 INTO lw_file. filepath = lw_file-pathname. ENDIF. ENDMETHOD. "f4_presentation_file * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: F4_SERVER_FILE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD f4_server_file. DATA: lv_old_filepath TYPE string. lv_old_filepath = filepath. CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE' EXPORTING directory = filepath filemask = ' ' IMPORTING serverfile = filepath EXCEPTIONS canceled_by_user = 1 OTHERS = 2. CASE sy-subrc. WHEN 1. filepath = lv_old_filepath. WHEN 2. MESSAGE 'Server file open error' TYPE 'E'. ENDCASE. ENDMETHOD. "f4_server_file * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: EXTRACT_FROM_FILENAME || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD extract_from_filename. data: lt_tokens type standard table of string, lv_token type string, lv_path_separator type c length 1, lv_tabix type sy-tabix. if not filepath is initial. lv_path_separator = filepath(1). split filepath at lv_path_separator into table lt_tokens. describe table lt_tokens lines lv_tabix. read table lt_tokens index lv_tabix into lv_token. if sy-subrc = 0. split lv_token at '.' into table lt_tokens. read table lt_tokens index 1 into lv_token. if sy-subrc = 0. translate lv_token to upper case. * Check whether the result is an actual (existing) tracking object read table lcl_shadow=>gt_shadow_objects into lcl_shadow=>gw_shadow_object with key id = lv_token. if sy-subrc = 0. gv_shadow_object = lv_token. else. clear gv_shadow_object. endif. endif. endif. endif. ENDMETHOD. * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: F4_SHADOW_OBJECT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD f4_shadow_object. TYPES: BEGIN OF lty_columns, id TYPE INDX_SRTFD, description TYPE text50, END OF lty_columns. DATA: lt_columns TYPE STANDARD TABLE OF lty_columns, lw_column type lty_columns. clear: lt_columns[]. lcl_shadow=>read_objects( ). loop at lcl_shadow=>gt_shadow_objects into lcl_shadow=>gw_shadow_object. lw_column-id = lcl_shadow=>gw_shadow_object-id. lw_column-description = lcl_shadow=>gw_shadow_object-description. append lw_column to lt_columns. endloop. if sy-subrc = 0. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'ID' dynpprog = SY-REPID dynpnr = sy-dynnr dynprofield = screen_field * WINDOW_TITLE = value_org = 'S' TABLES value_tab = lt_columns. else. message 'No possible values available' type 'S'. endif. ENDMETHOD. * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: PREP_FILENAME || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD prep_filename. DATA: lv_system TYPE c LENGTH 15, lv_system_str TYPE string. CONCATENATE sy-sysid sy-mandt INTO lv_system SEPARATED BY '_'. CONDENSE lv_system NO-GAPS. lv_system_str = lv_system. REPLACE '{S}' WITH lv_system_str INTO filename. REPLACE '{D}' WITH sy-datum INTO filename. REPLACE '{d}' WITH sy-datum+6(2) INTO filename. REPLACE '{M}' WITH sy-datum+4(2) INTO filename. REPLACE '{Y}' WITH sy-datum(4) INTO filename. REPLACE '{y}' WITH sy-datum+2(2) INTO filename. REPLACE '{T}' WITH sy-uzeit INTO filename. REPLACE '{h}' WITH sy-uzeit(2) INTO filename. REPLACE '{m}' WITH sy-uzeit+2(2) INTO filename. REPLACE '{s}' WITH sy-uzeit+4(2) INTO filename. REPLACE '{C}' WITH sy-mandt(3) INTO filename. ENDMETHOD. * || _ _ _ * Class : LCL_F4_PROCESSING || _ __ ___ ___| |_| |__ ___ __| | * Method: CALL_SERVER_BLINK || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD call_server_blink. * Call the blink - if it is available data: lv_report type sy-repid, lw_tadir type tadir, lv_filename type c length 80. * When no filename is presented, assume all files (*). if filename is initial. lv_filename = '*'. else. lv_filename = filename. endif. * Place the tracking object ID in the filename (to start the filename with ..) if not tracking_object is initial. concatenate tracking_object lv_filename into lv_filename separated by '.'. endif. * Only submit the BLINK report if it is actually available: lv_report = lcl_SETTINGS=>gc_SERVERFILE_BLINK_report. select single * from TADIR into lw_TADIR where PGMID = 'R3TR' and OBJECT = 'PROG' and OBJ_NAME = lv_report. if sy-subrc = 0. submit (lv_report) with pa_fpath = pathname with pa_fmask = lv_filename with pa_direc = abap_false with pa_blink = abap_true * via selection-screen and return. else. message 'Functionality not available on your system' type 'S'. endif. ENDMETHOD. ENDCLASS. "lcl_f4_processing IMPLEMENTATION * || _ IMPLEMENTATION * LCL_LOGGING || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_logging IMPLEMENTATION. * || _ _ _ * Class : LCL_LOGGING || _ __ ___ ___| |_| |__ ___ __| | * Method: INITIALIZE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD initialize. TRY. CREATE OBJECT go_log EXPORTING i_object = object i_subobject = subobject i_repid = sy-repid. CATCH cx_ishmed_log. "#EC NO_HANDLER * No actual processing here ENDTRY. ENDMETHOD. "initialize * || _ _ _ * Class : LCL_LOGGING || _ __ ___ ___| |_| |__ ___ __| | * Method: SET_MESSAGE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * importing message type any, par1, par2 || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD set_message. " importing message type any, par1, par2 DATA: lv_message TYPE c LENGTH 200, lv_par1 type c length 80, lv_par2 type c length 80, lv_par3 type c length 80. lv_message = message. move par1 to lv_par1. shift lv_par1 LEFT DELETING LEADING space. move par2 to lv_par2. shift lv_par2 LEFT DELETING LEADING space. move par3 to lv_par3. shift lv_par3 LEFT DELETING LEADING space. REPLACE '&' WITH lv_par1 INTO lv_message. CONDENSE lv_message. REPLACE '&' WITH lv_par2 INTO lv_message. CONDENSE lv_message. REPLACE '&' WITH lv_par3 INTO lv_message. CONDENSE lv_message. TRY. go_log->add_free_text( EXPORTING i_msg_type = msgty i_text = lv_message ). CATCH cx_ishmed_log. "#EC NO_HANDLER * No actual logic on catch ENDTRY. if pass_to_joblog = abap_true and sy-batch = abap_true. message id 'V1' type 'I' number 899 with lv_message(50) lv_message+50(50). endif. ENDMETHOD. "set_message * || _ _ _ * Class : LCL_LOGGING || _ __ ___ ___| |_| |__ ___ __| | * Method: SET_SUBJECT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD set_subject. DATA: lv_subject TYPE c LENGTH 100. lv_subject = subject. * concatenate '==>' lv_subject into lv_subject SEPARATED BY space. TRANSLATE lv_subject TO UPPER CASE. set_message( message = lv_subject msgty = 'W' ). ENDMETHOD. "set_subject * || _ _ _ * Class : LCL_LOGGING || _ __ ___ ___| |_| |__ ___ __| | * Method: SET_ERROR || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD set_error. set_message( message = message par1 = par1 par2 = par2 msgty = 'E' ). lcl_logging=>gv_errors_were_logged = abap_true. ENDMETHOD. "set_error * || _ _ _ * Class : LCL_LOGGING || _ __ ___ ___| |_| |__ ___ __| | * Method: FORMATTER || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD formatter. case format. when 'DATE'. if not input is initial. write input to result DD/MM/YYYY. else. result = '(no date)'. endif. when 'TIME'. write input to result using EDIT MASK '__:__'. when 'FLAG'. if not input is initial. result = 'ON'. else. result = 'OFF'. endif. endcase. ENDMETHOD. ENDCLASS. "lcl_logging IMPLEMENTATION * || _ IMPLEMENTATION * LCL_SHADOW || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_shadow IMPLEMENTATION. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: READ_OBJECTS || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method read_objects. import gt_shadow_objects = gt_shadow_objects from database ZSHADOW_INDX(FS) id 'SHADOW_OBJECTS'. if sy-subrc <> 0. clear: gt_shadow_objects[]. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: SAVE_OBJECT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method save_object. data: lv_tabix type sy-tabix, lw_ZSHADOW_INDX type ZSHADOW_INDX, lv_SRTFD type ZSHADOW_INDX-SRTFD, lv_answer type c length 1. if id is initial or key_fields is initial or separator is initial. message 'Please enter required information' type 'S'. exit. endif. read_objects( ). concatenate id '~%' into lv_SRTFD. * Check whether the tracking object currently holds values select SRTFD from ZSHADOW_INDX into lv_SRTFD up to 1 rows where relid = 'FS' and SRTFD like lv_SRTFD. endselect. if sy-subrc = 0. * Ah. Settings are about to be changed, where shadow table info is already stored. Sure ? CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING TITLEBAR = 'Please confirm' TEXT_QUESTION = 'Tracking object currently holds information' TEXT_BUTTON_1 = 'Save settings' TEXT_BUTTON_2 = 'Cancel' DISPLAY_CANCEL_BUTTON = ' ' IMPORTING ANSWER = lv_answer EXCEPTIONS OTHERS = 0. if lv_answer <> '1'. exit. endif. endif. clear lv_tabix. read table gt_shadow_objects with key id = id into gw_shadow_object. if sy-subrc = 0. lv_tabix = sy-tabix. gw_shadow_object-description = description. gw_shadow_object-key_fields = key_fields. gw_shadow_object-header_lines = header_lines. gw_shadow_object-separator = separator. gw_shadow_object-controls_allowed = controls_allowed. gw_shadow_object-changed_since_allowed = allow_since. gw_shadow_object-logging_controls = logging_controls. gw_shadow_object-key_check = keycheck. gw_shadow_object-burn_after_reading = burn_after_reading. gw_shadow_object-mass_processing = mass_processing. modify gt_shadow_objects from gw_shadow_object index lv_tabix. else. gw_shadow_object-id = id. gw_shadow_object-description = description. gw_shadow_object-key_fields = key_fields. gw_shadow_object-header_lines = header_lines. gw_shadow_object-separator = separator. gw_shadow_object-controls_allowed = controls_allowed. gw_shadow_object-changed_since_allowed = allow_since. gw_shadow_object-logging_controls = logging_controls. gw_shadow_object-key_check = keycheck. gw_shadow_object-burn_after_reading = burn_after_reading. gw_shadow_object-mass_processing = mass_processing. append gw_shadow_object to gt_shadow_objects. sort gt_shadow_objects by id. endif. * The first time this is done, the original create date and create time should be set. And protected select single * from zshadow_indx into lw_zshadow_indx where relid = 'FS' and SRTFD = 'SHADOW_OBJECTS' and SRTF2 = 0. if sy-subrc <> 0 or lw_zshadow_indx-progname is initial. lw_zshadow_indx-create_date = sy-datum. lw_zshadow_indx-create_time = sy-uzeit. lw_zshadow_indx-progname = sy-repid. endif. lw_zshadow_indx-change_date = sy-datum. lw_zshadow_indx-change_time = sy-uzeit. * The ZSHADOW_INDX structure is set with predefined values - which are picked up in the EXPORT below ZSHADOW_INDX = lw_zshadow_indx. export gt_shadow_objects = gt_shadow_objects to database ZSHADOW_INDX(FS) id 'SHADOW_OBJECTS'. if sy-subrc = 0. message 'Tracking object updated' type 'S'. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: CLEAR_OBJECT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method clear_object. data: lv_SRTFD type ZSHADOW_INDX-SRTFD. concatenate id '~%' into lv_SRTFD. delete from ZSHADOW_INDX where RELID = 'FS' and SRTFD like lv_SRTFD. if sy-subrc = 0. commit work. message 'Tracking object cleared' type 'S'. else. message 'Tracking object could not be cleared' type 'W'. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: DELETE_OBJECT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method delete_object. data: lv_SRTFD type ZSHADOW_INDX-SRTFD. concatenate id '~%' into lv_SRTFD. * First check whether the object holds values select SRTFD from ZSHADOW_INDX into lv_SRTFD up to 1 rows where relid = 'FS' and SRTFD like lv_SRTFD. endselect. if sy-subrc = 0. message 'Please reset the tracking object first' type 'S'. exit. endif. delete gt_shadow_objects where id = id. export gt_shadow_objects = gt_shadow_objects to database ZSHADOW_INDX(FS) id 'SHADOW_OBJECTS'. if sy-subrc = 0. commit work. message 'Tracking object deleted' type 'S'. else. message 'Tracking object could not be deleted' type 'W'. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: READ || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method read. data: lv_ok_to_import type boolean. clear: gw_shadow, gw_record, gv_shadow_hashkey, lv_ok_to_import. gv_shadow_hashkey = hashkey. "Potentially shorter (!) gv_shadow_hashkey_full = hashkey. if gv_CHECK = abap_true. select SINGLE CREATE_DATE CREATE_TIME CHANGE_DATE CHANGE_TIME PROGNAME from ZSHADOW_INDX into CORRESPONDING FIELDS OF gw_shadow_indx where relid = 'FS' and SRTFD = gv_shadow_hashkey and SRTF2 = 0. if sy-subrc = 0. if not gv_RESEND_DATE is initial. if gv_RESEND_DATE < gw_shadow_indx-CHANGE_DATE. lv_ok_to_import = abap_true. elseif gv_RESEND_DATE = gw_shadow_indx-CHANGE_DATE and gv_RESEND_TIME >= gw_shadow_indx-CHANGE_TIME. lv_ok_to_import = abap_true. endif. else. lv_ok_to_import = abap_true. endif. if lv_ok_to_import = abap_true. import gw_shadow = gw_shadow from database ZSHADOW_INDX(FS) id gv_shadow_hashkey . endif. * The hashkey principle can hold multiple records which share the same first part of the * key. Thus when key fields add up to more than 15 characters, the remainder of the key is * stored on the same INDX entry. Focus on the exact key here: if sy-subrc = 0. read table gw_shadow-records with key hashkey = gv_shadow_hashkey_full into gw_record. endif. if sy-subrc <> 0. clear gw_record. endif. else. clear: gw_shadow-records[], gw_shadow, gw_record. endif. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: SAVE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method save. if gv_UPDATE = abap_true. if gw_shadow_indx-CREATE_DATE is initial. gw_shadow_indx-CREATE_DATE = sy-datum. gw_shadow_indx-CREATE_TIME = sy-uzeit. gw_shadow_indx-PROGNAME = sy-repid. else. gw_shadow_indx-CHANGE_DATE = sy-datum. gw_shadow_indx-CHANGE_TIME = sy-uzeit. endif. MOVE-CORRESPONDING gw_shadow_indx to ZSHADOW_INDX. read table gw_shadow-records with key hashkey = gv_shadow_hashkey_full transporting no fields. if sy-subrc = 0. modify gw_shadow-records index sy-tabix from gw_record. else. gw_record-hashkey = gv_shadow_hashkey_full. append gw_record to gw_shadow-records. sort gw_shadow-records by hashkey. delete adjacent duplicates from gw_shadow-records. endif. export gw_shadow = gw_shadow to database ZSHADOW_INDX(FS) id gv_shadow_hashkey. if sy-subrc <> 0. lcl_logging=>set_error( message = 'Schaduw tabel bijwerken: fout opgetreden (&)' par1 = gv_shadow_hashkey ). endif. endif. endmethod. * || _ _ _ * Class : LCL_SHADOW || _ __ ___ ___| |_| |__ ___ __| | * Method: VIEW_SHADOW || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method view_shadow. types: begin of ty_SRTFD, SRTFD type ZSHADOW_INDX-SRTFD, end of ty_SRTFD. data: lt_SRTFD type standard table of ty_SRTFD, lw_SRTFD type ty_SRTFD, lv_key_field type zshadow_indx-srtfd, lw_record type ty_record, lv_even_odd type boolean, lv_counter type sy-tabix. concatenate id '~' key_values '%' into lv_key_field. replace all occurrences of '**' in lv_key_field with '*'. replace all occurrences of '*' in lv_key_field with '%'. replace all occurrences of gw_shadow_object-separator in lv_key_field with '~'. * Select the shadow data up to a max number of entries: select SRTFD from ZSHADOW_INDX into table lt_SRTFD up to 500 rows where RELID = 'FS' and SRTFD like lv_key_field and SRTF2 = 0. if sy-subrc <> 0. message 'No data to be reported' type 'S'. exit. endif. clear: lv_counter, lv_even_odd. * Read the content and report on it: loop at lt_SRTFD into lw_SRTFD. import gw_shadow = gw_shadow from database ZSHADOW_INDX(FS) id lw_SRTFD. if list_keys = abap_false. if lv_even_odd = abap_true. clear: lv_even_odd. format color = col_heading. else. lv_even_odd = abap_true. format color = col_normal. endif. endif. loop at gw_shadow-records into lw_record. if list_keys = abap_true. write: / '=>', (22) lw_record-hashkey color col_total no-gap, lw_record-hashkey+22 color col_total intensified off. endif. write: / lw_record-contentline. add 1 to lv_counter. endloop. if lv_counter >= 500. write: / 'Max. number of entries reached'. exit. endif. endloop. endmethod. ENDCLASS. * || _ IMPLEMENTATION * LCL_FILE_PROCESSOR || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_file_processor IMPLEMENTATION. * || _ _ _ * Class : LCL_FILE_PROCESSOR || _ __ ___ ___| |_| |__ ___ __| | * Method: OPEN || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD open. check lcl_logging=>gv_errors_were_logged = abap_false. concatenate tracking_object '.' filename_in into gv_filename_in. OPEN DATASET gv_filename_in FOR INPUT IN TEXT MODE ENCODING DEFAULT. IF sy-subrc <> 0. lcl_logging=>set_error( 'Input file could not be opened' ). ENDIF. gv_filename_out = filename_out. ENDMETHOD. * || _ _ _ * Class : LCL_FILE_PROCESSOR || _ __ ___ ___| |_| |__ ___ __| | * Method: READ || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD read. data: lv_subrc type sy-subrc, lv_tabix type sy-tabix. check lcl_logging=>gv_errors_were_logged = abap_false. clear: lv_subrc, lv_tabix, gt_headerlines[], gt_keytable[]. gv_first_output = abap_true. clear: gv_line_counter, gv_difference_counter. while lv_subrc is initial. READ DATASET gv_filename_in INTO gv_contentline. if sy-subrc <> 0. lv_subrc = sy-subrc. exit. * HAZARD: does the last line get processed ? endif. add 1 to lv_tabix. if lv_tabix <= gv_headerlines. append gv_contentline to gt_headerlines. else. add 1 to gv_line_counter. process_record( lv_tabix ). endif. endwhile. CLOSE DATASET gv_filename_in. if lcl_shadow=>gw_shadow_object-burn_after_reading = abap_true. DELETE DATASET gv_filename_in. lcl_logging=>set_message( 'Input file deleted (burn after reading)' ). endif. ENDMETHOD. * || _ _ _ * Class : LCL_FILE_PROCESSOR || _ __ ___ ___| |_| |__ ___ __| | * Method: SET_DEFAULT_PATHS || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| METHOD set_default_paths. DATA: lw_pars TYPE spfpflpar, lw_path type path, begin of lw_system_fields, instance type c length 200, weekday type c length 20, end of lw_system_fields, begin of lw_helpfields, pars TYPE spfpflpar, end of lw_helpfields. define resolve_variables. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH space. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-sysid. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-dbsys. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-opsys. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-saprl. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-host. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH lw_system_fields-instance. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-mandt. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-mandt. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-langu. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-datum. replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-datum(4). replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-datum+2(2). replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-datum+4(2). replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH sy-datum+6(2). replace ALL OCCURRENCES OF '' IN lw_path-PATHEXTERN WITH lw_system_fields-weekday. replace ALL OCCURRENCES OF '