*&---------------------------------------------------------------------*
*&  Include           ZSOFTCOPY_FUGR                                   *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*& 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 <http://www.gnu.org/licenses/>.   *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&  Author:     Ruediger von Creytz     ruediger.creytz@globalbit.net  *
*&  Copyright:  globalBIT, LLC          http://www.globalbit.net       *
*&                                                                     *
*&---------------------------------------------------------------------*


*-----------------------------------------------------------------------
* fugr
*-----------------------------------------------------------------------
FORM fugr.
*FUGR
  PERFORM fugr_r3tr_fugr.
*INCL
  PERFORM fugr_r3tr_includes.
*MOD
  PERFORM fugr_r3tr_modules.
*Screen
  PERFORM fugr_r3tr_screen.

ENDFORM.                    "fugr


*-----------------------------------------------------------------------
* fugr_get_feldtab
*-----------------------------------------------------------------------
FORM fugr_get_feldtab
  USING
    is_d020s TYPE d020s
    it_d021s TYPE it_d021s
    it_d023x TYPE d023s_xtab
    is_dynpro_release TYPE st_dynpro_release
  CHANGING
    ct_feld TYPE it_feld
    ct_feld_redef TYPE it_feld_redef.

  DATA:
  ls_d021s_res1 LIKE d021s_res1,
  ls_feld TYPE feld,
  ls_feld_redef TYPE st_feld_redef,
  ls_func_old TYPE st_dynpro_function_old,
  ls_func_new TYPE st_dynpro_function_new,
  l_length TYPE i,
  l_strlen TYPE i.

  FIELD-SYMBOLS:
  <ls_d021s> TYPE d021s,
  <ls_d023x> TYPE d023s_xh,
  <l_recentry> TYPE ANY.

  CONSTANTS:
  lc_flg1ddf TYPE x VALUE '20',
  lc_flg1ddm TYPE x VALUE '10',
  lc_flg1edt TYPE x VALUE '80',
  lc_flg1scr TYPE x VALUE '01',
  lc_flg3obl TYPE x VALUE '20',
  lc_fmb1ges TYPE x VALUE '20',
  lc_fmb1out TYPE x VALUE '01',
  lcs_dynpro_rel_400 TYPE st_dynpro_release VALUE '4.00',
  lcs_dynpro_rel_401 TYPE st_dynpro_release VALUE '4.01',
  lcs_dynpro_rel_402 TYPE st_dynpro_release VALUE '4.02',
  lcs_dynpro_rel_46a TYPE st_dynpro_release VALUE '4.60',
  lcs_dynpro_rel_610 TYPE st_dynpro_release VALUE '6.10'.


  REFRESH:
  ct_feld,
  ct_feld_redef.


  LOOP AT it_d021s ASSIGNING <ls_d021s>.
    CLEAR ls_d021s_res1.
    CLEAR ls_feld.
    CLEAR ls_feld_redef.
    CLEAR ls_func_new.
    CLEAR ls_func_old.

    ls_d021s_res1 = <ls_d021s>-res1.

    ls_feld-name = <ls_d021s>-fnam.
    ls_feld-dynnr = is_d020s-dnum.
    ls_feld-line = <ls_d021s>-line.

    IF ( <ls_d021s>-lanf <> 0 AND <ls_d021s>-ltyp = 'T' )
    OR ( <ls_d021s>-ltyp = 'I' AND <ls_d021s>-fill = 'P' )
    OR <ls_d021s>-ltyp = 'S'.
      ls_feld-coln = <ls_d021s>-coln.
    ELSE.
      ls_feld-coln = <ls_d021s>-coln - 1.
    ENDIF.

    ls_feld-leng = <ls_d021s>-leng.

    ls_feld-vleng = 1.
    IF <ls_d021s>-didx <= 0.
      IF <ls_d021s>-stxt(1) = '@'.
        IF <ls_d021s>-leng > 2.
          ls_feld-vleng = <ls_d021s>-leng - 2.
        ENDIF.
      ELSE.
        IF <ls_d021s>-leng > 1.
          ls_feld-vleng = <ls_d021s>-leng.
        ENDIF.
      ENDIF.
    ELSE.
      IF <ls_d021s>-fill CA 'TBSUIR'.
        ls_feld-vleng = <ls_d021s>-leng.
      ELSE.
        IF <ls_d021s>-flg1 Z lc_flg1edt.
          IF <ls_d021s>-ltyp CA 'TP'.
            ls_feld-vleng = <ls_d021s>-didx.
          ELSE.
            IF <ls_d021s>-didx > 0.
              ls_feld-vleng = <ls_d021s>-didx.
            ELSE.
              ls_feld-vleng = <ls_d021s>-leng.
            ENDIF.
          ENDIF.
        ELSE.
          ls_feld-vleng = <ls_d021s>-didx.
        ENDIF.
      ENDIF.
    ENDIF.

    ls_feld-high = 1.
    IF <ls_d021s>-didx > 0
    AND <ls_d021s>-fill CA 'TBSUIR'.
      ls_feld-high = <ls_d021s>-didx.
    ENDIF.

    IF <ls_d021s>-flg1 O lc_flg1edt
    AND <ls_d021s>-flg1 O lc_flg1scr
    AND <ls_d021s>-fill NA 'TSI'.
      ls_feld-scroll = abap_true.
    ELSE.
      ls_feld-scroll = abap_false.
    ENDIF.
    IF <ls_d021s>-type = 'STRG'
    OR <ls_d021s>-type = 'RSTR'
    OR <ls_d021s>-type = 'SSTR'.
      ls_feld-scroll = abap_true.
    ENDIF.

    IF <ls_d021s>-flg1 O lc_flg1ddf.
      ls_feld-dict = abap_true.
    ELSE.
      ls_feld-dict = abap_false.
    ENDIF.

    IF <ls_d021s>-flg1 O lc_flg1edt.
      IF <ls_d021s>-flg1 O lc_flg1ddf
      AND <ls_d021s>-flg1 O lc_flg1ddm.
        ls_feld-dmod = abap_true.
      ENDIF.
    ELSE.
      IF <ls_d021s>-flg1 O lc_flg1ddf.
        IF <ls_d021s>-ityp = '4'.
          ls_feld-dmod = '4'.
        ELSE.
          IF <ls_d021s>-ityp = '1'
          OR <ls_d021s>-ityp = '2'
          OR <ls_d021s>-ityp = '3'.
            IF <ls_d021s>-flg1 O lc_flg1ddm.
              ls_feld-dmod = <ls_d021s>-ityp.
            ELSE.
              ls_feld-dmod = 'V'.
            ENDIF.
          ELSEIF <ls_d021s>-ityp = '0'.
            IF <ls_d021s>-flg1 O lc_flg1ddm.
              ls_feld-dmod = 'F'.
            ELSE.
              ls_feld-dmod = 'V'.
            ENDIF.
          ELSE.
            ls_feld-dmod = 'F'.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.

    ls_feld-grp1 = <ls_d021s>-grp1.
    ls_feld-grp2 = <ls_d021s>-grp2.
    ls_feld-grp3 = <ls_d021s>-grp3.
    ls_feld-grp4 = <ls_d021s>-grp4.

    IF <ls_d021s>-ltyp = 'L'.
      ls_feld-loop = <ls_d021s>-lrep.
      IF is_d020s-valp = <ls_d021s>-lanf.
        ls_feld-ltyp = 'Var'.
      ELSE.
        ls_feld-ltyp = 'Fix'.
      ENDIF.
    ENDIF.

    IF <ls_d021s>-fmb1 O lc_fmb1ges.
      ls_feld-fobl = 'N'.
    ELSEIF <ls_d021s>-flg3 O lc_flg3obl.
      ls_feld-fobl = 'O'.
      ls_feld-fein = abap_true.
    ELSE.
      ls_feld-fein = abap_true.
      ASSIGN COMPONENT 'RECENTRY' OF STRUCTURE ls_d021s_res1
        TO <l_recentry>.
      IF <l_recentry> IS ASSIGNED AND NOT <l_recentry> IS INITIAL.
        ls_feld-fobl = 'R'.
      ENDIF.
      UNASSIGN <l_recentry>.
    ENDIF.
    PERFORM get_dom_value_text
      USING 'SCRPFOBL' ls_feld-fobl
      CHANGING ls_feld_redef-fobl.

    IF <ls_d021s>-fill <> 'R'.
      ls_feld-fout = abap_true.
    ENDIF.

    PERFORM fugr_get_feld_fill_na_btisu
      USING <ls_d021s> is_dynpro_release
      CHANGING ls_feld.

    ls_feld-colr = <ls_d021s>-colr.
    ls_feld-mtch = <ls_d021s>-dmac.
    ls_feld-waer = <ls_d021s>-wnam.

    IF is_dynpro_release <= lcs_dynpro_rel_400.
      ls_func_old = <ls_d021s>-dmac.
      ls_feld-fcod  = ls_func_old-code.
      ls_feld-ptype = ls_func_old-type.
    ELSEIF is_dynpro_release <= lcs_dynpro_rel_402.
      ls_func_new  = <ls_d021s>-dmac.
      ls_feld-fcod  = ls_func_new-code.
      ls_feld-ptype = ls_func_new-type.
    ELSE.
      ls_feld-fcod  = ls_d021s_res1-funccode.
      ls_feld-ptype = ls_d021s_res1-functype.
    ENDIF.

    IF ls_d021s_res1-ctmenuflg = abap_true.
      ls_feld-ctmenust = abap_true.
      ls_feld-ctmenuprog = ls_d021s_res1-ctmenuprog.
      ls_feld-ctmenustat = ls_d021s_res1-ctmenustat.
    ELSE.
      ls_feld-ctmenudy = abap_true.
      ls_feld-ctmenuonct = ls_d021s_res1-ctmenustat.
    ENDIF.

    READ TABLE it_d023x ASSIGNING <ls_d023x>
        WITH KEY cccustom = <ls_d021s>-fnam.
    IF sy-subrc = 0.
      ls_feld-ccname = <ls_d023x>-ccname.
    ENDIF.

    CALL FUNCTION 'RS_SCRP_GET_FIELD_TYPE_TEXT'
      EXPORTING
        field                    = <ls_d021s>
        text_kind                = 'SHORT'
      IMPORTING
        field_type_without_modif = ls_feld-gtyp
      EXCEPTIONS
        OTHERS                   = 1.

    ls_feld-stxt = <ls_d021s>-stxt.
    ls_feld-dropfrom = ls_d021s_res1-dropval.
    IF ls_d021s_res1-dropdown = 'D'.
      CASE ls_d021s_res1-dropstyle.
        WHEN 'K'.
          ls_feld-dropdown = ls_d021s_res1-dropstyle.
        WHEN OTHERS.
          ls_feld-dropdown = ls_d021s_res1-droptyp.
      ENDCASE.
      PERFORM get_dom_value_text
          USING 'SCRPCOTYPE' ls_feld-dropdown
          CHANGING ls_feld_redef-dropdown.
    ENDIF.

    IF <ls_d021s>-colr = '8'.
      ls_feld-extend = 'N'.
    ELSEIF <ls_d021s>-colr = '7'.
      ls_feld-extend = 'C'.
    ENDIF.

    IF <ls_d021s>-fill CA 'BTSUI'.
      ls_feld-hierarchy = '+ '.
    ENDIF.
    IF <ls_d021s>-ltyp CA 'TSI'.
      ls_feld-hierarchy = ' -'.
    ENDIF.

    PERFORM fugr_get_feld_icon
      USING
        <ls_d021s>
      CHANGING
        ls_feld.

    ls_feld-prog = is_d020s-prog.
    ls_feld-dnum = is_d020s-dnum.

