* _______ _______ _______ _______ _______ _______ ______ _______ _______ ______ _______ * | _ | _ | _ | | | _ | || _ | _ | _ | | _ | * | |_| | |_| | |_| | _ | | |_| | _ | |_| | |_| | | || | |_| | * | | | | |_| | | | | | | | | |_||_| | * | | _ || | ___| _| | |_| | | _ || __ | | * | _ | |_| | _ | | | |_| _ | | _ | |_| | | | | _ | * |__| |__|_______|__| |__|___| |_______|__| |__|______||__| |__|_______|___| |_|__| |__| * www.abapcadabra.com *------------------------------------------------------------------------------------------- * Program : ZABAPCADABRA_QUEUE_MATERIALS * Title : Queue processing manager - Materials * Functional area : X-component * Environment : 4.7 * Description : If you are using a report that takes a lot of time to process in * bulk in the background, cutting up it's work in smaller chunks * can be an overall improvement of the process. This report works * with a queue of key-components that is filled and processed in * maneagable chunks. * * Previous version : This is the initial version * Developer name : Wim Maasdam * Development date : 07/07/2017 * Version : 0.1 *------------------------------------------------------------------------------------------- * _ _ _ _ * ___| |__ __ _ _ __ __ _ ___ | |__ (_)___| |_ ___ _ __ _ _ * / __| '_ \ / _` | '_ \ / _` |/ _ \ | '_ \| / __| __/ _ \| '__| | | | * | (__| | | | (_| | | | | (_| | __/ | | | | \__ \ || (_) | | | |_| | * \___|_| |_|\__,_|_| |_|\__, |\___| |_| |_|_|___/\__\___/|_| \__, | * |___/ (new entries at the bottom please)|___/ * Date Description * 07.07.2017 Initial release * By Wim Maasdam *------------------------------------------------------------------------------------------- * _ * _ __ __ _ _ __ ___ (_)_ __ __ _ * | '_ \ / _` | '_ ` _ \| | '_ \ / _` | 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_QUEUE_MATERIALS. * _ _ _ _ _ * __ _| | ___ | |__ __ _| | __| | __ _| |_ __ _ * / _` | |/ _ \| '_ \ / _` | | / _` |/ _` | __/ _` | * | (_| | | (_) | |_) | (_| | | | (_| | (_| | || (_| | * \__, |_|\___/|_.__/ \__,_|_| \__,_|\__,_|\__\__,_| * |___/ * tables: ZABAPCA_QUEUE, mara, sscrfields. "For selection screen purpose only * _ _ _ * (_) | | | | * _ _ __ ___| |_ _ __| | ___ * {include} | | '_ \ / __| | | | |/ _` |/ _ \ * ZABAPCADABRA_QUEUE_MANAGEMENT | | | | | (__| | |_| | (_| | __/ _ _ _ * |_|_| |_|\___|_|\__,_|\__,_|\___| (_|_|_) include ZABAPCADABRA_QUEUE_MANAGEMENT. * || _ DEFINITION * LCL_QUEUE_MANAGER || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_queue_manager DEFINITION. public section. types: ty_num3 type n length 3, begin of ty_queue_key, qkey type ZABAPCA_QUEUE-qkey, end of ty_queue_key, ty_queue_key_table type standard table of ty_queue_key. constants: co_queue_object type PROGNAME value 'ZABAPCADABRA_QUEUE_MATERIAL', co_queue_report type sy-repid value '<>'. class-methods: queue_report, lock_report importing release type boolean default abap_false returning value(success) type boolean, queue_fill importing queuekeys type ty_queue_key_table, queue_fill_from_string importing queuekeys type string priority type boolean default abap_false, queue_fill_from_selop, queue_fill_from_file importing filename type string, queue_clear, queue_clear_old importing age type ty_num3, queue_reset, queue_PROCESS importing autoclearqueue type boolean blocksize type BAPI_BP_COUNTER jobs type MSR_COUNTER immediate type boolean start_date type sy-datum start_time type sy-uzeit jobname type TBTCJOB-JOBNAME fieldname type any. class-data: gv_reportname type sy-repid, gr_matnr type range of mara-matnr, gr_matkl type range of mara-matkl, gr_mtart type range of mara-mtart, gr_mstae type range of mara-mstae, gr_mstav type range of mara-mstav, gr_prdha type range of mara-prdha, gr_qkey type range of ZABAPCA_QUEUE-qkey, gr_create_date type range of ZABAPCA_QUEUE-create_date, gr_create_time type range of ZABAPCA_QUEUE-create_time, gr_created_by type range of ZABAPCA_QUEUE-created_by, gr_priority type range of ZABAPCA_QUEUE-priority, gr_in_progress type range of ZABAPCA_QUEUE-in_progress, gr_since_date type range of ZABAPCA_QUEUE-since_date, gr_since_time type range of ZABAPCA_QUEUE-since_time, gt_variants type standard table of BTCVARIANT, gt_ZABAPCA_QUEUE type standard table of ZABAPCA_QUEUE, gv_priority type ZABAPCA_QUEUE-priority. ENDCLASS. * || _ IMPLEMENTATION * LCL_QUEUE_MANAGER || ___| | __ _ ___ ___ * || / __| |/ _` / __/ __| * || | (__| | (_| \__ \__ \ * || \___|_|\__,_|___/___/ CLASS lcl_queue_manager IMPLEMENTATION. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_REPORT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_report. data: lo_alv type ref to ZCL_EASY_ALV, lt_ZABAPCA_QUEUE type standard table of ZABAPCA_QUEUE. select * from ZABAPCA_QUEUE into table lt_ZABAPCA_QUEUE where qkey in gr_matnr. CREATE OBJECT lo_alv. lo_alv->set_alv_from_template( CHANGING c_content = lt_ZABAPCA_QUEUE ). lo_alv->set_field( i_fieldname = 'PRIORITY' i_is_checkbox = abap_true ). lo_alv->set_field( i_fieldname = 'IN_PROGRESS' i_description_overall = 'Wordt verwerkt' i_is_checkbox = abap_true ). lo_alv->set_sort( I_FIELDNAME = 'IN_PROGRESS' i_DESCENDING = abap_true ). lo_alv->set_sort( 'SINCE_DATE' ). lo_alv->set_sort( 'SINCE_TIME' ). lo_alv->set_sort( I_FIELDNAME = 'PRIORITY' i_DESCENDING = abap_true ). lo_alv->set_sort( 'CREATE_DATE' ). lo_alv->set_sort( 'CREATE_TIME' ). lo_alv->rf_display_settings->set_striped_pattern( abap_false ). lo_alv->display( ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: LOCK_REPORT || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method lock_report. success = abap_true. if release = abap_false. CALL FUNCTION 'ENQUEUE_ESRDIRE' EXPORTING * Note the "X" instead of the "_", to avoid having to close the SE38 editor while testing. NAME = co_queue_object EXCEPTIONS OTHERS = 4. IF SY-SUBRC <> 0. message 'Report(run) locked by other user' type 'S'. success = abap_false. ENDIF. else. CALL FUNCTION 'DEQUEUE_ESRDIRE' EXPORTING NAME = co_queue_object. endif. endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_FILL || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_fill. * This method can also be called from external reports, to add or update qkey entries on the * ZABAPCA_QUEUE table. data: lt_ZABAPCA_QUEUE type standard table of ZABAPCA_QUEUE, lw_queuekey type ty_queue_key, lt_ZABAPCA_QUEUE_update type standard table of ZABAPCA_QUEUE, lw_ZABAPCA_QUEUE type ZABAPCA_QUEUE. check lines( queuekeys ) > 0. * Plaats nieuwe queue entries, welke natuurlijk niet al mogen bestaan. Als ze wel al bestaan, * wordt de oorspronkelijke queue entry bewaard. De prioriteitstelling kan worden aangepast. Als * de wachtrij regel al in behandeling is, kan ook de prioriteit niet meer worden aangepast. select * from ZABAPCA_QUEUE into table lt_ZABAPCA_QUEUE for all entries in queuekeys where qkey = queuekeys-qkey. clear: lt_ZABAPCA_QUEUE_UPDATE[]. loop at queuekeys into lw_queuekey. read table lt_ZABAPCA_QUEUE into lw_ZABAPCA_QUEUE with key qkey = lw_queuekey-qkey. if sy-subrc <> 0. * Set the default valued for a new ZABAPCA_QUEUE entry: clear: lw_ZABAPCA_QUEUE. lw_ZABAPCA_QUEUE-qkey = lw_queuekey-qkey. lw_ZABAPCA_QUEUE-create_date = sy-datum. lw_ZABAPCA_QUEUE-create_time = sy-uzeit. lw_ZABAPCA_QUEUE-created_by = sy-uname. endif. * Prioriteit instellen (alleen voor de wachtrij regels die nog niet "in process" zijn) if lw_ZABAPCA_QUEUE-in_progress is initial. lw_ZABAPCA_QUEUE-priority = gv_priority. endif. * Add the entry to the internal administration append lw_ZABAPCA_QUEUE to lt_ZABAPCA_QUEUE_UPDATE. endloop. * At this point, the lt_ZABAPCA_QUEUE_UPDATE[] internal table holds the entries * that should be added to or modified on the ZABAPCA_QUEUE table. *----------------------------------------------------------------- MODIFY ZABAPCA_QUEUE FROM TABLE lt_ZABAPCA_QUEUE_UPDATE. *----------------------------------------------------------------- if sy-subrc = 0. message 'Records adjusted' type 'S'. else. message 'Records were NOT adjusted' type 'W'. endif. endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_FILL_FROM_STRING || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_fill_from_string. data: lt_tokens type table of string, lv_token type string, lt_queuekeys type ty_queue_key_table, lw_queuekey type ty_queue_key. split queuekeys at ';' into table lt_tokens. loop at lt_tokens into lv_token. lw_queuekey-qkey = lv_token. append lw_queuekey to lt_queuekeys. endloop. if not lt_queuekeys[] is initial. gv_priority = priority. queue_fill( lt_queuekeys ). endif. endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_FILL_FROM_SELOP || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_fill_from_selop. types: begin of lty_mara, matnr type mara-matnr, end of lty_mara. data: lt_mara type standard table of lty_mara, lw_mara type lty_mara, lv_question type c length 120, lv_lines type sy-dbcnt, lv_answer type c length 1, lt_queuekeys type ty_queue_key_table, lw_queuekey type ty_queue_key. check lock_report( ) = abap_true. select matnr from mara into corresponding fields of table lt_mara where matnr in gr_matnr and matkl in gr_matkl and mtart in gr_mtart and mstae in gr_mstae and mstav in gr_mstav and prdha in gr_prdha and lvorm = space. if sy-subrc <> 0. message 'No data selected' type 'S'. else. * De gegevens die zijn geselecteerd mogen in de queue worden geplaatst. Als * beveiliging is hier een maximum aan verbonden: if lines( lt_mara ) > 5000 and sy-batch = space. lv_lines = lines( lt_mara ). write lv_lines to lv_question LEFT-JUSTIFIED. concatenate lv_question 'elements selected - proceed ?' into lv_question separated by space. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING TITLEBAR = 'Please confirm' TEXT_QUESTION = lv_question DISPLAY_CANCEL_BUTTON = ' ' IMPORTING ANSWER = lv_answer. if lv_answer <> '1'. exit. endif. endif. clear lt_queuekeys[]. loop at lt_mara into lw_mara. append lw_mara-matnr to lt_queuekeys. endloop. queue_fill( lt_queuekeys ). endif. lock_report( release = abap_true ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_FILL_FROM_FILE || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_fill_from_file. data: lt_queuekeys type ty_queue_key_table, lw_queuekey type ty_queue_key, lt_textlines type standard table of tdline. check lock_report( ) = abap_true. * Fetch the (text0 file, which will be interpreted as qkey entries: CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = filename TABLES data_tab = lt_textlines EXCEPTIONS OTHERS = 4. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. clear lt_queuekeys[]. loop at lt_textlines into lw_queuekey. append lw_queuekey to lt_queuekeys. endloop. ENDIF. if lt_queuekeys[] is initial. message 'No entries in the file' type 'S'. else. queue_fill( lt_queuekeys ). endif. lock_report( release = abap_true ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_CLEAR || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_clear. check lock_report( ) = abap_true. *----------------------------------------------------------------- DELETE FROM ZABAPCA_QUEUE WHERE qkey in gr_qkey and create_date in gr_create_date and create_time in gr_create_time and created_by in gr_created_by and priority in gr_priority and in_progress in gr_in_progress and since_date in gr_since_date and since_time in gr_since_time. *----------------------------------------------------------------- if sy-subrc = 0. message 'Records removed from the queue' type 'S'. else. message 'Records were NOT removed from the queue' type 'W'. endif. lock_report( release = abap_true ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_CLEAR_OLD || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_clear_old. data: lv_older_than type sy-datum. check lock_report( ) = abap_true. lv_older_than = sy-datum - age. *----------------------------------------------------------------- DELETE FROM ZABAPCA_QUEUE WHERE in_progress = abap_true and since_date <= lv_older_than. *----------------------------------------------------------------- if sy-subrc = 0. message 'Records removed from the queue' type 'S'. else. message 'NO records removed from the queue' type 'S'. endif. lock_report( release = abap_true ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_RESET || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_reset. data: lv_cleared_date type d, lv_cleared_time type t. check lock_report( ) = abap_true. clear: lv_cleared_date, lv_cleared_time. *----------------------------------------------------------------- UPDATE ZABAPCA_QUEUE SET in_progress = abap_false since_date = lv_cleared_date since_time = lv_cleared_time WHERE in_progress = abap_true. *----------------------------------------------------------------- if sy-subrc = 0. message 'Queue entries restored' type 'S'. else. message 'Queue entries were NOT restored' type 'W'. endif. lock_report( release = abap_true ). endmethod. * || _ _ _ * Class : LCL_QUEUE_MANAGER || _ __ ___ ___| |_| |__ ___ __| | * Method: QUEUE_PROCESS || | '_ ` _ \ / _ | __| '_ \ / _ \ / _` | * || | | | | | | __| |_| | | | (_) | (_| | * || |_| |_| |_|\___|\__|_| |_|\___/ \__,_| method queue_PROCESS. data: lw_TVARVC type TVARVC, lv_runteller type n length 5, lv_jobteller type n length 2, lv_stapteller type n length 2, lv_artikelteller type n length 5, lt_ZABAPCA_QUEUE type standard table of ZABAPCA_QUEUE, lw_ZABAPCA_QUEUE type ZABAPCA_QUEUE, lv_variant type BTCVARIANT, lv_variant_NEW type BTCVARIANT, lo_variant type ref to lcl_variant_utility, lr_matnr type range of mara-matnr, lw_matnr like line of lr_matnr, lv_record_counter type sy-tabix. * Verwerken van de queue van artikelen, voor alle genoemde stappen. Stapsgewijze verwerking: check lock_report( ) = abap_true. * STAP 1: Queue opstellen. Hiervoor wordt de FIFO (First In First Out) methode toegepast, * waarbij rekening gehouden wordt met prioriteit: select * from ZABAPCA_QUEUE into table gt_ZABAPCA_QUEUE where IN_PROGRESS = space. sort gt_ZABAPCA_QUEUE by priority DESCENDING create_date create_time. if gt_ZABAPCA_QUEUE[] is initial. message 'No new requests in the queue' type 'S'. exit. endif. * Initializeren van de logging lcl_logging=>initialize( ). lcl_logging=>set_subject( 'Queue processing' ). lcl_logging=>set_message( message = 'Blocksize & number of jobs & jobname &' par1 = blocksize par2 = jobs par3 = jobname ). * STAP 2: Bepaal de Run counter stand - de verwerkingsteller. select single * from TVARVC into lw_TVARVC where name = lcl_queue_manager=>co_queue_object and type = 'P' and "Parameter numb = 0000. if sy-subrc <> 0. clear: lw_TVARVC. lw_TVARVC-mandt = sy-mandt. lw_TVARVC-name = lcl_queue_manager=>co_queue_object. lw_TVARVC-type = 'P'. endif. if sy-subrc <> 0 or lw_TVARVC-low = '99990'. lv_runteller = 1. clear lw_TVARVC. lw_TVARVC-mandt = sy-mandt. lw_TVARVC-name = lcl_queue_manager=>co_queue_object. lw_TVARVC-type = 'P'. lw_TVARVC-low = lv_runteller. else. move lw_TVARVC-low to lv_runteller. add 1 to lv_runteller. move lv_runteller to lw_TVARVC-low. endif. lcl_logging=>set_message( message = 'Run teller = &' par1 = lv_runteller ). * STAP 3: Verwerken van de ZABAPCA_QUEUE, met als overkoepelende lus: het aantal batch jobs: do jobs times. move sy-index to lv_jobteller. lcl_logging=>set_message( message = 'Job teller = &' par1 = lv_jobteller ). * STAP 4: Bepaal het gedeelte dat in deze job verwerkt moet worden, een deel van de * GT_ZABAPCA_QUEUE wordt verplaatst naar de lt_ZABAPCA_QUEUE. clear: lt_ZABAPCA_QUEUE[], lv_record_counter. loop at gt_ZABAPCA_QUEUE into lw_ZABAPCA_QUEUE. add 1 to lv_record_counter. if lv_record_counter > blocksize. exit. endif. delete gt_ZABAPCA_QUEUE. append lw_ZABAPCA_QUEUE to lt_ZABAPCA_QUEUE. endloop. * Controle: staan er nog wachtrij regels klaar om te verwerken ? if lt_ZABAPCA_QUEUE[] is initial. lcl_logging=>set_message( 'Wachtrij volledig verwerkt' ). exit. endif. describe table lt_ZABAPCA_QUEUE lines lv_artikelteller. lcl_logging=>set_message( message = 'Wachtrij verwerking voor & artikelen' par1 = lv_artikelteller ). * STAP 5: Open de achtergrond taak if lcl_job_utility=>job_open( jobname = jobname ) = abap_false. lcl_logging=>set_error( 'Achtergrond taak kon niet gestart worden' ). else. * STAP 6: maak varianten aan voor de stappen die in de achtergrond taak worden * opgenomen. De namen van de varianten zijn {runteller}~BJ{job nummer}ST{stapnummer}: loop at gt_variants into lv_variant. move sy-tabix to lv_stapteller. * Lees de variant, pas hem aan, en sla hem op als kopie-variant (met verwijzing naar * de oorspronkelijke variant, bij wijze van omschrijving. CREATE OBJECT lo_variant EXPORTING report_name = lcl_queue_manager=>GV_REPORTNAME variant_name = lv_variant. if lo_variant->gv_variant is initial. lcl_logging=>set_error( message = 'Variant & bestaat niet' par1 = lv_variant ). exit. "<- leave LOOP processing endif. * STAP 7: Plaats de lijst met artikelen in de variant (SO_MATNR). Hiervoor moet een select-option * range veld worden opgebouwd met de materiaalnummers: clear: lr_matnr[]. loop at lt_ZABAPCA_QUEUE into lw_ZABAPCA_QUEUE. lw_matnr = 'IEQ'. lw_matnr-low = lw_ZABAPCA_QUEUE-qkey. append lw_matnr to lr_matnr. endloop. lo_variant->set_selectoption_matnr( selectoption = fieldname values = lr_matnr ). * Samenstellen van een nieuwe variantnaam concatenate lv_runteller '@BJ' lv_jobteller 'ST' lv_stapteller into lv_variant_NEW. condense lv_variant_NEW NO-GAPS. if lo_variant->copy( lv_variant_NEW ) = abap_false. lcl_logging=>set_error( message = 'Variant & fout bij creeren' par1 = lv_variant_NEW ). else. if lo_variant->save( lv_variant_NEW ) = abap_false. lcl_logging=>set_syst( ). lcl_logging=>set_error( message = 'Variant & fout bij opslaan' par1 = lv_variant_NEW ). else. lcl_logging=>set_message( message = 'Step & variant & als & aangemaakt' par1 = lv_stapteller par2 = lv_variant par3 = lv_variant_NEW ). * Variant is aangemaakt, volgende stap kan worden ingezet: * STAP 8: Voeg een stap toe aan de achtergrond taak if lcl_job_utility=>job_submit( reportname = lcl_queue_manager=>GV_REPORTNAME variant = lv_variant_NEW ) = abap_false. lcl_logging=>set_syst( ). lcl_logging=>set_error( message = 'Fout bij uitvoeren - variant &' par1 = lv_variant_NEW ). exit. endif. endif. endif. endloop. endif. if lcl_logging=>GV_ERRORS_WERE_LOGGED = abap_false. * STAP 9: Sluit de achtergrond taak af if lcl_job_utility=>job_close( immediate = immediate start_date = start_date start_time = start_time ) = abap_false. lcl_logging=>set_syst( ). lcl_logging=>set_error( 'Error starting background task' ). exit. else. lcl_logging=>set_message( 'Background task started' ). endif. endif. if lcl_logging=>GV_ERRORS_WERE_LOGGED = abap_false. * STAP 10: Op de queue aangeven welke artikelen aan een achtergrondtaak voor de * herwaardering zijn afgegeven. loop at lt_ZABAPCA_QUEUE into lw_ZABAPCA_QUEUE. if autoclearqueue = abap_true. * HAZARD else. lw_ZABAPCA_QUEUE-IN_PROGRESS = abap_true. lw_ZABAPCA_QUEUE-SINCE_DATE = sy-datum. lw_ZABAPCA_QUEUE-SINCE_TIME = sy-uzeit. modify lt_ZABAPCA_QUEUE from lw_ZABAPCA_QUEUE. endif. endloop. *------------------------------------------------------- modify ZABAPCA_QUEUE from table lt_ZABAPCA_QUEUE. *------------------------------------------------------- endif. ENDDO. * Ophogen van de run teller (of er nou fouten zijn geweest of niet) MODIFY TVARVC FROM lw_TVARVC. lock_report( release = abap_true ). lcl_logging=>go_log->display( ). endmethod. ENDCLASS. * _ _ _ * ___ ___| | ___ ___| |_(_) ___ _ __ ___ ___ _ __ ___ ___ _ __ * / __|/ _ \ |/ _ \/ __| __| |/ _ \| '_ \ / __|/ __| '__/ _ \/ _ \ '_ \ * \__ \ __/ | __/ (__| |_| | (_) | | | | \__ \ (__| | | __/ __/ | | | * |___/\___|_|\___|\___|\__|_|\___/|_| |_| |___/\___|_| \___|\___|_| |_| * SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN. selection-screen begin of line. parameter pa_show radiobutton group gr1 default 'X' user-command rfsh. selection-screen comment 3(28) sl_000 for field pa_show. selection-screen end of line. SELECTION-SCREEN BEGIN OF BLOCK SB1 WITH FRAME. _selection_option: so_matn2 mara-matnr op1 sl_101. SELECTION-SCREEN END OF BLOCK SB1. _radio_button: pa_read gr1 xxx sl_100. SELECTION-SCREEN BEGIN OF BLOCK SB2 WITH FRAME. _radio_button: pa_fmara gr2 op2 sl_201. _selection_option: so_matnr mara-matnr op2 sl_202, so_matkl mara-matkl op2 sl_203, so_mtart mara-mtart op2 sl_204, so_mstae mara-mstae op2 sl_205, so_mstav mara-mstav op2 sl_206, so_prdha mara-prdha op2 sl_207. _skip skip1 op2. _radio_button: pa_ffile gr2 op2 sl_220. selection-screen begin of line. selection-screen comment 1(28) sl_221 for field pa_ufile modif id op2. parameters: pa_ufile type string lower case MODIF ID op2. selection-screen end of line. _skip skip2 op2. selection-screen begin of line. parameter pa_prio as checkbox default space MODIF ID op2. selection-screen comment 3(28) sl_222 for field pa_prio modif id op2. selection-screen end of line. SELECTION-SCREEN END OF BLOCK SB2. _radio_button: pa_clear gr1 xxx sl_300. SELECTION-SCREEN BEGIN OF BLOCK SB3 WITH FRAME. _selection_option: so_qkey ZABAPCA_QUEUE-qkey op3 sl_301, so_cdate ZABAPCA_QUEUE-create_date op3 sl_302, so_ctime ZABAPCA_QUEUE-create_time op3 sl_303, so_uname ZABAPCA_QUEUE-created_by op3 sl_304, so_prior ZABAPCA_QUEUE-priority op3 sl_305, so_inpro ZABAPCA_QUEUE-in_progress op3 sl_306, so_sdate ZABAPCA_QUEUE-since_date op3 sl_307, so_stime ZABAPCA_QUEUE-since_time op3 sl_308. SELECTION-SCREEN END OF BLOCK SB3. _radio_button: pa_reset gr1 xxx sl_320. _radio_button: pa_start gr1 xxx sl_350. SELECTION-SCREEN END OF SCREEN 1100. SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN. SELECTION-SCREEN begin of line. parameters: pa_autoq as checkbox default space. SELECTION-SCREEN COMMENT 3(77) sl_390 FOR FIELD pa_autoq. SELECTION-SCREEN end of line. SELECTION-SCREEN skip. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_400 FOR FIELD pa_block. parameters: pa_block type BAPI_BP_COUNTER default 1500. SELECTION-SCREEN COMMENT 40(30) sl_400b. SELECTION-SCREEN end of line. _parameter: pa_jbcnt sl_401 MSR_COUNTER. SELECTION-SCREEN begin of line. parameters: pa_bgchk as checkbox default 'X'. SELECTION-SCREEN COMMENT 3(77) sl_403 FOR FIELD pa_bgchk. SELECTION-SCREEN end of line. SELECTION-SCREEN SKIP. SELECTION-SCREEN begin of line. parameters: pa_immed type c AS CHECKBOX DEFAULT abap_true USER-COMMAND rfsh. SELECTION-SCREEN COMMENT 3(77) sl_404 FOR FIELD pa_immed. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_405 FOR FIELD pa_bjdat. parameters: pa_bjdat type sy-datum MODIF ID JPL, pa_bjtim type sy-uzeit MODIF ID JPL. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_406 FOR FIELD pa_runrl. parameters: pa_runrl type n length 5 MODIF ID reo. SELECTION-SCREEN PUSHBUTTON 42(4) tvarv_bt USER-COMMAND runcounter. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_407 FOR FIELD pa_jobnm. parameters: pa_jobnm type TBTCJOB-JOBNAME default lcl_queue_manager=>co_queue_object. SELECTION-SCREEN end of line. SELECTION-SCREEN SKIP. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_412 FOR FIELD pa_reprt. parameters: pa_reprt type sy-repid default lcl_queue_manager=>co_queue_report. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_413 FOR FIELD pa_fname. parameters: pa_fname type c length 20 default 'SO_MATNR'. SELECTION-SCREEN end of line. SELECTION-SCREEN SKIP. _parameter pa_vari1 sl_410 BTCVARIANT. _parameter pa_vari2 sl_411 BTCVARIANT. SELECTION-SCREEN begin of line. SELECTION-SCREEN position 35. parameters: pa_vari3 type BTCVARIANT. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN position 35. parameters: pa_vari4 type BTCVARIANT. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN position 35. parameters: pa_vari5 type BTCVARIANT. SELECTION-SCREEN end of line. SELECTION-SCREEN END OF SCREEN 1200. SELECTION-SCREEN BEGIN OF SCREEN 1300 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN PUSHBUTTON 1(20) refr_bt USER-COMMAND refresh. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN SKIP. _parameter_sta: pa_qued sl_420 6, pa_qong sl_421 6. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(70) sl_422 MODIF ID STA. SELECTION-SCREEN END OF LINE. _parameter_sta: pa_qact sl_423 2, pa_qpln sl_424 2. SELECTION-SCREEN SKIP. _parameter_sta: pa_qend sl_425 2, pa_qabo sl_426 2. SELECTION-SCREEN END OF SCREEN 1300. SELECTION-SCREEN BEGIN OF SCREEN 1400 AS SUBSCREEN. SELECTION-SCREEN begin of line. parameters: pa_killq type c AS CHECKBOX DEFAULT space. SELECTION-SCREEN COMMENT 3(77) sl_440 FOR FIELD pa_killq. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_441 FOR FIELD pa_q_age. parameters: pa_q_age type n length 3 default 10. SELECTION-SCREEN end of line. selection-screen skip. SELECTION-SCREEN begin of line. parameters: pa_killv type c AS CHECKBOX DEFAULT space. SELECTION-SCREEN COMMENT 3(77) sl_442 FOR FIELD pa_killv. SELECTION-SCREEN end of line. SELECTION-SCREEN begin of line. SELECTION-SCREEN COMMENT 1(33) sl_443 FOR FIELD pa_runfr. parameters: pa_runfr type n length 3 default 20. SELECTION-SCREEN end of line. SELECTION-SCREEN END OF SCREEN 1400. * SELECTION-SCREEN FUNCTION KEY 1. SELECTION-SCREEN BEGIN OF TABBED BLOCK maintab FOR 22 LINES. SELECTION-SCREEN TAB (28) gl_tab1 USER-COMMAND tab1 DEFAULT SCREEN 1100. SELECTION-SCREEN TAB (30) gl_tab2 USER-COMMAND tab2 DEFAULT SCREEN 1200. SELECTION-SCREEN TAB (22) gl_tab3 USER-COMMAND tab3 DEFAULT SCREEN 1300. SELECTION-SCREEN TAB (22) gl_tab4 USER-COMMAND tab4 DEFAULT SCREEN 1400. SELECTION-SCREEN END OF BLOCK maintab. * _ _ _ _ * | | | | | | (_) * __ _| |_ ___ ___| | ___ ___| |_ _ ___ _ __ ___ ___ _ __ ___ ___ _ __ * / _` | __| / __|/ _ \ |/ _ \/ __| __| |/ _ \| '_ \___/ __|/ __| '__/ _ \/ _ \ '_ \ * | (_| | |_ \__ \ __/ | __/ (__| |_| | (_) | | | |__\__ \ (__| | | __/ __/ | | | * \__,_|\__| |___/\___|_|\___|\___|\__|_|\___/|_| |_| |___/\___|_| \___|\___|_| |_| AT SELECTION-SCREEN ON VALUE-REQUEST for pa_ufile. lcl_variant_utility=>f4_presentation_file( exporting title = 'Kies een bestand om te verwerken' changing filepath = pa_ufile ). AT SELECTION-SCREEN ON VALUE-REQUEST for pa_vari1. CALL FUNCTION 'F4_REPORT_VARIANT' EXPORTING PROGRAM = pa_reprt IMPORTING RESULT = pa_vari1. AT SELECTION-SCREEN ON VALUE-REQUEST for pa_vari2. CALL FUNCTION 'F4_REPORT_VARIANT' EXPORTING PROGRAM = pa_reprt IMPORTING RESULT = pa_vari2. AT SELECTION-SCREEN ON VALUE-REQUEST for pa_vari3. CALL FUNCTION 'F4_REPORT_VARIANT' EXPORTING PROGRAM = pa_reprt IMPORTING RESULT = pa_vari3. AT SELECTION-SCREEN ON VALUE-REQUEST for pa_vari4. CALL FUNCTION 'F4_REPORT_VARIANT' EXPORTING PROGRAM = pa_reprt IMPORTING RESULT = pa_vari4. AT SELECTION-SCREEN ON VALUE-REQUEST for pa_vari5. CALL FUNCTION 'F4_REPORT_VARIANT' EXPORTING PROGRAM = pa_reprt IMPORTING RESULT = pa_vari5. AT SELECTION-SCREEN. CASE sscrfields-ucomm. when 'REFRESH'. select count(*) from ZABAPCA_QUEUE into pa_qued where IN_PROGRESS = abap_false. select count(*) from ZABAPCA_QUEUE into pa_qong where IN_PROGRESS = abap_true. pa_qpln = lcl_job_utility=>job_select( jobname = pa_jobnm running = abap_false ). pa_qact = lcl_job_utility=>job_select( jobname = pa_jobnm prelim = abap_false schedul = abap_false ready = abap_false ). pa_qend = lcl_job_utility=>job_select( jobname = pa_jobnm prelim = abap_false schedul = abap_false ready = abap_false running = abap_false finished = abap_true ). pa_qabo = lcl_job_utility=>job_select( jobname = pa_jobnm prelim = abap_false schedul = abap_false ready = abap_false running = abap_false aborted = abap_true ). message 'Refreshed' type 'S'. clear: sscrfields-ucomm. when 'RUNCOUNTER'. * Get the runcounter and alter it data: lt_SVAL type STANDARD TABLE OF SVAL, lw_SVAL type SVAL, lw_TVARVC type TVARVC, lv_returncode type c. * Fetch date from the system: select single * from TVARVC into lw_TVARVC where name = lcl_queue_manager=>co_queue_object and type = 'P' and "Parameter numb = 0000. if sy-subrc <> 0. clear: lw_TVARVC. lw_TVARVC-mandt = sy-mandt. lw_TVARVC-name = lcl_queue_manager=>co_queue_object. lw_TVARVC-type = 'P'. endif. clear: lt_SVAL[], lw_SVAL. lw_SVAL-TABNAME = 'MEAN'. lw_SVAL-FIELDNAME = 'LFNUM'. lw_SVAL-VALUE = lw_TVARVC-low. append lw_SVAL to lt_SVAL. * Show popup in which the future key date can be entered CALL FUNCTION 'POPUP_GET_VALUES' EXPORTING POPUP_TITLE = 'Run counter' IMPORTING RETURNCODE = lv_returncode TABLES FIELDS = lt_SVAL EXCEPTIONS OTHERS = 4. IF LV_RETURNCODE = 'A'. message 'Action cancelled' type 'S'. ELSE. read table lt_SVAL index 1 into lw_SVAL. if lw_SVAL-value co '0123456789 '. lw_TVARVC-low = lw_SVAL-VALUE. *---------------------------------------------------- * Update the TVARV variabele modify TVARVC from lw_TVARVC. *---------------------------------------------------- if sy-subrc <> 0. message 'Run counter - UPDATE ERROR' type 'W'. else. message 'Run counter was changed' type 'S'. endif. else. message 'Run counter - UPDATE ERROR - non numeric value' type 'W'. endif. ENDIF. leave program. ENDCASE. AT SELECTION-SCREEN OUTPUT. data: lw_TVARVC type TVARVC. select single * from TVARVC into lw_TVARVC where name = lcl_queue_manager=>co_queue_object and type = 'P' and "Parameter numb = 0000. if sy-subrc = 0. move lw_TVARVC-low to pa_runrl. else. message 'A run counter is not yet available (please create)' type 'S'. endif. loop at screen. if pa_show is initial and screen-group1 = 'OP1'. screen-input = '0'. screen-active = '0'. modify screen. endif. if pa_read is initial and screen-group1 = 'OP2'. screen-input = '0'. screen-active = '0'. modify screen. endif. if pa_clear is initial and screen-group1 = 'OP3'. screen-input = '0'. screen-active = '0'. modify screen. endif. if pa_immed = abap_true and screen-group1 = 'JPL'. screen-input = '0'. modify screen. endif. if screen-group1 = 'STA'. screen-input = '0'. if lcl_job_utility=>gv_jobdetails_selected = abap_false. screen-active = '0'. endif. modify screen. endif. if screen-group1 = 'REO'. screen-input = '0'. modify screen. endif. endloop. * _ _ _ _ _ _ _ _ * (_)_ __ (_) |_(_) __ _| (_)______ _| |_(_) ___ _ __ * | | '_ \| | __| |/ _` | | |_ / _` | __| |/ _ \| '_ \ * | | | | | | |_| | (_| | | |/ / (_| | |_| | (_) | | | | * |_|_| |_|_|\__|_|\__,_|_|_/___\__,_|\__|_|\___/|_| |_| * INITIALIZATION. gl_tab1 = 'Actions'. sl_000 = 'Show queue'. sl_100 = 'Fill queue'. sl_101 = 'Material number'. sl_201 = 'Selection from database'. sl_202 = 'Material number'. sl_203 = 'Material Group'. sl_204 = 'Material Type'. sl_205 = 'Cross-Plant Material Status'. sl_206 = 'Cross-distribution-chain material status'. sl_207 = 'Product hierarchy'. sl_220 = 'Selection from a file'. sl_221 = 'Filename (frontend)'. sl_222 = 'With priority'. sl_300 = 'Clear queue'. sl_301 = 'Material number'. sl_302 = 'Date created'. sl_303 = 'Time created'. sl_304 = 'Created by'. sl_305 = 'Priority'. sl_306 = 'In progress'. sl_307 = 'Date since'. sl_308 = 'Time since'. sl_320 = 'Restore queue'. sl_350 = 'Process queue'. gl_tab2 = 'Settings for processing'. sl_390 = 'Automatically clear the queue'. sl_400 = 'Blocksize'. sl_400b = 'Nr. of entries'. sl_401 = 'Nr. of parallel jobs'. sl_403 = 'Check background tasks (when active or planned: skip execution)'. sl_404 = 'Schedule immediately'. sl_405 = 'Date and time'. sl_406 = 'Run counter'. tvarv_bt = '@0Z@'. sl_407 = 'Batchjob name'. sl_410 = 'Variant name (step 1)'. sl_411 = '... (step 2)'. sl_412 = 'Target report'. sl_413 = 'Target selection field'. sl_420 = 'In the queue'. sl_421 = 'In process'. sl_422 = 'Background task (job) info for yesterday, today and tomorrow'. sl_423 = 'Active jobs'. sl_424 = 'Planned jobs'. sl_425 = 'Recently ended jobs'. sl_426 = 'Recently ABORTED jobs'. sl_440 = 'Remove queue entries'. sl_441 = '... older than n days'. sl_442 = 'Remove variants'. sl_443 = '... skip n run counts'. skip1 = ''. skip2 = ''. gl_tab3 = 'Status overview'. refr_bt = 'Refresh'. gl_tab4 = 'Housekeeping'. * When a transaction is set up for this report and the report * was started using the transaction, the existance of a variant * with the same name as the transaction is checked. If such * variant is available, it is regarded as the default variant * and the report is re-started using this variant. IF sy-batch = space and "Not run as batch job ( sy-tcode(1) co 'YZ' or sy-tcode = 'SE38' ) and "Started via Y or Z transaction sy-slset <> sy-tcode. "Current variant <> transaction code * Check: variant with the name of the transaction available ? data: lw_varid type varid. select single * from varid into lw_varid where report = sy-repid and variant = sy-tcode and flag1 = space and flag2 = space. IF sy-subrc = 0. * A variant exists, restart the report for this variant: message 'Variant automatically picked up' type 'S'. SUBMIT (lw_varid-report) USING SELECTION-SET lw_varid-variant VIA SELECTION-SCREEN. ENDIF. ENDIF. * _ _ __ _ _ _ * ___| |_ __ _ _ __| |_ ___ / _| ___ ___| | ___ ___| |_(_) ___ _ __ * / __| __/ _` | '__| __|__ / _ \| |_ ___/ __|/ _ \ |/ _ \/ __| __| |/ _ \| '_ \ * \__ \ || (_| | | | ||___| (_) | _|___\__ \ __/ | __/ (__| |_| | (_) | | | | * |___/\__\__,_|_| \__| \___/|_| |___/\___|_|\___|\___|\__|_|\___/|_| |_| * START-OF-SELECTION. * Voordat de radio buttons worden nagelopen: eerst huishoudelijke taken * uitvoeren: if pa_killq = abap_true or pa_killv = abap_true. if pa_killq = abap_true. * Verwijder de wachtrij gegevens die als ĪN_PROGESS staan aangemerkt en ouder zijn * dan PA_Q_AGE dagen lcl_queue_manager=>queue_clear_old( pa_q_age ). endif. if pa_killv = abap_true. lcl_queue_manager=>gv_reportname = pa_reprt. pa_runrl = pa_runrl - pa_runfr. if pa_runrl > 0. if lcl_variant_utility=>delete( reportname = lcl_queue_manager=>GV_REPORTNAME runnr = pa_runrl ) = abap_true. message 'Variants removed' type 'S'. else. message 'No variants removed' type 'S'. endif. else. message 'Variants removed' type 'S'. endif. endif. leave to current transaction. endif. *------------->> Radio button: Wachtrij tonen if pa_show = abap_true. * Wachtrij tonen: stels een ALV rapportage op met de wachtrij gegevens. Hierin worden ook * prioriteit en "in _progress" getoond. In progress betekend dat het betreffence artikel * is aangeboden aan de herwaardering. lcl_queue_manager=>gr_matnr[] = so_matn2[]. lcl_queue_manager=>queue_report( ). *------------->> Radio button: Wachtrij lezen elseif pa_read = abap_true. * Wachtrij lezen: handelingen waarmee de wachtrij kan worden gevuld. Door artikelnummers * op te geven, of door een bestand met nummers in te lezen. if not pa_fmara is initial. lcl_queue_manager=>gr_matnr[] = so_matnr[]. lcl_queue_manager=>gr_matkl[] = so_matkl[]. lcl_queue_manager=>gr_mtart[] = so_mtart[]. lcl_queue_manager=>gr_mstae[] = so_mstae[]. lcl_queue_manager=>gr_mstav[] = so_mstav[]. lcl_queue_manager=>gr_prdha[] = so_prdha[]. lcl_queue_manager=>gv_priority = pa_prio. lcl_queue_manager=>queue_fill_from_selop( ). else. if pa_ufile is initial. Message 'Ener filename' type 'S'. else. lcl_queue_manager=>gv_priority = pa_prio. lcl_queue_manager=>queue_fill_from_file( pa_ufile ). endif. endif. *------------->> Radio button: Wachtrij opschonen elseif pa_clear = abap_true. * Wachtrij opschonen: verwijder de gegevens die op de wachtrij staan, zodat ze niet meer * worden aangeboden als te verwerken. Alleen de queue gegevens die niet zijn aangemerkt * als "In progress" kunnen worden verwijderd. * lcl_queue_manager=>gr_matnr[] = so_matn3[]. lcl_queue_manager=>gr_create_date[] = so_cdate[]. lcl_queue_manager=>gr_create_time[] = so_ctime[]. lcl_queue_manager=>gr_created_by[] = so_uname[]. lcl_queue_manager=>gr_priority = so_prior[]. lcl_queue_manager=>gr_in_progress = so_inpro[]. lcl_queue_manager=>gr_since_date = so_sdate[]. lcl_queue_manager=>gr_since_time = so_stime[]. lcl_queue_manager=>queue_clear( ). *------------->> Radio button: Wachtrij herstellen elseif pa_reset = abap_true. * Wachtrij herstellen: de gegevens die op de wachtrij zijn aangemerkt als "In progress" * worden aangepast: de "In progress" indicator wordt leeggemaakt alsof ze niet eerder in * verwerking zijn genomen. Dit betekend dus dat bij "Uitvoeren" deze artikelen opnieuw * "In progress" zullen worden genomen. lcl_queue_manager=>queue_reset( ). *------------->> Radio button: Wachtrij verwerking starten elseif pa_start = abap_true. * Wachtrij verwerken: de wachtrij aan artikelen die klaar is om te verwerken wordt in * hapklare brokken aan de herwaardering aangeboden. lcl_queue_manager=>gv_reportname = pa_reprt. clear: lcl_queue_manager=>gt_variants[]. * Samenstellen van de variantenlijst (welke als stappen worden doorgevoerd) if not pa_vari1 is initial. append pa_vari1 to lcl_queue_manager=>gt_variants. endif. if not pa_vari2 is initial. append pa_vari2 to lcl_queue_manager=>gt_variants. endif. if not pa_vari3 is initial. append pa_vari3 to lcl_queue_manager=>gt_variants. endif. if not pa_vari4 is initial. append pa_vari4 to lcl_queue_manager=>gt_variants. endif. if not pa_vari5 is initial. append pa_vari5 to lcl_queue_manager=>gt_variants. endif. if lcl_queue_manager=>gt_variants[] is initial. message 'Geen varianten opgegeven' type 'S'. else. * Controleren of er al/nog achtergrond taken inde lucht zijn. In batch mode is dat * een reden om af te breken (queue-stacking). if pa_bgchk = abap_true. if lcl_job_utility=>job_select( pa_jobnm ) > 0. message 'Er zijn nog achtergrondtaken actief of gepland' type 'W'. leave program. endif. endif. *----------------------------------------------- lcl_queue_manager=>queue_PROCESS( exporting autoclearqueue = pa_autoq blocksize = pa_block jobs = pa_jbcnt immediate = pa_immed start_date = pa_bjdat start_time = pa_bjtim jobname = pa_jobnm fieldname = pa_fname ). *----------------------------------------------- endif. endif. *------------------------------------------------------------------------------------------- * __ _ _ _ _ * / _(_)_ __ (_)___| |__ ___ __| | * | |_| | '_ \| / __| '_ \ / _ \/ _` | Bye * | _| | | | | \__ \ | | | __/ (_| | for * |_| |_|_| |_|_|___/_| |_|\___|\__,_| now.. *-------------------------------------------------------------------------------------------