*&---------------------------------------------------------------------*
*& Include ZSOFTCOPY_PROG *
*& *
*&---------------------------------------------------------------------*
*& *
*& This file is part of ZSOFTCOPY. *
*& *
*& ZSOFTCOPY is free software: you can redistribute it and/or modify *
*& it under the terms of the GNU General Public License as published *
*& by the Free Software Foundation, either version 3 of the License, *
*& or any later version. *
*& *
*& ZSOFTCOPY is distributed in the hope that it will be useful, *
*& but WITHOUT ANY WARRANTY; without even the implied warranty of *
*& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
*& GNU General Public License for more details. *
*& *
*& You should have received a copy of the GNU General Public License *
*& along with ZDOWNLOAD. If not, see . *
*& *
*&---------------------------------------------------------------------*
*& *
*& Author: Ruediger von Creytz ruediger.creytz@globalbit.net *
*& Copyright: globalBIT, LLC http://www.globalbit.net *
*& *
*&---------------------------------------------------------------------*
*-----------------------------------------------------------------------
* prog
*-----------------------------------------------------------------------
FORM prog.
*INCL
PERFORM prog_r3tr_incl.
*PROG
PERFORM prog_r3tr_prog.
ENDFORM. "prog
*-----------------------------------------------------------------------
* prog_r3tr_incl Includes
*-----------------------------------------------------------------------
FORM prog_r3tr_incl.
DATA:
lt_tabstrip TYPE it_tabstrip,
lt_html TYPE it_string,
lt_ti TYPE it_textinput,
lt_ti_box TYPE it_textinput,
ls_ti TYPE st_textinput,
l_masterlang TYPE masterlang,
l_filename TYPE string,
ls_trdir TYPE trdir,
l_laiso TYPE laiso,
l_sptxt TYPE sptxt,
l_name TYPE ad_namtext,
l_text TYPE as4text,
l_atext TYPE appltxt.
FIELD-SYMBOLS:
TYPE st_ztadir.
PERFORM get_tabstrip
USING 'PROG_R3TR_INCL' space
CHANGING lt_tabstrip.
LOOP AT gt_ztadir ASSIGNING
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND subc = 'I'
AND downloaded = abap_false.
CLEAR:
ls_trdir,
l_atext.
REFRESH:
lt_html,
lt_ti,
lt_ti_box.
SELECT SINGLE * FROM trdir INTO ls_trdir
WHERE name = -progname.
IF sy-subrc <> 0.
-subrc = sy-subrc.
CONTINUE.
ENDIF.
*Attributes
* Title
CLEAR ls_ti.
ls_ti-name = txt_title.
ls_ti-value = -descript.
ls_ti-value_double_length = abap_true.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Original Language
CLEAR ls_ti.
ls_ti-name = txt_original_language.
l_masterlang = ls_trdir-rload.
IF l_masterlang IS INITIAL.
l_masterlang = -masterlang.
ENDIF.
PERFORM get_spras
USING
l_masterlang
CHANGING
l_laiso
l_sptxt.
ls_ti-value = l_laiso.
ls_ti-description = l_sptxt.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Space
CLEAR ls_ti.
ls_ti-space = abap_true.
APPEND ls_ti TO lt_ti.
* Created
CLEAR ls_ti.
ls_ti-name = txt_created.
PERFORM get_date
USING
ls_trdir-cdat
CHANGING
ls_ti-value.
ls_ti-value_ext = ls_trdir-cnam.
PERFORM get_user
USING
ls_trdir-cnam
CHANGING
l_name.
ls_ti-value_ext_text = l_name.
ls_ti-has_value_ext = abap_true.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Last changed by
CLEAR ls_ti.
ls_ti-name = txt_last_changed_by___1.
PERFORM get_date
USING
ls_trdir-udat
CHANGING
ls_ti-value.
ls_ti-value_ext = ls_trdir-unam.
PERFORM get_user
USING
ls_trdir-unam
CHANGING
l_name.
ls_ti-value_ext_text = l_name.
ls_ti-input = abap_true.
ls_ti-has_value_ext = abap_true.
APPEND ls_ti TO lt_ti.
* Status
CLEAR ls_ti.
ls_ti-name = txt_status.
ls_ti-value = txt_active___1.
APPEND ls_ti TO lt_ti.
*Attributes - Box
* Type
CLEAR ls_ti.
ls_ti-name = txt_type___1.
PERFORM get_dom_value_text
USING
'SUBC'
ls_trdir-subc
CHANGING
ls_ti-value.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Status
CLEAR ls_ti.
ls_ti-name = txt_status.
PERFORM get_dom_value_text
USING
'RSTAT'
ls_trdir-rstat
CHANGING
ls_ti-value.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Application
CLEAR ls_ti.
ls_ti-name = txt_application.
SELECT SINGLE atext FROM taplt INTO l_atext
WHERE appl = ls_trdir-appl
AND sprsl = sy-langu.
ls_ti-value = l_atext.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Authorization Group
CLEAR ls_ti.
ls_ti-name = txt_authorization_group.
ls_ti-value = ls_trdir-secu.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Package
CLEAR ls_ti.
ls_ti-name = txt_package.
ls_ti-value = -devclass.
PERFORM get_devclass
USING
-devclass
CHANGING
l_text.
ls_ti-description = l_text.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Space
CLEAR ls_ti.
ls_ti-space = abap_true.
APPEND ls_ti TO lt_ti_box.
* Editor lock
CLEAR ls_ti.
ls_ti-name = txt_editor_lock.
ls_ti-value = ls_trdir-edtx.
ls_ti-flag = abap_true.
APPEND ls_ti TO lt_ti_box.
*** HTML
PERFORM html_main_header
USING
tpt_fugr_incl
space "l_name_field
-progname
txt_active___1
space
space
'makeDivSize(''SOURCECODE'');'
lt_tabstrip
gt_link
CHANGING
lt_html.
* Attributes
PERFORM html_add_textinput_subbox
USING
lt_ti
txt_attributes___2
lt_ti_box
'ATTRIBUTES'
abap_false
CHANGING
lt_html.
* Source code
PERFORM add_report_sourcecode
USING
-progname
-progname
gc_extension_txt
abap_false
'SOURCECODE'
abap_true
CHANGING
lt_html.
*
PERFORM html_main_footer
USING
lt_html.
PERFORM download
USING
lt_html
-pgmid
-object
-progname
gc_extension_htm
abap_true.
-downloaded = abap_true.
ENDLOOP.
ENDFORM. "r3tr_incl
*-----------------------------------------------------------------------
* prog_r3tr_prog Programme, Includes
*-----------------------------------------------------------------------
FORM prog_r3tr_prog.
DATA:
lt_tabstrip TYPE it_tabstrip,
lt_html TYPE it_string,
ls_prog_inf TYPE rpy_prog,
lt_include_tab TYPE STANDARD TABLE OF rpy_repo,
lt_source_extended TYPE it_abaptxt255,
ls_source_extended TYPE st_abaptxt255,
lt_textelements TYPE STANDARD TABLE OF textpool,
ls_textelements_addons TYPE st_textpool_addons,
lt_text_symbols_addons TYPE it_textpool_addons,
lt_selection_texts TYPE STANDARD TABLE OF textpool,
lt_selection_texts_addons TYPE it_textpool_addons,
lt_text_symbols TYPE STANDARD TABLE OF textpool,
lt_list_titles TYPE it_textinput,
lt_row_titles TYPE it_textinput,
lt_doc TYPE it_string,
lt_ti TYPE it_textinput,
lt_ti_box TYPE it_textinput,
ls_ti TYPE st_textinput,
l_masterlang TYPE masterlang,
l_filename TYPE string,
lt_varid TYPE STANDARD TABLE OF varid,
lt_params TYPE STANDARD TABLE OF vanz,
lt_params_nonv TYPE STANDARD TABLE OF vanz,
lt_selop TYPE STANDARD TABLE OF vanz,
lt_selop_nonv TYPE STANDARD TABLE OF vanz,
lt_objects TYPE STANDARD TABLE OF vanz,
lt_valutab TYPE STANDARD TABLE OF rsparams,
lt_variant TYPE it_variant,
ls_variant TYPE st_variant,
ls_trdir TYPE trdir,
l_laiso TYPE laiso,
l_sptxt TYPE sptxt,
l_name TYPE ad_namtext,
l_text TYPE as4text,
l_atext TYPE appltxt,
l_text01 TYPE grouptext,
l_fu_param(30) TYPE c,
lt_source TYPE abapsource OCCURS 0.
FIELD-SYMBOLS:
TYPE st_tabstrip,
TYPE st_ztadir,
TYPE textpool,
TYPE varid,
TYPE vanz,
TYPE rsparams,
LIKE LINE OF lt_source.
PERFORM get_tabstrip
USING 'PROG_R3TR_PROG' space
CHANGING lt_tabstrip.
SELECT SINGLE parameter FROM fupararef INTO l_fu_param
WHERE funcname = 'RPY_PROGRAM_READ'
AND r3state = 'A'
AND parameter = 'SOURCE_EXTENDED'
AND paramtype = 'T'.
LOOP AT gt_ztadir ASSIGNING
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND subc = '1'
AND downloaded = abap_false.
-downloaded = abap_true.
CLEAR:
ls_prog_inf,
ls_trdir,
ls_variant,
l_atext.
REFRESH:
lt_html,
lt_include_tab,
lt_list_titles,
lt_objects,
lt_params,
lt_params_nonv,
lt_row_titles,
lt_selection_texts,
lt_selop,
lt_selop_nonv,
lt_source,
lt_source_extended,
lt_text_symbols,
lt_text_symbols_addons,
lt_textelements,
lt_ti,
lt_ti_box,
lt_valutab,
lt_variant,
lt_varid.
IF l_fu_param = 'SOURCE_EXTENDED'.
CALL FUNCTION 'RPY_PROGRAM_READ'
EXPORTING
language = sy-langu
program_name = -obj_name
with_includelist = abap_true
only_source = abap_false
only_texts = abap_false
read_latest_version = abap_true
with_lowercase = abap_true
IMPORTING
prog_inf = ls_prog_inf
TABLES
include_tab = lt_include_tab
source_extended = lt_source_extended
textelements = lt_textelements
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
-subrc = sy-subrc.
CONTINUE.
ENDIF.
ELSE.
CALL FUNCTION 'RPY_PROGRAM_READ'
EXPORTING
language = sy-langu
program_name = -obj_name
with_includelist = abap_true
only_source = abap_false
only_texts = abap_false
read_latest_version = abap_true
with_lowercase = abap_true
IMPORTING
prog_inf = ls_prog_inf
TABLES
include_tab = lt_include_tab
SOURCE = lt_source
textelements = lt_textelements
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
-subrc = sy-subrc.
CONTINUE.
ENDIF.
LOOP AT lt_source ASSIGNING .
ls_source_extended = -line.
APPEND ls_source_extended TO lt_source_extended.
ENDLOOP.
ENDIF.
SELECT SINGLE * FROM trdir INTO ls_trdir
WHERE name = -progname.
*Documentation
PERFORM get_docu
USING
'RE'
-obj_name
'E'
CHANGING
lt_doc.
*Text Symbols
LOOP AT lt_textelements ASSIGNING .
CASE -id.
WHEN 'H'.
CLEAR ls_ti.
ls_ti-value = -entry.
ls_ti-input = abap_true.
ls_ti-no_name = abap_true.
APPEND ls_ti TO lt_row_titles.
WHEN 'I'.
CLEAR ls_textelements_addons.
APPEND TO lt_text_symbols.
ls_textelements_addons-strlen = strlen(
-entry
).
APPEND ls_textelements_addons TO lt_text_symbols_addons.
WHEN 'S'.
CLEAR ls_textelements_addons.
IF -entry+0(1) = 'D'.
-entry+0(1) = space.
ls_textelements_addons-dict_ref = abap_true.
ENDIF.
CONDENSE -entry.
APPEND ls_textelements_addons
TO lt_selection_texts_addons.
APPEND TO lt_selection_texts.
WHEN 'T'.
CLEAR ls_ti.
ls_ti-value = -entry.
ls_ti-input = abap_true.
ls_ti-no_name = abap_true.
APPEND ls_ti TO lt_list_titles.
ENDCASE.
ENDLOOP.
*Attributes
* Title
CLEAR ls_ti.
ls_ti-name = txt_title.
ls_ti-value = -descript.
ls_ti-value_double_length = abap_true.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Original Language
CLEAR ls_ti.
ls_ti-name = txt_original_language.
l_masterlang = ls_prog_inf-masterlang.
IF l_masterlang IS INITIAL.
l_masterlang = -masterlang.
ENDIF.
PERFORM get_spras
USING
l_masterlang
CHANGING
l_laiso
l_sptxt.
ls_ti-value = l_laiso.
ls_ti-description = l_sptxt.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Space
CLEAR ls_ti.
ls_ti-space = abap_true.
APPEND ls_ti TO lt_ti.
* Created
CLEAR ls_ti.
ls_ti-name = txt_created.
PERFORM get_date
USING
ls_prog_inf-creat_date
CHANGING
ls_ti-value.
ls_ti-value_ext = ls_prog_inf-creat_user.
PERFORM get_user
USING
ls_prog_inf-creat_user
CHANGING
l_name.
ls_ti-value_ext_text = l_name.
ls_ti-has_value_ext = abap_true.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti.
* Last changed by
CLEAR ls_ti.
ls_ti-name = txt_last_changed_by___1.
PERFORM get_date
USING
ls_prog_inf-mod_date
CHANGING
ls_ti-value.
ls_ti-value_ext = ls_prog_inf-mod_user.
PERFORM get_user
USING
ls_prog_inf-mod_user
CHANGING
l_name.
ls_ti-value_ext_text = l_name.
ls_ti-input = abap_true.
ls_ti-has_value_ext = abap_true.
APPEND ls_ti TO lt_ti.
* Status
CLEAR ls_ti.
ls_ti-name = txt_status.
ls_ti-value = txt_active___1.
APPEND ls_ti TO lt_ti.
*Attributes - Box
* Type
CLEAR ls_ti.
ls_ti-name = txt_type___1.
PERFORM get_dom_value_text
USING
'SUBC'
ls_prog_inf-prog_type
CHANGING
ls_ti-value.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Status
CLEAR ls_ti.
ls_ti-name = txt_status.
PERFORM get_dom_value_text
USING
'RSTAT'
ls_prog_inf-status
CHANGING
ls_ti-value.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Application
CLEAR ls_ti.
ls_ti-name = txt_application.
SELECT SINGLE atext FROM taplt INTO l_atext
WHERE appl = ls_prog_inf-appl
AND sprsl = sy-langu.
ls_ti-value = l_atext.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Authorization Group
CLEAR ls_ti.
CLEAR l_text01.
ls_ti-name = txt_authorization_group.
ls_ti-value = ls_prog_inf-auth_group.
SELECT SINGLE text01 FROM tpgpt INTO l_text01
WHERE p_group = ls_prog_inf-auth_group
AND langu = sy-langu.
ls_ti-description = l_text01.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Package
CLEAR ls_ti.
ls_ti-name = txt_package.
ls_ti-value = -devclass.
PERFORM get_devclass
USING
-devclass
CHANGING
l_text.
ls_ti-description = l_text.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Logical database
CLEAR ls_ti.
ls_ti-name = txt_logical_database.
ls_ti-value = ls_prog_inf-dbname.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Selection screen version
CLEAR ls_ti.
ls_ti-name = txt_selection_screen_version.
ls_ti-value = ls_prog_inf-selscreen.
ls_ti-input = abap_true.
APPEND ls_ti TO lt_ti_box.
* Editor lock
CLEAR ls_ti.
ls_ti-name = txt_editor_lock.
ls_ti-value = ls_trdir-edtx.
ls_ti-flag = abap_true.
ls_ti-flag_col = 1.
APPEND ls_ti TO lt_ti_box.
* Fixed point arithmetic
CLEAR ls_ti.
ls_ti-name = txt_fixed_point_arithmetic.
ls_ti-value = ls_trdir-fixpt.
ls_ti-flag = abap_true.
ls_ti-flag_col = 2.
APPEND ls_ti TO lt_ti_box.
* Unicode checks active
CLEAR ls_ti.
ls_ti-name = txtt_unicode_checks_active.
ls_ti-value = ls_trdir-uccheck.
ls_ti-flag = abap_true.
ls_ti-flag_col = 1.
APPEND ls_ti TO lt_ti_box.
* Start using variant
CLEAR ls_ti.
ls_ti-name = txt_start_using_variant.
ls_ti-value = ls_trdir-sset.
ls_ti-flag = abap_true.
ls_ti-flag_col = 2.
APPEND ls_ti TO lt_ti_box.
*Variants
IF g_add_report_variants = abap_true.
SELECT * FROM varid INTO TABLE lt_varid
WHERE report = -obj_name.
LOOP AT lt_varid ASSIGNING .
READ TABLE gt_varid_broken TRANSPORTING NO FIELDS
WITH KEY report = -report
vari = -variant.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
report = -report
variant = -variant
TABLES
l_params = lt_params
l_params_nonv = lt_params_nonv
l_selop = lt_selop
l_selop_nonv = lt_selop_nonv
valutab = lt_valutab
OBJECTS = lt_objects
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
LOOP AT lt_valutab ASSIGNING .
IF sy-tabix > 100.
"too many entries may cause a timeout,
"so better skip the rest...
EXIT.
ENDIF.
CLEAR ls_variant.
ls_variant-program = -report.
ls_variant-variant = -variant.
ls_variant-selname = -selname.
PERFORM get_gui_kind
USING -kind
CHANGING ls_variant-kind.
PERFORM get_gui_sign
USING -sign
CHANGING ls_variant-sign.
PERFORM get_gui_operator
USING -option
CHANGING ls_variant-option.
ls_variant-low = -low.
ls_variant-high = -high.
READ TABLE lt_params ASSIGNING
WITH KEY name = -selname.
IF sy-subrc <> 0 OR -text IS INITIAL.
READ TABLE lt_params_nonv ASSIGNING
WITH KEY name = -selname.
IF sy-subrc <> 0 OR -text IS INITIAL.
READ TABLE lt_selop ASSIGNING
WITH KEY name = -selname.
IF sy-subrc <> 0 OR -text IS INITIAL.
READ TABLE lt_selop_nonv ASSIGNING
WITH KEY name = -selname.
IF sy-subrc <> 0 OR -text IS INITIAL.
READ TABLE lt_objects ASSIGNING
WITH KEY name = -selname.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
IF sy-subrc = 0.
ls_variant-text = -text.
ENDIF.
APPEND ls_variant TO lt_variant.
ENDLOOP.
ENDLOOP.
ENDIF.
***Tabstrip
LOOP AT lt_tabstrip ASSIGNING .
-empty = abap_false.
CASE -id.
WHEN 'LISTTITLE'.
IF lt_list_titles IS INITIAL
AND lt_row_titles IS INITIAL.
-empty = abap_true.
ENDIF.
WHEN 'SELECTIONTEXTS'.
IF lt_selection_texts IS INITIAL.
-empty = abap_true.
ENDIF.
WHEN 'TEXTSYMBOLS'.
IF lt_text_symbols IS INITIAL.
-empty = abap_true.
ENDIF.
WHEN 'DOC'.
IF lt_doc IS INITIAL.
-empty = abap_true.
ENDIF.
WHEN 'VARIANT'.
IF lt_variant IS INITIAL.
-empty = abap_true.
IF g_add_report_variants = abap_false.
-hidden = abap_true.
ENDIF.
ENDIF.
ENDCASE.
ENDLOOP.
*** HTML
PERFORM html_main_header
USING
tpt_prog_repo
space "l_name_field
-obj_name
txt_active___1
space
space
'makeDivSize(''SOURCECODE'');makeDivSize(''DOC'');'
lt_tabstrip
gt_link
CHANGING
lt_html.
* list and row titles
IF NOT lt_list_titles IS INITIAL
OR NOT lt_row_titles IS INITIAL
OR g_empty_tab = gc_empty_tab_display.
PERFORM html_add_box_textinput2ver
USING
txt_list_header
lt_list_titles
txt_column_heading
lt_row_titles
'LISTTITLE'
abap_false
CHANGING
lt_html.
ENDIF.
* selection texts
IF NOT lt_selection_texts IS INITIAL
OR g_empty_tab = gc_empty_tab_display.
PERFORM html_add_table
USING
'PROG_SELEC'
lt_selection_texts
lt_selection_texts_addons
'SELECTIONTEXTS'
abap_false
CHANGING
lt_html.
ENDIF.
* text symbols
IF NOT lt_text_symbols IS INITIAL
OR g_empty_tab = gc_empty_tab_display.
PERFORM html_add_table
USING
'PROG_SYMBO'
lt_text_symbols
lt_text_symbols_addons
'TEXTSYMBOLS'
abap_false
CHANGING
lt_html.
ENDIF.
* variants
IF g_add_report_variants = abap_true
AND ( NOT lt_variant IS INITIAL
OR g_empty_tab = gc_empty_tab_display ).
PERFORM html_add_table
USING
'PROG_VARIA'
lt_variant
lt_variant
'VARIANT'
abap_false
CHANGING
lt_html.
ENDIF.
* documentation
IF NOT lt_doc IS INITIAL
OR g_empty_tab = gc_empty_tab_display.
PERFORM html_add_doc
USING
lt_doc
'DOC'
abap_false
CHANGING
lt_html.
ENDIF.
* attributes
PERFORM html_add_textinput_subbox
USING
lt_ti
txt_attributes___2
lt_ti_box
'ATTRIBUTES'
abap_false
CHANGING
lt_html.
* source code
PERFORM add_report_sourcecode
USING
-obj_name
-obj_name
gc_extension_txt
abap_true
'SOURCECODE'
abap_true
CHANGING
lt_html.
*
PERFORM html_main_footer
USING
lt_html.
PERFORM download
USING
lt_html
-pgmid
-object
-obj_name
gc_extension_htm
abap_true.
ENDLOOP.
ENDFORM. "r3tr_prog