*post processing
    CASE <ls_d021s>-ltyp.
      WHEN 'O'.  "OK-Code
        ls_feld-type = ' OK '.
        ls_feld-line = '0'.
        ls_feld-coln = '0'.
        ls_feld-leng = ls_feld-vleng.
        ls_feld-fein = abap_undefined.
        ls_feld-fout = abap_undefined.
        ls_feld-oout = abap_undefined.
        ls_feld_redef-fobl = space.
        ls_feld-fixf = abap_false.
      WHEN OTHERS.
        ls_feld-type = <ls_d021s>-type.
    ENDCASE.

    CASE <ls_d021s>-fill.
      WHEN 'C'.  "Checkbutton
        ls_feld-scroll = abap_undefined.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        ls_feld-fixf = abap_false.
      WHEN 'P'.  "Pushbutton
        ls_feld-scroll = abap_undefined.
        ls_feld_redef-fobl = space.
      WHEN 'R'.  "Frame
        ls_feld-fout = abap_true.
        ls_feld-scroll = abap_undefined.
        ls_feld_redef-fobl = space.
      WHEN 'T'.
        ls_feld_redef-fobl = space.
    ENDCASE.

    CASE ls_feld-gtyp.
      WHEN 'Check'.
        IF <ls_d021s>-ityp = '0'.
          ls_feld-scroll = abap_undefined.
          ls_feld-fein = abap_false.
          ls_feld-fout = abap_false.
          ls_feld-oout = abap_false.
          ls_feld-type = space.
          ls_feld-icon_x = abap_undefined.
          ls_feld_redef-fobl = space.
          ls_feld-paid = space.
          ls_feld-cmbfoc = abap_false.
          ls_feld-ucnv = space.
        ENDIF.
      WHEN 'CuCtr'.
        ls_feld-scroll = abap_undefined.
        ls_feld-fein = abap_false.
        ls_feld-fout = abap_false.
        ls_feld-oout = abap_false.
        ls_feld-type = space.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        ls_feld-paid = space.
        ls_feld-cmbfoc = abap_false.
        ls_feld-ucnv = space.
      WHEN 'Frame'.
        ls_feld-scroll = abap_undefined.
        ls_feld-icon_x = abap_undefined.
        IF ls_feld-stxt CN ' _'.
          ls_feld-fein = abap_false.
          ls_feld-fout = abap_false.
          ls_feld-oout = abap_false.
          ls_feld-type = space.
          ls_feld_redef-fobl = space.
          ls_feld-paid = space.
          ls_feld-cmbfoc = abap_false.
          ls_feld-ucnv = space.
        ENDIF.
      WHEN 'I/O'.
        IF is_dynpro_release <= lcs_dynpro_rel_402.
          ls_feld-fixf = abap_false.
        ENDIF.
      WHEN 'Push'.
        ls_feld-scroll = abap_undefined.
        ls_feld-mtch = space.
        IF <ls_d021s>-flg1 Z lc_flg1edt.
          ls_feld-fein = abap_false.
          ls_feld-fout = abap_false.
          ls_feld-oout = abap_false.
          ls_feld-type = space.
          ls_feld-icon_x = abap_undefined.
          ls_feld_redef-fobl = space.
          ls_feld-paid = space.
          ls_feld-cmbfoc = abap_false.
          ls_feld-ucnv = space.
        ENDIF.
      WHEN 'Radio'.
        ls_feld-scroll = abap_undefined.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        IF ls_feld-fcod IS INITIAL.
          ls_feld-fein = abap_false.
          ls_feld-fout = abap_false.
          ls_feld-oout = abap_false.
          ls_feld-type = space.
          ls_feld-icon_x = abap_undefined.
          ls_feld_redef-fobl = space.
          ls_feld-paid = space.
          ls_feld-cmbfoc = abap_false.
          ls_feld-ucnv = space.
        ENDIF.
      WHEN 'SubSc'.
        ls_feld-scroll = abap_undefined.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        IF ls_feld-fcod IS INITIAL.
          ls_feld-fein = abap_false.
          ls_feld-fout = abap_false.
          ls_feld-oout = abap_false.
          ls_feld-type = space.
          ls_feld-icon_x = abap_undefined.
          ls_feld_redef-fobl = space.
          ls_feld-paid = space.
          ls_feld-cmbfoc = abap_false.
          ls_feld-ucnv = space.
        ENDIF.
      WHEN 'Table'.
        ls_feld-fein = abap_false.
        ls_feld-fout = abap_false.
        ls_feld-oout = abap_false.
        ls_feld-type = space.
        ls_feld-dict = abap_false.
        ls_feld-dmod = abap_false.
      WHEN 'TbStr'.
        ls_feld-scroll = abap_undefined.
        ls_feld-fein = abap_false.
        ls_feld-fout = abap_false.
        ls_feld-oout = abap_false.
        ls_feld-type = space.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        ls_feld-paid = space.
        ls_feld-cmbfoc = abap_false.
        ls_feld-ucnv = space.
      WHEN 'Text'.
        ls_feld-scroll = abap_undefined.
        ls_feld-fein = abap_false.
        ls_feld-fout = abap_false.
        ls_feld-oout = abap_false.
        ls_feld-type = space.
        ls_feld-icon_x = abap_undefined.
        ls_feld_redef-fobl = space.
        ls_feld-paid = space.
        ls_feld-cmbfoc = abap_false.
        ls_feld-ucnv = space.
        IF ls_feld-fixf = abap_false
        AND ls_feld-hell = abap_false
        AND ls_feld-unsi = abap_false
        AND <ls_d021s>-ltyp = space
        AND ls_feld-labelright = abap_false
        AND <ls_d021s>-flg1 <> '00'.
          ls_feld-labelleft = abap_true.
        ENDIF.
    ENDCASE.

    IF NOT ls_feld-stxt IS INITIAL.
      IF ls_feld-stxt NA '_'.
        l_length = <ls_d021s>-leng.
        IF l_length > 132.
          l_length = 132.
        ENDIF.
        l_strlen = strlen( ls_feld-stxt ).
        WHILE l_strlen < l_length.
          CONCATENATE ls_feld-stxt '_' INTO ls_feld-stxt.
          l_strlen = strlen( ls_feld-stxt ).
        ENDWHILE.
      ENDIF.
      IF <ls_d021s>-fill = 'R'.
        l_strlen = strlen( ls_feld-stxt ).
        l_length = l_strlen - 2.
        IF l_length > 0.
          ls_feld-stxt = ls_feld-stxt+0(l_length).
        ENDIF.
      ENDIF.
    ENDIF.

    APPEND ls_feld TO ct_feld.
    APPEND ls_feld_redef TO ct_feld_redef.
  ENDLOOP.
