Author: Andrea Olivieri
Supported Releases: SAP ECC 6.0
Submitted: 20 September 2010
Highlights
Source code taken from the ASU variant restore Tool RASUVCAT
Please see the parent page Discover All the Report Variants with Parameters - Select Options of type BUKRS
Variant Catalog Creation - General Flow and Pre-requisites
Function Groups ASU2,ASU4 as well as the DDIC Tables TASUVCAT, TASUVEXT, TASUVSVD and TASUNSVO should exist even if they are no longer required
Processing
The report update the TASUVCAT table with variant relevant data.
The variant catalog program works in "Delta Mode"; this means that only the variants that were not taken into account during the previous run are cataloged again.
Text Elements
Selection Texts:
S_REP Report(s) TESTRUN Testrun
Text Symbols
001 Number of Reports/variants: 002 Only testrun 003 Posting run 004 Number of already destroyed variants 005 Number of found Report/variants E02 Start only possible in batch! P01 Control data P02 Select specific reports (optional)
ABAP Source Code
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'*&---------------------------------------------------------------------* *& Report ZTEC_PROG_VARIANT_CATALOG *&---------------------------------------------------------------------* * Report Name: Create Variant Catalog * * Created by: Andrea Olivieri * * Company: Techedge SpA * * Created on: 30.08.2010 at 13:10:12 CET * * Source code taken from the ASU variant restore Tool RASUVCAT * *----------------------------------------------------------------------* report zsdn_prog_variant_catalog. tables: trdir, varid, tadir, tasuvcat. tables: sscrfields. ***********************selection screen************************* selection-screen begin of block general with frame title text-p01. parameters: testrun as checkbox default 'X'. selection-screen end of block general. selection-screen begin of block reps with frame title text-p02. select-options: s_rep for trdir-name. selection-screen end of block reps. ***********************data definition************************** include iasudata. *.constants constants: true(1) value 'X'. constants: false(1) value '-'. data: lt_varid like varid occurs 0 with header line. data: lt_varis like varis occurs 0 with header line. data: lt_varicata like tasuvcat occurs 0 with header line. data: lt_varipart like tasuvcat occurs 0 with header line. data: ls_varicata like tasuvcat. data: ls_varicat2 like tasuvcat. data: ls_varid like varid. data: ls_varis like varis. data: ls_tadir like tadir. data: bit0 type x value 'FF'. data: ld_start like sy-tabix. data: ld_end like sy-tabix. data: ld_lines like sy-tabix. data: ld_tabix like sy-tabix. data: ld_max_pack like sy-tabix value '500'. data: ld_self like sy-repid. data: ld_fehler like sy-subrc. data: ld_rc like sy-subrc. data: ld_err_nr like sy-tabix. data: it_is_back(1). ************************************************************* at selection-screen. case sscrfields-ucomm. *....start of program only allowed in batch when 'ONLI' or 'PRIN'. if sy-batch <> true. message e398(00) with text-e02. endif. endcase. ************************************************************* start-of-selection. *.Select all reports select * from varid into ls_varid where report in s_rep. *....do not take variants that contain a '&'. Those are either *....generated by Batch or a system variants that have a special *....client logic check: ls_varid-variant ns '&'. *....Check if report is upgrade relevant, this means if it is *....existent in the new release. select single * from tadir into ls_tadir where pgmid = 'R3TR' and object = 'PROG' and obj_name = ls_varid-report. check: sy-subrc = 0. *....no local objects check: ls_tadir-devclass <> '$TMP'. *....no development classes that cannot be transported check: ls_tadir-devclass(1) <> 'T'. *....check if the variant is screen-dependent *....xflag1 should be <> '00'. bit0 = 'FF' = '1111.1111' *....Z checks if f1 is 0 in all bits where f2 is 1 *....--> checks if f1 is '00'. if not ls_varid-xflag1 z bit0. *.......select all screens to this variant select * from varis into ls_varis where report = ls_varid-report and variant = ls_varid-variant. clear ls_varicata. move-corresponding ls_varid to ls_varicata. ls_varicata-vari = ls_varid-variant. ls_varicata-dynnr = ls_varis-dynnr. *..........only new ones! select single * from (c_tasuvcat) into ls_varicat2 where report = ls_varicata-report and dynnr = ls_varicata-dynnr and vari = ls_varicata-vari. if sy-subrc <> 0. append ls_varicata to lt_varicata. endif. endselect. *....variant is screen-independent else. clear ls_varicata. move-corresponding ls_varid to ls_varicata. ls_varicata-vari = ls_varid-variant. *.......what should this be???? * ls_varicata-dynnr = '1000'. *.......only new ones! select single * from (c_tasuvcat) into ls_varicat2 where report = ls_varicata-report and dynnr = ls_varicata-dynnr and vari = ls_varicata-vari. if sy-subrc <> 0. append ls_varicata to lt_varicata. endif. endif. endselect. describe table lt_varicata lines ld_lines. write: at 1(50) text-005. write: at 55(10) ld_lines. new-line. ******************************************************************** loop at lt_varicata into ls_varicata. ld_tabix = sy-tabix. *....Check if variant is currently o.k. call function 'FASU_V_VARIANT_VALUES' starting new task 'SLO' destination 'NONE' performing return_info on end of task exporting report = ls_varicata-report variant = ls_varicata-vari exceptions syst_except = 1 communication_failure = 2 system_failure = 3 error_happened = 4. if sy-subrc <> 0. delete lt_varicata index ld_tabix. endif. clear it_is_back. wait until it_is_back = 'X'. if ld_fehler = 3 or ld_fehler = 4. *......variant is already damaged -> do not take it add 1 to ld_err_nr. delete lt_varicata index ld_tabix. endif. endloop. ******************************************************************** describe table lt_varicata lines ld_lines. write: at 1(50) text-004. write: at 55(10) ld_err_nr. new-line. write: at 1(50) text-001. write: at 55(10) ld_lines. new-line. if testrun = true. write: / text-002. else. *....do the commit per package, because of unknown number of lines ld_start = 1. ld_end = ld_max_pack. while ld_start <= ld_lines. refresh: lt_varipart. append lines of lt_varicata from ld_start to ld_end to lt_varipart. ld_start = ld_end + 1. ld_end = ld_end + ld_max_pack. *.......insert on the database modify (c_tasuvcat) from table lt_varipart. commit work. endwhile. write: / text-003. endif. *---------------------------------------------------------------------* * FORM RETURN_INFO * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* * --> TASKNAME * *---------------------------------------------------------------------* form return_info using taskname. receive results from function 'FASU_V_VARIANT_VALUES' exceptions syst_except = 1 communication_failure = 2 system_failure = 3 error_happened = 4. if sy-subrc <> 0. endif. ld_fehler = sy-subrc. it_is_back = 'X'. endform. "RETURN_INFO
Back to Discover Report Variants with Parameters - Select Options of type BUKRS