ENDFORM.                    "get_feldtab


*-----------------------------------------------------------------------
* fugr_get_feld_fill_na_btisu
*-----------------------------------------------------------------------
FORM fugr_get_feld_fill_na_btisu
  USING
    is_d021s TYPE d021s
    is_dynpro_release TYPE st_dynpro_release
  CHANGING
    cs_feld TYPE feld.

  DATA:
  ls_d021s_res1 LIKE d021s_res1.

  CONSTANTS:
  lc_flg1ddf TYPE x VALUE '20',
  lc_flg1edt TYPE x VALUE '80',
  lc_flg1osb TYPE x VALUE '04',
  lc_flg2gks TYPE x VALUE '02',
  lc_flg2gpa TYPE x VALUE '08',
  lc_flg2jus TYPE x VALUE '20',
  lc_flg2nrs TYPE x VALUE '40',
  lc_flg2spa TYPE x VALUE '04',
  lc_flg2str TYPE x VALUE '80',
  lc_flg3fdu TYPE x VALUE '02',
  lc_flg3fix TYPE x VALUE '40',
  lc_flg3fku TYPE x VALUE '08',
  lc_flg3for TYPE x VALUE '04',
  lc_flg3out TYPE x VALUE '80',
  lc_fmb1d23 TYPE x VALUE '02',
  lc_fmb1dnk TYPE x VALUE '04',
  lc_fmb1fix TYPE x VALUE '40',
  lc_fmb1ges TYPE x VALUE '20',
  lc_fmb1hll TYPE x VALUE '08',
  lc_fmb1out TYPE x VALUE '01',
  lc_fmb2cmb TYPE x VALUE '08',
  lc_fmb2cmi TYPE x VALUE '04',
  lc_fmb2cmu TYPE x VALUE '10',
  lcs_dynpro_rel_400 TYPE st_dynpro_release VALUE '4.00',
  lcs_dynpro_rel_401 TYPE st_dynpro_release VALUE '4.01',
  lcs_dynpro_rel_402 TYPE st_dynpro_release VALUE '4.02',
  lcs_dynpro_rel_46a TYPE st_dynpro_release VALUE '4.60',
  lcs_dynpro_rel_610 TYPE st_dynpro_release VALUE '6.10'.


  CHECK is_d021s-fill NA 'BTISU'.

  ls_d021s_res1 = is_d021s-res1.

  IF is_d021s-flg2 O lc_flg2str.
    cs_feld-fstr = abap_true.
  ENDIF.
  IF is_d021s-flg2 O lc_flg2nrs.
    cs_feld-fnrs = abap_true.
  ENDIF.
  IF is_d021s-flg2 O lc_flg2gks.
    cs_feld-fgks = abap_true.
  ENDIF.
  IF is_d021s-flg3 O lc_flg3fix.
    cs_feld-ffix = abap_true.
  ENDIF.
  IF is_d021s-flg1 O lc_flg1osb.
    cs_feld-fosb = abap_true.
  ENDIF.
  IF is_d021s-flg2 O lc_flg2jus.
    cs_feld-fjus = abap_true.
  ENDIF.
  IF is_d021s-fill = '0'.
    cs_feld-fill = abap_true.
  ENDIF.
  IF is_d021s-flg2 O lc_flg2gpa.
    cs_feld-fgpa = abap_true.
  ENDIF.
  IF is_d021s-flg2 O lc_flg2spa.
    cs_feld-fspa = abap_true.
  ENDIF.
  IF is_d021s-flg1 O lc_flg1ddf
  AND is_d021s-flg3 O lc_flg3for
  AND is_d021s-flg3 Z lc_flg3fdu
  AND is_d021s-flg3 Z lc_flg3fku.
    cs_feld-ffky = 'X'.
  ENDIF.
  IF is_d021s-flg1 O lc_flg1edt.
    IF is_d021s-fmb1 Z lc_fmb1ges.
      cs_feld-fein = abap_true.
    ELSE.
      cs_feld-fein = abap_false.
    ENDIF.
    IF is_d021s-flg3 O lc_flg3out.
      cs_feld-fout = abap_true.
    ELSE.
      cs_feld-fout = abap_false.
    ENDIF.
    IF is_d021s-fmb1 O lc_fmb1out.
      cs_feld-oout = abap_true.
    ELSE.
      cs_feld-oout = abap_false.
    ENDIF.
  ENDIF.
  cs_feld-paid = is_d021s-paid.
  cs_feld-ucnv = is_d021s-ucnv.
  IF is_d021s-fmb1 O lc_fmb1hll.
    cs_feld-hell = abap_true.
  ENDIF.
  IF is_d021s-fmb1 O lc_fmb1dnk.
    cs_feld-unsi = abap_true.
  ENDIF.
  IF is_d021s-fmb1 O lc_fmb1d23.
    cs_feld-no3d = abap_true.
  ENDIF.
  IF is_dynpro_release <= lcs_dynpro_rel_402.
    IF cs_feld-oout = abap_true
    AND cs_feld-fout = abap_true
    AND is_d021s-flg3 Z lc_flg3out.
      cs_feld-fixf = abap_true.
    ELSEIF cs_feld-oout = abap_false
    AND is_d021s-fmb1 O lc_fmb1out.
      cs_feld-fixf = abap_true.
    ENDIF.
  ENDIF.
  IF is_d021s-fmb1 O lc_fmb1fix.
    cs_feld-fixf = abap_true.
  ENDIF.
  cs_feld-labelleft = ls_d021s_res1-labelleft.
  cs_feld-labelright = ls_d021s_res1-labelright.
  cs_feld-dblclick = ls_d021s_res1-dblclick.

  IF is_d021s-fill <> 'P'
  AND is_d021s-dmac <> space.
    cs_feld-cmbfoc = abap_true.
  ENDIF.

  IF is_d021s-fmb2 Z lc_fmb2cmb.
    cs_feld-cmbfoc = abap_false.
  ELSE.
    cs_feld-cmbfoc  = abap_true.
  ENDIF.
  IF is_d021s-fmb2 Z lc_fmb2cmu
  AND is_d021s-fmb2 Z lc_fmb2cmi.
    cs_feld-cmbtast = space.
  ELSEIF is_d021s-fmb2 O lc_fmb2cmu
  AND is_d021s-fmb2 O lc_fmb2cmi.
    cs_feld-cmbtast = '0'.
  ELSEIF is_d021s-fmb2 O lc_fmb2cmu
  AND is_d021s-fmb2 Z lc_fmb2cmi.
    cs_feld-cmbtast = '1'.
  ELSEIF is_d021s-fmb2 Z lc_fmb2cmu
  AND is_d021s-fmb2 O lc_fmb2cmi.
    cs_feld-cmbtast = '2'.
  ENDIF.
ENDFORM.                    "get_feld_fill_na_btisu


*-----------------------------------------------------------------------
* fugr_get_feld_icon
*-----------------------------------------------------------------------
FORM fugr_get_feld_icon
  USING
    is_d021s TYPE d021s
  CHANGING
    cs_feld TYPE feld.

  DATA:
  l_icon_id_pure(2) TYPE c,
  ls_icon TYPE icon,
  ls_icont TYPE icont,
  l_id_and_param(132) TYPE c,
  l_is_non_icon TYPE flag,
  l_pos_at TYPE i,
  l_quick_is TYPE flag,
  l_strlen TYPE i.

  FIELD-SYMBOLS:
  <l_fs> TYPE ANY.

  CONSTANTS:
  lc_flg1edt TYPE x VALUE '80'.


  CHECK is_d021s-stxt(1) = '@'.

  ASSIGN is_d021s-stxt+1(*) TO <l_fs>.
  IF <l_fs> CA '@'.
    l_pos_at = sy-fdpos + 1.
    l_id_and_param = <l_fs>(sy-fdpos).
    IF l_id_and_param CS '\Q'.
      l_quick_is = abap_true.
      SPLIT l_id_and_param AT '\Q'
            INTO l_icon_id_pure
                 cs_feld-icon_q.
      CONCATENATE '@' l_icon_id_pure '@'
            INTO cs_feld-icon.
    ELSE.
      l_quick_is = abap_false.
      CONCATENATE '@' l_id_and_param '@'
            INTO cs_feld-icon.
    ENDIF.
    IF cs_feld-icon = '@@'.
      CLEAR cs_feld-icon.
      l_is_non_icon = abap_true.
    ENDIF.
    SELECT SINGLE * FROM icon INTO ls_icon
        WHERE id = cs_feld-icon.
    IF sy-subrc = 0.
      SELECT SINGLE * FROM icont INTO ls_icont
          WHERE id = cs_feld-icon
          AND langu = sy-langu.
      cs_feld-icon_n = ls_icon-name.
    ELSE.
      cs_feld-icon_n = space.
    ENDIF.
    IF cs_feld-icon_q IS INITIAL
    AND l_quick_is = abap_false.
      cs_feld-icon_q = ls_icont-quickinfo.
    ENDIF.
    l_pos_at = l_pos_at + 1.
    ASSIGN is_d021s-stxt+l_pos_at(*) TO <l_fs>.
    l_strlen = strlen( <l_fs> ).
    IF l_strlen > 0.
      IF l_is_non_icon = abap_true.
      ELSE.
        l_pos_at = l_pos_at + 1.
      ENDIF.
      cs_feld-stxt = is_d021s-stxt+l_pos_at.
    ELSE.
      cs_feld-stxt = space.
    ENDIF.
  ENDIF.
  UNASSIGN <l_fs>.

  IF cs_feld-icon = '@00@'
  AND is_d021s-flg1 O lc_flg1edt.
    cs_feld-icon_x = abap_true.
  ENDIF.
ENDFORM.                    "get_feld_icon


*-----------------------------------------------------------------------
* fugr_r3tr_fugr                                Function group
*-----------------------------------------------------------------------
FORM fugr_r3tr_fugr.

  DATA:
  l_progname TYPE progname,
  lt_tabstrip TYPE it_tabstrip,
  ls_ti TYPE st_textinput,
  lt_attributes TYPE it_textinput,
  lt_documentation TYPE it_string,
  ls_progdir TYPE progdir,
  ls_tadir TYPE tadir,
  l_name TYPE ad_namtext,
  lt_html TYPE it_string.

  FIELD-SYMBOLS:
  <ls_ztadir> TYPE st_ztadir,
  <ls_tabstrip> TYPE st_tabstrip.

*Tabstrip
  PERFORM get_tabstrip
    USING 'FUGR_R3TR_FUGR' space
    CHANGING lt_tabstrip.

  LOOP AT gt_ztadir ASSIGNING <ls_ztadir>
      WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND futype = gc_futype_group
      AND downloaded = abap_false.
    <ls_ztadir>-downloaded = abap_true.

    CLEAR:
    l_name,
    l_progname,
    ls_progdir,
    ls_tadir.

    REFRESH:
    lt_attributes,
    lt_documentation,
    lt_html.

    CALL FUNCTION 'RS_TADIR_TO_PROGNAME'
      EXPORTING
        object   = <ls_ztadir>-object
        obj_name = <ls_ztadir>-obj_name
      IMPORTING
        progname = l_progname.

    SELECT SINGLE * FROM progdir INTO ls_progdir
      WHERE name = l_progname.
    SELECT SINGLE * FROM tadir INTO ls_tadir
      WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND obj_name = <ls_ztadir>-obj_name.

*Attributes
*   Function group
    CLEAR ls_ti.
    ls_ti-name = txt_function_group.
    ls_ti-input = abap_true.
    ls_ti-value = <ls_ztadir>-obj_name.
    APPEND ls_ti TO lt_attributes.
*   Description
    CLEAR ls_ti.
    ls_ti-name = txt_short_text___1.
    ls_ti-input = abap_true.
    ls_ti-value = <ls_ztadir>-descript.
    APPEND ls_ti TO lt_attributes.
*   Empty row
    CLEAR ls_ti.
    ls_ti-space = abap_true.
    APPEND ls_ti TO lt_attributes.
*   Person responsible
    CLEAR ls_ti.
    ls_ti-name = txt_person_responsible___1.
    ls_ti-input = abap_true.
    ls_ti-value = ls_tadir-author.
    PERFORM get_user
      USING
        ls_tadir-author
      CHANGING
        l_name.
    ls_ti-value_text = l_name.
    APPEND ls_ti TO lt_attributes.
*   Package
    CLEAR ls_ti.
    ls_ti-name = txt_package.
    ls_ti-input = abap_true.
    ls_ti-value = ls_tadir-devclass.
    APPEND ls_ti TO lt_attributes.
*   Application
    CLEAR ls_ti.
    ls_ti-name = txt_application.
    ls_ti-input = abap_true.
    ls_ti-value = ls_progdir-appl.
    APPEND ls_ti TO lt_attributes.
*   Status
    CLEAR ls_ti.
    ls_ti-name = txt_status.
    ls_ti-input = abap_true.
    IF ls_progdir-state = 'A'.
      ls_ti-value = txt_activated.
    ELSE.
      ls_ti-value = txt_inactive.
    ENDIF.
    APPEND ls_ti TO lt_attributes.
*   Program status
    CLEAR ls_ti.
    ls_ti-name = txt_program_status.
    ls_ti-input = abap_true.
    ls_ti-value = ls_progdir-rstat.
    PERFORM get_dom_value_text
      USING 'RSTAT' ls_progdir-rstat
      CHANGING ls_ti-value_text.
    APPEND ls_ti TO lt_attributes.
*   Editor lock
    CLEAR ls_ti.
    ls_ti-name = txt_editor_lock.
    ls_ti-flag = abap_true.
    ls_ti-value = ls_progdir-edtx.
    APPEND ls_ti TO lt_attributes.
*   Fixed point arithmetic
    CLEAR ls_ti.
    ls_ti-name = txt_fixed_point_arithmetic.
    ls_ti-flag = abap_true.
    ls_ti-value = ls_progdir-fixpt.
    APPEND ls_ti TO lt_attributes.
*   Unicode checks active
    CLEAR ls_ti.
    ls_ti-name = txtt_unicode_checks_active.
    ls_ti-flag = abap_true.
    ls_ti-value = ls_progdir-uccheck.
    APPEND ls_ti TO lt_attributes.
*Documentation
    PERFORM get_docu
      USING
        'RE'
        l_progname
        'E'
      CHANGING
        lt_documentation.
***Tabstrip
    LOOP AT lt_tabstrip ASSIGNING <ls_tabstrip>.
      <ls_tabstrip>-empty = abap_false.
      CASE <ls_tabstrip>-id.
        WHEN 'DOCUMENTATION'.
          IF lt_documentation IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
      ENDCASE.
    ENDLOOP.

*** HTML
    PERFORM html_main_header
      USING
        tpt_fugr_fugr
        space
        <ls_ztadir>-obj_name
        space
        space
        space
        'makeDivSize(''MAIN_PROG'');makeDivSize(''DOCUMENTATION'');'
        lt_tabstrip
        gt_link
      CHANGING
        lt_html.
*   Attributes
    PERFORM html_add_textinput
      USING
        lt_attributes
        'ATTRIBUTES'
        abap_true
      CHANGING
        lt_html.
*Main program
    PERFORM add_report_sourcecode
      USING
        l_progname
        l_progname
        gc_extension_txt
        abap_true
        <ls_ztadir>
        'MAIN_PROG'
        abap_false
      CHANGING
        lt_html.
*Documentation
    IF NOT lt_documentation IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_doc
        USING
          lt_documentation
          'DOCUMENTATION'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*
    PERFORM html_main_footer
      USING
        lt_html.

    PERFORM download
      USING
        lt_html
        <ls_ztadir>-pgmid
        <ls_ztadir>-object
        l_progname
        gc_extension_htm
        abap_true.
  ENDLOOP.

ENDFORM.                                                    "r3tr_fugr


*-----------------------------------------------------------------------
* fugr_r3tr_includes                            Includes
*-----------------------------------------------------------------------
FORM fugr_r3tr_includes.

  DATA:
  lt_tabstrip TYPE it_tabstrip,
  lt_html TYPE it_string,
  ls_attributes TYPE st_attributes,
  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:
  <ls_ztadir> TYPE st_ztadir.

*Tabstrip
  PERFORM get_tabstrip
    USING 'FUGR_R3TR_INCLUDES' space
    CHANGING lt_tabstrip.

  LOOP AT gt_ztadir ASSIGNING <ls_ztadir>
      WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND futype = gc_futype_include
      AND downloaded = abap_false.

    CLEAR:
    ls_attributes,
    ls_trdir,
    l_text,
    l_atext.

    REFRESH:
    lt_html,
    lt_ti,
    lt_ti_box.

    SELECT SINGLE * FROM trdir INTO ls_trdir
        WHERE name = <ls_ztadir>-progname.
    IF sy-subrc <> 0.
      <ls_ztadir>-subrc = sy-subrc.
      CONTINUE.
    ENDIF.

*Attributes
*   Title
    CLEAR ls_ti.
    ls_ti-name = txt_title.
    ls_ti-value = <ls_ztadir>-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 = <ls_ztadir>-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.
*   Space
    CLEAR ls_ti.
    ls_ti-space = abap_true.
    APPEND ls_ti TO lt_ti_box.
*   Package
    CLEAR ls_ti.
    ls_ti-name = txt_package.
    ls_ti-value = <ls_ztadir>-devclass.
    PERFORM get_devclass
      USING
        <ls_ztadir>-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
        <ls_ztadir>-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
        <ls_ztadir>-progname
        <ls_ztadir>-progname
        gc_extension_txt
        abap_false
        <ls_ztadir>
        'SOURCECODE'
        abap_true
      CHANGING
        lt_html.
*
    PERFORM html_main_footer
      USING
        lt_html.

    PERFORM download
      USING
        lt_html
        <ls_ztadir>-pgmid
        <ls_ztadir>-object
        <ls_ztadir>-progname
        gc_extension_htm
        abap_true.
    <ls_ztadir>-downloaded = abap_true.
  ENDLOOP.
ENDFORM.                                                    "r3tr_incl


*-----------------------------------------------------------------------
* fugr_r3tr_modules                             Funktionsbausteine
*-----------------------------------------------------------------------
FORM fugr_r3tr_modules.

  DATA:
  ls_tabstrip TYPE st_tabstrip,
  lt_tabstrip TYPE it_tabstrip,
  lt_classification TYPE it_textinput,
  ls_classification TYPE st_textinput,
  lt_processing_type TYPE it_access,
  ls_processing_type TYPE st_access,
  lt_general_data TYPE it_textinput,
  ls_general_data TYPE st_textinput,
  lt_html TYPE it_string,
  lt_ptfdir TYPE STANDARD TABLE OF tfdir,
  ls_ptfdir TYPE tfdir,
  lt_ptftit TYPE STANDARD TABLE OF tftit,
  ls_ptftit TYPE tftit,
  lt_pfunct TYPE STANDARD TABLE OF funct,
  ls_pfunct TYPE funct,
  lt_penlfdir TYPE STANDARD TABLE OF enlfdir,
  ls_penlfdir TYPE enlfdir,
  lt_ptrdir TYPE STANDARD TABLE OF trdir,
  ls_ptrdir TYPE trdir,
  lt_pfupararef TYPE STANDARD TABLE OF sfupararef,
  lt_uincl TYPE it_abaptxt255,
  lt_vsmodisrc TYPE STANDARD TABLE OF smodisrc,
  lt_vsmodilog TYPE STANDARD TABLE OF smodilog,
  lt_parameter TYPE it_parameter,
  ls_parameter TYPE st_parameter,
  lt_importing TYPE it_parameter,
  lt_exporting TYPE it_parameter,
  lt_changing TYPE it_parameter,
  lt_table TYPE it_parameter,
  lt_exception TYPE it_parameter,
  l_kind TYPE char1,
  lt_doku TYPE it_string,
  lt_documentation TYPE it_string,
  lt_sourcecode TYPE it_string,
  l_sourcecode TYPE string,
  l_namtext TYPE ad_namtext,
  l_javascript TYPE string,
  l_id TYPE string,
  l_filename TYPE string,
  l_on TYPE flag,
  l_areat TYPE areat.

  FIELD-SYMBOLS:
  <ls_tabstrip> TYPE st_tabstrip,
  <ls_ztadir> TYPE st_ztadir,
  <ls_parameter> TYPE st_parameter,
  <ls_pfupararef> TYPE sfupararef,
  <ls_uincl> TYPE st_abaptxt255.


  LOOP AT gt_ztadir ASSIGNING <ls_ztadir>
      WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND futype = gc_futype_module
      AND downloaded = abap_false.
    <ls_ztadir>-downloaded = abap_true.

    CLEAR:
    ls_classification,
    ls_general_data,
    l_javascript,
    ls_parameter,
    ls_penlfdir,
    ls_pfunct,
    ls_processing_type,
    ls_ptfdir,
    ls_ptftit,
    ls_ptrdir,
    l_sourcecode,
    l_areat.

    REFRESH:
    lt_changing,
    lt_classification,
    lt_exception,
    lt_exporting,
    lt_general_data,
    lt_html,
    lt_importing,
    lt_parameter,
    lt_processing_type,
    lt_sourcecode,
    lt_table,
    lt_uincl.

    CALL FUNCTION 'FUNC_GET_OBJECT'
      EXPORTING
        funcname   = <ls_ztadir>-funcname
        r3state    = 'A'
      TABLES
        ptfdir     = lt_ptfdir
        ptftit     = lt_ptftit
        pfunct     = lt_pfunct
        penlfdir   = lt_penlfdir
        ptrdir     = lt_ptrdir
        pfupararef = lt_pfupararef
        uincl      = lt_uincl
        vsmodisrc  = lt_vsmodisrc
        vsmodilog  = lt_vsmodilog
      EXCEPTIONS
        OTHERS     = 1.
    IF sy-subrc <> 0.
      <ls_ztadir>-subrc = sy-subrc.
      CONTINUE.
    ENDIF.

    IF NOT lt_ptfdir IS INITIAL.
      READ TABLE lt_ptfdir INTO ls_ptfdir INDEX 1.
    ENDIF.
    IF NOT lt_ptftit IS INITIAL.
      READ TABLE lt_ptftit INTO ls_ptftit INDEX 1.
    ENDIF.
    IF NOT lt_penlfdir IS INITIAL.
      READ TABLE lt_penlfdir INTO ls_penlfdir INDEX 1.
    ENDIF.
    IF NOT lt_ptrdir IS INITIAL.
      READ TABLE lt_ptrdir INTO ls_ptrdir INDEX 1.
    ENDIF.

*Attributes - Classification
    ls_classification-name = txt_function_group.
    ls_classification-value = ls_penlfdir-area.
    ls_classification-input = abap_true.
    ls_classification-has_value_ext = abap_true.
    SELECT SINGLE areat FROM tlibt INTO l_areat
        WHERE area = <ls_ztadir>-obj_name
        AND spras = sy-langu.
    ls_classification-value_ext = l_areat.
    APPEND ls_classification TO lt_classification.
    CLEAR ls_classification.
    ls_classification-name = txt_short_text___1.
    ls_classification-value = ls_ptftit-stext.
    ls_classification-input = abap_true.
    APPEND ls_classification TO lt_classification.

*Attributes - Processing type
    ls_processing_type-ddtext = txt_normal_function_module.
    IF ls_ptfdir-fmode IS INITIAL AND ls_ptfdir-utask IS INITIAL.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_true.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.
    ls_processing_type-ddtext = txt_remote_enabled_module.
    IF NOT ls_ptfdir-fmode IS INITIAL.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_true.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.
    ls_processing_type-ddtext = txt_update_module.
    IF NOT ls_ptfdir-utask IS INITIAL.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_true.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.

    ls_processing_type-ddtext = txt_start_immed.
    ls_processing_type-sub = '1'.
    IF ls_ptfdir-utask IS INITIAL OR ls_ptfdir-utask = '1'.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_false.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.
    ls_processing_type-ddtext = txt_immediate_start_no_restart.
    ls_processing_type-sub = '1'.
    IF ls_ptfdir-utask = '3'.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_false.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.
    ls_processing_type-ddtext = txt_start_delayed.
    ls_processing_type-sub = '1'.
    IF ls_ptfdir-utask = '2'.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_false.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.
    ls_processing_type-ddtext = txt_coll_run.
    ls_processing_type-sub = '1'.
    IF ls_ptfdir-utask = '5'.
      ls_processing_type-checked = abap_true.
    ELSE.
      ls_processing_type-checked = abap_false.
    ENDIF.
    APPEND ls_processing_type TO lt_processing_type.

*Attributes - General Data
    ls_general_data-name = txt_person_responsible___1.
    ls_general_data-input = abap_true.
    ls_general_data-value = ls_ptrdir-cnam.
    PERFORM get_user
      USING
        ls_ptrdir-cnam
      CHANGING
        l_namtext.
    ls_general_data-value_text = l_namtext.
    APPEND ls_general_data TO lt_general_data.
    CLEAR ls_general_data.
    ls_general_data-name = txt_last_changed_by___2.
    ls_general_data-input = abap_true.
    ls_general_data-value = ls_ptrdir-unam.
    PERFORM get_user
      USING
        ls_ptrdir-unam
      CHANGING
        l_namtext.
    ls_general_data-value_text = l_namtext.
    APPEND ls_general_data TO lt_general_data.
    CLEAR ls_general_data.
    ls_general_data-name = txt_changed_on.
    ls_general_data-input = abap_true.
    PERFORM get_date USING ls_ptrdir-udat
                    CHANGING ls_general_data-value.
    APPEND ls_general_data TO lt_general_data.
    ls_general_data-name = txt_package.
    ls_general_data-input = abap_true.
    ls_general_data-value = <ls_ztadir>-devclass.
    APPEND ls_general_data TO lt_general_data.
    ls_general_data-name = txt_program_name.
    ls_general_data-input = abap_true.
    ls_general_data-value = ls_ptfdir-pname.
    APPEND ls_general_data TO lt_general_data.
    ls_general_data-name = txt_include_name.
    ls_general_data-input = abap_true.
    ls_general_data-value = ls_ptrdir-name.
    APPEND ls_general_data TO lt_general_data.
    ls_general_data-name = txt_original_language.
    ls_general_data-input = abap_true.
    ls_general_data-value = ls_ptftit-spras.
    APPEND ls_general_data TO lt_general_data.
    IF NOT ls_ptfdir-freedate IS INITIAL
    AND ls_ptfdir-freedate > 19000101.
      ls_general_data-name = txt_internally_released_on.
      PERFORM get_date USING ls_ptfdir-freedate
                      CHANGING ls_general_data-value.
      ls_general_data-input = abap_true.
    ELSE.
      ls_general_data-name = txt_not_released.
      ls_general_data-value = space.
      ls_general_data-input = abap_false.
    ENDIF.
    APPEND ls_general_data TO lt_general_data.
    CLEAR ls_general_data.
    ls_general_data-name = txt_edit_lock.
    ls_general_data-flag = abap_true.
    ls_general_data-value = ls_ptrdir-edtx.
    APPEND ls_general_data TO lt_general_data.
    ls_general_data-name = txt_global.
    ls_general_data-flag = abap_true.
    ls_general_data-value = ls_penlfdir-global.
    APPEND ls_general_data TO lt_general_data.

*Parameter
    SORT lt_pfupararef BY pposition.
    LOOP AT lt_pfupararef ASSIGNING <ls_pfupararef>.
      CLEAR ls_parameter.
      l_kind = 'P'.
      IF <ls_pfupararef>-paramtype = 'X'.
        l_kind = 'X'.
      ENDIF.
      ls_parameter-name = <ls_pfupararef>-parameter.
      IF <ls_pfupararef>-type = abap_true.
        ls_parameter-typing = 'TYPE'.
      ELSEIF <ls_pfupararef>-ref_class = abap_true.
        ls_parameter-typing = 'TYPE REF TO'.
      ELSE.
        ls_parameter-typing = 'LIKE'.
      ENDIF.
      ls_parameter-structure = <ls_pfupararef>-structure.
      ls_parameter-defvalue = <ls_pfupararef>-defaultval.
      ls_parameter-optional = <ls_pfupararef>-optional.
      IF <ls_pfupararef>-reference = abap_false.
        ls_parameter-passvalue = abap_true.
      ENDIF.
      READ TABLE lt_pfunct INTO ls_pfunct
          WITH KEY parameter = <ls_pfupararef>-parameter
                   kind = l_kind
                   spras = sy-langu.
      IF sy-subrc <> 0.
        READ TABLE lt_pfunct INTO ls_pfunct
            WITH KEY parameter = <ls_pfupararef>-parameter
                     kind = l_kind
                     spras = sy-langu.
      ENDIF.
      ls_parameter-stext = ls_pfunct-stext.
*     Long Text
      ls_parameter-ltext_doku_obj = <ls_ztadir>-funcname.
      ls_parameter-ltext_doku_obj+30 = <ls_pfupararef>-parameter.

      SELECT SINGLE object FROM dokhl INTO ls_parameter-ltext_doku_obj
        WHERE id = 'FU'
        AND object = ls_parameter-ltext_doku_obj
        AND langu = sy-langu.
      IF sy-subrc = 0.
        ls_parameter-ltext = '-->'.
        CONCATENATE 'switchContent(''LTEXT_'
                <ls_pfupararef>-parameter ''')'
                INTO ls_parameter-ltext_onclick.
      ELSE.
        CLEAR ls_parameter-ltext_doku_obj.
      ENDIF.
*     Append
      APPEND ls_parameter TO lt_parameter.
      CASE <ls_pfupararef>-paramtype.
        WHEN 'I'.  "Importing
          APPEND ls_parameter TO lt_importing.
        WHEN 'E'.  "Exporting
          APPEND ls_parameter TO lt_exporting.
        WHEN 'C'.  "Changing
          APPEND ls_parameter TO lt_changing.
        WHEN 'T'.  "Tables
          APPEND ls_parameter TO lt_table.
        WHEN 'X'.  "Exceptions
          APPEND ls_parameter TO lt_exception.
      ENDCASE.
    ENDLOOP.

*Documentation
    PERFORM get_docu
      USING
        'FU'
        <ls_ztadir>-funcname
        'T'
      CHANGING
        lt_documentation.

*SourceCode
    LOOP AT lt_uincl ASSIGNING <ls_uincl>.
      l_sourcecode = <ls_uincl>-line.
      APPEND l_sourcecode TO lt_sourcecode.
    ENDLOOP.

***Tabstrip
    PERFORM get_tabstrip
      USING 'FUGR_R3TR_MODULES' space
      CHANGING lt_tabstrip.

    LOOP AT lt_tabstrip ASSIGNING <ls_tabstrip>.
      <ls_tabstrip>-empty = abap_false.
      CASE <ls_tabstrip>-id.
        WHEN 'DOCUMENTATION'.
          IF lt_documentation IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'IMPORT'.
          IF lt_importing IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'EXPORT'.
          IF lt_exporting IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'CHANGING'.
          IF lt_changing IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'TABLES'.
          IF lt_table IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'EXCEPTIONS'.
          IF lt_exception IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
        WHEN 'SOURCECODE'.
          IF lt_sourcecode IS INITIAL.
            <ls_tabstrip>-empty = abap_true.
          ENDIF.
      ENDCASE.
    ENDLOOP.

*     Long text
    CONCATENATE
        'makeDivSize(''DOCUMENTATION'');'
        'makeDivSize(''SOURCECODE'');'
        INTO l_javascript.
    LOOP AT lt_parameter ASSIGNING <ls_parameter>
        WHERE ltext = '-->'.
      CLEAR ls_tabstrip.
      CONCATENATE 'LTEXT_' <ls_parameter>-name
          INTO ls_tabstrip-id.
      ls_tabstrip-hidden = abap_true.
      APPEND ls_tabstrip TO lt_tabstrip.
      CONCATENATE
          l_javascript
          'makeDivSize(''' ls_tabstrip-id ''');'
          INTO l_javascript.
    ENDLOOP.

*** HTML
    PERFORM html_main_header
      USING
        tpt_fugr_fuba
        txt_function_module
        <ls_ztadir>-funcname
        txt_active___1
        space
        space
        l_javascript
        lt_tabstrip
        gt_link
      CHANGING
        lt_html.
*   Attributes
    IF lt_sourcecode IS INITIAL
      AND g_empty_tab <> gc_empty_tab_display.
      l_on = abap_true.
    ELSE.
      l_on = abap_false.
    ENDIF.
    PERFORM html_add_box1ti_2rb_ti
      USING
        txt_classification
        lt_classification
        txt_processing_type
        'PTYPE'
        lt_processing_type
        txt_general_data
        lt_general_data
        'ATTRIBUTES'
        l_on
      CHANGING
        lt_html.
*   Importing
    IF NOT lt_importing IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_table
        USING
          'MODU_IMPOR'
          lt_importing
          lt_importing
          'IMPORT'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   Exporting
    IF NOT lt_exporting IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_table
        USING
          'MODU_EXPOR'
          lt_exporting
          lt_exporting
          'EXPORT'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   Changing
    IF NOT lt_changing IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_table
        USING
          'MODU_IMPOR'
          lt_changing
          lt_changing
          'CHANGING'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   Tables
    IF NOT lt_table IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_table
        USING
          'MODU_TABLE'
          lt_table
          lt_table
          'TABLES'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   Exceptions
    IF NOT lt_exception IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_table
        USING
          'MODU_EXCEP'
          lt_exception
          lt_exception
          'EXCEPTIONS'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   SourceCode
    IF NOT lt_sourcecode IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      IF g_add_sourcecode = abap_true.
        l_filename = <ls_ztadir>-funcname.
        PERFORM download
          USING
            lt_sourcecode
            <ls_ztadir>-pgmid
            <ls_ztadir>-object
            l_filename
            gc_extension_txt
            abap_false.
      ENDIF.
      PERFORM html_add_sourcecode
        USING
          lt_sourcecode
          l_filename
          space
          space
          gc_extension_txt
          'SOURCECODE'
          abap_true
        CHANGING
          lt_html.
    ENDIF.
*   Documentation
    IF NOT lt_documentation IS INITIAL
    OR g_empty_tab = gc_empty_tab_display.
      PERFORM html_add_doc
        USING
          lt_documentation
          'DOCUMENTATION'
          abap_false
        CHANGING
          lt_html.
    ENDIF.
*   Long texts
    LOOP AT lt_parameter ASSIGNING <ls_parameter>
        WHERE ltext = '-->'.
      REFRESH lt_doku.
      PERFORM get_docu
        USING
          'FU'
          <ls_parameter>-ltext_doku_obj
          'T'
        CHANGING
          lt_doku.
      PERFORM get_id
        USING 'LTEXT_' <ls_parameter>-name
        CHANGING l_id.
      PERFORM html_add_doc
      USING
        lt_doku
        l_id
        abap_false
      CHANGING
        lt_html.
    ENDLOOP.
*
    PERFORM html_main_footer
      USING
        lt_html.

    PERFORM download
      USING
        lt_html
        <ls_ztadir>-pgmid
        <ls_ztadir>-object
        <ls_ztadir>-progname
        gc_extension_htm
        abap_true.
  ENDLOOP.
ENDFORM.                    "fugr_r3tr_modules


*-----------------------------------------------------------------------
* fugr_r3tr_screen                              Screens
*-----------------------------------------------------------------------
FORM fugr_r3tr_screen.

  DATA:
  lt_tabstrip TYPE it_tabstrip,
  ls_dynpro_name TYPE st_dynpro_name,
  ls_d020s TYPE d020s,                    "screen header
  lt_d021s TYPE STANDARD TABLE OF d021s,  "field list
  lt_d022s TYPE STANDARD TABLE OF d022s,  "flow logic
  lt_d023s TYPE d023s_tab,                "matchcode information
  ls_d023sx TYPE d023s_x,
  lt_d023x TYPE d023s_xtab,
  lt_feld TYPE STANDARD TABLE OF feld,
  lt_feld_redef TYPE it_feld_redef,
  lt_source TYPE it_string,
  lt_html TYPE it_string,
  ls_attributes TYPE st_attributes,
  lt_access_screen_type TYPE it_access,
  ls_access TYPE st_access,
  lt_ti_settings TYPE it_textinput,
  lt_ti_other TYPE it_textinput,
  ls_ti TYPE st_textinput,
  l_date_last_generation TYPE d,
  l_time_last_generation TYPE t,
  l_lines TYPE sycurow,
  l_cols TYPE sycucol,
  l_filename TYPE string,
  ls_dynpro_release TYPE st_dynpro_release,
  l_dynpro_release(4) TYPE c,
  l_title TYPE string.

  FIELD-SYMBOLS:
  <ls_d022s> TYPE d022s,
  <ls_d023s> TYPE d023s,
  <ls_ztadir> TYPE st_ztadir,
  <l_x> TYPE x.

  CONSTANTS:
  lc_type_cntcmp TYPE scrpdytype VALUE 'CNTCMP    ',
  lc_milikmp TYPE x VALUE '40',
  lc_miliksc TYPE x VALUE '08',
  lc_milinog TYPE x VALUE '20',
  lc_milinot TYPE x VALUE '04'.


*Tabstrip
  PERFORM get_tabstrip
    USING 'FUGR_R3TR_SCREEN' space
    CHANGING lt_tabstrip.

  LOOP AT gt_ztadir ASSIGNING <ls_ztadir>
      WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND futype = gc_futype_screen
      AND downloaded = abap_false.

    CLEAR:
    ls_access,
    ls_attributes,
    ls_d020s,
    ls_d023sx,
    l_dynpro_release,
    ls_ti.

    REFRESH:
    lt_access_screen_type,
    lt_d021s,
    lt_d022s,
    lt_d023s,
    lt_d023x,
    lt_feld,
    lt_feld_redef,
    lt_html,
    lt_source,
    lt_ti_settings,
    lt_ti_other.

    ls_dynpro_name-prog = <ls_ztadir>-progname.
    ls_dynpro_name-dnum = <ls_ztadir>-dynpronr.
    IMPORT DYNPRO ls_d020s lt_d021s lt_d022s lt_d023s
        ID ls_dynpro_name.
    IF sy-subrc <> 0.
      <ls_ztadir>-subrc = sy-subrc.
      CONTINUE.
    ENDIF.

    CALL FUNCTION 'RS_DYNPRO_RELEASE_GET'
      EXPORTING
        dynpro_header  = ls_d020s
      IMPORTING
        dynpro_release = l_dynpro_release
      EXCEPTIONS
        OTHERS         = 1.
    ls_dynpro_release = l_dynpro_release.

    LOOP AT lt_d023s ASSIGNING <ls_d023s> WHERE type = lc_type_cntcmp.
      ls_d023sx = <ls_d023s>-content.
      APPEND ls_d023sx-cccont TO lt_d023x.
    ENDLOOP.

*Attributes
    ls_attributes-descript = <ls_ztadir>-descript.
    ls_attributes-devclass = <ls_ztadir>-devclass.
    PERFORM get_devclass
      USING
        <ls_ztadir>-devclass
      CHANGING
        ls_attributes-devclass_descr.
    PERFORM get_spras
      USING
        ls_d020s-spra
      CHANGING
        ls_attributes-laiso
        ls_attributes-sptxt.
    PERFORM get_date
      USING
        ls_d020s-dgen
      CHANGING
        ls_attributes-date_last_changed.
    PERFORM get_time
      USING
        ls_d020s-tgen
      CHANGING
        ls_attributes-time_last_changed.

    CALL FUNCTION 'RS_SCRP_GET_GEN_DATA'
      EXPORTING
        progname = ls_d020s-prog
        dynnr    = ls_d020s-dnum
      IMPORTING
        gen_date = l_date_last_generation
        gen_time = l_time_last_generation
      EXCEPTIONS
        OTHERS   = 1.
    PERFORM get_date
      USING
        l_date_last_generation
      CHANGING
        ls_attributes-date_last_generation.
    PERFORM get_time
      USING
        l_time_last_generation
      CHANGING
        ls_attributes-time_last_generation.
*Attributes - Screen type
    CLEAR ls_access.
    ls_access-ddtext = txt_normal.
    ls_access-checked = abap_false.
    IF ls_d020s-type NA 'IMSWJ'.
      ls_access-checked = abap_true.
    ENDIF.
    APPEND ls_access TO lt_access_screen_type.
    ls_access-ddtext = txt_subscreen.
    ls_access-checked = abap_false.
    IF ls_d020s-type = 'I'.
      ls_access-checked = abap_true.
    ENDIF.
    APPEND ls_access TO lt_access_screen_type.
    ls_access-ddtext = txt_modal_dialog_box.
    ls_access-checked = abap_false.
    IF ls_d020s-type = 'M'.
      ls_access-checked = abap_true.
    ENDIF.
    APPEND ls_access TO lt_access_screen_type.
    ls_access-ddtext = txt_selection_screen.
    ls_access-checked = abap_false.
    IF ls_d020s-type CA 'SWJ'.
      ls_access-checked = abap_true.
    ENDIF.
    APPEND ls_access TO lt_access_screen_type.
*Attributes - Settings
    CLEAR ls_ti.
    IF ls_d020s-type <> 'I'.
      ls_ti-name = txt_hold_data.
      ls_ti-flag = abap_true.
      ls_ti-value = ls_d020s-hdat.
      APPEND ls_ti TO lt_ti_settings.
    ENDIF.
    ASSIGN ls_d020s-mili TO <l_x> CASTING.
    ls_ti-name = txt_switch_off_runtime_compres.
    ls_ti-flag = abap_true.
    IF <l_x> O lc_milikmp.
      ls_ti-value = abap_false.
    ELSE.
      ls_ti-value = abap_true.
    ENDIF.
    APPEND ls_ti TO lt_ti_settings.
    ls_ti-name = txt_template_non_executable.
    ls_ti-flag = abap_true.
    IF <l_x> O lc_milinog.
      ls_ti-value = abap_true.
    ELSE.
      ls_ti-value = abap_false.
    ENDIF.
    APPEND ls_ti TO lt_ti_settings.
    ls_ti-name = txt_hold_scroll_position.
    ls_ti-flag = abap_true.
    IF <l_x> O lc_miliksc.
      ls_ti-value = abap_true.
    ELSE.
      ls_ti-value = abap_false.
    ENDIF.
    APPEND ls_ti TO lt_ti_settings.
    ls_ti-name = txt_without_application_toolba.
    ls_ti-flag = abap_true.
    IF <l_x> O lc_milinot.
      ls_ti-value = abap_true.
    ELSE.
      ls_ti-value = abap_false.
    ENDIF.
    APPEND ls_ti TO lt_ti_settings.
*Attributes - Other attributes
    CLEAR ls_ti.
    ls_ti-name = txt_next_screen.
    ls_ti-value = ls_d020s-fnum.
    ls_ti-input = abap_true.
    APPEND ls_ti TO lt_ti_other.
    ls_ti-name = txt_cursor_position.
    ls_ti-value = ls_d020s-cupo.
    ls_ti-input = abap_true.
    APPEND ls_ti TO lt_ti_other.
    ls_ti-name = txt_screen_group.
    ls_ti-value = ls_d020s-dgrp.
    ls_ti-input = abap_true.
    APPEND ls_ti TO lt_ti_other.
    ls_ti-name = txtt_lines_columns.
    ls_ti-name_suffix = txt_occupied.
    CALL FUNCTION 'RS_SCRP_GET_SCREEN_INFOS'
      EXPORTING
        progname = ls_d020s-prog
        dynnr    = ls_d020s-dnum
      IMPORTING
        lines    = l_lines
        columns  = l_cols
      EXCEPTIONS
        OTHERS   = 1.
    IF sy-subrc <> 0 OR l_lines > 999 OR l_cols > 999.
      l_lines = 0.
      l_cols = 0.
    ENDIF.
    ls_ti-value = l_lines.
    ls_ti-value_ext = l_cols.
    ls_ti-input = abap_true.
    ls_ti-has_value_ext = abap_true.
    APPEND ls_ti TO lt_ti_other.
    ls_ti-name = space.
    ls_ti-name_suffix = txt_maintenance.
    ls_ti-value = ls_d020s-noli.
    ls_ti-value_ext = ls_d020s-noco.
    ls_ti-input = abap_true.
    ls_ti-has_value_ext = abap_true.
    APPEND ls_ti TO lt_ti_other.
    CLEAR ls_ti.
    ls_ti-name = txtt_context_menu_form_on_ctme.
    READ TABLE lt_d023s ASSIGNING <ls_d023s>
        WITH KEY type = 'CTMENU'.
    IF sy-subrc = 0.
      ls_ti-value = <ls_d023s>-content.
    ENDIF.
    ls_ti-input = abap_true.
    UNASSIGN <ls_d023s>.
    APPEND ls_ti TO lt_ti_other.
*   Element list
    PERFORM fugr_get_feldtab
      USING
        ls_d020s
        lt_d021s
        lt_d023x
        ls_dynpro_release
      CHANGING
        lt_feld
        lt_feld_redef.

*SourceCode
    LOOP AT lt_d022s ASSIGNING <ls_d022s>.
      APPEND <ls_d022s>-line TO lt_source.
    ENDLOOP.

*** HTML
    l_title = tpt_fugr_scr.
    PERFORM replace_single
      USING '#NAME_VALUE#' <ls_ztadir>-progname
      CHANGING l_title.
    PERFORM html_main_header
      USING
        l_title
        txt_screen_number
        <ls_ztadir>-dynpronr
        txt_active___1
        space
        space
        'makeDivSize(''FLOW_LOGIC'');'
        lt_tabstrip
        gt_link
      CHANGING
        lt_html.
*   Attributes
    PERFORM html_add_attributes_3
      USING
        ls_attributes
        txt_screen_type
        'scrType'
        lt_access_screen_type
        txt_settings
        lt_ti_settings
        txt_other_attributes
        lt_ti_other
        'ATTRIBUTES'
        abap_false
      CHANGING
        lt_html.
*   Element list - begin
    PERFORM html_add_container_begin
      USING
        lt_tabstrip
        'ELEMENT_LIST'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_general_attr
        'SCRN_GENER'
        lt_feld_redef
        lt_feld
        'GENERAL_ATTR'
        abap_true
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_texts_io_templates
        'SCRN_IOTEM'
        lt_feld_redef
        lt_feld
        'TEXTS_IO_TEMPLATES'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_special_attr
        'SCRN_SPECI'
        lt_feld_redef
        lt_feld
        'SPECIAL_ATTR'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_display_attr
        'SCRN_DISPL'
        lt_feld_redef
        lt_feld
        'DISPLAY_ATTR'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_mod_groups_func
        'SCRN_MODGR'
        lt_feld_redef
        lt_feld
        'MOD_GROUPS_FUNCTIONS'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_table
      USING
*        lt_table_references
        'SCRN_REFER'
        lt_feld_redef
        lt_feld
        'REFERENCES'
        abap_false
      CHANGING
        lt_html.
    PERFORM html_add_container_end
      CHANGING
        lt_html.
*   Element list - end
*   Flow logic
    CONCATENATE <ls_ztadir>-progname '-' <ls_ztadir>-dynpronr
        INTO l_filename.
    PERFORM html_add_sourcecode
      USING
        lt_source
        l_filename
        space
        space
        gc_extension_txt
        'FLOW_LOGIC'
        abap_true
      CHANGING
        lt_html.
    IF g_add_sourcecode = abap_true.
      PERFORM download
        USING
          lt_source
          <ls_ztadir>-pgmid
          <ls_ztadir>-object
          l_filename
          gc_extension_txt
          abap_false.
    ENDIF.
*
    PERFORM html_main_footer
      USING
        lt_html.

    PERFORM download
      USING
        lt_html
        <ls_ztadir>-pgmid
        <ls_ztadir>-object
        l_filename
        gc_extension_htm
        abap_true.
    <ls_ztadir>-downloaded = abap_true.
  ENDLOOP.
ENDFORM.                    "r3tr_screen
