SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

SAP R/3 ABAP/DDIC down-and upload program in XML



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary -> Migration
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 12:08 am    Post subject: SAP R/3 ABAP/DDIC down-and upload program in XML Reply with quote

1. Download Classes, Interfaces, Functiongroups, Programs, DDIC into PC files in XML-Format
2. Upload a single XML file or the file file_index.xml
The index file file_index.xml contains a list of XML-Files

manual (german) (pdf) Manual of the SAP R/3 down and upload program
Version2 (txt) a) complete version (including classes and interfaces)
Version1 (txt) b) version without classes and interfaces

Author: Multisoft GmbH
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:30 am    Post subject: Reply with quote

Code:
*$*$ ******** Please do not remove this copyright notice, thank you ****
*$*$ Shareware program by
*$*$                      Ulrich Streit (c) 2006
*$*$                      Multisoft GmbH
*$*$                      Talainstr. 1
*$*$                      D-97267 Himmelstadt, Germany
*$*$                      email: [email protected]
*$*$                      http://www.multisoft-expert.de
*$*$
*$*$                      and
*$*$
*$*$                      Axel Angeli (c) 2006
*$*$                      Logos! Informatik GmbH
*$*$                      Bruehler Strasse 21
*$*$                      D-68782 Bruehl, Germany
*$*$                      email: [email protected]
*$*$                      http://idocs.de and http://logosworld.com
*$*$
************************************************************************
*$*$                  Down- and Upload program
************************************************************************
*$*$*
*$*$* The program is only tested on SAP Web AS 6.2
*$*$* Upload of classes does not work in newer/older versions of the
*$*$* ABAP Workbench
*$*$* Function modules must have line size 72
*$*$*
*$*$*       Beta Version
*$*$*
*$*$* 1. Download Classes, Interfaces, Functiongroups, Programs, DDIC
*$*$*    into PC files in XML-Format
*$*$* 2. Upload a single XML file or the file file_index.xml
*$*$*    The index file file_index.xml contains a list of XML-Files
*$*$*
*$*$* Upload:   - Parameter postfix is ignored for DDIC objects.
*$*$*
*$*$* Download: - Please activate before downloading.
*$*$*           - Maximum size of a single XML-File: 7MB
*$*$*             ( constant c_size_max_xml )
*$*$*           - if you download in several XML-files, the file
*$*$*             file_index.xml is created automatically
*$*$*             You can upload a single XML-File or the file
*$*$*             file_index.xml
*$*$*
************************************************************************
REPORT  ZLOMU_DOWN_UP_ABAP_X001 line-size 1023.

*****************************
* Type Pools
*****************************
type-pools: SEOO, SEOP, SEOS, SEOK, SREXT, sydes, SEDI, SSCR.

*****************************
* Tables
*****************************
tables: tlibg, trdir,
        SSCRFIELDS,
        SEOCLSKEY,
        vseointerf,
        tadir,
        dd01l,
        dd04l,
        dd02l,
        dd40l,
        DD30L,
        D020S,
        DDTYPET.

************************************************
* Types
************************************************

* Types zum Up- und Download von Klassen
Types: begin of TYMETHOD,
  CMPKEY type SEOCMPKEY,
  METHOD type line of SEOO_METHODS_R,
  METHOD_DETAILS type SEOO_METHOD_DETAILS,
  PARAMETERS type SEOS_PARAMETERS_R,
  EXCEPTIONS type SEOS_EXCEPTIONS_R,
  INCNAME type PROGRAM,
  SOURCE type SEOP_SOURCE,
end of TYMETHOD.

types: begin of TIMPLMETHOD,
  method TYPE  VSEOMETHOD,
  ALIAS  TYPE line of SEO_ALIASES,
  include type line of SEOP_METHODS_W_INCLUDE,
  SOURCE type SEOP_SOURCE,
end of TIMPLMETHOD.

types: begin of TREDEFINITION,
  method TYPE  VSEOMETHOD,
  include type line of SEOP_METHODS_W_INCLUDE,
  SOURCE type SEOP_SOURCE,
end of TREDEFINITION.

types: begin of tsection,
  LIMU TYPE  TROBJTYPE,
  INCNAME type PROGRAM,
  source type seop_source,
end of tsection.

types: begin of ttypes,
  TYPES type SEOO_TYPES_R,
  TYPE_SOURCE type seop_source,
end of ttypes.

types: begin of TIMPLEMENTINGS,
 IMPLEMENTINGS TYPE  SEOR_IMPLEMENTINGS_R,
 IMPL_DETAILS TYPE  SEO_REDEFINITIONS,
end of TIMPLEMENTINGS.

types: begin of tLocal,
 name(3),
 source_locals type seop_source,
end of tLocal.

types tlocals type standard table of tLocal WITH NON-UNIQUE DEFAULT KEY.

* Klasse
types: begin of tCLASS,
  CIFKEY type SEOCLSKEY,
  CLASS type vseoclass,
  ATTRIBUTES type SEOO_ATTRIBUTES_R,
  sections type standard table of tsection
  WITH NON-UNIQUE DEFAULT KEY,
  METHODS type standard table of TYMETHOD
  WITH NON-UNIQUE DEFAULT KEY,
  TYPES type ttypes,
  TYPEPUSAGES TYPE SEOT_TYPEPUSAGES_R,
  EVENTS TYPE  SEOO_EVENTS_R,
  Friends TYPE  SEOF_FRIENDSHIPS_R,
  ALIASES TYPE  SEO_ALIASES,
  implementings type timplementings,
  METHODS_IMPL type standard table of TIMPLMETHOD
  WITH NON-UNIQUE DEFAULT KEY,
  INHERITANCE TYPE  SEOR_INHERITANCE_R,
  EXPLORE_INHERITANCE TYPE standard table of vseoclass
  WITH NON-UNIQUE DEFAULT KEY,
  REDEFINITIONS TYPE  SEOR_REDEFINITIONS_R,
  METHODS_REDEF type standard table of TREDEFINITION
  WITH NON-UNIQUE DEFAULT KEY,
  CLASSDEFERREDS TYPE  SEOT_CLSDEFERRDS_R,
  INTERFACEDEFERREDS TYPE  SEOT_INTDEFERRDS_R,
  LOCALS type tLocals,
end of tCLASS.

* Interface
types: begin of tinter,
  INTKEY TYPE SEOCLSKEY,
  INTERFACE TYPE  VSEOINTERF,
  ATTRIBUTES TYPE  SEOO_ATTRIBUTES_R,
  METHODS TYPE  SEOO_METHODS_R,
  EVENTS TYPE  SEOO_EVENTS_R,
  PARAMETERS TYPE  SEOS_PARAMETERS_R,
  EXCEPS TYPE  SEOS_EXCEPTIONS_R,
  COMPRISINGS TYPE  SEOR_COMPRISINGS_R,
  TYPEPUSAGES TYPE  SEOT_TYPEPUSAGES_R,
  CLSDEFERRDS TYPE  SEOT_CLSDEFERRDS_R,
  INTDEFERRDS TYPE  SEOT_INTDEFERRDS_R,
  EXPLORE_COMPRISINGS TYPE  SEOK_INT_TYPEINFOS,
  ALIASES TYPE  SEOO_ALIASES_R,
end of tinter.

* Dynpros
types: begin of tdynpro,
        PROGNAME TYPE D020S-PROG,
        DYNNR TYPE D020S-DNUM,
        HEADER TYPE RPY_DYHEAD,
        CONTAINERS type DYCATT_TAB,
        FIELDS_TO_CONTAINERS type DYFATC_TAB,
        FLOW_LOGIC type standard table of RPY_DYFLOW
        WITH NON-UNIQUE DEFAULT KEY,
        PARAMS type standard table of RPY_DYPARA
        WITH NON-UNIQUE DEFAULT KEY,
       end of tdynpro.

types:  tdynpros type standard table of tdynpro
        WITH NON-UNIQUE DEFAULT KEY.

* Funktionsgruppen
types: begin of tfmodule,
  funcname type enlfdir-funcname,
  area type enlfdir-area,
  GLOBAL_FLAG type  RS38L-GLOBAL,
  REMOTE_CALL type RS38L-REMOTE,
  UPDATE_TASK type RS38L-UTASK,
  SHORT_TEXT type TFTIT-STEXT,
  t_import  type standard table of rsimp
            WITH NON-UNIQUE DEFAULT KEY,
  t_change  type standard table of rscha
            WITH NON-UNIQUE DEFAULT KEY,
  t_export  type standard table of rsexp
            WITH NON-UNIQUE DEFAULT KEY,
  t_tables  type standard table of rstbl
            WITH NON-UNIQUE DEFAULT KEY,
  t_except  type standard table of rsexc
            WITH NON-UNIQUE DEFAULT KEY,
  source    type seop_source,
end of tfmodule.

types: tfmodules type standard table of tfmodule
       WITH NON-UNIQUE DEFAULT KEY.

types: begin of tinclude,
         include type rseuinc-include,
         source type seop_source,
       end of tinclude.

types: tincludes type standard table of tinclude
       WITH NON-UNIQUE DEFAULT KEY.

types: begin of tfgroup,
       area type enlfdir-area,
       includes type tincludes,
       fmodules type tfmodules,
       dynpros type tdynpros,
       end of tfgroup.

types: begin of ttextpool,
       langu type sy-langu,
       textpool type standard table of textpool
       WITH NON-UNIQUE DEFAULT KEY,
       end of ttextpool.

types: begin of tprogram,
       name type trdir-name,
       subc type trdir-subc,
       title type RGLIF-TITLE,
       textpool type ttextpool,
       PROG_INF TYPE RPY_PROG,
       source type seop_source,
       dynpros type tdynpros,
       end of tprogram.

types: begin of tdomain,
       NAME TYPE DDOBJNAME,
       GOTSTATE TYPE DDGOTSTATE,
       DD01V_WA TYPE DD01V,
       DD07V_TAB type standard table of DD07V
       WITH NON-UNIQUE DEFAULT KEY,
       end of tdomain.

types: begin of tdataelement,
       NAME TYPE DDOBJNAME,
       GOTSTATE TYPE  DDGOTSTATE,
       DD04V_WA TYPE  DD04V,
       TPARA_WA TYPE  TPARA,
       end of tdataelement.

types: begin of ttable,
       name TYPE  DDOBJNAME,
       tabclass type dd02l-tabclass,
       GOTSTATE TYPE  DDGOTSTATE,
       DD02V_WA TYPE  DD02V,
       DD09L_WA TYPE  DD09V,
       DD03P_TAB type standard table of DD03P
       WITH NON-UNIQUE DEFAULT KEY,
       DD05M_TAB type standard table of DD05M
       WITH NON-UNIQUE DEFAULT KEY,
       DD08V_TAB type standard table of DD08V
       WITH NON-UNIQUE DEFAULT KEY,
       DD12V_TAB type standard table of DD12V
       WITH NON-UNIQUE DEFAULT KEY,
       DD17V_TAB type standard table of DD17V
       WITH NON-UNIQUE DEFAULT KEY,
       DD35V_TAB type standard table of DD35V
       WITH NON-UNIQUE DEFAULT KEY,
       DD36M_TAB type standard table of DD36M
       WITH NON-UNIQUE DEFAULT KEY,
       end of ttable.

types: begin of tview,
       name TYPE  DDOBJNAME,
       GOTSTATE TYPE DDGOTSTATE,
       DD25V_WA TYPE DD25V,
       DD09L_WA TYPE DD09V,
       DD26V_TAB TYPE STANDARD TABLE OF DD26V
       WITH NON-UNIQUE DEFAULT KEY,
       DD27P_TAB TYPE STANDARD TABLE OF DD27P
       WITH NON-UNIQUE DEFAULT KEY,
       DD28J_TAB TYPE STANDARD TABLE OF DD28J
       WITH NON-UNIQUE DEFAULT KEY,
       DD28V_TAB TYPE STANDARD TABLE OF DD28V
       WITH NON-UNIQUE DEFAULT KEY,
       end of tview.

types: begin of ttabletype,
       NAME TYPE DDOBJNAME,
       GOTSTATE TYPE DDGOTSTATE,
       DD40V_WA TYPE  DD40V,
       DD42V_TAB TYPE STANDARD TABLE OF DD42V
       WITH NON-UNIQUE DEFAULT KEY,
       end of ttabletype.

types: begin of tshlp,
       NAME TYPE  DDOBJNAME,
       GOTSTATE TYPE  DDGOTSTATE,
       DD30V_WA TYPE  DD30V,
       DD31V_TAB type standard table of DD31V
       WITH NON-UNIQUE DEFAULT KEY,
       DD32P_TAB type standard table of DD32P
       WITH NON-UNIQUE DEFAULT KEY,
       DD33V_TAB type standard table of DD33V
       WITH NON-UNIQUE DEFAULT KEY,
       end of tshlp.

types: begin of ttypegroup,
       name type trdir-name,
       texts type standard table of DDTYPET
       WITH NON-UNIQUE DEFAULT KEY,
       source type standard table of abapsource
       WITH NON-UNIQUE DEFAULT KEY,
       end of ttypegroup.

types: tclasses type standard table of tclass,
       tinters type standard table of tinter,
       tfgroups type standard table of tfgroup,
       tprograms type standard table of tprogram,
       tdomains  type standard table of tdomain,
       ttables type standard table of ttable,
       tviews type standard table of tview,
       ttabletypes type standard table of ttabletype,
       tshlps type standard table of tshlp,
       ttypegroups type standard table of ttypegroup.

* Names
types: begin of tdynproname,
       PROGNAME TYPE D020S-PROG,
       DYNNR TYPE D020S-DNUM,
       end of tdynproname.

types: tdynpronames type standard table of tdynproname.

types: begin of TABAP_GLREFS_TAG,
        name type string,
        GLREF type line of SCR_GLREFS,
        tag type SCR_TAG,
       end of TABAP_GLREFS_TAG.
types: TABAP_GLREFS_TAGS type standard table of TABAP_GLREFS_TAG.

types: ttadir_table type standard table of tadir.

types: begin of tp,
 classes type table of TCLASS
 WITH NON-UNIQUE DEFAULT KEY,
 inters  type table of tinter
 WITH NON-UNIQUE DEFAULT KEY,
 fgroups type table of tfgroup
 WITH NON-UNIQUE DEFAULT KEY,
 programs type table of tprogram
 WITH NON-UNIQUE DEFAULT KEY,
 typegroups type table of ttypegroup
 WITH NON-UNIQUE DEFAULT KEY,
 tables type table of ttable
 WITH NON-UNIQUE DEFAULT KEY,
 views type table of tview
 WITH NON-UNIQUE DEFAULT KEY,
 tabletypes type table of ttabletype
 WITH NON-UNIQUE DEFAULT KEY,
 searchhelps type table of tshlp
 WITH NON-UNIQUE DEFAULT KEY,
 dataelements type table of tdataelement
 WITH NON-UNIQUE DEFAULT KEY,
 domains type table of tdomain
 WITH NON-UNIQUE DEFAULT KEY,
end of tp.

* Typdeklaration index-Datei
Types: begin of tindex,
   type type seocmpkey-cmpname,
   name type SEOCMPKEY-cmpname,
   file type localfile,
end of tindex.

* Typdeklaration index-Datei
Types: tindex_table type standard table of tindex.


***************************************
* Globale Datendeklarationen
***************************************

* Globales Datenfeld fuer die Daten
data: p type tp.

* Auswahlliste
data: flag_POPUP_abg.

***************************************
* Klassendefinitionen deferred
***************************************

class start_upload_index definition deferred.
class start_upload_single definition deferred.
class xml_upload definition deferred.

***************************************
* Konstanten
***************************************

constants:
      C_ch_Class type SEOCMPKEY-cmpname value 'Class',
      c_ch_Interface type SEOCMPKEY-cmpname value 'Interface',
      c_ch_Fgroup type SEOCMPKEY-cmpname value 'Area',
      c_ch_include type SEOCMPKEY-cmpname value 'Include',
      c_ch_program type SEOCMPKEY-cmpname value 'Program',
      c_ch_domain  type SEOCMPKEY-cmpname value 'Domain',
      c_ch_delement type SEOCMPKEY-cmpname value 'Dataelement',
      c_ch_table type SEOCMPKEY-cmpname value 'Table',
      c_ch_viewname type SEOCMPKEY-cmpname value 'View',
      c_ch_tabletype type SEOCMPKEY-cmpname value 'Tabletype',
      c_ch_searchelp type SEOCMPKEY-cmpname value 'Searchhelp',
      c_ch_typegroup type SEOCMPKEY-cmpname value 'Typegroup'.

* TXT-Dateinamen (Source .txt Dateien)
constants: C_ch_Class_method
               type SEOCMPKEY-cmpname value 'Class_Method',
           C_ch_Class_section
               type SEOCMPKEY-cmpname value 'Class_Section',
           C_ch_Class_redef
               type SEOCMPKEY-cmpname value 'Class_Redef',
           C_ch_Class_impl
               type SEOCMPKEY-cmpname value 'Class_Impl',
           C_ch_Class_locals
               type SEOCMPKEY-cmpname value 'Class_Locals',
           C_ch_Area_fmodule
               type SEOCMPKEY-cmpname value 'Area_Fmodule',
           C_ch_Area_Include
               type SEOCMPKEY-cmpname value 'Area_Include',
           C_ch_Area_Dynpro
               type SEOCMPKEY-cmpname value 'Area_Dynpro',
           c_ch_Program_Dynpro
               type SEOCMPKEY-cmpname value 'Program_Dynpro'.

* Sonstige Konstanten
constants: c_sapl(4) value 'SAPL',
           c_z(1) value 'Z',
           c_y(1) value 'Y',
           c_z%(2) value 'Z%',
           c_y%(2) value 'Y%'.

* Konstanten Tadir
constants: c_ta_R3TR(4) value 'R3TR',
           c_ta_DOMA(4) value 'DOMA',
           c_ta_DTEL(4) value 'DTEL',
           c_ta_INTTAB(6) value 'INTTAB',
           c_ta_TRANSP(6) value 'TRANSP',
           c_ta_APPEND(6) value 'APPEND',
           c_ta_tabl(4) value 'TABL',
           c_ta_view(4) value 'VIEW',
           c_ta_TTYP(4) value 'TTYP',
           c_ta_SHLP(4) value 'SHLP',
           c_ta_CLAS(4) value 'CLAS',
           c_ta_intf(4) value 'INTF',
           c_ta_fugr(4) value 'FUGR',
           c_ta_prog(4) value 'PROG',
           c_ta_type(4) value 'TYPE'.

* XML-Dokument Encoding
constants: c_xml_encoding_utf8 type string value 'UTF-8'.

* Maximale Groesse XML-Datei
constants: c_size_max_xml type sytabix value '7000000'.  "7MB

* Index-Datei
constants: c_file_index_xml type localfile value 'FILE_INDEX.XML'.

******************************
* Makros Error Processing/Log
******************************

* Stop the Upload Prcessing
data: gv_flg_stop_upload_processing.

* Makro ERROR
define ERROR.
  IF &3 &2 SY-SUBRC.
    new-line.
    WRITE: 'Error:' color col_negative, '&1.' color col_negative.
  ENDIF.
end-of-definition.

* Makro ERROR_MESSAGE
data: error_text1 type sy-msgv1,
      error_text2 type sy-msgv2,
      length type i.

define ERROR_MESSAGE.
  new-line.
  WRITE: 'Error:' color col_negative, &1 color col_negative.

  clear: error_text1, error_text2.
  length = strlen( &1 ).
  if length > 0.
    length = length / 2.
    move error_text(length) to error_text1.
    move error_text+length  to error_text2.
  endif.

  if not SY-MSGID is initial.
    new-line.
    WRITE: 'SY-MSGID' color col_negative,
           SY-MSGID color col_negative,
           'SY-MSGNO' color col_negative,
           SY-MSGNO color col_negative.
    if not SY-MSGV1 is initial.
      new-line.
      write: 'SY-MSGV1' color col_negative,
             SY-MSGV1 color col_negative.
    endif.
    if not SY-MSGV2 is initial.
      new-line.
      write: 'SY-MSGV2' color col_negative,
             SY-MSGV2 color col_negative.
    endif.
    if not SY-MSGV3 is initial.
      new-line.
      write: 'SY-MSGV3' color col_negative,
             SY-MSGV3 color col_negative.
    endif.
    if not SY-MSGV4 is initial.
      new-line.
      write: 'SY-MSGV4' color col_negative,
             SY-MSGV4 color col_negative.
    endif.
    MESSAGE ID SY-MSGID TYPE &2 NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  else.
    message ID '38' type &2 NUMBER '000' with error_text1 error_text2.
  endif.
  skip 1.
end-of-definition.

* Makro result message
define result_message.

* Ausgabe Ergebnis
  if &3 eq '0'.
    write: &1 color col_positive,
           &2 color col_positive,
           'created' color col_positive.
    new-line.
  else.
    write: &1 color col_negative,
           &2 color col_negative,
           'ERROR' color col_negative.
    new-line.
  endif.

end-of-definition.

* Makro download message
define download_message.

  write: &1 color col_positive,
         at 25 &2 color col_positive,
         at 65 'read successfully' color col_positive.
  new-line.

end-of-definition.


**********************************************************************
* Parameter/select-options
**********************************************************************
parameters: download radiobutton group r1 default 'X'.
selection-screen begin of block b with frame.
selection-screen comment 1(23) cdown.
selection-screen uline.
selection-screen begin of line.
selection-screen comment 1(26) csfiles.
parameters: sfiles radiobutton group r2.
selection-screen comment 32(17) cpath.
parameters: path type LOCALFILE.
selection-screen end of line.
selection-screen uline.
selection-screen begin of line.
selection-screen comment 1(26) csave.
parameters: SAVE radiobutton group r2 default 'X'.
selection-screen comment 32(17) cfile.
parameters: PCFILE type LOCALFILE default '.xml'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(11) cdisplay.
parameters: DISPLAY as checkbox default 'X'.
selection-screen comment 22(21) cedit.
parameters: CALLEDIT as checkbox.
selection-screen comment 53(12) dispon.
parameters: DISP_ONL as checkbox.
selection-screen end of line.
selection-screen uline.
selection-screen begin of line.
selection-screen comment 1(26) ctxtfile.
parameters: ctxt as checkbox.
selection-screen comment 32(17) cpath1.
parameters: path1 type LOCALFILE.
selection-screen end of line.
selection-screen uline.
selection-screen begin of line.
selection-screen comment 1(26) ccdata.
parameters: cdata as checkbox default 'X'.
selection-screen end of line.
selection-screen begin of block a with frame title comment.
selection-screen begin of line.
selection-screen comment 1(8) cComp.
parameters: complete radiobutton group c1.
selection-screen comment 18(8) cnosour.
parameters: nosource radiobutton group c1 default 'X'.
selection-screen comment 38(10) cnocr.
parameters: nocross radiobutton group c1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(19) cgrade.
parameters: grade type SCR_GRADE.
selection-screen end of line.
selection-screen end of block a.
select-options: package for tadir-devclass. " memory id lib.
select-options: intname for vseointerf-clsname.
select-options: clsname for SEOCLSKEY-CLSNAME.
parameters: friends as checkbox default 'X'.
select-options: funcarea for tlibg-area.
select-options: program for trdir-name.
parameters: dynpro as checkbox default 'X'.
select-options: table for dd02l-tabname.
select-options: view for dd02l-tabname.
select-options: tabletyp for DD40L-TYPENAME.
select-options: searchlp for DD30L-shlpname.
select-options: domain for dd01l-DOMNAME.
select-options: delement for dd04l-rollname.
select-options: typgroup for DDTYPET-TYPEGROUP.
selection-screen end of block b.
parameters: upload radiobutton group r1.
selection-screen begin of block c with frame.
selection-screen comment 1(25) cup.
selection-screen begin of line.
selection-screen comment 1(30) cup_sing.
parameters: up_sing radiobutton group j1 default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(30) cup_ind.
parameters: up_index radiobutton group j1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(25) cfile_up.
parameters: PCFILE1 type localfile default '.xml'.
selection-screen end of line.
parameters postfix(1).
selection-screen end of block c.

************************************************************************
* Initialization
************************************************************************
initialization.
  move 'Store in single XML file' to csave.
  move 'Display XML' to cdisplay.
  move 'Display XML in Editor' to cedit.
  move 'Store Source in CDATA' to ccdata.
  move 'Crossreference' to comment.
  move 'Complete' to ccomp.
  move 'NoSource' to cnosour.
  move 'NoCrossref' to cnocr.
  move 'Grade of Sourcescan' to cgrade.
  move 'Store in several XML-files' to csfiles.
  move 'Path' to cpath.
  move 'Path' to cpath1.
  move 'Path and Filename' to cfile.
  move 'Store Source in txt files' to ctxtfile.
  move 'Parameters for Download' to cdown.
  move 'Parameters for Upload' to cup.
  move 'Path and filename of XML file' to cfile_up.
  move 'Upload single XML-File' to cup_sing.
  move 'Upload file FILE_INDEX.XML' to cup_ind.
  move 'Display only' to dispon.

************************************************************************
* At selection-screen
************************************************************************
at selection-screen.

  perform check_selection.

***********************************************************************
* At selection-screen on value request
***********************************************************************
at selection-screen on value-request for pcfile1.
  perform on_value_request_pcfile1.

**********************************************************************
* start-of-selection
**********************************************************************
start-of-selection.

  condense PCFILE no-gaps.
  perform main.

end-of-selection.

**********************************************************************
* Klassendeklarationen
**********************************************************************

class error_handling definition.

  public section.
    class-methods: error_question
                   importing error_text type string
                   exporting ev_flg_stop_upload_processing type as4flag,
                   commit_work importing wait type as4flag optional,
                   rollback_work.

endclass.                    "error_handling DEFINITION

*---------------------------------------------------------------------*
*       CLASS error_handling IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class error_handling implementation.

  method error_question.

**************************************
* Lokale Datendeklaration
**************************************
    data: eq_text1 type string,
          eq_text2 type string.
    data: eq_answer.
    data: eq_msgid type sy-msgid,
          eq_msgno type sy-msgno,
          eq_msgv1 type sy-msgv1,
          eq_msgv2 type sy-msgv2,
          eq_msgv3 type sy-msgv3,
          eq_msgv4 type sy-msgv4.

*************************************
* Systemnachricht
*************************************
    move sy-msgid to eq_msgid.
    move sy-msgno to eq_msgno.
    move sy-msgv1 to eq_msgv1.
    move sy-msgv2 to eq_msgv2.
    move sy-msgv3 to eq_msgv3.
    move sy-msgv4 to eq_msgv4.

**************************************
* Log
**************************************

* Error ausgeben
    new-line.
    WRITE: 'Error:' color col_negative, error_text color col_negative.

* Error message
    if not EQ_MSGID is initial.
      new-line.
      WRITE: 'SY-MSGID' color col_negative,
             EQ_MSGID color col_negative,
             'SY-MSGNO' color col_negative,
             EQ_MSGNO color col_negative.
      if not EQ_MSGV1 is initial.
        new-line.
        write: 'SY-MSGV1' color col_negative,
               EQ_MSGV1 color col_negative.
      endif.
      if not EQ_MSGV2 is initial.
        new-line.
        write: 'SY-MSGV2' color col_negative,
               EQ_MSGV2 color col_negative.
      endif.
      if not EQ_MSGV3 is initial.
        new-line.
        write: 'SY-MSGV3' color col_negative,
               EQ_MSGV3 color col_negative.
      endif.
      if not EQ_MSGV4 is initial.
        new-line.
        write: 'SY-MSGV4' color col_negative,
               EQ_MSGV4 color col_negative.
      endif.
    endif.

************************************
* Question
************************************
    move 'Do you want to continue upload processing?' to eq_text2.

    CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
      EXPORTING
*       DEFAULTOPTION        = 'Y'
        TEXTLINE1            = error_text
        TEXTLINE2            = eq_text2
        TITEL                = 'Warning'
*       START_COLUMN         = 25
*       START_ROW            = 6
        CANCEL_DISPLAY       = ' '
      IMPORTING
        ANSWER               = eq_answer
              .

*****************************************
* Answer
*****************************************
    clear: eq_text1, eq_text2.
    length = strlen( error_text ).
    if length > 0.
      length = length / 2.
      move error_text(length) to eq_text1.
      move error_text+length  to eq_text2.
    endif.

    if eq_answer eq 'N'.
      message ID '38' type 'S' NUMBER '000' with eq_text1 eq_text2.
* Upload ganz abbrechen (globale Variable)
      move 'X' to gv_flg_stop_upload_processing.
      new-line.
      write 'Canceled by user' color col_total.
    endif.

    new-line.

*******************************************
* Rueckgabewert
*******************************************
    move gv_flg_stop_upload_processing to ev_flg_stop_upload_processing.

  endmethod.                    "error_question

  method commit_work.

    if wait eq 'X'.
      commit work and wait.
    else.
      commit work.
    endif.

  endmethod.                    "commit_work

  method rollback_work.

    rollback work.

  endmethod.                    "rollback_work

endclass.                    "error_handling IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS source_read_and_convert DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class source_convert_and_read definition.

  public section.
    class-methods read_source importing i_name type PROGNAME
                        exporting e_source type seop_source
                                  e_lines_truncated type i
                                  e_long type SCRPFLAG
                        exceptions
                             error.

endclass.                    "source_read_and_convert DEFINITION

*---------------------------------------------------------------------*
*       CLASS source_read_and_convert IMPLEMENTATION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class source_convert_and_read implementation.

  method read_source.

    DATA: ABAP_SOURCE_FORMAT type ref to CL_WB_ABAP_SOURCE_FORMAT.
    DATA: target_source type swbse_max_line_tab,
          w_target_source like line of target_source.
    DATA: w_source type line of seop_source.
    DATA: error_text type string.

* Initialisieren
    free: e_source, e_lines_truncated.

* Source lesen
    CREATE OBJECT ABAP_SOURCE_FORMAT
         EXPORTING
           PROGNAME           = i_name
           LINE_WIDTH         = SWBSE_C_NORM_LINE_WIDTH
         EXCEPTIONS
           NOT_EXISTS         = 1
           ILLEGAL_LINE_WIDTH = 2
           others             = 3
          .
    IF SY-SUBRC <> 0.
      error NOT_EXISTS         = 1.
      error ILLEGAL_LINE_WIDTH = 2.
      error others             = 3.
      concatenate 'Program' i_name 'error'
      '(Klasse CL_WB_ABAP_SOURCE_FORMAT)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    ENDIF.

    CALL METHOD ABAP_SOURCE_FORMAT->CONVERT
      EXPORTING
        TRUNCATE_SINGLE_LINES      = SPACE
        CONVERT_DESPITE_ALL_ERRORS = SPACE
      IMPORTING
        TARGET_SOURCE              = target_source
        LINES_TRUNCATED            = e_lines_truncated
      EXCEPTIONS
        NOT_CONVERTABLE            = 1
        NOT_SCANABLE               = 2
        others                     = 3.
    IF SY-SUBRC <> 0.
      error NOT_CONVERTABLE            = 1.
      error NOT_SCANABLE               = 2.
      error others                     = 3.
      concatenate 'Program' i_name 'error'
      '(Klasse CL_WB_ABAP_SOURCE_FORMAT)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    ELSE.
      Loop at target_source into w_target_source.
        move w_target_source to w_source.
        append w_source to e_source.
      Endloop.
    ENDIF.

* Hat es zu lange Zeilen ?
    CALL METHOD ABAP_SOURCE_FORMAT->IS_CONTAINING_TOO_LONG_LINES
      IMPORTING
        IS_LONG = e_long.

  endmethod.                    "read_source

endclass.                    "source_read_and_convert IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS dynpro_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class dynpro_read definition.

  public section.
    methods: read_dynpro
             importing i_dynproname type tdynproname
             exporting e_dynpro type tdynpro.

  private section.
* Attribute
    data: dynpro type tdynpro,
          error_text type string.

endclass.                    "dynpro_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS dynpro_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class dynpro_read implementation.

  method read_dynpro.

* Initilisieren
    free dynpro.
    move i_dynproname-progname to dynpro-progname.
    move i_dynproname-dynnr to dynpro-dynnr.

* Selektieren
    CALL FUNCTION 'RPY_DYNPRO_READ'
      EXPORTING
        PROGNAME                    = dynpro-progname
        DYNNR                       = dynpro-dynnr
*       SUPPRESS_EXIST_CHECKS       = ' '
*       SUPPRESS_CORR_CHECKS        = ' '
      IMPORTING
        HEADER                      = dynpro-HEADER
      TABLES
        CONTAINERS                  = dynpro-CONTAINERS
        FIELDS_TO_CONTAINERS        = dynpro-FIELDS_TO_CONTAINERS
        FLOW_LOGIC                  = dynpro-FLOW_LOGIC
        PARAMS                      = dynpro-PARAMS
      EXCEPTIONS
        CANCELLED                   = 1
        NOT_FOUND                   = 2
        PERMISSION_ERROR            = 3
        OTHERS                      = 4
              .

    IF SY-SUBRC <> 0.
      error CANCELLED                   = 1.
      error NOT_FOUND                   = 2.
      error PERMISSION_ERROR            = 3.
      error OTHERS                      = 4.
      concatenate 'Dynpro' dynpro-progname dynpro-dynnr 'error'
      '(Fb. RPY_DYNPRO_READ)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free dynpro.
    ENDIF.

* Rueckgabe
    e_dynpro = dynpro.
    free dynpro.

  endmethod.                    "read_dynpro

endclass.                    "dynpro_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS typegroup_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroup_read definition.

  public section.
    methods read_typegroup
            importing typegroup_name TYPE trdir-name
            exporting e_typegroup type ttypegroup
            exceptions error.

  private section.
    data: typegroup type ttypegroup.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "typegroup_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS typegroup_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroup_read implementation.

  method read_typegroup.

    free typegroup.
* Name
    move typegroup_name to typegroup-name.

* Source
    data: name(30) type C.
    concatenate '%_C' typegroup-name into name.
    read report name into typegroup-source state 'A'.
    if sy-subrc ne 0.
      concatenate 'Typegroup' typegroup-name 'cant read'
      into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free typegroup.
      raise error.
    endif.

* Texte
    select * from DDTYPET into table typegroup-texts
             where typegroup = typegroup-name.

* Rueckgabe
    e_typegroup = typegroup.

  endmethod.                    "read_typegroup

endclass.                    "typegroup_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS domain_read DEFINITION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class domain_read definition.

  public section.
    methods read_domain importing DOMA_NAME TYPE RPY_DOMA-DOMANAME
                        exporting e_domain type tdomain
                        exceptions error.
  private section.
    data: domain type tdomain.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "domain_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS domain_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class domain_read implementation.

  method read_domain.

    free domain.
    move doma_name to domain-name.

    CALL FUNCTION 'DDIF_DOMA_GET'
      EXPORTING
        NAME          = domain-name
        STATE         = 'A'
        LANGU         = sy-langu
      IMPORTING
        GOTSTATE      = domain-gotstate
        DD01V_WA      = domain-dd01V_WA
      TABLES
        DD07V_TAB     = domain-dd07v_tab
      EXCEPTIONS
        ILLEGAL_INPUT = 1
        OTHERS        = 2.

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'Domain' doma_name 'not found'
      '(Fb. DDIF_DOMA_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free domain.
      raise error.
    ENDIF.

* Rueckgabe
    if not domain-gotstate is initial.
      e_domain = domain.
    else.
      free e_domain.
    endif.

  endmethod.                    "read_domain

endclass.                    "domain_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS dataelement_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class dataelement_read definition.

  public section.
    methods read_dataelement
            importing DATAELEMENT_NAME TYPE RPY_DTEL-DTELNAME
            exporting e_dataelement type tdataelement
            exceptions error.
  private section.
    data: dataelement type tdataelement.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "domain_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS dataelement_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class dataelement_read implementation.

  method read_dataelement.

    free dataelement.

    move DATAELEMENT_NAME to dataelement-NAME.

    CALL FUNCTION 'DDIF_DTEL_GET'
      EXPORTING
        NAME                = dataelement-name
*       STATE               = 'A'
        LANGU               = sy-langu
      IMPORTING
        GOTSTATE            = dataelement-gotstate
        DD04V_WA            = dataelement-DD04V_WA
        TPARA_WA            = dataelement-TPARA_WA
      EXCEPTIONS
        ILLEGAL_INPUT       = 1
        OTHERS              = 2
              .

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'Dataelement' DATAELEMENT_NAME
      'not found'
      '(Fb. DDIF_DTEL_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free dataelement.
      raise error.
    ENDIF.

* Rueckgabe
    if not dataelement-gotstate is initial.
      e_dataelement = dataelement.
    else.
      free e_dataelement.
    endif.

  endmethod.                    "read_domain

endclass.                    "dataelement_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS table_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class table_read definition.

  public section.
    methods read_table
            importing TABLE_NAME TYPE RPY_TABL-TABLNAME
            exporting e_table type ttable
            exceptions error.
  private section.
    data: table type ttable.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "domain_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS table_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class table_read implementation.

  method read_table.

    free table.

    move table_name to table-name.

    CALL FUNCTION 'DDIF_TABL_GET'
      EXPORTING
        NAME                = table-name
*       STATE               = 'A'
*       LANGU               = ' '
      IMPORTING
        GOTSTATE            = table-GOTSTATE
        DD02V_WA            = table-DD02V_WA
        DD09L_WA            = table-DD09L_WA
      TABLES
        DD03P_TAB           = table-DD03P_TAB
        DD05M_TAB           = table-DD05M_TAB
        DD08V_TAB           = table-DD08V_TAB
        DD12V_TAB           = table-DD12V_TAB
        DD17V_TAB           = table-DD17V_TAB
        DD35V_TAB           = table-DD35V_TAB
        DD36M_TAB           = table-DD36M_TAB
      EXCEPTIONS
        ILLEGAL_INPUT       = 1
        OTHERS              = 2
              .

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'Table' TABLE_NAME
      'not found'
      '(Fb. DDIF_TABL_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free table.
      raise error.
    ENDIF.

* Tableclass
    select tabclass up to 1 rows
      from dd02l
      into table-tabclass
      where TABNAME eq table-name.
    endselect.

* Rueckgabe
    if not table-GOTSTATE is initial.
      e_table = table.
    else.
      free e_table.
    endif.

  endmethod.                    "read_domain

endclass.                    "table_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS view_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class view_read definition.

  public section.
    methods read_view
            importing VIEW_NAME TYPE DDOBJNAME
            exporting e_view type tview
            exceptions error.
  private section.
    data: view type tview.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "view_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS view_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class view_read implementation.

  method read_view.

    free view.

    move view_name to view-name.

    CALL FUNCTION 'DDIF_VIEW_GET'
      EXPORTING
        NAME                = view-name
*    STATE               = 'A'
        LANGU               = sy-langu
      IMPORTING
        GOTSTATE            = view-GOTSTATE
        DD25V_WA            = view-DD25V_WA
        DD09L_WA            = view-DD09L_WA
      TABLES
        DD26V_TAB           = view-DD26V_TAB
        DD27P_TAB           = view-DD27P_TAB
        DD28J_TAB           = view-DD28J_TAB
        DD28V_TAB           = view-DD28V_TAB
      EXCEPTIONS
        ILLEGAL_INPUT       = 1
        OTHERS              = 2
              .

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'View' VIEW_NAME
      'not found'
      '(Fb. DDIF_VIEW_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free view.
      raise error.
    ENDIF.

* Rueckgabe
    if not view-GOTSTATE is initial.
      e_view = view.
    else.
      free e_view.
    endif.

  endmethod.                    "read_view

endclass.                    "view_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS tabletype_read DEFINITION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class tabletype_read definition.

  public section.
    methods read_tabletype
            importing tabletype_name TYPE DDOBJNAME
            exporting e_tabletype type ttabletype
            exceptions error.
  private section.
    data: tabletype type ttabletype.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "tabletype_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS tabletype_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tabletype_read implementation.

  method read_tabletype.

    free tabletype.

    move tabletype_name to tabletype-name.

    CALL FUNCTION 'DDIF_TTYP_GET'
      EXPORTING
        NAME                = tabletype-name
*       STATE               = 'A'
        LANGU               = sy-langu
      IMPORTING
        GOTSTATE            = tabletype-GOTSTATE
        DD40V_WA            = tabletype-DD40V_WA
      TABLES
        DD42V_TAB           = tabletype-DD42V_TAB
      EXCEPTIONS
        ILLEGAL_INPUT       = 1
        OTHERS              = 2
              .

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'Tabletype' tabletype-name
      'not found'
      '(Fb. DDIF_TTYP_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free tabletype.
      raise error.
    ENDIF.

* Rueckgabe
    if not tabletype-GOTSTATE is initial.
      e_tabletype = tabletype.
    else.
      free e_tabletype.
    endif.

  endmethod.                    "read_tabletype

endclass.                    "tabletype_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS shlp_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlp_read definition.

  public section.
    methods read_shlp
            importing shlp_name TYPE DDOBJNAME
            exporting e_shlp type tshlp
            exceptions error.
  private section.
    data: shlp type tshlp.
* Hilfsvariabeln
    data error_text type string.

endclass.                    "shlp_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS shlp_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlp_read implementation.

  method read_shlp.

    free shlp.

    move shlp_name to shlp-name.

    CALL FUNCTION 'DDIF_SHLP_GET'
      EXPORTING
        NAME          = shlp-name
        STATE         = 'A'
        LANGU         = sy-langu
      IMPORTING
        GOTSTATE      = shlp-GOTSTATE
        DD30V_WA      = shlp-DD30V_WA
      TABLES
        DD31V_TAB     = shlp-DD31V_TAB
        DD32P_TAB     = shlp-DD32P_TAB
        DD33V_TAB     = shlp-DD33V_TAB
      EXCEPTIONS
        ILLEGAL_INPUT = 1
        OTHERS        = 2.

    IF SY-SUBRC <> 0.
      error ILLEGAL_INPUT       = 1.
      error OTHERS              = 2.
      concatenate 'Search Help' shlp-name
      'not found'
      '(Fb. DDIF_SHLP_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free shlp.
      raise error.
    ENDIF.

* Rueckgabe
    if not shlp-GOTSTATE is initial.
      e_shlp = shlp.
    else.
      free e_shlp.
    endif.

  endmethod.                    "read_shlp

endclass.                    "shlp_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS class_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class class_read definition.

  public section.
    methods:
        READ_CLASS importing i_cifkey type SEOCLSKEY
                   exporting e_class type tclass
                   exceptions error.

  private section.
* Attribute
    data: class type tclass.
    data: clskey type  SEOCLSKEY.
    data: CIFKEY type  SEOCLSKEY.
* Hilfsvariabeln
    data error_text type string.

* Methoden
    methods:
        READ_METHODS changing methods TYPE SEOO_METHODS_R
                     exceptions error,
        READ_METHOD_PARAMS
            importing METHOD type SEOO_METHOD_R
            exporting PARAMETERS type SEOS_PARAMETERS_R
            exceptions error,
         READ_METHOD_DETAIL
            importing METHOD type SEOO_METHOD_R
            changing METHOD_DETAILS type SEOO_METHOD_DETAILS
            exceptions error,
         READ_METHOD_EXCEPTIONS
            importing method type tymethod
            changing METHOD_EXCEPTIONS type SEOS_EXCEPTIONS_R
            exceptions error,
        READ_METHOD_SOURCE
            importing METHOD type SEOO_METHOD_R
            exporting SOURCE type SEOP_SOURCE
            changing INCNAME type PROGRAM
            exceptions error,
        error_method_source
            importing mtdkey type SEOCPDKEY,
        READ_IMPL_METHODS
           exceptions error,
        READ_REDEF_METHODS
           exceptions error,
        READ_LOCALS
           exceptions error,
        ERROR_INCLUDE_SOURCE
           exceptions error,
        error_method_includes
           exceptions error,
        READ_TYPE_SOURCE
           exceptions error,
        READ_SECTIONS
           exceptions error.

endclass.                    "class DEFINITION

*---------------------------------------------------------------------*
*       CLASS class IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class class_read implementation.

***** private ******

  method READ_CLASS.

    data: explore TYPE SEOK_CLS_TYPEINFOS,
          w_explore type line of SEOK_CLS_TYPEINFOS,
          methods type SEOO_METHODS_R.

    move i_cifkey to cifkey.
    move-corresponding i_cifkey to clskey.

* refresh
    free class.

    CALL FUNCTION 'SEO_CLASS_TYPEINFO_GET'
     EXPORTING
       CLSKEY                             = clskey
       VERSION                             = SEOC_VERSION_INACTIVE
       STATE                               = '1'
       WITH_DESCRIPTIONS                   = SEOX_TRUE
       RESOLVE_EVENTHANDLER_TYPEINFO       = SEOX_FALSE
    IMPORTING
      CLASS                               = class-class
      ATTRIBUTES                          = class-attributes
      METHODS                             = methods
      EVENTS                              = class-events
      TYPES                               = class-types-types
*     PARAMETERS                          =
*     EXCEPS                              =
   IMPLEMENTINGS                    = class-implementings-implementings
      INHERITANCE                         = class-inheritance
      REDEFINITIONS                       = class-redefinitions
    IMPL_DETAILS                     = class-implementings-impl_details
      FRIENDSHIPS                         = class-friends
      TYPEPUSAGES                         = class-TYPEPUSAGES
      CLSDEFERRDS                         = class-CLASSDEFERREDS
      INTDEFERRDS                         = class-INTERFACEDEFERREDS
      EXPLORE_INHERITANCE                 = EXPLORE
*     EXPLORE_IMPLEMENTINGS               =
      ALIASES                             = class-aliases
    EXCEPTIONS
      NOT_EXISTING                        = 1
      IS_INTERFACE                        = 2
      MODEL_ONLY                          = 3
      OTHERS                              = 4
              .

    IF SY-SUBRC <> 0.
      error NOT_EXISTING                        = 1.
      error IS_INTERFACE                        = 2.
      error MODEL_ONLY                          = 3.
      error OTHERS                              = 4.
      concatenate 'Class' clskey-clsname 'not found'
      '(Fb. SEO_CLASS_TYPEINFO_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free class.
      raise error.
    ENDIF.

* cifkey
    move i_cifkey to class-cifkey.

* Explore
    loop at explore into w_explore.
      append w_explore-class to class-explore_inheritance.
    endloop.

* TypeSource
    call method READ_TYPE_SOURCE
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* Sektionen lesen
    call method READ_SECTIONS
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* Methoden lesen
    call method READ_METHODS
      CHANGING
        methods = methods
      EXCEPTIONS
        error   = 1
        others  = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* Locals
    call method read_locals
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* implementierte(Interfaces) Methoden lesen
    call method read_impl_methods
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* redefinierte Methoden lesen
    call method read_redef_methods
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      free class.
      raise error.
    endif.

* Rueckgabeparameter
    e_class = class.

  endmethod.                    " READ_CLASS

  method READ_METHODS.

    field-symbols: <METHOD> type line of SEOO_METHODS_R.
    data: METHOD type line of TCLASS-METHODS.

    delete methods where alias eq 'X'.

    loop at METHODS assigning <METHOD>.

* refresh
      free method.

* uebergabe
      METHOD-METHOD = <METHOD>.
      METHOD-CMPKEY-CLSNAME = <METHOD>-CLSNAME.
      METHOD-CMPKEY-CMPNAME = <METHOD>-CMPNAME.
*
      call method READ_METHOD_SOURCE
        EXPORTING
          METHOD  = <method>
        IMPORTING
          SOURCE  = method-source
        CHANGING
          INCNAME = method-incname
        EXCEPTIONS
          error   = 1
          others  = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

*
      call method READ_METHOD_PARAMS
        EXPORTING
          METHOD     = <method>
        IMPORTING
          PARAMETERS = method-parameters
        EXCEPTIONS
          error      = 1
          others     = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

*
      call method READ_METHOD_DETAIL
        EXPORTING
          METHOD         = <METHOD>
        CHANGING
          METHOD_DETAILS = METHOD-METHOD_DETAILS
        EXCEPTIONS
          error          = 1
          others         = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

*
      call method READ_METHOD_EXCEPTIONS
        EXPORTING
          METHOD            = METHOD
        CHANGING
          METHOD_EXCEPTIONS = method-EXCEPTIONS
        EXCEPTIONS
          error             = 1
          others            = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

      append METHOD to CLASS-METHODS.
*
    endloop.

  endmethod.                    "read_methods
*&--------------------------------------------------------------------*
*& FORM READ_METHOD_PARAMS
*&--------------------------------------------------------------------*
  method READ_METHOD_PARAMS.
*
    data: CMPKEY type SEOCMPKEY.

* refresh
    free parameters.

*
    CMPKEY-CLSNAME = METHOD-CLSNAME.
    CMPKEY-CMPNAME = METHOD-CMPNAME.
*
    call function 'SEO_PARAMETER_READ_ALL'
      EXPORTING
        CMPKEY                 = CMPKEY
        VERSION                = SEOC_VERSION_ACTIVE
        MASTER_LANGUAGE        = SY-LANGU
        MODIF_LANGUAGE         = SY-LANGU
        WITH_DESCRIPTIONS      = SEOX_TRUE
      IMPORTING
        parameters             = PARAMETERS[]
      EXCEPTIONS
        COMPONENT_NOT_EXISTING = 1
        others                 = 2.
    if SY-SUBRC <> 0.
      ERROR  SEO_PARAMETER_READ_ALL_COMPONENT_NOT_EXISTING       = 1.
      ERROR  SEO_PARAMETER_READ_ALL_OTHERS                       = 2.
      concatenate 'Class' CMPKEY
      'Cant get Methodparameters' '(Fb. SEO_PARAMETER_READ_ALL)'
      into error_text separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    endif.
*
  endmethod.                    "READ_METHOD_PARAMS

  method READ_METHOD_DETAIL.

    data: begin of SEO_METHOD_GET_DETAIL.
    data: CPDKEY type SEOCPDKEY.
    data: METHOD type VSEOMETHOD.
    data: METHOD_DETAILS type SEOO_METHOD_DETAILS.
    data: end of SEO_METHOD_GET_DETAIL.

* refresh
    free method_details.

    SEO_METHOD_GET_DETAIL-CPDKEY-CLSNAME = METHOD-CLSNAME.
    SEO_METHOD_GET_DETAIL-CPDKEY-CPDNAME = METHOD-CMPNAME.
*
    call function 'SEO_METHOD_GET_DETAIL'
      EXPORTING
        CPDKEY         = SEO_METHOD_GET_DETAIL-CPDKEY
      IMPORTING
        METHOD         = SEO_METHOD_GET_DETAIL-METHOD
        METHOD_DETAILS = METHOD_DETAILS
      EXCEPTIONS
        NOT_EXISTING   = 1
        NO_METHOD      = 2
        others         = 3.
    if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ERROR   SEO_METHOD_GET_DETAIL_NOT_EXISTING         = 1.
      ERROR   SEO_METHOD_GET_DETAIL_NO_METHOD            = 2.
      ERROR   SEO_METHOD_GET_DETAIL_OTHERS               = 3.
      concatenate 'Class' SEO_METHOD_GET_DETAIL-CPDKEY
      'Cant get Methoddetail' '(Fb. SEO_METHOD_GET_DETAIL)'
      into error_text separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    endif.

*
  endmethod.                    "READ_METHOD_DETAIL

  method READ_METHOD_EXCEPTIONS.

* refresh
    free method_exceptions.

    CALL FUNCTION 'SEO_EXCEPTION_READ_ALL'
      EXPORTING
        CMPKEY                       = method-CMPKEY
*       VERSION                      = SEOC_VERSION_INACTIVE
*       MASTER_LANGUAGE              = SY-LANGU
*       MULTISOFT                    = SY-LANGU
*       WITH_DESCRIPTIONS            = SEOX_TRUE
      IMPORTING
        EXCEPS                       = method_exceptions
      EXCEPTIONS
        COMPONENT_NOT_EXISTING       = 1
        OTHERS                       = 2
              .
    IF SY-SUBRC <> 0.
      error COMPONENT_NOT_EXISTING       = 1.
      error OTHERS                       = 2.
      concatenate 'Class' method-CMPKEY
      'Cant get Methodexceptions' '(Fb. SEO_EXCEPTION_READ_ALL)'
      into error_text separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "READ_METHOD_EXCEPTIONS

  method READ_METHOD_SOURCE.

    data: begin of SEO_METHOD_GET_SOURCE.
    data: MTDKEY type SEOCPDKEY.
    data: SOURCE type SEOP_SOURCE.
    data: INCNAME type PROGRAM.
    data: end of SEO_METHOD_GET_SOURCE.

*  refresh
    free: source, incname.

*
    SEO_METHOD_GET_SOURCE-MTDKEY-CLSNAME = METHOD-CLSNAME.
    SEO_METHOD_GET_SOURCE-MTDKEY-CPDNAME = METHOD-CMPNAME.
*
    call function 'SEO_METHOD_GET_SOURCE'
      exporting
        MTDKEY                      = SEO_METHOD_GET_SOURCE-MTDKEY
        STATE                       = 'A'
      importing
        source                      = SEO_METHOD_GET_SOURCE-SOURCE
*     SOURCE_EXPANDED             =
        INCNAME                     = SEO_METHOD_GET_SOURCE-INCNAME
     exceptions
       _INTERNAL_METHOD_NOT_EXISTING       = 1
       _INTERNAL_CLASS_NOT_EXISTING        = 2
       VERSION_NOT_EXISTING                = 3
       INACTIVE_NEW                        = 4
       INACTIVE_DELETED                    = 5
       others                              = 6      .
    if SY-SUBRC eq 0.
      SOURCE[] = SEO_METHOD_GET_SOURCE-SOURCE.
      INCNAME = SEO_METHOD_GET_SOURCE-INCNAME.
    else.

      call method error_method_source
        EXPORTING
          mtdkey = SEO_METHOD_GET_SOURCE-MTDKEY.
      raise error.

    endif.

    data: ORGSOURCE like SEO_METHOD_GET_SOURCE-SOURCE[].
    ORGSOURCE[] = SEO_METHOD_GET_SOURCE-SOURCE.
    call function 'PRETTY_PRINTER'
      exporting
        INCTOO                        = SPACE
*   IMPORTING
*     INDENTATION_MAYBE_WRONG       =
      tables
        NTEXT                         = ORGSOURCE[]
        OTEXT                         = SEO_METHOD_GET_SOURCE-SOURCE[]
     exceptions
       ENQUEUE_TABLE_FULL            = 1
       INCLUDE_ENQUEUED              = 2
       INCLUDE_READERROR             = 3
       INCLUDE_WRITEERROR            = 4
       others                        = 5
              .
    if SY-SUBRC <> 0.
      error ENQUEUE_TABLE_FULL            = 1.
      error INCLUDE_ENQUEUED              = 2.
      error INCLUDE_READERROR             = 3.
      error INCLUDE_WRITEERROR            = 4.
      error others                        = 5.
      concatenate 'Class' SEO_METHOD_GET_SOURCE-MTDKEY
      'Error Pretty Printer' '(Fb. PRETTY_PRINTER)'
      into error_text separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    endif.
*
  endmethod.                    "read_methods

  method error_method_source.

    ERROR _INTERNAL_METHOD_NOT_EXISTING       = 1.
    ERROR _INTERNAL_CLASS_NOT_EXISTING        = 2.
    ERROR VERSION_NOT_EXISTING                = 3.
    ERROR INACTIVE_NEW                        = 4.
    ERROR INACTIVE_DELETED                    = 5.
    ERROR OTHERS                              = 6.
    concatenate 'Class' MTDKEY
    'Cant get Methodsource' '(Fb. SEO_METHOD_GET_SOURCE)'
    into error_text separated by space.
    error_message error_text 'S'.        "Makro

  endmethod.                    "error_method_source

Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:43 am    Post subject: Reply with quote

Code:
  method read_impl_methods.

    data: includes type SEOP_METHODS_W_INCLUDE,
          w_include like line of includes.
    data: method_impl  like line of class-methods_impl.
    data: MTDKEY TYPE  SEOCPDKEY,
          MTDKEY1 TYPE SEOCMPKEY.
    data: w_alias like method_impl-alias.

    move-corresponding cifkey to clskey.

* Includes lesen
    CALL FUNCTION 'SEO_CLASS_GET_METHOD_INCLUDES'
      EXPORTING
        CLSKEY                       = clskey
      IMPORTING
        INCLUDES                     = includes
      EXCEPTIONS
        _INTERNAL_CLASS_NOT_EXISTING = 1
        OTHERS                       = 2.

    IF SY-SUBRC <> 0.

      call method error_method_includes.
      raise error.

    ELSE.

      loop at includes into w_include.

* refresh
        free: method_impl, MTDKEY, MTDKEY1.

        read table class-methods
        transporting no fields
        with key method-cmpname = w_include-cpdkey-cpdname.
        if sy-subrc ne 0.

* Includename
          move w_include to method_impl-include.

* Method
          if w_include-cpdkey-cpdname ca '~'.
* Iterface
            split w_include-cpdkey-cpdname at '~'
            into MTDKEY1-CLSNAME MTDKEY1-CMPNAME.
          else.
* Redefinition
            continue.
          endif.

          CALL FUNCTION 'SEO_METHOD_GET'
            EXPORTING
              MTDKEY       = mtdkey1
              VERSION      = SEOC_VERSION_INACTIVE
            IMPORTING
              METHOD       = method_impl-method
            EXCEPTIONS
              NOT_EXISTING = 1
              DELETED      = 2
              IS_EVENT     = 3
              IS_TYPE      = 4
              IS_ATTRIBUTE = 5
              OTHERS       = 6.

          IF SY-SUBRC <> 0.
            error NOT_EXISTING = 1.
            error DELETED      = 2.
            error IS_EVENT     = 3.
            error IS_TYPE      = 4.
            error IS_ATTRIBUTE = 5.
            error OTHERS       = 6.
            concatenate 'Class' mtdkey1
            'Cant get Method'
            '(Fb. SEO_METHOD_GET)'
            into error_text separated by space.
            error_message error_text 'S'.        "Makro
            raise error.

          else.
* Source
            MTDKEY-CLSNAME = w_include-cpdkey-clsname.
            MTDKEY-CPDNAME = w_include-cpdkey-cpdname.
            call function 'SEO_METHOD_GET_SOURCE'
              exporting
                MTDKEY                      = MTDKEY
                STATE                       = 'A'
              importing
                source                      = method_impl-SOURCE
*             SOURCE_EXPANDED             =
                INCNAME                     = w_include-INCNAME
             exceptions
               _INTERNAL_METHOD_NOT_EXISTING       = 1
               _INTERNAL_CLASS_NOT_EXISTING        = 2
               VERSION_NOT_EXISTING                = 3
               INACTIVE_NEW                        = 4
               INACTIVE_DELETED                    = 5
               others                              = 6      .

            IF SY-SUBRC <> 0.
              call method error_method_source
                EXPORTING
                  mtdkey = MTDKEY.
              raise error.
            ELSE.
* Alias
              clear w_alias.
              read table class-aliases into w_alias
                 with key
                 REFCLSNAME = MTDKEY1-CLSNAME
                 REFCMPNAME = MTDKEY1-CMPNAME.
              if sy-subrc eq 0.
                move w_alias to method_impl-alias.
              else.
                clear method_impl-alias.
              endif.
              append method_impl to class-methods_impl.
            endif.
          endif.

          free method_impl.

        endif.
      endloop.

    ENDIF.

  endmethod.                    "read_impl_methods

  method error_method_includes.

    error _INTERNAL_CLASS_NOT_EXISTING  = 1.
    error  OTHERS                       = 2.
    concatenate 'Class' clskey
    'Cant get Method Includes'
    '(Fb. SEO_CLASS_GET_METHOD_INCLUDES)'
    into error_text separated by space.
    error_message error_text 'S'.        "Makro

  endmethod.                    "error_method_includes

  method read_redef_methods.

    data: includes type SEOP_METHODS_W_INCLUDE,
          w_include like line of includes.
    data: w_redefinition like line of class-redefinitions.
    data: method_redef like line of class-methods_redef.
    data: MTDKEY TYPE  SEOCPDKEY,
          MTDKEY1 TYPE SEOCMPKEY.
    data: explore like line of class-explore_inheritance.

    clear clskey.
    move-corresponding cifkey to clskey.

    CALL FUNCTION 'SEO_CLASS_GET_METHOD_INCLUDES'
      EXPORTING
        CLSKEY                       = clskey
      IMPORTING
        INCLUDES                     = includes
      EXCEPTIONS
        _INTERNAL_CLASS_NOT_EXISTING = 1
        OTHERS                       = 2.

    IF SY-SUBRC <> 0.
      call method error_method_includes.
      raise error.
    ELSE.

      loop at includes into w_include.

* refresh
        free method_redef.

        read table class-methods
        transporting no fields
        with key method-cmpname = w_include-cpdkey-cpdname.
        if sy-subrc ne 0.

* Includename
          move w_include to method_redef-include.

* Method
          if w_include-cpdkey-cpdname ca '~'.
            continue.
          endif.

          clear w_redefinition.
          read table class-redefinitions
          into w_redefinition
          with key
          mtdname = w_include-cpdkey-cpdname.

          if sy-subrc eq 0.

            loop at class-explore_inheritance into explore.

* refresh
              free: method_redef-method, mtdkey1.

              move explore-clsname to MTDKEY1-CLSNAME.
              move w_redefinition-mtdname to MTDKEY1-CMPNAME.

* Methodenattribute lesen
              CALL FUNCTION 'SEO_METHOD_GET'
                EXPORTING
                  MTDKEY       = mtdkey1
                  VERSION      = SEOC_VERSION_INACTIVE
                IMPORTING
                  METHOD       = method_redef-method
                EXCEPTIONS
                  NOT_EXISTING = 1
                  DELETED      = 2
                  IS_EVENT     = 3
                  IS_TYPE      = 4
                  IS_ATTRIBUTE = 5
                  OTHERS       = 6.

              IF SY-SUBRC eq 0.
                exit.
              ENDIF.

            endloop.

* Source
            free: mtdkey, method_redef-SOURCE.
            MTDKEY-CLSNAME = w_include-cpdkey-clsname.
            MTDKEY-CPDNAME = w_include-cpdkey-cpdname.
            call function 'SEO_METHOD_GET_SOURCE'
              exporting
                MTDKEY                      = MTDKEY
                STATE                       = 'A'
              importing
                source                      = method_redef-SOURCE
*               SOURCE_EXPANDED             =
                INCNAME                     = w_include-INCNAME
             exceptions
               _INTERNAL_METHOD_NOT_EXISTING       = 1
               _INTERNAL_CLASS_NOT_EXISTING        = 2
               VERSION_NOT_EXISTING                = 3
               INACTIVE_NEW                        = 4
               INACTIVE_DELETED                    = 5
               others                              = 6      .

            IF SY-SUBRC <> 0.
              call method error_method_source
                EXPORTING
                  mtdkey = MTDKEY.
              raise error.
            ELSE.
              append method_redef to class-methods_redef.
            ENDIF.

          endif.
        endif.

* refresh
        free method_redef.

      endloop.

    ENDIF.

  endmethod.                    "read_redef_methods

  method READ_locals.

    data: source type tLocal-source_locals,
          local type Tlocal.

    move-corresponding cifkey to clskey.

    CALL FUNCTION 'SEO_CLASS_GET_INCLUDE_SOURCE'
      EXPORTING
        CLSKEY                             = clskey
        INCTYPE                            = seop_ext_class_locals_def
      IMPORTING
       SOURCE                              = source
*      SOURCE_EXPANDED                     =
      EXCEPTIONS
        _INTERNAL_CLASS_NOT_EXISTING       = 1
        NOT_EXISTING                       = 2
        OTHERS                             = 3
              .

    IF SY-SUBRC <> 0.
      call method error_include_source.
      raise error.
    ENDIF.

    move 'DEF' to local-name.
    move source to local-source_locals.
    append local to class-locals.

    free local.
    refresh source.
    CALL FUNCTION 'SEO_CLASS_GET_INCLUDE_SOURCE'
      EXPORTING
        CLSKEY                             = clskey
        INCTYPE                            = seop_ext_class_locals_imp
      IMPORTING
        SOURCE                           = source
*       SOURCE_EXPANDED                    =
      EXCEPTIONS
        _INTERNAL_CLASS_NOT_EXISTING       = 1
        NOT_EXISTING                       = 2
        OTHERS                             = 3
              .

    IF SY-SUBRC <> 0.
      call method error_include_source.
      raise error.
    ENDIF.

    move 'IMP' to local-name.
    move source to local-source_locals.
    append local to class-locals.

    free local.
    refresh source.
    CALL FUNCTION 'SEO_CLASS_GET_INCLUDE_SOURCE'
      EXPORTING
        CLSKEY                             = clskey
        INCTYPE                            = seop_ext_class_macros
      IMPORTING
       SOURCE                            = source
*     SOURCE_EXPANDED                    =
      EXCEPTIONS
        _INTERNAL_CLASS_NOT_EXISTING       = 1
        NOT_EXISTING                       = 2
        OTHERS                             = 3
              .

    IF SY-SUBRC <> 0.
      call method error_include_source.
      raise error.
    ENDIF.

    move 'MAC' to local-name.
    move source to local-source_locals.
    append local to class-locals.


  endmethod.                    "READ_locals

  method error_include_source.

    error  _INTERNAL_CLASS_NOT_EXISTING       = 1.
    error  NOT_EXISTING                       = 2.
    error  OTHERS                             = 3.
    concatenate 'Class' clskey
    'Cant get Includesource'
    '(Fb. SEO_CLASS_GET_INCLUDE_SOURCE)'
    into error_text separated by space.
    error_message error_text 'S'.        "Makro

  endmethod.                    "error_include_source

  method READ_TYPE_SOURCE.

*********************
* Typesource
*********************
    DATA: TYPKEY TYPE  SEOCMPKEY.
    DATA: w_type like line of class-types-types.
    DATA: t_source type seop_source.

    loop at class-types-types into w_type.

      refresh t_source.
      move-corresponding w_type to typkey.

      CALL FUNCTION 'SEO_CLASS_GET_TYPE_SOURCE'
        EXPORTING
          TYPKEY                       = typkey
        IMPORTING
          SOURCE                       = t_source
        EXCEPTIONS
          _INTERNAL_CLASS_NOT_EXISTING = 1
          NOT_EXISTING                 = 2
          NOT_EDITED                   = 3
          OTHERS                       = 4.

      IF SY-SUBRC <> 0.
        if sy-subrc ne 3.
          error _INTERNAL_CLASS_NOT_EXISTING  = 1.
          error  NOT_EXISTING                 = 2.
          error  NOT_EDITED                   = 3.
          error  OTHERS                       = 4.
          concatenate 'Class' typkey-clsname 'Cant get type source'
          '(Fb. SEO_CLASS_GET_TYPE_SOURCE)' into error_text
          separated by space.
          error_message error_text 'S'.
          refresh t_source.
          raise error.
        endif.
      ENDIF.

      append lines of t_source to class-types-type_source.
      refresh t_source.

    endloop.

  endmethod.                    "READ_TYPES

  method READ_sections.

    DATA: SECTION like line of class-sections.

    do 3 times.

* refresh
      free section.

      case sy-index.
        when 1.
          move seok_limu_public to section-LIMU.
        when 2.
          move seok_limu_private to section-LIMU.
        when 3.
          move seok_limu_protected to section-LIMU.
      endcase.

* >>>> Beginn geaendert US20060112 XYXY
      if sy-saprl >= 640.
        data: ls_seo_section_source(255),
              lt_seo_section_source like standard table of
              ls_seo_section_source.
        CALL FUNCTION 'SEO_SECTION_GET_SOURCE'
                EXPORTING
                  CIFKEY                     = class-cifkey
                  LIMU                       = section-limu
*       STATE                      =
                IMPORTING
                  SOURCE                     = lt_seo_section_source
                  INCNAME                    = section-incname
                EXCEPTIONS
                  CLASS_NOT_EXISTING         = 1
                  VERSION_NOT_EXISTING       = 2
                  OTHERS                     = 3
                        .
        Loop at lt_seo_section_source into ls_seo_section_source.
          append ls_seo_section_source(72) to section-source.
        Endloop.
      else.
* >>>> Ende geaendert US20060112 XYXY
        CALL FUNCTION 'SEO_SECTION_GET_SOURCE'
          EXPORTING
            CIFKEY                     = class-cifkey
            LIMU                       = section-limu
*       STATE                      =
          IMPORTING
            SOURCE                     = section-source
            INCNAME                    = section-incname
          EXCEPTIONS
            CLASS_NOT_EXISTING         = 1
            VERSION_NOT_EXISTING       = 2
            OTHERS                     = 3
                  .
      endif.

      IF SY-SUBRC <> 0.
        error CLASS_NOT_EXISTING         = 1.
        error VERSION_NOT_EXISTING       = 2.
        error OTHERS                     = 3.
        concatenate 'Class' class-cifkey-clsname
        'Cant get Sectionsource' '(Fb. SEO_SECTION_GET_SOURCE)'
        into error_text separated by space.
        error_message error_text 'S'.        "Makro
        raise error.
      else.
        append section to class-sections.
      ENDIF.

    enddo.

  endmethod.                    "READ_sections

endclass.                    "class IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS interface_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interface_read definition.

  public section.
    methods: read_interface importing i_intkey type SEOCLSKEY
                            exporting e_inter type tinter
                            exceptions error.

  private section.
* Klassenattribute
    data: inter type tinter.
* Hilfsvariabeln
    data: error_text type string.

endclass.                    "interface_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS interface_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interface_read implementation.

  method read_interface.

* Refresh
    free inter.

* Objektschluessel
    move i_intkey to inter-intkey.

    CALL FUNCTION 'SEO_INTERFACE_TYPEINFO_GET'
            EXPORTING
              INTKEY              = inter-intkey
              VERSION             = SEOC_VERSION_INACTIVE
              STATE               = '1'
            IMPORTING
              INTERFACE           = inter-interface
              ATTRIBUTES          = inter-attributes
              METHODS             = inter-methods
              EVENTS              = inter-events
              PARAMETERS          = inter-parameters
              EXCEPS              = inter-exceps
              COMPRISINGS         = inter-comprisings
              TYPEPUSAGES         = inter-typepusages
              CLSDEFERRDS         = inter-clsdeferrds
              INTDEFERRDS         = inter-intdeferrds
*             EXPLORE_COMPRISINGS = inter-explore_comprisings
              ALIASES             = inter-aliases
            EXCEPTIONS
              NOT_EXISTING        = 1
              IS_CLASS            = 2
              MODEL_ONLY          = 3
              OTHERS              = 4.

    IF SY-SUBRC <> 0.
      error NOT_EXISTING        = 1.
      error IS_CLASS            = 2.
      error MODEL_ONLY          = 3.
      error OTHERS              = 4.
      concatenate 'Interface' inter-intkey 'not found'
      '(Fb. SEO_INTERFACE_TYPEINFO_GET)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free inter.
      raise error.
    ENDIF.

    e_inter = inter.

  endmethod.                    "read_interface

endclass.                    "interface_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS interface_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interface_upload definition.

  public section.
    methods: upload_interface importing i_inter type tinter
             exceptions error.

  private section.
    methods: postfix.
    data: inter type tinter,
          error_text type string.

endclass.                    "interface_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS interface_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interface_upload implementation.

  METHOD upload_interface.

    inter = i_inter.

********************************************
* Postfix
********************************************

    call method postfix.

********************************************
* Ueberpruefen, ob Klasse existiert
********************************************
    data: clskey type SEOCLSKEY.
    move inter-intkey-clsname to clskey-clsname.
    CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
      EXPORTING
        CLSKEY              = clskey
*     IMPORTING
*       NOT_ACTIVE          =
      EXCEPTIONS
        NOT_SPECIFIED       = 1
        NOT_EXISTING        = 2
        IS_INTERFACE        = 3
        NO_TEXT             = 4
        INCONSISTENT        = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.


    IF SY-SUBRC ne 2.
      error NOT_SPECIFIED       = 1.
      error NOT_EXISTING        = 2.
      error IS_INTERFACE        = 3.
      error NO_TEXT             = 4.
      error INCONSISTENT        = 5.
      error ERROR_MESSAGE       = 6.
      error OTHERS              = 7.
      concatenate 'Interface' inter-intkey 'Already exists'
      '(Fb. SEO_CLASS_EXISTENCE_CHECK)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'SEO_INTERFACE_CREATE_COMPLETE'
      EXPORTING
*       CORRNR                =
        DEVCLASS              = '$TMP'
*       VERSION               = SEOC_VERSION_INACTIVE
*       GENFLAG               = ' '
*       AUTHORITY_CHECK       = SEOX_TRUE
*       OVERWRITE             = SEOX_FALSE
*     IMPORTING
*       KORRNR                =
      CHANGING
        INTERFACE             = inter-interface
        COMPRISINGS           = inter-comprisings
        ATTRIBUTES            = inter-attributes
        METHODS               = inter-methods
        EVENTS                = inter-events
        PARAMETERS            = inter-parameters
        EXCEPS                = inter-exceps
        ALIASES               = inter-aliases
        TYPEPUSAGES           = inter-typepusages
        CLSDEFERRDS           = inter-clsdeferrds
        INTDEFERRDS           = inter-intdeferrds
      EXCEPTIONS
        EXISTING              = 1
        IS_CLASS              = 2
        DB_ERROR              = 3
        COMPONENT_ERROR       = 4
        NO_ACCESS             = 5
        OTHER                 = 6
        ERROR_MESSAGE     = 7        " Error messages
        OTHERS            = 8.

    IF SY-SUBRC <> 0.
      error EXISTING              = 1.
      error IS_CLASS              = 2.
      error DB_ERROR              = 3.
      error COMPONENT_ERROR       = 4.
      error NO_ACCESS             = 5.
      error OTHER                 = 6.
      error ERROR_MESSAGE         = 7.
      error OTHERS                = 8.
      concatenate 'Interface' inter-intkey 'Cant create'
      '(Fb. SEO_INTERFACE_CREATE_COMPLETE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  ENDMETHOD.                    " interface_einspielen

  method postfix.

    DATA: clsname_new like inter-intkey-clsname.

    if not postfix is initial.
      concatenate inter-intkey-clsname postfix into clsname_new.
* INTKEY
      move clsname_new to inter-intkey-clsname.
*  INTERFACE
      move clsname_new to inter-interface-clsname.
*  ATTRIBUTES
      data: w_attribute like line of inter-attributes.
      loop at inter-attributes into w_attribute.
        move clsname_new to w_attribute-clsname.
        modify inter-attributes from w_attribute.
      endloop.
*  METHODS
      data: w_method like line of inter-methods.
      loop at inter-methods into w_method.
        move clsname_new to w_method-clsname.
        modify inter-methods from w_method.
      endloop.
*  EVENTS
      data: w_event like line of inter-events.
      loop at inter-events into w_event.
        move clsname_new to w_event-clsname.
        modify inter-events from w_event.
      endloop.
*  PARAMETERS
      data: w_parameter like line of inter-parameters.
      loop at inter-parameters into w_parameter.
        move clsname_new to w_parameter-clsname.
        modify inter-parameters from w_parameter.
      endloop.
*  EXCEPS
      data: w_excep like line of inter-exceps.
      loop at inter-exceps into w_excep.
        move clsname_new to w_excep-clsname.
        modify inter-exceps from w_excep.
      endloop.
*  COMPRISINGS
      data: w_COMPRISING like line of inter-COMPRISINGs.
      loop at inter-COMPRISINGs into w_COMPRISING.
        move clsname_new to w_COMPRISING-clsname.
        modify inter-COMPRISINGs from w_COMPRISING.
      endloop.
*  TYPEPUSAGES
      data: w_TYPEPUSAGE like line of inter-TYPEPUSAGES.
      loop at inter-TYPEPUSAGES into w_TYPEPUSAGE.
        move clsname_new to w_TYPEPUSAGE-clsname.
        modify inter-TYPEPUSAGES from w_TYPEPUSAGE.
      endloop.
*  CLSDEFERRDS
      data: w_CLSDEFERRD like line of inter-CLSDEFERRDS.
      loop at inter-CLSDEFERRDS into w_CLSDEFERRD.
        move clsname_new to w_CLSDEFERRD-clsname.
        modify inter-CLSDEFERRDS from w_CLSDEFERRD.
      endloop.
*  INTDEFERRDS
      data: w_INTDEFERRD like line of inter-INTDEFERRDS.
      loop at inter-INTDEFERRDS into w_INTDEFERRD.
        move clsname_new to w_INTDEFERRD-clsname.
        modify inter-INTDEFERRDS from w_INTDEFERRD.
      endloop.
*  EXPLORE_COMPRISINGS
*  ALIASES
      data: w_ALIAS like line of inter-ALIASES.
      loop at inter-ALIASES into w_ALIAS.
        move clsname_new to w_ALIAS-clsname.
        modify inter-ALIASES from w_ALIAS.
      endloop.
    endif.

  endmethod.                    "postfix

endclass.                    "interface_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS interfaces_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interfaces_upload definition.

  public section.
    methods:
    constructor,
    interfaces_create.

  private section.
    DATA: interface_upload type ref to interface_upload.
    methods:
      determine_sequence_interfaces.

endclass.                    "interfaces_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS interfaces_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class interfaces_upload implementation.

  method constructor.

    create object interface_upload.

  endmethod.                    "constructor

  method interfaces_create.

    field-symbols: <INTER> type TINTER.

    data: lv_subrc type sy-subrc.

* Reihenfolge selber bestimmen
    call method determine_sequence_interfaces.

* Interfaces einspielen
    loop at p-inters assigning <inter>.
      call method interface_upload->upload_interface
        EXPORTING
          i_inter = <inter>
        EXCEPTIONS
          error   = 1
          others  = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Interface' <inter>-intkey-clsname lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "inters_create

*&---------------------------------------------------------------------*
*&      Form  determine_sequence_interfaces
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <--P_INTERS  text
*----------------------------------------------------------------------*
  METHOD determine_sequence_interfaces.

    data: w_inters  type standard table of tinter-intkey-clsname,
          w_inters1 type standard table of tinter-intkey-clsname,
          inter1 type tinter,
          inter2 type tinter.
    data: w_comprising type line of tinter-comprisings.

* Sortieren
    loop at p-inters into inter1.
      loop at inter1-comprisings into w_comprising.
        loop at p-inters into inter2
             where intkey-clsname = w_comprising-refclsname.
          insert inter2-intkey-clsname into w_inters1 index 1.
        endloop.
      endloop.
      insert inter1-intkey-clsname into w_inters1 index 1.
      loop at w_inters1 into inter2-intkey-clsname.
        insert inter2-intkey-clsname into w_inters index 1.
        delete w_inters1.
      endloop.
    endloop.

* doppelte Eintraege
    data: index type i.
    loop at w_inters into inter1-intkey-clsname.
      move 0 to index.
      loop at w_inters into inter2-intkey-clsname
              where table_line = inter1-intkey-clsname.
        index = index + 1.
        if index > 1.
          delete w_inters.
        endif.
      endloop.
    endloop.

*   Uebergeben
    loop at w_inters into inter1-intkey-clsname.
      read table p-inters into inter2
           with key intkey-clsname = inter1-intkey-clsname.
      delete p-inters index sy-tabix.
      append inter2 to p-inters.
    endloop.

  ENDMETHOD.                    " determine_sequence_interfaces

endclass.                    "interfaces_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS class_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class class_upload definition.

  public section.

    methods create_class importing i_class type tclass
                         exceptions error.

  private section.

* Attribute
    data: class type tclass.
    data: clskey type  SEOCLSKEY.
    data: clsname type SEOCLSKEY-CLSNAME.
    data: error_text type string.

* Methods
    methods:
    create_class_types exceptions error,
    create_source exceptions error,
    create_source_fb importing cpdname type seop_method_w_source-cpdname
                               source type seop_source
                      changing t_seop_method_w_source
                               type seop_methods_w_source,
    create_source_methods_redef exceptions error,
    create_source_methods_locals exceptions error,
    create_source_methods_impl exceptions error,
    create_source_sections exceptions error.

endclass.                    "class_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS class_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class class_upload implementation.

  method create_class_types.

    data: w_class like class.
    data: clsname_temp like class-cifkey-clsname.
    data: w_inter type tinter.

****************************
* Klassenattribute
****************************
    if not clsname is initial.
      move clsname to class-class-clsname.
      move clsname to class-cifkey-clsname.
    endif.

***************************
* Methoden und Parameter
***************************
    DATA: T_SEOO_METHOD_R TYPE STANDARD TABLE OF SEOO_METHOD_R
          WITH KEY CLSNAME CMPNAME VERSION LANGU,
          W_SEOO_METHOD_R TYPE SEOO_METHOD_R.
    DATA: t_seos_parameters_r TYPE STANDARD TABLE OF seos_parameter_r
          WITH KEY clsname cmpname sconame version langu,
          w_seos_parameters_r TYPE seos_parameter_r.
    field-symbols: <METHOD> type TYMETHOD,
                   <parameters> type line of tymethod-parameters.

    loop at class-methods assigning <method>.

* Unerwuenschte Methoden
      if not <method>-method-REFCLSNAME is initial.
        delete class-methods.
        continue.
      endif.

* Methoden
      if not clsname is initial.
        move clsname to <method>-method-clsname.
      endif.
      move <method>-method to W_SEOO_METHOD_R.
      append W_SEOO_METHOD_R to T_SEOO_METHOD_R.

* Parameter
      loop at <method>-parameters assigning <parameters>.
        if not clsname is initial.
          move clsname to <parameters>-clsname.
        endif.
        move <parameters> to w_seos_parameters_r.
        append w_seos_parameters_r to t_seos_parameters_r.
      endloop.

    endloop.

********************************************************************
* Ausnahmen
********************************************************************
    data: t_exceptions type tymethod-exceptions,
          w_exceptions type line of tymethod-exceptions.
    loop at class-methods assigning <method>.
      loop at <method>-exceptions into w_exceptions.
        if not clsname is initial.
          move clsname to w_exceptions-clsname.
        endif.
        append w_exceptions to t_exceptions.
        modify <method>-exceptions from w_exceptions.
      endloop.
    endloop.

*********************************************************************
* Attribute
*********************************************************************
    field-symbols: <attribute> type line of SEOO_ATTRIBUTES_R.
    loop at class-attributes assigning <attribute>.

      if not clsname is initial.
        move clsname to <attribute>-clsname.
        if not <attribute>-REFCLSNAME is initial.
          delete class-attributes.
        endif.
      endif.

    endloop.

********************************************************************
* Events
********************************************************************
    field-symbols <event> like line of class-events.
    loop at class-events assigning <event>.
      if not clsname is initial.
        move clsname to <event>-clsname.
      endif.
    endloop.

********************************************************************
* Friends
********************************************************************
    data: friend like line of class-friends.
    loop at class-friends into friend.
      if not clsname is initial.
        move clsname to friend-clsname.
      endif.
      if not postfix is initial.
        concatenate friend-REFCLSNAME postfix into clsname_temp.
        loop at p-classes into w_class.
          if w_class-cifkey-clsname eq friend-refclsname
          or w_class-cifkey-clsname eq clsname_temp.
           concatenate friend-REFCLSNAME postfix into friend-REFCLSNAME
           .
            exit.
          endif.
        endloop.
      endif.
      modify class-friends from friend.
    endloop.

********************************************************************
* Types
********************************************************************
    field-symbols: <type> like line of class-types-types.
    loop at class-types-types assigning <type>.
      if not clsname is initial.
        move clsname to <type>-clsname.
      endif.
    endloop.

********************************************************************
* Inheritance
********************************************************************
    if not class-inheritance is initial.
      if not clsname is initial.
        move clsname to class-inheritance-clsname.
        if class-inheritance-REFCLSNAME(1) eq c_z
        or class-inheritance-REFCLSNAME(1) eq c_y.
          if not postfix is initial.
            concatenate class-inheritance-REFCLSNAME postfix
                        into clsname_temp.
            loop at p-classes into w_class.
              if w_class-cifkey-clsname eq class-inheritance-REFCLSNAME
              or w_class-cifkey-clsname eq clsname_temp.
                concatenate class-inheritance-REFCLSNAME postfix
                          into class-inheritance-REFCLSNAME.
                exit.
              endif.
            endloop.
          endif.
        endif.
      endif.
    endif.

*********************************************************************
* Redefinitions
*********************************************************************
    data: redefinitions like line of class-redefinitions.
    loop at class-redefinitions into redefinitions.
      if not clsname is initial.
        move clsname to redefinitions-clsname.
        if redefinitions-REFCLSNAME(1) eq c_z
        or redefinitions-REFCLSNAME(1) eq c_y.
          if not postfix is initial.
            concatenate redefinitions-REFCLSNAME postfix
                        into clsname_temp.
            loop at p-classes into w_class.
              if w_class-cifkey-clsname eq redefinitions-REFCLSNAME
              or w_class-cifkey-clsname eq clsname_temp.
                concatenate redefinitions-REFCLSNAME postfix
                          into redefinitions-REFCLSNAME.
                exit.
              endif.
            endloop.
          endif.
        endif.
      endif.
      modify class-redefinitions from redefinitions.
    endloop.

*********************************************************************
* Aliases
*********************************************************************
    data: aliases like line of class-aliases.
    data: aliases_r type SEOO_ALIASES_R,
          w_aliases_r like line of aliases_r.
    loop at class-aliases into aliases.
      if not clsname is initial.
        move clsname to aliases-clsname.
        if aliases-REFCLSNAME(1) eq c_z
        or aliases-REFCLSNAME(1) eq c_y.
          if not postfix is initial.
            concatenate aliases-REFCLSNAME postfix
                        into clsname_temp.
            loop at p-classes into w_class.
              if w_class-cifkey-clsname eq aliases-REFCLSNAME
              or w_class-cifkey-clsname eq clsname_temp.
                concatenate aliases-REFCLSNAME postfix
                          into aliases-REFCLSNAME.
                exit.
              endif.
            endloop.
          endif.
        endif.
      endif.
      move-corresponding aliases to w_aliases_r.
      append w_aliases_r to aliases_r.
      modify class-aliases from aliases.
    endloop.

*********************************************************************
* Implementings
*********************************************************************
    data: implementing like line of class-implementings-implementings,
          impl_details like line of class-implementings-impl_details.

    loop at class-implementings-implementings into implementing.
      if not clsname is initial.
        move clsname to implementing-clsname.
        if not postfix is initial.
          concatenate implementing-REFCLSNAME postfix
                      into clsname_temp.
          loop at p-inters into w_inter.
            if w_inter-intkey-clsname eq implementing-REFCLSNAME
            or w_inter-intkey-clsname eq clsname_temp.
              concatenate implementing-REFCLSNAME postfix
                        into implementing-REFCLSNAME.
              exit.
            endif.
          endloop.
        endif.
      endif.
      modify class-implementings-implementings from implementing.
    endloop.

    loop at class-implementings-impl_details into impl_details.
      if not clsname is initial.
        move clsname to impl_details-clsname.
        if not postfix is initial.
          concatenate impl_details-REFCLSNAME postfix
                      into clsname_temp.
          loop at p-inters into w_inter.
            if w_inter-intkey-clsname eq impl_details-REFCLSNAME
            or w_inter-intkey-clsname eq clsname_temp.
              concatenate impl_details-REFCLSNAME postfix
                        into impl_details-REFCLSNAME.
              exit.
            endif.
          endloop.
        endif.
      endif.
      modify class-implementings-impl_details from impl_details.
    endloop.

*********************************************************************
* CLSDEFERRDS
*********************************************************************
    field-symbols <classdeferreds> like line of class-classdeferreds.
    loop at class-classdeferreds assigning <classdeferreds>.
      if not clsname is initial.
        move clsname to <classdeferreds>-clsname.
      endif.
    endloop.

*********************************************************************
* INTDEFERRDS
*********************************************************************
    field-symbols: <INTerfaceDEFERREDS>
                   like line of class-INTerfaceDEFERREDS.
    loop at class-INTerfaceDEFERREDS
    assigning <INTerfaceDEFERREDS>.
      if not clsname is initial.
        move clsname to <INTerfaceDEFERREDS>-clsname.
      endif.
    endloop.

*********************************************************************
* Klasse anlegen
*********************************************************************
    CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
      EXPORTING
*     CORRNR                           =
      DEVCLASS                         = '$TMP'
      VERSION                          = SEOC_VERSION_ACTIVE
*     GENFLAG                          = ' '
*     13.07.1974                       = SEOX_TRUE
      OVERWRITE                        = SEOX_false
*     SUPPRESS_METHOD_GENERATION       = SEOX_FALSE
* IMPORTING
*     KORRNR                           =
      CHANGING
      CLASS                            = class-class
      INHERITANCE                      = class-inheritance
      REDEFINITIONS                    = class-redefinitions
     IMPLEMENTINGS                  = class-implementings-implementings
      IMPL_DETAILS                   = class-implementings-impl_details
      ATTRIBUTES                       = class-attributes
      METHODS                          = T_SEOO_METHOD_R
      EVENTS                           = class-events
      TYPES                            = class-types-types
      TYPE_SOURCE                      = class-types-type_source
      PARAMETERS                       = t_seos_parameters_r
      EXCEPS                           = t_exceptions
      ALIASES                          = aliases_r
      TYPEPUSAGES                      = class-typepusages
      CLSDEFERRDS                      = class-classdeferreds
      INTDEFERRDS                      = class-INTerfaceDEFERREDS
      FRIENDSHIPS                      = class-friends
      EXCEPTIONS
        EXISTING                         = 1
        IS_INTERFACE                     = 2
        DB_ERROR                         = 3
        COMPONENT_ERROR                  = 4
        NO_ACCESS                        = 5
        OTHER                            = 6
        ERROR_MESSAGE     = 7        " Error messages
        OTHERS            = 8.


    IF SY-SUBRC <> 0.
      error EXISTING                         = 1.
      error IS_INTERFACE                     = 2.
      error DB_ERROR                         = 3.
      error COMPONENT_ERROR                  = 4.
      error NO_ACCESS                        = 5.
      error OTHER                            = 6.
      error ERROR_MESSAGE                    = 7.
      error OTHERS                           = 8.
      concatenate 'class' clskey 'cant create it'
      '(Fb. SEO_CLASS_CREATE_COMPLETE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    " create_class_types

  method create_source.

* Methoden Locals Source anlegen
    call method create_source_methods_locals
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

* Source Sketionen (Attribute, Types) anlegen
    call method create_source_sections
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

* Source implementierte Methoden
    call method create_source_methods_impl
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

* Source Redefinitions anlegen
    call method create_source_methods_redef
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

  endmethod.                    " create_source

  method create_source_fb.

    DATA: seop_methods like line of t_seop_method_w_source.

    DATA: w_seop_source
          type line of seop_method_w_source-source.

    DATA: w_source  type line of seop_source,
          w_source1 type line of seop_source.

* Methoden

    move cpdname to seop_methods-cpdname.

    loop at source into w_source.
      move w_source to w_source1.
      condense w_source1.
      if  w_source1 NP 'METHOD*'
      and w_source1 NP 'ENDMETHOD*'.
        move w_source to w_seop_source.
        append w_seop_source to seop_methods-source.
      endif.
    endloop.

    append seop_methods to t_seop_method_w_source.

  endmethod.                    "create_source_fb

  method create_source_methods_redef.

    data: method_redef like line of class-methods_redef.
    data: cpdname type seop_method_w_source-cpdname.
    data: t_seop_method_w_source type seop_methods_w_source.
    field-symbols: <seop_method_w_source>
                   type line of seop_methods_w_source.

* Methoden
    loop at class-methods_redef into method_redef.

      move method_redef-include-cpdkey-CPDNAME to cpdname.

      call method create_source_fb
        EXPORTING
          cpdname                = cpdname
          source                 = method_redef-source
        CHANGING
          t_seop_method_w_source = t_seop_method_w_source.

      loop at t_seop_method_w_source
      assigning <seop_method_w_source>.
        move 'X' to <seop_method_w_source>-redefine.
      endloop.

    endloop.

    if not t_seop_method_w_source[] is initial.

      CALL FUNCTION 'SEO_CLASS_CREATE_SOURCE'
        EXPORTING
          CLASS                       = class-cifkey
          SOURCE                      = t_seop_method_w_source
*         LOCALS                      =
*         LOCALS_DEF                =
*         LOCALS_IMP                =
*         LOCALS_MAC                =
          VERSION                   = SEOC_VERSION_ACTIVE
          SUPPRESS_INDEX_UPDATE     = SEOX_FALSE
      EXCEPTIONS
          OTHER                       = 1
          CLASS_NOT_EXISTING          = 2
          METHOD_NOT_EXISTING         = 3
          ERROR_MESSAGE     = 4        " Error messages
          OTHERS            = 5.

      IF SY-SUBRC <> 0.
        error OTHER                       = 1.
        error CLASS_NOT_EXISTING          = 2.
        error METHOD_NOT_EXISTING         = 3.
        error ERROR_MESSAGE               = 4.
        error OTHERS                      = 5.
        concatenate 'class' class-cifkey
        'cant create class redefinition source'
        '(Fb. SEO_CLASS_CREATE_SOURCE)' into error_text
        separated by space.
        call method error_handling=>error_question
          EXPORTING
            error_text = error_text.
*       error_message error_text 'S'.        "Makro
        raise error.
      ENDIF.

    endif.

  ENDMETHOD.                    "create_source_methods_redef

  method create_source_methods_locals.

    DATA: t_METHOD type TYMETHOD,
          cpdname type seop_method_w_source-cpdname.
    data: t_seop_method_w_source type seop_methods_w_source.

    data: source_locals_def type tlocal-source_locals,
          source_locals_imp type tLocal-source_locals,
          source_locals_mac type tLocal-source_locals.

    field-symbols <local> type tLocal.

* Methoden
    loop at class-methods into t_method.

      move t_method-cmpkey-CMPNAME to cpdname.

      call method create_source_fb
        EXPORTING
          cpdname                = cpdname
          source                 = t_method-source
        CHANGING
          t_seop_method_w_source = t_seop_method_w_source.

    endloop.

* Locals
    loop at class-locals assigning <local>.

      if <local>-name eq 'DEF'.
        move <local>-source_locals to source_locals_def.
      endif.

      if <local>-name eq 'MAC'.
        move <local>-source_locals to source_locals_mac.
      endif.

      if <local>-name eq 'IMP'.
        move <local>-source_locals to source_locals_imp.
      endif.

    endloop.

    if not t_seop_method_w_source[] is initial
    or not source_locals_def[] is initial
    or not source_locals_imp[] is initial
    or not source_locals_mac[] is initial.

      CALL FUNCTION 'SEO_CLASS_CREATE_SOURCE'
        EXPORTING
          CLASS                       = class-cifkey
          SOURCE                      = t_seop_method_w_source
*         LOCALS                      =
          LOCALS_DEF                = source_locals_def
          LOCALS_IMP                = source_locals_imp
          LOCALS_MAC                = source_locals_mac
          VERSION                   = SEOC_VERSION_ACTIVE
          SUPPRESS_INDEX_UPDATE     = SEOX_FALSE
      EXCEPTIONS
          OTHER                       = 1
          CLASS_NOT_EXISTING          = 2
          METHOD_NOT_EXISTING         = 3
          ERROR_MESSAGE     = 4        " Error messages
          OTHERS            = 5.

      IF SY-SUBRC <> 0.
        error OTHER                       = 1.
        error CLASS_NOT_EXISTING          = 2.
        error METHOD_NOT_EXISTING         = 3.
        error ERROR_MESSAGE               = 4.
        error OTHERS                      = 5.
        concatenate 'class' class-cifkey
        'cant create class source methods and locals'
        '(Fb. SEO_CLASS_CREATE_SOURCE)' into error_text
        separated by space.
        call method error_handling=>error_question
          EXPORTING
            error_text = error_text.
*       error_message error_text 'S'.        "Makro
        raise error.
      ENDIF.

    endif.

  endmethod.                    " create_source_methods_locals

  method create_source_methods_impl.

    data: method_impl like line of class-methods_impl,
          cpdname type seop_method_w_source-cpdname.
    data: t_seop_method_w_source type seop_methods_w_source.


* Methoden
    loop at class-methods_impl into method_impl.

      move method_impl-include-cpdkey-CPDNAME to cpdname.

      call method create_source_fb
        EXPORTING
          cpdname                = cpdname
          source                 = method_impl-source
        CHANGING
          t_seop_method_w_source = t_seop_method_w_source.

    endloop.

    if not t_seop_method_w_source[] is initial.

      CALL FUNCTION 'SEO_CLASS_CREATE_SOURCE'
        EXPORTING
          CLASS                       = class-cifkey
          SOURCE                      = t_seop_method_w_source
*         LOCALS                      =
*         LOCALS_DEF                =
*         LOCALS_IMP                =
*         LOCALS_MAC                =
          VERSION                   = SEOC_VERSION_ACTIVE
          SUPPRESS_INDEX_UPDATE     = SEOX_FALSE
      EXCEPTIONS
          OTHER                       = 1
          CLASS_NOT_EXISTING          = 2
          METHOD_NOT_EXISTING         = 3
          ERROR_MESSAGE               = 4
          OTHERS                      = 5
                .
      IF SY-SUBRC <> 0.
        error OTHER                       = 1.
        error CLASS_NOT_EXISTING          = 2.
        error METHOD_NOT_EXISTING         = 3.
        error ERROR_MESSAGE               = 4.
        error OTHERS                      = 5.
        concatenate 'class' class-cifkey
        'cant create class implementation source'
        '(Fb. SEO_CLASS_CREATE_SOURCE)' into error_text
        separated by space.
        call method error_handling=>error_question
          EXPORTING
            error_text = error_text.
*       error_message error_text 'S'.        "Makro
        raise error.
      ENDIF.

    endif.

  endmethod.                    "create_source_methods_impl

  method create_source_sections.

    DATA: section  type tsection.

    if 1 = 0.

* Include einfuegen (funktioniert nicht ?!?!)
      loop at class-sections into section.

        case section-limu.

          when seok_limu_public.
            insert report section-incname from section-source
            extension type srext_ext_class_public
            state 'I'
            program type 'I'.

          when seok_limu_private.
            insert report section-incname from section-source
            extension type srext_ext_class_private
            state 'I'
            program type 'I'.

          when seok_limu_protected.
            insert report section-incname from section-source
            extension type srext_ext_class_protected
            state 'I'
            program type 'I'.

        endcase.

      endloop.

    else.

*** funktioniert, allerdings umstaendlich
*** Die Kommentare gehen allerdings dabei verloren
      loop at class-sections into section.

        CALL FUNCTION 'SEO_NA_SET_SECTION_TYPE_SOURCE'
          EXPORTING
            CLSKEY                           = clskey
            LIMU                             = section-limu
            VERSION                          = '0'
*           SUPPRESS_ACCESS_PERMISSION       = SEOX_TRUE
            SAVE                             = SEOX_false
          TABLES
            SOURCE                           = section-source
          EXCEPTIONS
            CLASS_NOT_EXISTING               = 1
            SCAN_ABAP_SOURCE_ERROR           = 2
            ERROR_MESSAGE                    = 3
            OTHERS                           = 4
                  .
        IF SY-SUBRC <> 0.
          error CLASS_NOT_EXISTING               = 1.
          error SCAN_ABAP_SOURCE_ERROR           = 2.
          error ERROR_MESSAGE                    = 3.
          error OTHERS                           = 4.
          concatenate 'class' clskey
          'cant create class section source'
          '(Fb. SEO_NA_SET_SECTION_TYPE_SOURCE)' into error_text
          separated by space.
          call method error_handling=>error_question
            EXPORTING
              error_text = error_text.
*         error_message error_text 'E'.        "Makro
          raise error.
        ENDIF.

      endloop.

****** Typen nochmals anlegen
      DATA: w_type like line of class-types-types.
      loop at class-types-types into w_type
      where not type is initial.

        CALL FUNCTION 'SEO_TYPE_CREATE_F_DATA'
          EXPORTING
            SAVE         = SEOX_FALSE
          CHANGING
            TYPE         = w_type
          EXCEPTIONS
            EXISTING     = 1
            IS_ATTRIBUTE = 2
            IS_METHOD    = 3
            IS_EVENT     = 4
            NOT_CREATED  = 5
            DB_ERROR     = 6
            ERROR_MESSAGE     = 7        " Error messages
            OTHERS            = 8.

        IF SY-SUBRC <> 0.
          error EXISTING     = 1.
          error IS_ATTRIBUTE = 2.
          error IS_METHOD    = 3.
          error IS_EVENT     = 4.
          error NOT_CREATED  = 5.
          error DB_ERROR     = 6.
          error ERROR_MESSAGE = 7.
          error OTHERS       = 8.
          concatenate 'class' clskey
          'cant create class type source'
          '(Fb. SEO_TYPE_CREATE_F_DATA)' into error_text
          separated by space.
          call method error_handling=>error_question
            EXPORTING
              error_text = error_text.
*         error_message error_text 'E'.        "Makro
          raise error.
        ENDIF.

      endloop.

******** Attribute nochmals anlegen
      DATA: w_attribute type line of SEOO_ATTRIBUTES_R.

      loop at class-attributes into w_attribute
      where not type is initial.

        CALL FUNCTION 'SEO_ATTRIBUTE_CREATE_F_DATA'
          EXPORTING
            SAVE                     = SEOX_FALSE
*           SUPPRESS_LOG_ENTRY       = SEOX_FALSE
          CHANGING
            ATTRIBUTE                = w_attribute
          EXCEPTIONS
            EXISTING                 = 1
            IS_METHOD                = 2
            IS_EVENT                 = 3
            IS_TYPE                  = 4
            NOT_CREATED              = 5
            DB_ERROR                 = 6
            ERROR_MESSAGE     = 7        " Error messages
            OTHERS            = 8.

        IF SY-SUBRC <> 0.
          error EXISTING                 = 1.
          error IS_METHOD                = 2.
          error IS_EVENT                 = 3.
          error IS_TYPE                  = 4.
          error NOT_CREATED              = 5.
          error DB_ERROR                 = 6.
          error ERROR_MESSAGE            = 7.
          error OTHERS                   = 8.
          concatenate 'class' clskey
          'cant create class attribute source'
          '(Fb. SEO_ATTRIBUTE_CREATE_F_DATA)' into error_text
          separated by space.
          call method error_handling=>error_question
            EXPORTING
              error_text = error_text.
*         error_message error_text 'E'.        "Makro
          raise error.
        ENDIF.

      endloop.

    endif.

  endmethod.                   " create_source_sections

  method create_class.

********************************************
* Wertuebergabe
********************************************
    class = i_class.

********************************************
* classname, clskey
********************************************
    move-corresponding class-cifkey to clskey.
* classname
    if postfix is initial.
      move clskey-clsname to clsname.
    else.
      concatenate clskey-clsname postfix into clsname.
      move clsname to class-cifkey-clsname.
      move clsname to clskey-clsname.
    endif.

********************************************
* Auf Kundenklasse beschraenken
********************************************
    if clsname(1) ne c_z
    and clsname(1) ne c_y.
      concatenate 'class' clskey 'does not begin with Z or Y'
      'Classname check' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

********************************************
* Ueberpruefen, ob Klasse existiert
********************************************
    CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
      EXPORTING
        CLSKEY              = clskey
*     IMPORTING
*       NOT_ACTIVE          =
      EXCEPTIONS
        NOT_SPECIFIED       = 1
        NOT_EXISTING        = 2
        IS_INTERFACE        = 3
        NO_TEXT             = 4
        INCONSISTENT        = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC ne 2.
      error NOT_SPECIFIED       = 1.
      error NOT_EXISTING        = 2.
      error IS_INTERFACE        = 3.
      error NO_TEXT             = 4.
      error INCONSISTENT        = 5.
      error ERROR_MESSAGE       = 6.
      error OTHERS              = 7.
      concatenate 'class' clskey 'already exists'
      '(Fb. SEO_CLASS_EXISTENCE_CHECK)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

********************************************
* Klasse anlegen
********************************************
    call method create_class_types
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

********************************************
* Source Code METHODEN und Locals
********************************************
    call method create_source
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

*********************************************
* Sichern
*********************************************
    CALL FUNCTION 'SEO_CLIF_SAVE_ALL'
      EXPORTING
        CIFKEY                   = class-cifkey
        SECTIONS_ONLY            = SEOX_TRUE
      EXCEPTIONS
        NOT_EXISTING             = 1
        NOTHING_TO_DO            = 2
        ACCESS_ERROR             = 3
        DB_ERROR                 = 4
        ERROR_IN_CODE_GENERATION = 5
        ERROR_MESSAGE            = 6
        OTHERS                   = 7.

    IF SY-SUBRC <> 0.
      error NOT_EXISTING             = 1.
      error NOTHING_TO_DO            = 2.
      error ACCESS_ERROR             = 3.
      error DB_ERROR                 = 4.
      error ERROR_IN_CODE_GENERATION = 5.
      error ERROR_MESSAGE            = 6.
      error OTHERS                   = 7.
      concatenate 'class' clskey 'cant save'
      '(Fb. SEO_CLIF_SAVE_ALL)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  ENDMETHOD.                    " klasse_einspielen

endclass.                    "class_upload IMPLEMENTATION
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:44 am    Post subject: Reply with quote

Code:
*---------------------------------------------------------------------*
*       CLASS classes_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class classes_upload definition.

  public section.
    methods:
    constructor,
    classes_create.

  private section.
    data: class_upload type ref to class_upload.
    methods:
          determine_sequence_classes.

endclass.                    "classes_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS classes_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class classes_upload implementation.

  method constructor.

    create object class_upload.

  endmethod.                    "constructor

  method classes_create.

    field-symbols: <CLASS> type TCLASS.

    data: lv_subrc type sy-subrc.

* Reihenfolge festlegen
    call method determine_sequence_classes.

* Klassen einspielen
    loop at p-classes assigning <class>.
      call method class_upload->create_class
        EXPORTING
          i_class = <class>
        EXCEPTIONS
          error   = 1
          others  = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Class' <class>-cifkey-clsname lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "classes_create

  METHOD determine_sequence_classes.

    data: w_classes type standard table of tclass-cifkey-clsname,
          w_classes1 type standard table of tclass-cifkey-clsname,
          class1 type tclass,
          class2 type tclass.
    data: w_expl_inheritance type line of tclass-explore_inheritance.

* Sortieren
    loop at p-classes into class1.
      loop at class1-explore_inheritance into w_expl_inheritance.
        loop at p-classes into class2
             where cifkey-clsname = w_expl_inheritance-clsname.
          insert class2-cifkey-clsname into w_classes1 index 1.
        endloop.
      endloop.
      insert class1-cifkey-clsname into w_classes1 index 1.
      loop at w_classes1 into class2-cifkey-clsname.
        insert class2-cifkey-clsname into w_classes index 1.
        delete w_classes1.
      endloop.
    endloop.

* doppelte Eintraege
    data: index type i.
    loop at w_classes into class1-cifkey-clsname.
      move 0 to index.
      loop at w_classes into class2-cifkey-clsname
              where table_line eq class1-cifkey-clsname.
        index = index + 1.
        if index > 1.
          delete w_classes.
        endif.
      endloop.
    endloop.

*   Uebergeben
    loop at w_classes into class1-cifkey-clsname.
      read table p-classes into class2
           with key cifkey-clsname = class1-cifkey-clsname.
      delete p-classes index sy-tabix.
      append class2 to p-classes.
    endloop.

  ENDMETHOD.                    " determine_sequence_classes

endclass.                    "classes_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS fmodule_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fmodule_read definition.

  public section.
    methods: read_fmodule importing i_funcname type tfdir-funcname
                          exceptions error,
             get_fmodule exporting e_fmodule type tfmodule.

  private section.
* Attribute
    DATA: fmodule type tfmodule,
          funcname type tfdir-funcname,
          error_text type string.
    methods read_fmodule_wo_rpy
              exporting  ev_long type SCRPFLAG
              exceptions error.

endclass.                    "fmodule_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS fmodule_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fmodule_read implementation.

  method read_fmodule.

* refresh
    free fmodule.   " refresh

* funcname
    funcname = i_funcname.

* funcname uebergeben
    move funcname to fmodule-funcname.

* Name Funktionsgruppe
    select area up to 1 rows
           from enlfdir into fmodule-area
           where funcname = fmodule-funcname.
    endselect.
    if sy-subrc ne 0.
      concatenate 'Fmodule' fmodule-funcname 'error Cant read enlfdir'
      into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free fmodule.
      raise error.
    endif.

* Ist die Zeilenlaenge > 72
    DATA: lv_long type SCRPFLAG.
    call method read_fmodule_wo_rpy
      IMPORTING
        ev_long = lv_long
      EXCEPTIONS
        error   = 1.
    if sy-subrc ne 0.
      raise error.
    endif.

    if lv_long eq 'X'.
      concatenate 'Fmodule' fmodule-funcname 'error'
      'Zeilenlaenge > 72.' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free fmodule.
      raise error.
    endif.

* RPY_FUNCTIONMODULE_READ ist wahrscheinlich veraltet
    DATA: p_param_docu type standard table of RSFDO.
    free: fmodule-global_flag,
          fmodule-remote_call,
          fmodule-update_task,
          fmodule-short_text,
          fmodule-t_import,
          fmodule-t_change,
          fmodule-t_export,
          fmodule-t_tables,
          fmodule-t_except,
          fmodule-source.

    CALL FUNCTION 'RPY_FUNCTIONMODULE_READ'
      EXPORTING
        FUNCTIONNAME       = fmodule-funcname
      IMPORTING
        GLOBAL_FLAG        = fmodule-global_flag
        REMOTE_CALL        = fmodule-remote_call
        UPDATE_TASK        = fmodule-update_task
        SHORT_TEXT         = fmodule-short_text
*       MULTISOFT          =
      TABLES
        IMPORT_PARAMETER   = fmodule-t_import
        CHANGING_PARAMETER = fmodule-t_change
        EXPORT_PARAMETER   = fmodule-t_export
        TABLES_PARAMETER   = fmodule-t_tables
        EXCEPTION_LIST     = fmodule-t_except
        DOCUMENTATION      = p_param_docu
        SOURCE             = fmodule-source
      EXCEPTIONS
        ERROR_MESSAGE      = 1
        FUNCTION_NOT_FOUND = 2
        INVALID_NAME       = 3
        OTHERS             = 4.

    IF SY-SUBRC <> 0.
      error ERROR_MESSAGE      = 1.
      error FUNCTION_NOT_FOUND = 2.
      error INVALID_NAME       = 3.
      error OTHERS             = 4.
      concatenate 'Fmodule' fmodule-funcname 'error'
      '(Fb. RPY_FUNCTIONMODULE_READ)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      free fmodule.
      raise error.
    endif.

  endmethod.                    "read_fmodule

  method read_fmodule_wo_rpy.

* Source lesen und ueberpruefen, ob Zeilenlaenge > 72
    DATA: lv_lines_truncated type i.
    DATA: lv_progname type progname.
    DATA: ls_tfdir type tfdir.

    select single * from tfdir into ls_tfdir
           where funcname = fmodule-funcname.
    if sy-subrc ne 0.
* Error
      free fmodule.
      concatenate 'Fmodule' fmodule-funcname 'error'
      '(select tfdir)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    endif.
    concatenate 'L' fmodule-area 'U' ls_tfdir-include into lv_progname.
    call method source_convert_and_read=>read_source
      EXPORTING
        i_name            = lv_progname
      IMPORTING
        e_source          = fmodule-source
        e_lines_truncated = lv_lines_truncated
        e_long            = ev_long
      EXCEPTIONS
        error             = 1.
    if sy-subrc ne 0.
      free fmodule.
      raise error.
    endif.

  endmethod.                    "read_fmodule_wo_rpy

  method get_fmodule.

    e_fmodule = fmodule.

  endmethod.                    "get_fmodule

endclass.                    "fmodule_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS fgroup_read DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fgroup_read definition.

  public section.
    methods: constructor,
             read_fgroup
             importing i_area type enlfdir-area
             exporting e_fgroup type tfgroup
             exceptions error.

  private section.
* Attribute
    data: area type enlfdir-area,
          fgroup type tfgroup,
          fmodule_read type ref to fmodule_read,
          dynpro_read type ref to dynpro_read,
          error_text type string.
    methods: collect_fmodules exceptions error,
             collect_funcarea exceptions error,
             read_dynpros.

endclass.                    "fgroup_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS fgroup_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fgroup_read implementation.

  method constructor.

    create object fmodule_read.
    create object dynpro_read.

  endmethod.                    "constructor

  method read_fgroup.

***************************
* Initialisieren
***************************
    area = i_area.
    free fgroup.
    move area to fgroup-area.

***************************
* Funktionsbausteine lesen
***************************
    call method collect_fmodules
      EXCEPTIONS
        error = 1.
    if sy-subrc ne 0.
      free fgroup.
      raise error.
    endif.

***************************
* Funktionsgruppe lesen
***************************
    call method collect_funcarea
      EXCEPTIONS
        error = 1.
    if sy-subrc ne 0.
      free fgroup.
      raise error.
    endif.

***************************
* Dynpros lesen
***************************
    if dynpro eq 'X'.
      call method read_dynpros.
    endif.

*************************
* Ergebnis zurueckgeben
*************************
    e_fgroup = fgroup.

  endmethod.                    "read_fgroup

  method collect_fmodules.

    data: w_fmodule type tfmodule,
          t_enlfdir type standard table of enlfdir,
          w_enlfdir like line of t_enlfdir.

    select * from enlfdir into table t_enlfdir
             where area eq fgroup-area.
    loop at t_enlfdir into w_enlfdir.
      call method fmodule_read->read_fmodule
        EXPORTING
          i_funcname = w_enlfdir-funcname
        EXCEPTIONS
          error      = 1.
      if sy-subrc ne 0.
        raise error.
      endif.
* refresh
      free w_fmodule.
      call method fmodule_read->get_fmodule
        IMPORTING
          e_fmodule = w_fmodule.
      if not w_fmodule is initial.
        append w_fmodule to fgroup-fmodules.
      endif.
    endloop.

  endmethod.                    "collect_fmodules

  method collect_funcarea.

    data: t_includes type standard table of tinclude-include,
          w_include like line of t_includes,
          PROGRAM LIKE  SY-REPID,
          FUGR_IS_FUNCTIONMODULE_NAME.

    DATA: lv_progname type progname,
          oasis type tinclude.

    concatenate C_SAPL fgroup-area into program.

    CALL FUNCTION 'RS_GET_ALL_INCLUDES'
      EXPORTING
        PROGRAM                      = program
*       WITH_INACTIVE_INCLS          = ' '
*       WITH_RESERVED_INCLUDES       =
      TABLES
        INCLUDETAB                   = t_includes
      EXCEPTIONS
        NOT_EXISTENT                 = 1
        NO_PROGRAM                   = 2
        OTHERS                       = 3
              .

    IF SY-SUBRC <> 0.
      free fgroup.
      error NOT_EXISTENT                 = 1.
      error NO_PROGRAM                   = 2.
      error OTHERS                       = 3.
      concatenate 'Fmodule' program 'error'
      '(Fb. RS_GET_ALL_INCLUDES)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    ELSE.

      loop at t_includes into w_include.

        clear FUGR_IS_FUNCTIONMODULE_NAME.

        CALL FUNCTION 'RS_PROGNAME_SPLIT'
          EXPORTING
            PROGNAME_WITH_NAMESPACE           = w_include
          IMPORTING
*         NAMESPACE                         =
*         PROGNAME_WITHOUT_NAMESPACE        =
*         FUGR_IS_NAME                      =
*         FUGR_IS_RESERVED_NAME             =
*         FUGR_IS_FUNCTIONPOOL_NAME         =
*         FUGR_IS_INCLUDE_NAME              =
         FUGR_IS_FUNCTIONMODULE_NAME      = FUGR_IS_FUNCTIONMODULE_NAME
*         FUGR_IS_HIDDEN_NAME               =
*         FUGR_GROUP                        =
*         FUGR_INCLUDE_NUMBER               =
*         FUGR_SUFFIX                       =
*         FUGR_IS_RESERVED_EXIT_NAME        =
*         SLDB_IS_RESERVED_NAME             =
*         MULTISOFT                         =
*         MST_IS_RESERVED_NAME              =
*         TYPE_IS_RESERVED_NAME             =
*         TYPE_NAME                         =
*         MENU_IS_RESERVED_NAME             =
*         MENU_NAME                         =
*         CLASS_IS_RESERVED_NAME            =
*         CLASS_IS_NAME                     =
*         CLASS_NAME                        =
*         CLASS_IS_METHOD_NAME              =
*         CLASS_METHOD_NAME                 =
*         CNTX_IS_RESERVED_NAME             =
          EXCEPTIONS
            DELIMITER_ERROR                   = 1
            OTHERS                            = 2
                  .
        IF SY-SUBRC <> 0.
          free fgroup.
          error DELIMITER_ERROR                   = 1.
          error OTHERS                            = 2.
          concatenate 'Fmodule' w_include 'error'
          '(Fb. RS_PROGNAME_SPLIT)' into error_text
          separated by space.
          error_message error_text 'S'.        "Makro
          raise error.
        ENDIF.

        if FUGR_IS_FUNCTIONMODULE_NAME eq 'X'.
* Funktionsbaustein
          delete t_includes.
          continue.
        ENDIF.

        move w_include to lv_progname.
        free oasis-source.
        call method source_convert_and_read=>read_source
          EXPORTING
            i_name   = lv_progname
          IMPORTING
            e_source = oasis-source
          EXCEPTIONS
            error    = 1.
        if sy-subrc ne 0.
          free oasis.
          raise error.
        endif.
        move w_include to oasis-include.
        append oasis to fgroup-includes.
        free oasis.

      endloop.

    endif.

  endmethod.                    "collect_funcarea

  method read_dynpros.

    data: dynpro type tdynpro,
          dynproname  type tdynproname,
          dynpronames type tdynpronames.

* Dynpros zu Funktionsgruppen lesen
    data: name type string.
    concatenate C_SAPL area into name.
    select PROG DNUM from D020S
        into (dynproname-progname, dynproname-dynnr)
        where prog eq name.
      append dynproname to dynpronames.
    endselect.

* Dynpros selektieren
    loop at dynpronames into dynproname.
      free dynpro.
      call method dynpro_read->read_dynpro
        EXPORTING
          i_dynproname = dynproname
        IMPORTING
          e_dynpro     = dynpro.
      if not dynpro is initial.
        append dynpro to fgroup-dynpros.
      endif.
    endloop.

  endmethod.                    "read_dynpros

endclass.                    "fgroup_read IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS program_read DEFINITION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class program_read definition.

  public section.
    methods: constructor,
             read_program
             importing i_progname type trdir-name
             exporting e_program type tprogram
             exceptions error.

  private section.
* Attribute
    data: program type tprogram,
          error_text type string,
          dynpro_read type ref to dynpro_read,
          dynproname  type tdynproname,
          dynpronames type tdynpronames,
          dynpro type tdynpro.
    methods: prog exceptions error,
             dynpros.

endclass.                    "program_read DEFINITION

*---------------------------------------------------------------------*
*       CLASS program_read IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class program_read implementation.

  method constructor.

    create object dynpro_read.

  endmethod.                    "constructor

  method prog.

    DATA: SOURCE_EXTENDED type standard table of ABAPTXT255.

    free: program-prog_inf,
          program-source,
          program-textpool-textpool.

    CALL FUNCTION 'RPY_PROGRAM_READ'
        EXPORTING
          LANGUAGE                  = SY-LANGU
          PROGRAM_NAME              = program-name
          WITH_INCLUDELIST          = space
*         ONLY_SOURCE               = ' '
*         ONLY_TEXTS                = ' '
*         READ_LATEST_VERSION       = ' '
*         WITH_LOWERCASE            = ' '
        IMPORTING
          PROG_INF                  = program-prog_inf
        TABLES
*         INCLUDE_TAB               =
          SOURCE                    = program-source
          SOURCE_EXTENDED           = source_extended
          TEXTELEMENTS              = program-textpool-textpool
        EXCEPTIONS
          CANCELLED                 = 1
          NOT_FOUND                 = 2
          PERMISSION_ERROR          = 3
          OTHERS                    = 4
                .

    IF SY-SUBRC <> 0.
      error CANCELLED                 = 1.
      error NOT_FOUND                 = 2.
      error PERMISSION_ERROR          = 3.
      error OTHERS                    = 4.
      concatenate 'Programm' program-name 'error'
      '(Fb. RPY_PROGRAM_READ)' into error_text
      separated by space.
      error_message error_text 'S'.        "Makro
      raise error.
    ENDIF.

    if program-source is initial.
      call method source_convert_and_read=>read_source
        EXPORTING
          i_name   = program-name
        IMPORTING
          e_source = program-source
        EXCEPTIONS
          error    = 1.
      if sy-subrc ne 0.
        raise error.
      endif.
    endif.

  endmethod.                    "program

  method dynpros.

* Dynpros vom Programm lesen
    free: dynpronames, dynpro.
    select PROG DNUM from D020S
        into (dynproname-progname, dynproname-dynnr)
        where prog eq program-name.
      append dynproname to dynpronames.
    endselect.
    loop at dynpronames into dynproname.
      free dynpro.
      call method dynpro_read->read_dynpro
        EXPORTING
          i_dynproname = dynproname
        IMPORTING
          e_dynpro     = dynpro.
      if not dynpro is initial.
        append dynpro to program-dynpros.
      endif.
    endloop.

  endmethod.                    "dynpros

  method read_program.

* Initialisieren
    free program.
    move i_progname to program-name.

* program
    call method prog
      EXCEPTIONS
        error = 1.
    if sy-subrc ne 0.
      raise error.
    endif.

* dynpros zum Programm
    call method dynpros.

* Sonstige Werte
    move program-prog_inf-prog_type to program-subc.
    move sy-langu to program-textpool-langu.

* Rueckgabe
    e_program = program.
    free program.

  endmethod.                    "read_program

endclass.                    "program_read IMPLEMENTATION


*---------------------------------------------------------------------*
*       CLASS dynpro_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class dynpro_upload definition.

  public section.
    methods: set_dynpro importing i_dynpro type tdynpro,
             create_dynpro exceptions error.

  private section.
    DATA: dynpro type tdynpro,
          error_text type string.

endclass.                    "dynpro_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS dynpro_upload IMPLEMENTATION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class dynpro_upload implementation.

  method set_dynpro.

    dynpro = i_dynpro.

  endmethod.                    "set_dynpro

  method create_dynpro.

    if not postfix is initial.
      concatenate dynpro-progname postfix into dynpro-header-program.
    endif.

    CALL FUNCTION 'RPY_DYNPRO_INSERT'
      EXPORTING
*       SUPPRESS_CORR_CHECKS           = ' '
*       CORRNUM                        = ' '
*       SUPPRESS_EXIST_CHECKS          = ' '
*       SUPPRESS_GENERATE              = ' '
*       SUPPRESS_DICT_SUPPORT          = ' '
*       SUPPRESS_EXTENDED_CHECKS       = ' '
        HEADER                         = dynpro-header
      TABLES
        CONTAINERS                     = dynpro-containers
        FIELDS_TO_CONTAINERS           = dynpro-FIELDS_TO_CONTAINERS
        FLOW_LOGIC                     = dynpro-FLOW_LOGIC
        PARAMS                         = dynpro-PARAMS
      EXCEPTIONS
        CANCELLED                      = 1
        ALREADY_EXISTS                 = 2
        PROGRAM_NOT_EXISTS             = 3
        NOT_EXECUTED                   = 4
        MISSING_REQUIRED_FIELD         = 5
        ILLEGAL_FIELD_VALUE            = 6
        FIELD_NOT_ALLOWED              = 7
        NOT_GENERATED                  = 8
        ILLEGAL_FIELD_POSITION         = 9
        ERROR_MESSAGE                  = 10
        OTHERS                         = 11
              .

    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error ALREADY_EXISTS                 = 2.
      error PROGRAM_NOT_EXISTS             = 3.
      error NOT_EXECUTED                   = 4.
      error MISSING_REQUIRED_FIELD         = 5.
      error ILLEGAL_FIELD_VALUE            = 6.
      error FIELD_NOT_ALLOWED              = 7.
      error NOT_GENERATED                  = 8.
      error ILLEGAL_FIELD_POSITION         = 9.
      error ERROR_MESSAGE                  = 10.
      error OTHERS                         = 11.
      concatenate 'Dynpro' dynpro-progname dynpro-dynnr 'cant create'
      '(Fb. RPY_DYNPRO_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'S'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_dynpro

endclass.                    "dynpro_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS fmodule_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fmodule_upload definition.

  public section.
    methods: create_fmodule importing i_fmodule type tfmodule
                            exceptions error.

  private section.
    DATA: fmodule type tfmodule,
          error_text type string.

endclass.                    "fmodule_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS fmodule_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fmodule_upload implementation.

  method create_fmodule.

    data: rs38l type rs38l.
    data: parameter_docu type standard table of rsfdo.
    data: source type standard table of RSSOURCE,
          w_source type line of tinclude-source,
          w_string type string.

    fmodule = i_fmodule.

    rs38l-name = fmodule-funcname.
    rs38l-area = fmodule-area.

* postfix
    if not postfix is initial.
      concatenate rs38l-name postfix into rs38l-name.
      concatenate rs38l-area postfix into rs38l-area.
    endif.

    call function 'RPY_FUNCTIONMODULE_INSERT'
         exporting
            funcname                = rs38l-name
            function_pool           = rs38l-area
            INTERFACE_GLOBAL        = fmodule-global_flag
            REMOTE_CALL             = fmodule-remote_call
            short_text              = fmodule-short_text
*           SUPPRESS_CORR_CHECK     = 'X'
            UPDATE_TASK             = fmodule-update_task
*           CORRNUM                 = ' '
*           NAMESPACE               = ' '
         importing
            function_include        = rs38l-include
         tables
            import_parameter        = fmodule-t_import
            export_parameter        = fmodule-t_export
            tables_parameter        = fmodule-t_tables
            changing_parameter      = fmodule-t_change
            exception_list          = fmodule-t_except
            parameter_docu          = parameter_docu
            source                  = source
         exceptions
            double_task             = 1
            error_message           = 2
            function_already_exists = 3
            invalid_function_pool   = 4
            invalid_name            = 5
            too_many_functions      = 6
            others                  = 7.

    if sy-subrc eq 0.

      if not postfix is initial.
        loop at fmodule-source into w_source.
          concatenate 'FUNCTION' '*#' into w_string.
          concatenate w_string fmodule-funcname into w_string
          separated by space.
          concatenate w_string '*' into w_string.
          if w_source cp w_string.
            replace fmodule-funcname in w_source with rs38l-name.
            modify fmodule-source from w_source.
            exit.
          endif.
        endloop.
      endif.

      insert report rs38l-include from fmodule-source.

    else.
      error double_task             = 1.
      error error_message           = 2.
      error function_already_exists = 3.
      error invalid_function_pool   = 4.
      error invalid_name            = 5.
      error too_many_functions      = 6.
      error others                  = 7.
      concatenate 'fmodule' rs38l-name
      'cant insert and create include'
      '(Fb. RPY_FUNCTIONMODULE_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

  endmethod.                    "create_fmodule

endclass.                    "fmodule_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS fgroup_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fgroup_upload definition.

  public section.
    methods: constructor,
             set_fgroup importing i_fgroup type tfgroup,
             create_fgroup exceptions error.

  private section.
    DATA: rdynpro type ref to dynpro_upload,
          fgroup type tfgroup,
          error_text type string.

    METHODS:
    create_fgroup_def exceptions error,
    create_fgroup_includes exceptions error,
    create_fgroup_fbs exceptions error,
    create_fgroup_dynpros exceptions error.

endclass.                    "fgroup_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS fgroup_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fgroup_upload implementation.

  method constructor.

    create object rdynpro.

  endmethod.                    "constructor

  method set_fgroup.

    fgroup = i_fgroup.

  endmethod.                    "set_fgroup

  method create_fgroup_def.

    Data: funcpool type RSNEWLENG-AREA.

    if not postfix is initial.
      concatenate fgroup-area postfix into funcpool.
    else.
      move fgroup-area to funcpool.
    endif.

    CALL FUNCTION 'RS_FUNCTION_POOL_INSERT'
      EXPORTING
        FUNCTION_POOL                 = funcpool
        SHORT_TEXT                    = 'Short description'
*       RESPONSIBLE                   = SY-UNAME
*       NAMESPACE                     = ' '
        DEVCLASS                      = '$TMP'
*       CORRNUM                       =
*       SUPPRESS_LANGUAGE_CHECK       = 'X'
*       AUTHORITY_CHECK               = 'X'
        SUPPRESS_CORR_CHECK           = space
*       UNICODE_CHECKS                = 'X'
*     IMPORTING
*       CORRNUM                       =
      EXCEPTIONS
        NAME_ALREADY_EXISTS           = 1
        NAME_NOT_CORRECT              = 2
        FUNCTION_ALREADY_EXISTS       = 3
        INVALID_FUNCTION_POOL         = 4
        INVALID_NAME                  = 5
        TOO_MANY_FUNCTIONS            = 6
        NO_MODIFY_PERMISSION          = 7
        NO_SHOW_PERMISSION            = 8
        ENQUEUE_SYSTEM_FAILURE        = 9
        CANCELED_IN_CORR              = 10
        UNDEFINED_ERROR               = 11
        ERROR_MESSAGE                 = 12
        OTHERS                        = 13
              .

    IF SY-SUBRC <> 0.
      error NAME_ALREADY_EXISTS           = 1.
      error NAME_NOT_CORRECT              = 2.
      error FUNCTION_ALREADY_EXISTS       = 3.
      error INVALID_FUNCTION_POOL         = 4.
      error INVALID_NAME                  = 5.
      error TOO_MANY_FUNCTIONS            = 6.
      error NO_MODIFY_PERMISSION          = 7.
      error NO_SHOW_PERMISSION            = 8.
      error ENQUEUE_SYSTEM_FAILURE        = 9.
      error CANCELED_IN_CORR              = 10.
      error UNDEFINED_ERROR               = 11.
      error ERROR_MESSAGE                 = 12.
      error OTHERS                        = 13.
      concatenate 'funcpool' funcpool 'cant create'
      '(Fb. RS_FUNCTION_POOL_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_fgroup_def

  method create_fgroup_includes.

    data: w_include like line of fgroup-includes,
          oasis like w_include-include,
          w_source like line of w_include-source.

    data: praefix type string,
          pfix    type string,
          length  type i.

    concatenate 'L' fgroup-area into praefix.
    length = strlen( praefix ).

    loop at fgroup-includes into w_include.
      if w_include-include(length) eq praefix(length).
        pfix = w_include-include+length.
        if not postfix is initial.
          concatenate praefix(length) postfix into praefix.
        endif.
        concatenate praefix pfix into oasis.
      else.
        move w_include-include to oasis.
      endif.
* modify source
      if pfix eq 'TOP'.
        if not postfix is initial.
          loop at w_include-source into w_source.
            if w_source CP 'FUNCTION-POOL*'.
              clear w_source.
              concatenate 'FUNCTION-POOL' fgroup-area
              into w_source separated by space.
              concatenate w_source postfix '.' into w_source.
              delete w_include-source.
              insert w_source into w_include-source index 1.
              exit.
            endif.
          endloop.
        endif.
      endif.
* Insert Include
      insert report oasis
      from w_include-source
      state 'A'
      program type 'I'.
* Insert Include in Fgroup
      if pfix ne 'TOP'.
        if 1 = 1.
* das funktioniert
          data: MASTER TYPE  TRDIR-NAME,
                INCLUDE_NAME TYPE  TRDIR-NAME,
                NEW_INCLUDE TYPE  CHAR1,
                INSERT_INCLUDE_STATEMENT TYPE  CHAR1,
                MASTER_SOURCE TYPE  SEDI_SOURCE.

          if not postfix is initial.
            concatenate C_SAPL fgroup-area postfix into master.
          else.
            concatenate C_SAPL fgroup-area into master.
          endif.
          move oasis to include_name.
          move 'X' to insert_include_statement.
          move 'X' to new_include.
* Include in Fgruppe einfuegen
          CALL FUNCTION 'RS_CREATE_NEW_INCLUDE'
            EXPORTING
              MASTER                   = master
              INCLUDE_NAME             = include_name
              NEW_INCLUDE              = new_include
              INSERT_INCLUDE_STATEMENT = insert_include_statement
            TABLES
              MASTER_SOURCE            = master_source
            EXCEPTIONS
              PROGRAM_ENQUEUED         = 1
              ERROR_MESSAGE            = 2
              OTHERS                   = 3.
          IF SY-SUBRC <> 0.
            error PROGRAM_ENQUEUED         = 1.
            error ERROR_MESSAGE            = 2.
            error OTHERS                   = 3.
            concatenate 'funcpool' include_name
            'cant insert and create include'
            '(Fb. RS_CREATE_NEW_INCLUDE)' into error_text
            separated by space.
            call method error_handling=>error_question
              EXPORTING
                error_text = error_text.
*           error_message error_text 'E'.        "Makro
            raise error.
          ENDIF.

        else.
* das funktioniert ebenfalls
          data: TRDIR_RAHMEN type TRDIR,
                name type trdir-name,
                progdir_prog type progdir.
          if not postfix is initial.
            concatenate C_SAPL fgroup-area postfix
            into name.
          else.
            concatenate C_SAPL fgroup-area
            into name.
          endif.
          select single * from  progdir into progdir_prog
                    where  name        = name
                    and    state       = 'I'.
          if sy-subrc ne 0.
            select single * from  progdir into progdir_prog
                   where  name        = name
                   and    state       = 'A'.
          endif.
          move-corresponding progdir_prog to trdir_rahmen.
          CALL FUNCTION 'RS_EDTR_ATTRIBUTE'
            EXPORTING
              NAME                      = space
              NEW_OR_MODF               = 'NEW'
              PROGRAM                   = oasis
              REPORT_TITLE              = 'GENERATED'
              TYPE                      = 'I'
              UPPER_LOWER_CASE          = 'X'
              TRDIR_RAHMEN              = TRDIR_RAHMEN
              TYPE_SWITCH_ALLOWED       = ' '
*           IMPORTING
*             NEXT_ACTION               =
*             NEW_TRDIR                 =
            EXCEPTIONS
              NOT_EXECUTED              = 1
              PROGRAM_ENQUEUED          = 2
              ERROR_MESSAGE             = 3
              OTHERS                    = 4
                    .
          IF SY-SUBRC <> 0.
            error NOT_EXECUTED              = 1.
            error PROGRAM_ENQUEUED          = 2.
            error ERROR_MESSAGE             = 3.
            error OTHERS                    = 4.
            concatenate 'funcpool' name
            'cant insert and create include'
            '(Fb. RS_EDTR_ATTRIBUTE)' into error_text
            separated by space.
            call method error_handling=>error_question
              EXPORTING
                error_text = error_text.
*           error_message error_text 'E'.        "Makro
            raise error.
          ENDIF.
        endif.
      endif.

    endloop.

  endmethod.                    "create_fgroup_includes

  method create_fgroup_fbs.

    field-symbols <fmodule> type tfmodule.
    data          fmodule_upload type ref to fmodule_upload.

    create object fmodule_upload.

    loop at fgroup-fmodules assigning <fmodule>.
      call method fmodule_upload->create_fmodule
        EXPORTING
          i_fmodule = <fmodule>
        EXCEPTIONS
          error     = 1
          others    = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

    endloop.

  endmethod.                    "create_fgroup_fbs

  method create_fgroup_dynpros.

    field-symbols: <dynpro> type tdynpro.

    loop at fgroup-dynpros assigning <dynpro>.
      call method rdynpro->set_dynpro
        EXPORTING
          i_dynpro = <dynpro>.
      call method rdynpro->create_dynpro
        EXCEPTIONS
          error  = 1
          others = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

    endloop.

  endmethod.                    "create_fgroup_dynpros

  method create_fgroup.

***************************************
* Funktionsgruppe anlegen
***************************************
    call method create_fgroup_def
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

***************************************
* Includes
***************************************
    call method create_fgroup_includes
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

***************************************
* Funktionsbausteine anlegen
***************************************
    call method create_fgroup_fbs
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

***************************************
* Dynpros einspielen
***************************************
    call method create_fgroup_dynpros
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

  endmethod.                    "create_fgroup

endclass.                    "fgroup_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS fgroups_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class fgroups_upload definition.

  public section.
    methods: constructor,
             fgroups_create.

  private section.
    data: fgroup_upload type ref to fgroup_upload.

endclass.                    "fgroups_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS fgroups_upload IMPLEMENTATION
*---------------------------------------------------------------------*
* Ulrich Streit
*---------------------------------------------------------------------*
class fgroups_upload implementation.

  method constructor.

    create object fgroup_upload.

  endmethod.                    "constructor

  method fgroups_create.

    field-symbols: <fgroup> type tfgroup.

    data: lv_subrc type sy-subrc.

    loop at p-fgroups assigning <fgroup>.
      call method fgroup_upload->set_fgroup
        EXPORTING
          i_fgroup = <fgroup>.
      call method fgroup_upload->create_fgroup
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Area' <fgroup>-area lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "upload_fgroups

endclass.                    "fgroups_upload IMPLEMENTATION


*---------------------------------------------------------------------*
*       CLASS program_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class program_upload definition.

  public section.
    methods: constructor,
             set_program importing i_program type tprogram,
             create_program exceptions error.

  private section.
    DATA: program type tprogram,
          rdynpro type ref to dynpro_upload,
          error_text type string.
    methods: program_insert exceptions error,
             textpool_insert,
             dynpros_insert exceptions error.

endclass.                    "program_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS program_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class program_upload implementation.

  method constructor.

    create object rdynpro.

  endmethod.                    "constructor

  method set_program.

    program = i_program.

  endmethod.                    "set_program

  method program_insert.

    data: LOG_DB type  RGLIF-LOGDB.

    move 'Lost in Translation' to program-title.
    move program-prog_inf-DBNAME to log_db.
    CALL FUNCTION 'RPY_PROGRAM_INSERT'
      EXPORTING
        APPLICATION               = program-prog_inf-appl
        AUTHORIZATION_GROUP       = program-prog_inf-auth_group
*       DEVELOPMENT_CLASS         = '$TMP'
        EDIT_LOCK                 = program-prog_inf-edit_lock
        LOG_DB                    = log_db
        PROGRAM_NAME              = program-name
        PROGRAM_TYPE              = program-prog_inf-prog_type
*       R2_FLAG                   = ' '
        TEMPORARY                 = 'X'
        TITLE_STRING              = program-title
*       TRANSPORT_NUMBER          = ' '
        SAVE_INACTIVE             = ' '
      TABLES
        SOURCE                    = program-source
      EXCEPTIONS
        ALREADY_EXISTS            = 1
        CANCELLED                 = 2
        NAME_NOT_ALLOWED          = 3
        PERMISSION_ERROR          = 4
        ERROR_MESSAGE             = 5
        OTHERS                    = 6
              .

    IF SY-SUBRC <> 0.
      error ALREADY_EXISTS            = 1.
      error CANCELLED                 = 2.
      error NAME_NOT_ALLOWED          = 3.
      error PERMISSION_ERROR          = 4.
      error ERROR_MESSAGE             = 5.
      error OTHERS                    = 6.
      concatenate 'program' program-name 'cant create'
      '(Fb. RPY_PROGRAM_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
*      OBJECT                         = pname(8)
       OBJECT                         = program-name
       OBJECT_CLASS                   = 'ABAP'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
*      MASTER_LANGUAGE                = ' '
       GENFLAG                        = ' '
       PROGRAM                        = program-name
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE                  = 4
      OTHERS                         = 5
             .
    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'program' program-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "program_insert

  method textpool_insert.

    insert textpool program-name from program-textpool-textpool
            language program-textpool-langu.

  endmethod.                    "textpool_insert

  method dynpros_insert.

    field-symbols: <dynpro> type tdynpro.
    loop at program-dynpros assigning <dynpro>.
      call method rdynpro->set_dynpro
        EXPORTING
          i_dynpro = <dynpro>.
      call method rdynpro->create_dynpro
        EXCEPTIONS
          error  = 1
          others = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

    endloop.

  endmethod.                    "dynpro_insert

  method create_program.

* Postfix beachten
    if not postfix is initial.
      concatenate program-name postfix into program-name.
    endif.

* Programm einfuegen
    call method program_insert
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

* Textpool einfuegen
    call method textpool_insert.

* Dynpro einfuegen
    call method dynpros_insert
      EXCEPTIONS
        error  = 1
        others = 2.
    if sy-subrc ne 0.
      raise error.
    endif.

  endmethod.                    "create_program

endclass.                    "program_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS programs_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class programs_upload definition.

  public section.
    methods: constructor,
             programs_create.

  private section.
    data: program_upload type ref to program_upload.

endclass.                    "fgroups_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS programs_upload IMPLEMENTATION
*--------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class programs_upload implementation.

  method constructor.

    create object program_upload.

  endmethod.                    "constructor

  method programs_create.

    field-symbols <program> type tprogram.

    data: lv_subrc type sy-subrc.

    loop at p-programs assigning <program>.

      call method program_upload->set_program
        EXPORTING
          i_program = <program>.
      call method program_upload->create_program
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Program' <program>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "programs_create

endclass.                    "programs_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS typegroup_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroup_upload definition.

  public section.
    methods: set_typegroup importing i_typegroup type ttypegroup,
             create_typegroup exceptions error.

  private section.
    DATA: typegroup type ttypegroup,
          error_text type string.

endclass.                    "typegroup_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS typegroup_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroup_upload implementation.

  method set_typegroup.

    typegroup = i_typegroup.

  endmethod.                    "set_typegroup

  method create_typegroup.

    data: objname type RSEDD0-TYPEGROUP,
          text type DDTYPET.

    if not typegroup-texts is initial.
      loop at typegroup-texts into text
      where ddlanguage eq sy-langu.
      endloop.
      if sy-subrc ne 0.
        read table typegroup-texts into text index 1.
      endif.
    else.
      move 'Oasis' to text-ddtext.
    endif.

    move typegroup-name to objname.

    CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
      EXPORTING
        TYPEGROUPNAME        = objname
        DDTEXT               = text-ddtext
        CORRNUM              = ' '
        DEVCLASS             = '$TMP'
      TABLES
        SOURCE               = typegroup-source
      EXCEPTIONS
        ALREADY_EXISTS       = 1
        NOT_EXECUTED         = 2
        PERMISSION_FAILURE   = 3
        OBJECT_NOT_SPECIFIED = 4
        ILLEGAL_NAME         = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      error ALREADY_EXISTS       = 1.
      error NOT_EXECUTED         = 2.
      error PERMISSION_FAILURE   = 3.
      error OBJECT_NOT_SPECIFIED = 4.
      error ILLEGAL_NAME         = 5.
      error ERROR_MESSAGE        = 6.
      error OTHERS               = 7.
      concatenate 'typegroup' typegroup-name 'cant create'
      '(Fb. RS_DD_TYGR_INSERT_SOURCES)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'S'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_typegroup

endclass.                    "typegroup_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS typegroups_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroups_upload definition.

  public section.
    methods: constructor,
             typegroups_create.

  private section.
    data: typegroup_upload type ref to typegroup_upload.

endclass.                    "typegroups_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS typegroups_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class typegroups_upload implementation.

  method constructor.

    create object typegroup_upload.

  endmethod.                    "constructor

  method typegroups_create.

    field-symbols <typegroup> type ttypegroup.

    data: lv_subrc type sy-subrc.

    loop at p-typegroups assigning <typegroup>.

      call method typegroup_upload->set_typegroup
        EXPORTING
          i_typegroup = <typegroup>.
      call method typegroup_upload->create_typegroup
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Typegroup' <typegroup>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "typegroups_create

endclass.                    "typegroups_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS domain_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class domain_upload definition.

  public section.
    methods: set_domain importing i_domain type tdomain,
             create_domain exceptions error.

  private section.
    DATA: domain type tdomain,
          error_text type string.

endclass.                    "domain_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS domain_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class domain_upload implementation.

  method set_domain.

    domain = i_domain.

  endmethod.                    "set_domain

  method create_domain.

*******************
* Ueberpruefen, ob die Domaene existiert
*******************
    select count( * ) from dd01l
               where domname eq domain-name.
    if sy-subrc eq 0.
      concatenate 'domain' domain-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
      raise error.
    endif.

*******************
* Domaene anlegen
*******************
* Kommentar: Commit Work findet im Fb. statt
    CALL FUNCTION 'DDIF_DOMA_PUT'
      EXPORTING
        NAME              = domain-name
        DD01V_WA          = domain-dd01v_wa
      TABLES
        DD07V_TAB         = domain-dd07v_tab
      EXCEPTIONS
        DOMA_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        DOMA_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      call method error_handling=>rollback_work.
      error DOMA_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error DOMA_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'domain' domain-name 'cant create'
      '(Fb. DDIF_DOMA_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
      raise error.
    ELSE.
* findet bereits im Fb. statt
      call method error_handling=>commit_work.
    ENDIF.

*****************************************************
* Package zuordnen
*****************************************************
    data name type string.
    concatenate 'DOMA' domain-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
       OBJECT                         = name
       OBJECT_CLASS                   = 'DICT'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
       MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE                  = 4
      OTHERS                         = 5
             .

    IF SY-SUBRC <> 0.
      call method error_handling=>rollback_work.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'domain' domain-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ELSE.
      call method error_handling=>commit_work.
    ENDIF.

**************
* Domaene aktivieren
**************
* Kommentar: commit work findet in DDIF_DOMA_ACTIVATE statt
    CALL FUNCTION 'DDIF_DOMA_ACTIVATE'
      EXPORTING
        NAME              = domain-name
*       AUTH_CHK          = 'X'
*       PRID              = -1
*     IMPORTING
*       RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3
        OTHERS            = 4
              .

    IF SY-SUBRC <> 0.
      call method error_handling=>rollback_work.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'domain' domain-name 'cant activate'
      '(Fb. DDIF_DOMA_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
      raise error.
    ELSE.
* findet bereits im Fb. statt
      call method error_handling=>commit_work.
    ENDIF.


  endmethod.                    "create_domain

endclass.                    "domain_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS domains_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class domains_upload definition.

  public section.
    methods: constructor,
             domains_create.

  private section.
    data: domain_upload type ref to domain_upload.

endclass.                    "domains_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS domains_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class domains_upload implementation.

  method constructor.

    create object domain_upload.

  endmethod.                    "constructor

  method domains_create.

    field-symbols <domain> type tdomain.

    data: lv_subrc type sy-subrc.

    loop at p-domains assigning <domain>.

      call method domain_upload->set_domain
        EXPORTING
          i_domain = <domain>.
      call method domain_upload->create_domain
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Domain' <domain>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "domains_create

endclass.                    "domains_upload IMPLEMENTATION


Last edited by admin on Sun Dec 30, 2007 11:48 am; edited 1 time in total
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:45 am    Post subject: Reply with quote

Code:
*---------------------------------------------------------------------*
*       CLASS delement_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class delement_upload definition.

  public section.
    methods: set_delement
             importing i_dataelement type tdataelement,
             create_delement exceptions error.

  private section.
    DATA: dataelement type tdataelement,
          error_text type string.

endclass.                    "delement_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS dataelement_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class delement_upload implementation.

  method set_delement.

    dataelement = i_dataelement.

  endmethod.                    "set_dataelement

  method create_delement.

    select count( * ) from dd04l
              where rollname eq dataelement-name.
    if sy-subrc eq 0.
      concatenate 'dtel' dataelement-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

    CALL FUNCTION 'DDIF_DTEL_PUT'
      EXPORTING
        NAME              = dataelement-name
        DD04V_WA          = dataelement-DD04V_WA
      EXCEPTIONS
        DTEL_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        DTEL_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      error DTEL_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error DTEL_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'dtel' dataelement-name 'cant create'
      '(Fb. DDIF_DTEL_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'DDIF_DTEL_ACTIVATE'
      EXPORTING
        NAME              = dataelement-name
*       AUTH_CHK          = 'X'
*       PRID              = -1
*     IMPORTING
*       RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3        " Error messages
        OTHERS            = 4.
    .

    IF SY-SUBRC <> 0.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'dtel' dataelement-name 'cant activate'
      '(Fb. DDIF_DTEL_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    data name type string.
    concatenate 'DTEL' dataelement-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
       EXPORTING
        OBJECT                         = name
        OBJECT_CLASS                   = 'DICT'
        MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
        DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
        MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
        SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
      EXCEPTIONS
       CANCELLED                      = 1
       PERMISSION_FAILURE             = 2
       UNKNOWN_OBJECTCLASS            = 3
       ERROR_MESSAGE                 = 4        " Error messages
       OTHERS                        = 5.

    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'dtel' dataelement-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_delement

endclass.                    "delement_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS delements_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class delements_upload definition.

  public section.
    methods: constructor,
             delements_create.

  private section.
    data: delement_upload type ref to delement_upload.

endclass.                    "domains_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS delements_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class delements_upload implementation.

  method constructor.

    create object delement_upload.

  endmethod.                    "constructor

  method delements_create.

    field-symbols <dataelement> type tdataelement.

    data: lv_subrc type sy-subrc.

    loop at p-dataelements assigning <dataelement>.

      call method delement_upload->set_delement
        EXPORTING
          i_dataelement = <dataelement>.
      call method delement_upload->create_delement
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Dataelement' <dataelement>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "domains_create

endclass.                    "domains_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS table_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class table_upload definition.

  public section.
    methods: set_table importing i_table type ttable,
             create_table exceptions error.

  private section.
    DATA: table type ttable,
          error_text type string.

endclass.                    "table_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS table_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class table_upload implementation.

  method set_table.

    table = i_table.

  endmethod.                    "set_table

  method create_table.

    select count( * ) from dd02l
               where tabname eq table-name
               and ( tabclass eq 'INTTAB'
                or   tabclass eq 'TRANSP' ).
    if sy-subrc eq 0.
      concatenate 'table' table-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

* Anlegen
    CALL FUNCTION 'DDIF_TABL_PUT'
      EXPORTING
        NAME              = table-name
        DD02V_WA          = table-DD02V_WA
        DD09L_WA          = table-DD09L_WA
      TABLES
        DD03P_TAB         = table-DD03P_TAB
        DD05M_TAB         = table-DD05M_TAB
        DD08V_TAB         = table-DD08V_TAB
        DD35V_TAB         = table-DD35V_TAB
        DD36M_TAB         = table-DD36M_TAB
      EXCEPTIONS
        TABL_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        TABL_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      error TABL_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error TABL_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'table' table-name 'cant create'
      '(Fb. DDIF_TABL_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'DDIF_TABL_ACTIVATE'
      EXPORTING
        NAME              = table-name
*       AUTH_CHK          = 'X'
*       PRID              = -1
*     IMPORTING
*       RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3        " Error messages
        OTHERS            = 4.

    IF SY-SUBRC <> 0.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'table' table-name 'cant activate'
      '(Fb. DDIF_TABL_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    data: name type string.
    concatenate 'TABL' table-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
       OBJECT                         = name
       OBJECT_CLASS                   = 'DICT'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
       MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE     = 4        " Error messages
      OTHERS            = 5.

    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'table' table-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_program

endclass.                    "domain_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS tables_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tables_upload definition.

  public section.
    methods: constructor,
             tables_create.

  private section.
    data: table_upload type ref to table_upload.
    methods: determine_sequence.

endclass.                    "tables_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS tables_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tables_upload implementation.

  method constructor.

    create object table_upload.

  endmethod.                    "constructor

  method tables_create.

    field-symbols <table> type ttable.

    data: lv_subrc type sy-subrc.

    call method determine_sequence.

    loop at p-tables assigning <table>.

      call method table_upload->set_table
        EXPORTING
          i_table = <table>.
      call method table_upload->create_table
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Table' <table>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "tables_create

  method determine_sequence.

    field-symbols <table> type ttable.
    data: ptables type ttables.

* Sortieren wegen Includes und Appends
    loop at p-tables assigning <table>.
      if <table>-tabclass eq 'TRANSP'.
        append <table> to ptables.
      else.
        insert <table> into ptables index 1.
      endif.
    endloop.

    move ptables to p-tables.
    free ptables.

  endmethod.                    "determine_sequence

endclass.                    "tables_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS view_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class view_upload definition.

  public section.
    methods: set_view importing i_view type tview,
             create_view exceptions error.

  private section.
    DATA: view type tview,
          error_text type string.

endclass.                    "view_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS view_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class view_upload implementation.

  method set_view.

    view = i_view.

  endmethod.                    "set_table

  method create_view.

    select count( * ) from dd02l
               where tabname eq view-name
                 and tabclass eq 'VIEW'.
    if sy-subrc eq 0.
      concatenate 'View' view-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

* Anlegen
    CALL FUNCTION 'DDIF_VIEW_PUT'
      EXPORTING
        NAME              = view-name
        DD25V_WA          = view-DD25V_WA
        DD09L_WA          = view-DD09L_WA
      TABLES
        DD26V_TAB         = view-DD26V_TAB
        DD27P_TAB         = view-DD27P_TAB
        DD28J_TAB         = view-DD28J_TAB
        DD28V_TAB         = view-DD28V_TAB
      EXCEPTIONS
        VIEW_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        VIEW_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      error VIEW_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error VIEW_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'View' view-name 'cant create'
      '(Fb. DDIF_VIEW_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'DDIF_VIEW_ACTIVATE'
      EXPORTING
        NAME              = view-name
*       AUTH_CHK          = 'X'
*       PRID              = -1
*     IMPORTING
*       RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3        " Error messages
        OTHERS            = 4.

    IF SY-SUBRC <> 0.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'View' view-name 'cant activate'
      '(Fb. DDIF_VIEW_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    data: name type string.
    concatenate 'VIEW' view-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
       OBJECT                         = name
       OBJECT_CLASS                   = 'DICT'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
       MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE     = 4        " Error messages
      OTHERS            = 5.

    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'view' view-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_view

endclass.                    "view_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS views_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class views_upload definition.

  public section.
    methods: constructor,
             views_create.

  private section.
    data: view_upload type ref to view_upload.

endclass.                    "views_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS views_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class views_upload implementation.

  method constructor.

    create object view_upload.

  endmethod.                    "constructor

  method views_create.

    field-symbols <view> type tview.

    data: lv_subrc type sy-subrc.

    loop at p-views assigning <view>.

      call method view_upload->set_view
        EXPORTING
          i_view = <view>.
      call method view_upload->create_view
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'View' <view>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "tables_create

endclass.                    "tables_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS tabletype_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tabletype_upload definition.

  public section.
    methods: set_tabletype importing i_tabletype type ttabletype,
             create_tabletype exceptions error.

  private section.
    DATA: tabletype type ttabletype,
          error_text type string.

endclass.                    "tabletype_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS tabletype_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tabletype_upload implementation.

  method set_tabletype.

    tabletype = i_tabletype.

  endmethod.                    "set_tabletype

  method create_tabletype.

    select count( * ) from dd40l
               where typename eq tabletype-name.
    if sy-subrc eq 0.
      concatenate 'Tabletype' tabletype-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

* Anlegen
    CALL FUNCTION 'DDIF_TTYP_PUT'
      EXPORTING
        NAME              = tabletype-name
        DD40V_WA          = tabletype-DD40V_WA
      TABLES
        DD42V_TAB         = tabletype-DD42V_TAB
      EXCEPTIONS
        TTYP_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        TTYP_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.


    IF SY-SUBRC <> 0.
      error TTYP_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error TTYP_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'Tabletype' tabletype-name 'cant create'
      '(Fb. DDIF_TTYP_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'DDIF_TTYP_ACTIVATE'
      EXPORTING
        NAME              = tabletype-name
*       PRID              = -1
*     IMPORTING
*       RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3        " Error messages
        OTHERS            = 4.
              .

    IF SY-SUBRC <> 0.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'Tabletype' tabletype-name 'cant activate'
      '(Fb. DDIF_TTYP_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    data: name type string.
    concatenate 'TTYP' tabletype-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
       OBJECT                         = name
       OBJECT_CLASS                   = 'DICT'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
       MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE     = 4        " Error messages
      OTHERS            = 5.


    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'Tabletype' tabletype-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_view

endclass.                    "view_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS tabletypes_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tabletypes_upload definition.

  public section.
    methods: constructor,
             tabletypes_create.

  private section.
    data: tabletype_upload type ref to tabletype_upload.

endclass.                    "tabletypes_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS tabletypes_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class tabletypes_upload implementation.

  method constructor.

    create object tabletype_upload.

  endmethod.                    "constructor

  method tabletypes_create.

    field-symbols <tabletype> type ttabletype.

    data: lv_subrc type sy-subrc.

    loop at p-tabletypes assigning <tabletype>.

      call method tabletype_upload->set_tabletype
        EXPORTING
          i_tabletype = <tabletype>.
      call method tabletype_upload->create_tabletype
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Tabletype' <tabletype>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "tabletypes_create

endclass.                    "tabletypes_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS shlp_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlp_upload definition.

  public section.
    methods: set_shlp importing i_shlp type tshlp,
             create_shlp exceptions error.

  private section.
    DATA: shlp type tshlp,
          error_text type string.

endclass.                    "shlp_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS shlp_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlp_upload implementation.

  method set_shlp.

    shlp = i_shlp.

  endmethod.                    "set_tabletype

  method create_shlp.

    select count( * ) from DD30L
               where shlpname eq shlp-name.
    if sy-subrc eq 0.
      concatenate 'Shlp' shlp-name 'already exists'
      into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    endif.

* Anlegen
    CALL FUNCTION 'DDIF_SHLP_PUT'
      EXPORTING
        NAME              = shlp-name
        DD30V_WA          = shlp-DD30V_WA
      TABLES
        DD31V_TAB         = shlp-DD31V_TAB
        DD32P_TAB         = shlp-DD32P_TAB
        DD33V_TAB         = shlp-DD33V_TAB
      EXCEPTIONS
        SHLP_NOT_FOUND    = 1
        NAME_INCONSISTENT = 2
        SHLP_INCONSISTENT = 3
        PUT_FAILURE       = 4
        PUT_REFUSED       = 5
        ERROR_MESSAGE     = 6        " Error messages
        OTHERS            = 7.

    IF SY-SUBRC <> 0.
      error SHLP_NOT_FOUND          = 1.
      error NAME_INCONSISTENT       = 2.
      error SHLP_INCONSISTENT       = 3.
      error PUT_FAILURE             = 4.
      error PUT_REFUSED             = 5.
      error ERROR_MESSAGE           = 6.
      error OTHERS                  = 7.
      concatenate 'Shlp' shlp-name 'cant create'
      '(Fb. DDIF_SHLP_PUT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    CALL FUNCTION 'DDIF_SHLP_ACTIVATE'
      EXPORTING
        NAME              = shlp-name
*   PRID              = -1
* IMPORTING
*   RC                =
      EXCEPTIONS
        NOT_FOUND         = 1
        PUT_FAILURE       = 2
        ERROR_MESSAGE     = 3        " Error messages
        OTHERS            = 4.


    IF SY-SUBRC <> 0.
      error NOT_FOUND         = 1.
      error PUT_FAILURE       = 2.
      error ERROR_MESSAGE     = 3.
      error OTHERS            = 4.
      concatenate 'SHLP' shlp-name 'cant activate'
      '(Fb. DDIF_SHLP_ACTIVATE)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

    data: name type string.
    concatenate 'SHLP' shlp-name into name.

    CALL FUNCTION 'RS_CORR_INSERT'
      EXPORTING
       OBJECT                         = name
       OBJECT_CLASS                   = 'DICT'
       MODE                           = 'I'
*      GLOBAL_LOCK                    = ' '
       DEVCLASS                       = '$TMP'
*      KORRNUM                        = ' '
*      USE_KORRNUM_IMMEDIATEDLY       = ' '
*      AUTHOR                         = ' '
       MASTER_LANGUAGE                = sy-langu
*      GENFLAG                        = ' '
*      PROGRAM                        =
*      OBJECT_CLASS_SUPPORTS_MA       = ' '
*      EXTEND                         = ' '
       SUPPRESS_DIALOG                = 'X'
*      MOD_LANGU                      = ' '
*     IMPORTING
*      DEVCLASS                       =
*      KORRNUM                        =
*      ORDERNUM                       =
*      NEW_CORR_ENTRY                 =
*      AUTHOR                         =
*      TRANSPORT_KEY                  =
*      NEW_EXTEND                     =
     EXCEPTIONS
      CANCELLED                      = 1
      PERMISSION_FAILURE             = 2
      UNKNOWN_OBJECTCLASS            = 3
      ERROR_MESSAGE     = 4        " Error messages
      OTHERS            = 5.


    IF SY-SUBRC <> 0.
      error CANCELLED                      = 1.
      error PERMISSION_FAILURE             = 2.
      error UNKNOWN_OBJECTCLASS            = 3.
      error ERROR_MESSAGE                  = 4.
      error OTHERS                         = 5.
      concatenate 'SHLP' shlp-name 'cant $TMP'
      '(Fb. RS_CORR_INSERT)' into error_text
      separated by space.
      call method error_handling=>error_question
        EXPORTING
          error_text = error_text.
*     error_message error_text 'E'.        "Makro
      raise error.
    ENDIF.

  endmethod.                    "create_shlp

endclass.                    "shlp_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS shlps_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlps_upload definition.

  public section.
    methods: constructor,
             shlps_create.

  private section.
    data: shlp_upload type ref to shlp_upload.

endclass.                    "shlps_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS shlps_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class shlps_upload implementation.

  method constructor.

    create object shlp_upload.

  endmethod.                    "constructor

  method shlps_create.

    field-symbols <shlp> type tshlp.

    data: lv_subrc type sy-subrc.

    loop at p-searchhelps assigning <shlp>.

      call method shlp_upload->set_shlp
        EXPORTING
          i_shlp = <shlp>.
      call method shlp_upload->create_shlp
        EXCEPTIONS
          error  = 1
          others = 2.
* Commit work
      move sy-subrc to lv_subrc.
      if lv_subrc eq 0.
        call method error_handling=>commit_work.
      else.
        call method error_handling=>rollback_work.
      endif.
* Ausgabe Ergebnis
      result_message 'Searchhelp' <shlp>-name lv_subrc.
* Stop Processing
      if gv_flg_stop_upload_processing eq 'X'.
        exit.
      endif.

    endloop.

  endmethod.                    "tabletypes_create

endclass.                    "tabletypes_upload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS choose_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_upload definition.

  public section.
    methods choose.

  private section.
* Objekte, die zur Auswahl angezeigt werden
    DATA: begin of object.
    include type SEOCMPKEY.
    data: checkbox.
    data: end of object.
    DATA: objects like standard table of object.
* Methoden
    methods: choice,
             accept_choice.

endclass.                    "choose_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS choose_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_upload implementation.

  method choose.

* Auswahl treffen
    call method choice.
    if flag_popup_abg eq space.
* Zuvor wurde ausgewaehlt
      call method accept_choice.
    else.
      free p.
      message S000(38) with 'Canceled'.
    endif.

  endmethod.                    "choose

  method choice.

* Funktionscodes
    data: FUNCTIONS type standard table of SVALP,
          w_function like line of functions.
    field-symbols:
          <class> type tclass,
          <inter> type tinter,
          <fgroup> type tfgroup,
          <program> type tprogram,
          <domain> type tdomain,
          <dataelement> type tdataelement,
          <table> type ttable,
          <tabletype> type ttabletype,
          <shlp> type tshlp,
          <view> type tview,
          <typegroup> type ttypegroup.

    move 'OK' to w_function-func_name.
    move sy-cprog to w_function-prog_name.
    if download eq 'X'.
      move 'AUSWAHL_DOWNLOAD' to w_function-form_name.
    elseif upload eq 'X'.
      move 'AUSWAHL_UPLOAD' to w_function-form_name.
    endif.
    append w_function to functions.

* Objects fuellen
    loop at p-domains assigning <domain>.
      move <domain>-name to object-clsname.
      move c_ch_domain to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-dataelements assigning <dataelement>.
      move <dataelement>-name to object-clsname.
      move c_ch_delement to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-searchhelps assigning <shlp>.
      move <shlp>-name to object-clsname.
      move c_ch_searchelp to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-tables assigning <table>.
      move <table>-name to object-clsname.
      move c_ch_table to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-views assigning <view>.
      move <view>-name to object-clsname.
      move c_ch_viewname to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-tabletypes assigning <tabletype>.
      move <tabletype>-name to object-clsname.
      move c_ch_tabletype to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-typegroups assigning <typegroup>.
      move <typegroup>-name to object-clsname.
      move c_ch_typegroup to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-inters assigning <inter>.
      move <inter>-intkey-clsname to object-clsname.
      move c_ch_Interface to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-classes assigning <class>.
      move <class>-cifkey-clsname to object-clsname.
      move C_ch_Class to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-programs assigning <program>.
      move <program>-name to object-clsname.
      case <program>-subc.
        when 'I'.
          move c_ch_include to object-cmpname.
        when others.
          move c_ch_program to object-cmpname.
      endcase.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

    loop at p-fgroups assigning <fgroup>.
      move <fgroup>-area to object-clsname.
      move c_ch_Fgroup to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    endloop.

* Popup anzeigen
    if not objects[] is initial.
      move 'X' to flag_POPUP_abg.
      CALL FUNCTION 'POPUP_GET_SELECTION_FROM_LIST'
        EXPORTING
          DISPLAY_ONLY                 = 'X'
          TABLE_NAME                   = 'SEOCMPKEY'
          TITLE_BAR                    = 'Selection'
        TABLES
          LIST                         = objects
          FUNCTIONS                    = functions
        EXCEPTIONS
          NO_TABLEFIELDS_IN_DICTIONARY = 1
          NO_TABLE_STRUCTURE           = 2
          NO_TITLE_BAR                 = 3
          OTHERS                       = 4.

      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.

  endmethod.                    "choice

  method accept_choice.
    field-symbols: <class> type tclass,
                   <inter> type tinter,
                   <fgroup> type tfgroup,
                   <program> type tprogram,
                   <domain> type tdomain,
                   <dataelement> type tdataelement,
                   <table> type ttable,
                   <typegroup> type ttypegroup,
                   <tabletype> type ttabletype,
                   <shlp> type tshlp,
                   <view> type tview.

    loop at p-classes assigning <class>.
      read table objects into object
      with key clsname = <class>-cifkey-clsname
           cmpname = c_ch_class
           checkbox  = space.
      if sy-subrc eq 0.
        delete p-classes.
      endif.
    endloop.
    loop at p-inters assigning <inter>.
      read table objects into object
      with key clsname = <inter>-intkey-clsname
           cmpname = c_ch_interface
           checkbox  = space.
      if sy-subrc eq 0.
        delete p-inters.
      endif.
    endloop.
    loop at p-fgroups assigning <fgroup>.
      read table objects into object
      with key clsname = <fgroup>-area
               cmpname = c_ch_Fgroup
              checkbox = space.
      if sy-subrc eq 0.
        delete p-fgroups.
        continue.
      endif.
    endloop.
    loop at p-programs assigning <program>.
      read table objects into object
      with key clsname = <program>-name
               cmpname = c_ch_program
              checkbox = space.
      if sy-subrc eq 0.
        delete p-programs.
      else.
        read table objects into object
        with key clsname = <program>-name
                 cmpname = c_ch_include
                checkbox = space.
        if sy-subrc eq 0.
          delete p-programs.
          continue.
        endif.
      endif.
    endloop.
    loop at p-typegroups assigning <typegroup>.
      read table objects into object
      with key clsname = <typegroup>-name
               cmpname = c_ch_typegroup
              checkbox = space.
      if sy-subrc eq 0.
        delete p-typegroups.
        continue.
      endif.
    endloop.
    loop at p-domains assigning <domain>.
      read table objects into object
      with key clsname = <domain>-name
               cmpname = c_ch_domain
              checkbox = space.
      if sy-subrc eq 0.
        delete p-domains.
      endif.
    endloop.
    loop at p-dataelements assigning <dataelement>.
      read table objects into object
      with key clsname = <dataelement>-name
               cmpname = c_ch_delement
              checkbox = space.
      if sy-subrc eq 0.
        delete p-dataelements.
      endif.
    endloop.
    loop at p-tables assigning <table>.
      read table objects into object
      with key clsname = <table>-name
               cmpname = c_ch_table
              checkbox = space.
      if sy-subrc eq 0.
        delete p-tables.
      endif.
    endloop.
    loop at p-tabletypes assigning <tabletype>.
      read table objects into object
      with key clsname = <tabletype>-name
               cmpname = c_ch_tabletype
              checkbox = space.
      if sy-subrc eq 0.
        delete p-tabletypes.
      endif.
    endloop.
    loop at p-searchhelps assigning <shlp>.
      read table objects into object
      with key clsname = <shlp>-name
               cmpname = c_ch_searchelp
              checkbox = space.
      if sy-subrc eq 0.
        delete p-searchhelps.
      endif.
    endloop.
    loop at p-views assigning <view>.
      read table objects into object
      with key clsname = <view>-name
               cmpname = c_ch_viewname
              checkbox = space.
      if sy-subrc eq 0.
        delete p-views.
      endif.
    endloop.

  endmethod.                    "accept_choice

endclass.                    "choose_upload IMPLEMENTATION


*---------------------------------------------------------------------*
*       CLASS choose_upload_index DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_upload_index definition.

  public section.
    methods: choose exporting e_index type tindex_table,
             constructor importing i_index type tindex_table,
             set_index importing i_index type tindex_table,
             get_index exporting e_index type tindex_table.

  private section.
* Objekte, die zur Auswahl angezeigt werden
    DATA: begin of object.
    include type SEOCMPKEY.
    data: checkbox.
    data: end of object.
    DATA: objects like standard table of object.

* Index-Datei
    DATA: index type tindex_table,
          w_index like line of index.

* Methoden
    methods: choice,
             accept_choice.

endclass.                    "choose_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS choose_upload_index IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_upload_index implementation.

  method constructor.

    index = i_index.

  endmethod.                    "constructor

  method set_index.

    index = i_index.

  endmethod.                    "set_index

  method get_index.

    e_index = index.

  endmethod.                    "get_index

  method choose.

* Auswahl treffen
    call method choice.
    if flag_popup_abg eq space.
* Zuvor wurde ausgewaehlt
      call method accept_choice.
    else.
      free index.
      message S000(38) with 'Canceled'.
    endif.

* Index Tabelle zuordnen
    e_index = index.

  endmethod.                    "choose

  method choice.

* Funktionscodes
    data: FUNCTIONS type standard table of SVALP,
          w_function like line of functions.

    move 'OK' to w_function-func_name.
    move sy-cprog to w_function-prog_name.
    if download eq 'X'.
      move 'AUSWAHL_DOWNLOAD' to w_function-form_name.
    elseif upload eq 'X'.
      move 'AUSWAHL_UPLOAD' to w_function-form_name.
    endif.
    append w_function to functions.

* interne Auswahltabelle fuellen
    Loop at index into w_index.
      move w_index-name to object-clsname.
      move w_index-type to object-cmpname.
      move 'X' to object-checkbox.
      append object to objects.
    Endloop.

* Popup anzeigen
    if not objects[] is initial.
      move 'X' to flag_POPUP_abg.
      CALL FUNCTION 'POPUP_GET_SELECTION_FROM_LIST'
        EXPORTING
          DISPLAY_ONLY                 = 'X'
          TABLE_NAME                   = 'SEOCMPKEY'
          TITLE_BAR                    = 'Selection'
        TABLES
          LIST                         = objects
          FUNCTIONS                    = functions
        EXCEPTIONS
          NO_TABLEFIELDS_IN_DICTIONARY = 1
          NO_TABLE_STRUCTURE           = 2
          NO_TITLE_BAR                 = 3
          OTHERS                       = 4.

      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.

  endmethod.                    "choice

  method accept_choice.

    loop at index into w_index.
      read table objects into object
      with key clsname = w_index-name
           cmpname = w_index-type
           checkbox  = space.
      if sy-subrc eq 0.
        delete index.
      endif.
    endloop.

  endmethod.                    "accept_choice

endclass.                    "choose_upload_index IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS xml_upload DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class xml_upload definition.

  public section.
    methods: upload_XML_file
              importing filename type localfile
              exporting dataobject type any
             exceptions error,
             constructor.

  private section.
    data: XMLDOC type ref to CL_XML_DOCUMENT.
    data: RETCODE type SY-SUBRC.

endclass.                    "xml_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS xml_upload IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class xml_upload implementation.

  method constructor.

    create object XMLDOC.

  endmethod.                    "constructor

  method upload_XML_file.

******************************
* XML-Dokument freigeben
******************************
    call method XMLDOC->FREE.

****************************
* XML-Datei lesen
****************************
    if filename ne SPACE.
      RETCODE = XMLDOC->IMPORT_FROM_FILE( filename ).
      if retcode eq 0.
        write: / retcode, 'Import from PC File', filename color
        col_total.
        new-line.
*********************************
* XML-Datei in interne Tabelle
*********************************
        call method XMLDOC->GET_DATA
          CHANGING
            DATAOBJECT = dataobject.

      else.
        write: / retcode color col_negative,
        'Error Cant Import from PC File' color col_negative,
        filename color col_negative.
        new-line.
        raise error.
      endif.
    else.
      raise error.
    endif.

******************************
* XML-Dokument freigeben
******************************
    call method XMLDOC->FREE.

  endmethod.                    " uploading

endclass.                    "xml_upload IMPLEMENTATION


*---------------------------------------------------------------------*
*       CLASS create DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class create definition.

  public section.
    methods: create.

  private section.
    data: domains_upload type ref to domains_upload.
    data: delements_upload type ref to delements_upload.
    data: tables_upload type ref to tables_upload.
    data: views_upload type ref to views_upload.
    data: tabletypes_upload type ref to tabletypes_upload.
    data: shlps_upload type ref to shlps_upload.
    data: typegroups_upload type ref to typegroups_upload.
    data: interfaces_upload type ref to interfaces_upload.
    data: classes_upload type ref to classes_upload.
    data: fgroups_upload type ref to fgroups_upload.
    data: programs_upload type ref to programs_upload.

endclass.                    "create DEFINITION

*---------------------------------------------------------------------*
*       CLASS create IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class create implementation.

  method create.

* Kommentar: Reihenfolge entscheidend !!

* Domains einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-domains is initial.
      if not domains_upload is bound.
        create object domains_upload.
      endif.
      call method domains_upload->domains_create.
      free p-domains.                              " Speicher freigeben
    endif.

* Dataelements einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-dataelements is initial.
      if not delements_upload is bound.
        create object delements_upload.
      endif.
      call method delements_upload->delements_create.
      free p-dataelements.                    " Speicher freigeben
    endif.

* Searchhelps einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-searchhelps is initial.
      if not shlps_upload is bound.
        create object shlps_upload.
      endif.
      call method shlps_upload->shlps_create.
      free p-searchhelps.                    " Speicher freigeben
    endif.

* Tables einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-tables is initial.
      if not tables_upload is bound.
        create object tables_upload.
      endif.
      call method tables_upload->tables_create.
      free p-tables.                    " Speicher freigeben
    endif.

* Views einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-views is initial.
      if not views_upload is bound.
        create object views_upload.
      endif.
      call method views_upload->views_create.
      free p-views.                    " Speicher freigeben
    endif.

* Tabletypes einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-tabletypes is initial.
      if not tabletypes_upload is bound.
        create object tabletypes_upload.
      endif.
      call method tabletypes_upload->tabletypes_create.
      free p-tabletypes.                    " Speicher freigeben
    endif.

* Typegroups einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-typegroups is initial.
      if not typegroups_upload is bound.
        create object typegroups_upload.
      endif.
      call method typegroups_upload->typegroups_create.
      free p-typegroups.
    endif.

* Interfaces einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-inters is initial.
      if not interfaces_upload is bound.
        create object interfaces_upload.
      endif.
      call method interfaces_upload->interfaces_create.
      free p-inters.                              " Speicher freigeben
    endif.

* Klassen einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-classes is initial.
      if not classes_upload is bound.
        create object classes_upload.
      endif.
      call method classes_upload->classes_create.
      free p-classes.                            " Speicher freigeben
    endif.

* Programme einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-programs is initial.
      if not programs_upload is bound.
        create object programs_upload.
      endif.
      call method programs_upload->programs_create.
      free p-programs.
    endif.

* Funktionsgruppen einspielen
    check not gv_flg_stop_upload_processing eq 'X'.
    if not p-fgroups is initial.
      if not fgroups_upload is bound.
        create object fgroups_upload.
      endif.
      call method fgroups_upload->fgroups_create.
      free p-fgroups.                          "Speicher freigeben
    endif.

  endmethod.                    "create

endclass.                    "create IMPLEMENTATION


*---------------------------------------------------------------------*
*       CLASS start_upload_index DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_upload_index definition.

  public section.
* Methoden
    methods: upload,
             constructor
               importing i_index type tindex_table
                         i_rxml_upload type ref to xml_upload,
             set_index importing i_index type tindex_table.

  private section.
    data: rchoose_upload_index type ref to choose_upload_index,
          index type tindex_table,
          w_index like line of index,
          rxml_upload type ref to xml_upload,
          rcreate type ref to create.
    data: path_oasis type localfile.

endclass.                    "start_upload DEFINITION

*---------------------------------------------------------------------*
*       CLASS start_upload_index IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_upload_index implementation.

  method constructor.

    index = i_index.
* Auswahl Objekt erzeugen
    create object rchoose_upload_index
         exporting i_index = index.
* xml Upload Objekt
    rxml_upload = i_rxml_upload.
* Create Objekt anlegen
    create object rcreate.
* Pfad festlegen
    move pcfile1 to path_oasis.
    SET LOCALE LANGUAGE 'D'.
    translate path_oasis to upper case.
    SET LOCALE LANGUAGE sy-langu.
    replace c_file_index_xml in path_oasis with space.

  endmethod.                    "constructor

  method set_index.

    index = i_index.

  endmethod.                    "set_index

  method UPLOAD.

    data: filename_oasis type localfile.

* Auswahl treffen
    call method rchoose_upload_index->choose
      IMPORTING
        e_index = index.

    Loop at index into w_index.

* Soll abgebrochen werden
      check not gv_flg_stop_upload_processing eq 'X'.

* Globales Datenobjekt initialisieren
      free p.

* Pfad der Index-Datei hinzufuegen
      concatenate path_oasis w_index-file into filename_oasis.

* Datei lesen
      call method rxml_upload->upload_xml_file
        EXPORTING
          filename   = filename_oasis
        IMPORTING
          dataobject = p
        EXCEPTIONS
          error      = 1
          others     = 2.
      if sy-subrc eq 0.
        call method rcreate->create.
      endif.
    Endloop.

  endmethod.                    "UPLOAD

endclass.                    "start_upload_index IMPLEMENTATION
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:54 am    Post subject: Reply with quote

Code:
*---------------------------------------------------------------------*
*       CLASS start_upload_single DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_upload_single definition.

  public section.
* Methoden
    methods: upload,
             constructor.

  private section.
    data: rchoose_upload type ref to choose_upload.
    data: rcreate type ref to create.
* Methoden
    methods: create.

endclass.                    "start_upload_single DEFINITION

*---------------------------------------------------------------------*
*       CLASS start_upload_single IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_upload_single implementation.

  method constructor.

    create object rchoose_upload.
    create object rcreate.

  endmethod.                    "constructor

  method UPLOAD.

    call method rchoose_upload->choose.
    if not p is initial.
      call method create.
    endif.

  endmethod.                    "UPLOAD

  method create.

    call method rcreate->create.

  endmethod.                    "create

endclass.                    "start_upload_single IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS xml_download DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class xml_download definition.

  public section.

* Types
    types: begin of TNODE,
    NAME type STRING,
    NODE type ref to IF_IXML_NODE,
    NODELIST type ref to IF_IXML_NODE_LIST,
    end of TNODE.

* Methods
    methods: download_XML,
             download_XML_single_file
               importing p type tp
                         filename type LOCALFILE
               exceptions error,
             download_XML_index_file
                importing index type tindex_table
                exceptions error,
             get_size_of_xml
                importing p type tp
                exporting size type sytabix
                exceptions error,
             constructor.

* statische Methoden
    class-methods: check_if_file_exists
                     importing i_filename type localfile
                     exporting e_flg_file_exists type as4flag.


  private section.

* Attribute XML
    data: XMLDOC type ref to CL_XML_DOCUMENT.
    data: RETCODE type SY-SUBRC.

* private Methoden
    methods: TAB2XML importing p type tp,
             XML_APPEND_SOURCES_AS_CDATA importing p type tp,
             XML_cdata_source_classes
               importing p type tp
                         clsname type tclass-cifkey-clsname
               exporting source type seop_source
               changing  node type tnode,
             XML_cdata_source_fgroups
               importing p type tp
                         area type tfgroup-area
               exporting source type seop_source
               changing  node type tnode,
             XML_cdata_source_programs
               importing p type tp
                         name type tprogram-name
               exporting source type seop_source
               changing  node type tnode,
             XML_cdata_source_typegroups
               importing p type tp
                         tname type ttypegroup-name
               exporting source type seop_source
               changing  node type tnode,
             save_xml_file importing i_filename type localfile
                           exporting retcode type sy-subrc
                           exceptions
                             canceled_by_user.

endclass.                    "xml_download DEFINITION

*---------------------------------------------------------------------*
*       CLASS xml_load IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class xml_download implementation.

  method constructor.

    create object XMLDOC.

  endmethod.                    "constructor

  method save_xml_file.

    data: flg_file_exists.

* check, if file exists ?
    call method check_if_file_exists
      EXPORTING
        i_filename        = i_filename
      IMPORTING
        e_flg_file_exists = flg_file_exists.

    if flg_file_exists eq 'X'.
* Popup Soll ueberschrieben werden ?

    endif.

    RETCODE = XMLDOC->EXPORT_TO_FILE( i_filename ).
    if retcode eq 0.
      write: / retcode, 'Export to PC File', i_filename color col_total.
      new-line.
    else.
      write: / retcode color col_negative,
      'Error Cant Export to PC File' color col_negative,
      i_filename color col_negative.
      new-line.
    endif.

  endmethod.                    "save_xml_file

  method check_if_file_exists.



  endmethod.                    "check_if_file_exists

  method get_size_of_xml.

********************************
* XML-Dokument erzeugen
********************************
    call method XMLDOC->CREATE_WITH_DATA
     exporting
*       NAME       = 'DATA'
       DATAOBJECT = p
     receiving
       RETCODE    = RETCODE .

    if retcode ne 0.
      raise error.
    endif.

******************************
* Groesse bekommen
******************************
    call method XMLDOC->RENDER_2_TABLE
      EXPORTING
        PRETTY_PRINT = 'X'
      IMPORTING
        SIZE         = SIZE.

******************************
* XML-Dokument freigeben
******************************
    call method XMLDOC->FREE.

  endmethod.                    "get_size_of_xml

  method download_xml_index_file.

    data filename type localfile.

    if sfiles eq 'X'.

*********************************
* XML DOC erzeugen
*********************************
      call method XMLDOC->CREATE_WITH_DATA
      exporting
*       NAME       = 'DATA'
        DATAOBJECT = index
      receiving
        RETCODE    = RETCODE .

      if retcode ne 0.
        raise error.
      endif.

*********************************
* Encoding zuweisen
*********************************
      data: charset type string.
      move c_xml_encoding_utf8 to charset.
      CALL METHOD XMLDOC->SET_ENCODING
        EXPORTING
          CHARSET = charset.

*********************************
* Datei speichern
*********************************
      concatenate path c_file_index_xml into filename.

      clear retcode.
      call method save_xml_file
        EXPORTING
          i_filename       = filename
        IMPORTING
          retcode          = retcode
        EXCEPTIONS
          canceled_by_user = 1
          others           = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

      if retcode ne 0.
        raise error.
      endif.

******************************
* XML-Dokument freigeben
******************************
      call method XMLDOC->FREE.

    endif.

  endmethod.                    "download_xml_index_file

  method download_XML_single_file.

    check not p is initial.

    if sfiles eq 'X'.
*********************************
* XML DOC erzeugen
*********************************
      call method TAB2XML
        EXPORTING
          p = p.

*********************************
* Method Sorce in CDATA Segment
*********************************
      if cdata eq 'X'.
        call method XML_APPEND_SOURCES_AS_CDATA
          EXPORTING
            p = p.
      endif.

*********************************
* Encoding zuweisen
*********************************
      data: charset type string.
      move c_xml_encoding_utf8 to charset.
      CALL METHOD XMLDOC->SET_ENCODING
        EXPORTING
          CHARSET = charset.

*********************************
* Datei speichern
*********************************
      clear retcode.
      call method save_xml_file
        EXPORTING
          i_filename       = filename
        IMPORTING
          retcode          = retcode
        EXCEPTIONS
          canceled_by_user = 1
          others           = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

      if retcode ne 0.
        raise error.
      endif.

******************************
* XML-Dokument freigeben
******************************
      call method XMLDOC->FREE.

    endif.

  endmethod.                    "download_XML_single_file

  method download_XML.

*********************************
* XML DOC erzeugen
*********************************
    call method TAB2XML
      EXPORTING
        p = p.

*********************************
* Method Sorce in CDATA Segment
*********************************
    if cdata eq 'X'.
      call method XML_APPEND_SOURCES_AS_CDATA
        EXPORTING
          p = p.
    endif.

*********************************
* Globales Datenobjekt initialisieren, Speicher sparen
*********************************
    free p.

*********************************
* Encoding zuweisen
*********************************
    data: charset type string.
    move c_xml_encoding_utf8 to charset.
    CALL METHOD XMLDOC->SET_ENCODING
      EXPORTING
        CHARSET = charset.

*********************************
* XML Dokument in File speichern
*********************************
    if save eq 'X'.
      if disp_onl ne 'X'.
        if PCFILE ne SPACE.
          call method save_xml_file
            EXPORTING
              i_filename       = pcfile
            IMPORTING
              retcode          = retcode
            EXCEPTIONS
              canceled_by_user = 1
              others           = 2.
        endif.
      endif.
    endif.

*********************************
* XML Dokument anzeigen
*********************************
    DATA: table type standard table of ABAPTXT255.
    if display eq 'X'.
      XMLDOC->DISPLAY( ).
    endif.

**********************************
* Im Editor anzeigen
**********************************
    if calledit eq 'X'.
      CALL METHOD XMLDOC->GET_AS_TABLE
        IMPORTING
          TABLE   = table
*         SIZE    =
*         RETCODE =
.
* Editor Call
      editor-call for table display-mode.
    endif.

******************************
* XML-Dokument freigeben
******************************
    call method XMLDOC->FREE.

  endmethod.                    " download_XML

  method TAB2XML.

    call method XMLDOC->CREATE_WITH_DATA
      exporting
*       NAME       = 'DATA'
        DATAOBJECT = p
      receiving
        RETCODE    = RETCODE .

  endmethod.                                                "TAB2XML

  method XML_APPEND_SOURCES_AS_CDATA.

* Datendeklarationen
    data: NODE type tnode.
    data: XMLCDATA type ref to IF_IXML_CDATA_SECTION.
    data: CDATA type STRING.
    DATA: RVAL_ITERATOR type ref to IF_IXML_NODE_ITERATOR.
    data: source type seop_source.

* Konstanten
    constants:
    c_name_clsname type string
                    value '/DATA/CLASSES/item/CIFKEY',
    c_name_area type string
                    value '/DATA/FGROUPS/item',
    c_name_name type string
                    value '/DATA/PROGRAMS/item',
    c_name_tname type string
                    value '/DATA/TYPEGROUPS/item'.

* Classname
    data: clsname type tclass-cifkey-clsname.
* Fgroupname
    data: area type tfgroup-area.
* Programmname
    data: name type tprogram-name.
* Typegroup
    data: tname type ttypegroup-name.

* Iteration ueber das XML Dokument
    call method XMLDOC->m_document->IF_IXML_NODE~CREATE_ITERATOR
      RECEIVING
        rval = rval_iterator.

    do.
      call method rval_iterator->get_next
        RECEIVING
          rval = NODE-NODE.

      if NODE-NODE is bound.

        call method XMLDOC->GET_NODE_PATH
          EXPORTING
            NODE = NODE-NODE
          RECEIVING
            path = NODE-name.

* Refresh
        clear source.
        refresh source.

* Name der Klasse
        if node-name eq c_name_clsname.
          CLSNAME =
          XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'CLSNAME'
                                       ROOT = NODE-NODE ).
        endif.
* Name der Fgruppe
        if node-name eq c_name_area.
          AREA =
          XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'AREA'
                                       ROOT = NODE-NODE ).
        endif.
* Name Programm lesen
        if node-name eq c_name_name.
          name =
          XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'NAME'
                                       ROOT = NODE-NODE ).
        endif.
* Name der Typegroup
        if node-name eq c_name_tname.
          tname = XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'NAME'
                                               ROOT = NODE-NODE ).
        endif.

* Source Klasse lesen
        call method XML_cdata_source_classes
          EXPORTING
            p       = p
            clsname = clsname
          IMPORTING
            source  = source
          CHANGING
            node    = node.

* Source Fgroup lesen
        call method XML_cdata_source_fgroups
          EXPORTING
            p      = p
            area   = area
          IMPORTING
            source = source
          CHANGING
            node   = node.

* Source Programme lesen
        call method XML_cdata_source_programs
          EXPORTING
            p      = p
            name   = name
          IMPORTING
            source = source
          CHANGING
            node   = node.

* Source Typegroups lesen
        call method XML_cdata_source_typegroups
          EXPORTING
            p      = p
            tname  = tname
          IMPORTING
            source = source
          CHANGING
            node   = node.

* Source als CDATA anhaengen
        if not source[] is initial.
          clear cdata.
          call function 'COPY_CTAB_TO_STRING'
*             EXPORTING
*               DATA_LEN       = 0
            importing
              DATA_OUT       = CDATA
            tables
              DATA_IN        = SOURCE.
          XMLCDATA = XMLDOC->M_DOCUMENT->CREATE_CDATA_SECTION(
              CDATA  = CDATA ).
          NODE-NODE->APPEND_CHILD( NEW_CHILD = XMLCDATA ).
        endif.

      else.
* Am Ende angelangt
        exit.
      endif.

    enddo.

  endmethod.                    "XML_APPEND_SOURCES_AS_CDATA

  method XML_cdata_source_classes.

    CONSTANTS:     c_NAME_METHODS type string
                   value '/DATA/CLASSES/item/METHODS/item',
                   c_NAME_sections type string
                   value '/DATA/CLASSES/item/SECTIONS/item',
                   c_NAME_REDEF type string
                   value '/DATA/CLASSES/item/METHODS_REDEF/item',
                   c_NAME_IMPL type string
                   value '/DATA/CLASSES/item/METHODS_IMPL/item',
                   c_NAME_LOCALS type string
                   value '/DATA/CLASSES/item/LOCALS/item'.

    field-symbols <class> type tclass.
    data: CMPKEY type SEOCMPKEY.

    case node-name.

* Source Methoden
      when c_NAME_METHODS.
        field-symbols <method> type tymethod.
        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        CMPKEY-CLSNAME =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'CLSNAME'
                                     ROOT = NODE-NODE ).
        CMPKEY-CMPNAME =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'CMPNAME'
                                     ROOT = NODE-NODE ).
        if not CMPKEY-CLSNAME is initial
        and not CMPKEY-CMPNAME is initial.
          loop at p-classes assigning <class>
          where cifkey-clsname eq cmpkey-clsname.
            read table <class>-METHODS assigning <method>
              with key CMPKEY-CLSNAME = CMPKEY-CLSNAME
                       CMPKEY-CMPNAME = CMPKEY-CMPNAME.
            if sy-subrc eq 0.
              move <method>-source to source.
            endif.
          endloop.
        endif.

* Source Sektionen
      when c_NAME_sections.

        field-symbols: <sections> type line of tclass-sections.
        data: limu type tsection-limu.
        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).

        LIMU =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'LIMU'
                                     ROOT = NODE-NODE ).

        if not CLSNAME is initial
        and not limu is initial.
          loop at p-classes assigning <class>
            where cifkey-clsname eq clsname.
            read table <class>-sections assigning <sections>
            with key limu = limu.
            if sy-subrc eq 0.
              move <sections>-source to source.
            endif.
          endloop.
        endif.

* Source Redef
      when c_NAME_REDEF.

        field-symbols: <method_redef> type TREDEFINITION.
        data: mCMPNAME type TREDEFINITION-method-CMPNAME.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        mCMPNAME =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'CMPNAME'
                                     ROOT = NODE-NODE ).

        if not CLSNAME is initial
        and not mCMPNAME is initial.
          loop at p-classes assigning <class>
            where cifkey-clsname eq clsname.
            read table <class>-METHODS_REDEF
            assigning <method_redef>
            with key method-cmpname = mCMPNAME.
            if sy-subrc eq 0.
              move <method_redef>-source to source.
            endif.
          endloop.
        endif.

      when c_NAME_IMPL.

        field-symbols: <method_impl> type TIMPLMETHOD.
        data: iCMPNAME type TIMPLMETHOD-method-CMPNAME.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        iCMPNAME =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'CMPNAME'
                                     ROOT = NODE-NODE ).

        if not CLSNAME is initial
        and not iCMPNAME is initial.
          loop at p-classes assigning <class>
            where cifkey-clsname eq clsname.
            read table <class>-METHODS_IMPL
            assigning <method_impl>
            with key method-cmpname = iCMPNAME.
            if sy-subrc eq 0.
              move <method_impl>-source to source.
            endif.
          endloop.
        endif.

* Source Locals
      when c_NAME_LOCALS.

        field-symbols: <local> type line of tclass-locals.
        data: name type tlocal-name.
        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        name =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'NAME'
                                     ROOT = NODE-NODE ).

        if not CLSNAME is initial
        and not name is initial.
          loop at p-classes assigning <class>
            where cifkey-clsname eq clsname.
            read table <class>-locals assigning <local>
            with key name = name.
            if sy-subrc eq 0.
              move <local>-source_locals to source.
            endif.
          endloop.
        endif.

    endcase.

  endmethod.                    "XML_cdata_source_classes

  method XML_cdata_source_fgroups.

    CONSTANTS:     c_NAME_FMODULES type string
                   value '/DATA/FGROUPS/item/FMODULES/item',
                   c_NAME_INCLUDES type string
                   value '/DATA/FGROUPS/item/INCLUDES/item',
                   c_NAME_DYNPROS type string
                   value '/DATA/FGROUPS/item/DYNPROS/item'.

    field-symbols <fgroup> type tfgroup.
    data: funcname type tfmodule-funcname.

    case node-name.

* Source Funktionsbausteine
      when c_NAME_FMODULES.

        field-symbols <fmodule> type tfmodule.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        funcname =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'FUNCNAME'
                                     ROOT = NODE-NODE ).
        if not area is initial
        and not funcname is initial.
          loop at p-fgroups assigning <fgroup>
          where area = area.
            read table <fgroup>-fmodules assigning <fmodule>
              with key funcname = funcname.
            if sy-subrc eq 0.
              move <fmodule>-source to source.
            endif.
          endloop.
        endif.

* Source Includes
      when c_NAME_INCLUDES.

        field-symbols <include> type tinclude.
        data: include type tinclude-include.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        include =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'INCLUDE'
                                     ROOT = NODE-NODE ).
        if not area is initial
        and not include is initial.
          loop at p-fgroups assigning <fgroup>
          where area = area.
            read table <fgroup>-includes assigning <include>
              with key include = include.
            if sy-subrc eq 0.
              move <include>-source to source.
            endif.
          endloop.
        endif.

      when c_NAME_DYNPROS.

        field-symbols <dynpro> type tdynpro.
        data: dynnr type tdynpro-dynnr.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        dynnr =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'DYNNR'
                                     ROOT = NODE-NODE ).
        if not area is initial
        and not dynnr is initial.
          loop at p-fgroups assigning <fgroup>
          where area = area.
            read table <fgroup>-dynpros assigning <dynpro>
              with key dynnr = dynnr.
            if sy-subrc eq 0.
              move <dynpro>-FLOW_LOGIC to source.
            endif.
          endloop.
        endif.

    endcase.

  endmethod.                    "XML_cdata_source_classes

  method XML_cdata_source_programs.

    CONSTANTS:     c_NAME_NAME type string
                   value '/DATA/PROGRAMS/item',
                   c_NAME_DYNPROS type string
                   value '/DATA/PROGRAMS/item/DYNPROS/item'.

    field-symbols: <program> type tprogram.

    case node-name.

* Source Includes
      when c_NAME_name.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).

        if not name is initial.
          loop at p-programs assigning <program>
          where name = name.
            move <program>-source to source.
            exit.
          endloop.
        endif.

      when c_NAME_dynpros.

        field-symbols <dynpro> type tdynpro.
        data: dynnr type tdynpro-dynnr.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).
        dynnr =
        XMLDOC->FIND_SIMPLE_ELEMENT( NAME = 'DYNNR'
                                     ROOT = NODE-NODE ).
        if not name is initial
        and not dynnr is initial.
          loop at p-programs assigning <program>
          where name = name.
            read table <program>-dynpros assigning <dynpro>
              with key dynnr = dynnr.
            if sy-subrc eq 0.
              move <dynpro>-FLOW_LOGIC to source.
            endif.
          endloop.
        endif.

    endcase.

  endmethod.                    "XML_cdata_source_classes

  method XML_cdata_source_typegroups.

    CONSTANTS:     c_NAME_TNAME type string
                   value '/DATA/TYPEGROUPS/item'.

    field-symbols: <typegroup> type ttypegroup.

    case node-name.

* Source Includes
      when c_NAME_tname.

        NODE-NODELIST = NODE-NODE->GET_CHILDREN( ).

        if not tname is initial.
          loop at p-typegroups assigning <typegroup>
          where name = tname.
            move <typegroup>-source to source.
            exit.
          endloop.
        endif.

    endcase.

  endmethod.                    "XML_cdata_source_typegroups

endclass.                    "xml_download IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS txt_download DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class txt_download definition.

  public section.
    methods:   constructor,
             txt_source_classes
               importing p type tp
               exceptions error,
             txt_source_fgroups
               importing p type tp
               exceptions error,
             txt_source_programs
               importing p type tp
               exceptions error,
             txt_source_typegroups
               importing p type tp
               exceptions error.

* Class Methods
    class-methods: check_filename changing filename type string.

  private section.
    data: oasis type localfile.
    methods:   download_txt
               importing filename type string
                         source type seop_source
               exceptions error.
* statische Attribute
    class-data: zahl(3) type n.

endclass.                    "txt_download DEFINITION

*---------------------------------------------------------------------*
*       CLASS txt_download IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class txt_download implementation.

  method constructor.

    move path1 to oasis.

  endmethod.                    "constructor

  method download_txt.

    check ctxt eq 'X'.

    data: flg_file_exists,
          filename_xy type localfile.

* check, if file exists ?
    move filename to filename_xy.
    call method xml_download=>check_if_file_exists
      EXPORTING
        i_filename        = filename_xy
      IMPORTING
        e_flg_file_exists = flg_file_exists.

    if flg_file_exists eq 'X'.
* Popup Soll ueberschrieben werden ?

    endif.

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                = filename
      TABLES
        DATA_TAB                = source
      EXCEPTIONS
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        OTHERS                  = 22.

    if sy-subrc eq 0.
      write: / sy-subrc, 'Export to PC File', filename color col_total.
      new-line.
    else.
      write: / sy-subrc color col_negative,
            'Error Cant Export to PC File' color col_negative,
            filename color col_negative.
      new-line.
      raise error.
    endif.

  endmethod.                    "download_txt

  method check_filename.

* Dateiname ueberpruefen
    if filename ca '<>?:'.
      zahl = zahl + 1.
      replace ALL OCCURRENCES OF '<' in filename with space.
      replace ALL OCCURRENCES OF '>' in filename with space.
      replace ALL OCCURRENCES OF '?' in filename with space.
      replace ALL OCCURRENCES OF ':' in filename with space.
      condense filename no-gaps.
      concatenate filename '_' zahl into filename.
    endif.

  endmethod.                    "check_filename

  method txt_source_classes.

    field-symbols <class> type tclass.
    data: filename type string.

* Source Methoden
    field-symbols <method> type tymethod.
    loop at p-classes assigning <class>.
      loop at <class>-METHODS assigning <method>.
        concatenate C_ch_Class_method
                    '_'
                    <method>-CMPKEY-CLSNAME
                    '_'
                    <method>-CMPKEY-CMPNAME
                    into filename.

        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <method>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.
      endloop.
    endloop.

* Source Sektionen
    field-symbols: <sections> type line of tclass-sections.
    loop at p-classes assigning <class>.
      Loop at <class>-sections assigning <sections>.
        concatenate C_ch_Class_section
                    '_'
                    <class>-CIFKEY-CLSNAME
                    '_'
                    <sections>-incname
                    into filename.

        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <sections>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.
      Endloop.
    endloop.

* Source Redef
    field-symbols: <method_redef> type TREDEFINITION.
    loop at p-classes assigning <class>.
      loop at <class>-METHODS_REDEF assigning <method_redef>.
        concatenate C_ch_Class_redef
                    '_'
                    <method_redef>-method-CLSNAME
                    '_'
                    <method_redef>-method-CMPNAME
                    into filename.
        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <method_redef>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.
      endloop.
    endloop.

* Source Impl
    field-symbols: <method_impl> type TIMPLMETHOD.
    loop at p-classes assigning <class>.
      loop at <class>-METHODS_IMPL assigning <method_impl>.
        concatenate C_ch_Class_impl
                    '_'
                    <method_impl>-method-CLSNAME
                    '_'
                    <method_impl>-method-CMPNAME
                    into filename.

        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <method_impl>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.
      endloop.
    endloop.

* Source Locals
    field-symbols: <local> type line of tclass-locals.
    loop at p-classes assigning <class>.
      loop at <class>-locals assigning <local>.
        concatenate C_ch_Class_locals
                    '_'
                    <class>-CIFKEY-CLSNAME
                    '_'
                    <local>-NAME
                    into filename.

        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <local>-source_locals
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.

      endloop.
    endloop.

  endmethod.                    "XML_source_classes

  method txt_source_fgroups.

    field-symbols <fgroup> type tfgroup.
    data: filename type string.

* Source Funktionsbausteine
    field-symbols <fmodule> type tfmodule.
    loop at p-fgroups assigning <fgroup>.
      loop at <fgroup>-fmodules assigning <fmodule>.
        concatenate C_ch_Area_fmodule
                    '_'
                    <fmodule>-area
                    '_'
                    <fmodule>-funcname
                     into filename.
        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <fmodule>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.
      endloop.
    endloop.

* Source Includes
    field-symbols <include> type tinclude.
    loop at p-fgroups assigning <fgroup>.
      loop at <fgroup>-includes assigning <include>.
        concatenate C_ch_Area_Include
                    '_'
                    <fgroup>-area
                    '_'
                    <include>-include
                    into filename.
        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        call method download_txt
          EXPORTING
            filename = filename
            source   = <include>-source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.

      endloop.
    endloop.

* Source Dynpros
    field-symbols <dynpro> type tdynpro.
    data: source type seop_source,
          ls_source like line of source,
          ls_flow_logic like line of <dynpro>-flow_logic.

    loop at p-fgroups assigning <fgroup>.
      loop at <fgroup>-dynpros assigning <dynpro>.
        concatenate C_ch_Area_Dynpro
                    '_'
                    <fgroup>-area
                    '_'
                    <dynpro>-dynnr
                    into filename.
        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        Loop at <dynpro>-flow_logic into ls_flow_logic.
          move ls_flow_logic to ls_source.
          append ls_source to source.
        Endloop.

        call method download_txt
          EXPORTING
            filename = filename
            source   = source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.

        free source.

      endloop.
    endloop.

  endmethod.                    "XML_source_classes

  method txt_source_programs.

    field-symbols: <program> type tprogram.
    field-symbols <dynpro> type tdynpro.
    data: filename type string.

* Source Includes
    loop at p-programs assigning <program>.
      concatenate c_ch_program
                  '_'
                  <program>-name
                  into filename.
      call method check_filename
        CHANGING
          filename = filename.

      concatenate oasis filename '.TXT' into filename.

      call method download_txt
        EXPORTING
          filename = filename
          source   = <program>-source
        EXCEPTIONS
          error    = 1
          others   = 2.
      if sy-subrc ne 0.
        raise error.
      endif.
    endloop.

* Source Dynpros
    data: source type seop_source,
          ls_source like line of source,
          ls_flow_logic like line of <dynpro>-flow_logic.

    loop at p-programs assigning <program>.
      loop at <program>-dynpros assigning <dynpro>.
        concatenate c_ch_Program_Dynpro
                    '_'
                    <program>-name
                    '_'
                    <dynpro>-dynnr
                    into filename.
        call method check_filename
          CHANGING
            filename = filename.

        concatenate oasis filename '.TXT' into filename.

        Loop at <dynpro>-flow_logic into ls_flow_logic.
          move ls_flow_logic to ls_source.
          append ls_source to source.
        Endloop.

        call method download_txt
          EXPORTING
            filename = filename
            source   = source
          EXCEPTIONS
            error    = 1
            others   = 2.
        if sy-subrc ne 0.
          raise error.
        endif.

        free source.

      endloop.
    endloop.

  endmethod.                    "XML_source_classes

  method txt_source_typegroups.

    field-symbols: <typegroup> type ttypegroup.
    data: filename type string.
    data: source type seop_source,
          ls_source like line of source,
          ls_ty_source like line of <typegroup>-source.

* Source Typegroups
    loop at p-typegroups assigning <typegroup>.
      concatenate c_ch_typegroup
                  '_'
                  <typegroup>-name
                    into filename.
      call method check_filename
        CHANGING
          filename = filename.

      concatenate oasis filename '.TXT' into filename.

      Loop at <typegroup>-source into ls_ty_source.
        move ls_ty_source to ls_source.
        append ls_source to source.
      Endloop.

      call method download_txt
        EXPORTING
          filename = filename
          source   = source
        EXCEPTIONS
          error    = 1
          others   = 2.
      if sy-subrc ne 0.
        raise error.
      endif.

    endloop.

  endmethod.                    "txt_source_typegroups

endclass.                    "txt_download IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS choose_download DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_download definition.

  public section.
    methods choose changing t_tadir type ttadir_table.

  private section.
* Attribute
* Objekte, die zur Auswahl angezeigt werden
    DATA: begin of object.
    include type SEOSCOKEY.
    data: checkbox.
    data: end of object.
    DATA: objects like standard table of object.
* Hilfsvariablen
* Ulrich Streit
    DATA: w_tadir type tadir.

* Methoden
    methods: choice importing t_tadir type ttadir_table,
             accept_choice changing t_tadir type ttadir_table,
             warning_single_xml_file changing t_tadir type ttadir_table.

endclass.                    "choose_download DEFINITION

*---------------------------------------------------------------------*
*       CLASS choose_download IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class choose_download implementation.

  method warning_single_xml_file.

  endmethod.                    "warning_single_xml_file

  method choose.

* Auswahl
    call method choice
      EXPORTING
        t_tadir = t_tadir.
    if flag_POPUP_abg eq space.
* Auswahl auswerten
      call method accept_choice
        CHANGING
          t_tadir = t_tadir.
    else.
      free t_tadir.
      message S000(38) with 'Canceled'.
    endif.

  endmethod.                    "choose

  method choice.

* Funktionscodes
    data: FUNCTIONS type standard table of SVALP,
          w_function like line of functions.

    move 'OK' to w_function-func_name.
    move sy-cprog to w_function-prog_name.
    if download eq 'X'.
      move 'AUSWAHL_DOWNLOAD' to w_function-form_name.
    elseif upload eq 'X'.
      move 'AUSWAHL_UPLOAD' to w_function-form_name.
    endif.
    append w_function to functions.

* Objects fuellen
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_DOMA.
      move w_tadir-obj_name to object-clsname.
      move c_ch_domain to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_DTEL.
      move w_tadir-obj_name to object-clsname.
      move c_ch_delement to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_SHLP.
      move w_tadir-obj_name to object-clsname.
      move c_ch_searchelp to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
      where pgmid    = c_ta_R3TR
        and object   = c_ta_TABL.
      move w_tadir-obj_name to object-clsname.
      move c_ch_table to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_VIEW.
      move w_tadir-obj_name to object-clsname.
      move c_ch_viewname to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_TTYP.
      move w_tadir-obj_name to object-clsname.
      move c_ch_tabletype to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_TYPE.
      move w_tadir-obj_name to object-clsname.
      move c_ch_typegroup to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_INTF.
      move w_tadir-obj_name to object-clsname.
      move c_ch_Interface to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_CLAS.
      move w_tadir-obj_name to object-clsname.
      move C_ch_Class to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_PROG.
      move w_tadir-obj_name to object-clsname.
      move c_ch_program to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

    loop at t_tadir into w_tadir
      where pgmid    = c_ta_R3TR
        and object   = c_ta_FUGR.
      move w_tadir-obj_name to object-clsname.
      move c_ch_Fgroup to object-cmpname.
      move w_tadir-devclass to object-sconame.
      move 'X' to object-checkbox.
      append object to objects.
      clear object.
    endloop.

* Popup anzeigen
    if not objects[] is initial.
      move 'X' to flag_POPUP_abg.
      CALL FUNCTION 'POPUP_GET_SELECTION_FROM_LIST'
        EXPORTING
          DISPLAY_ONLY                 = 'X'
          TABLE_NAME                   = 'SEOSCOKEY'
          TITLE_BAR                    = 'Selection'
        TABLES
          LIST                         = objects
          FUNCTIONS                    = functions
        EXCEPTIONS
          NO_TABLEFIELDS_IN_DICTIONARY = 1
          NO_TABLE_STRUCTURE           = 2
          NO_TITLE_BAR                 = 3
          OTHERS                       = 4.

      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.

  endmethod.                    "auswahl

  method accept_choice.

    loop at t_tadir into w_tadir
     where pgmid    = c_ta_R3TR
       and object   = c_ta_CLAS.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_class
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_INTF.
      read table objects into object
      with key clsname = w_tadir-obj_name
           cmpname = c_ch_interface
           checkbox  = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_FUGR.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_Fgroup
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_PROG.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_program
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_DOMA.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_domain
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
        where pgmid    = c_ta_R3TR
          and object   = c_ta_DTEL.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_delement
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_TABL.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_table
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_VIEW.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_viewname
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_TTYP.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_tabletype
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_SHLP.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_searchelp
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.
    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_TYPE.
      read table objects into object
      with key clsname = w_tadir-obj_name
               cmpname = c_ch_typegroup
              checkbox = space.
      if sy-subrc eq 0.
        delete t_tadir.
      endif.
    endloop.

* Warnung ausgeben
    call method warning_single_xml_file
      CHANGING
        t_tadir = t_tadir.

  endmethod.                    "check_auswahl

endclass.                    "choose_sownload IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS crosssource DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class crosssource definition.

  public section.
    methods: constructor importing i_tadir type ttadir_table,
             crosssource exporting e_tadir type ttadir_table.

  private section.

* Attribute
    data: t_tadir type standard table of tadir,
          t_tadir_cross type standard table of tadir,
          w_tadir like line of t_tadir.

* Methoden
    methods: crossref_scan,
             crossref_cl_abap_compiler
             importing i_name type program
                       i_include type program optional
             changing ABAP_GLREFS_TAGS type TABAP_GLREFS_TAGS,
             crossref_tadir
             importing ABAP_GLREFS_TAGS type TABAP_GLREFS_TAGS,
             cross_friends_and_superclasses.

endclass.                    "crosssource DEFINITION

*---------------------------------------------------------------------*
*       CLASS crosssource IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class crosssource implementation.

  method constructor.

    t_tadir_cross = i_tadir.
    t_tadir       = i_tadir.

  endmethod.                    "constructor

  method crosssource.

* Lokale Datendeklaration
    data: lines1 type i,
          zaehler type i.

* Crossref ueber den Source machen
    do.
      if not grade is initial.
        if sy-index > grade.
          exit.
        endif.
      endif.
      if not t_tadir is initial.
        describe table t_tadir lines lines1.
        call method crossref_scan.
        zaehler = 0.
        loop at t_tadir into w_tadir.
          if zaehler < lines1.
            delete t_tadir.
            zaehler = zaehler + 1.
            exit.
          endif.
        endloop.
        loop at t_tadir into w_tadir.
          read table t_tadir_cross
              transporting no fields
               with key pgmid   = w_tadir-pgmid
                       object   = w_tadir-object
                       obj_name = w_tadir-obj_name.
          if sy-subrc ne 0.
            append w_tadir to t_tadir_cross.
          else.
            delete t_tadir.
          endif.
        endloop.
      else.
        exit.
      endif.
    enddo.

* Rueckgabe
    e_tadir = t_tadir_cross.

  endmethod.                    "crossref

  method crossref_scan.

    data: name type program.

* Klassen
    data: clskey type SEOCLSKEY.

* Compiler Cross Ref
    data: ABAP_GLREFS_TAGS type TABAP_GLREFS_TAGS.

* Programme
    loop at t_tadir into w_tadir
         where pgmid  eq c_ta_r3tr
           and object eq c_ta_prog.
      move w_tadir-obj_name to name.
      call method crossref_cl_abap_compiler
        EXPORTING
          i_name           = name
        CHANGING
          ABAP_GLREFS_TAGS = ABAP_GLREFS_TAGS.
    endloop.
* Funktionsgruppen
    loop at t_tadir into w_tadir
         where pgmid  eq c_ta_r3tr
           and object eq c_ta_fugr.
      concatenate c_sapl w_tadir-obj_name into name.
      call method crossref_cl_abap_compiler
        EXPORTING
          i_name           = name
        CHANGING
          ABAP_GLREFS_TAGS = ABAP_GLREFS_TAGS.
    endloop.
* Typegroups
    loop at t_tadir into w_tadir
         where pgmid  eq c_ta_r3tr
           and object eq c_ta_type.
      concatenate '%_C' w_tadir-obj_name into name.
      call method crossref_cl_abap_compiler
        EXPORTING
          i_name           = name
        CHANGING
          ABAP_GLREFS_TAGS = ABAP_GLREFS_TAGS.
    endloop.
* Klassen
    loop at t_tadir into w_tadir
         where pgmid  eq c_ta_r3tr
           and object eq c_ta_clas.
      move w_tadir-obj_name to clskey-clsname.
      CALL FUNCTION 'SEO_CLASS_GET_INCLUDE_BY_NAME'
        EXPORTING
          CLSKEY         = clskey
          LIMU           = seok_r3tr_class
*         INCTYPE        =
        IMPORTING
          PROGNAME       = name
              .
      call method crossref_cl_abap_compiler
        EXPORTING
          i_name           = name
        CHANGING
          ABAP_GLREFS_TAGS = ABAP_GLREFS_TAGS.
    endloop.
* Cross Ref auswerten
    call method crossref_tadir
      EXPORTING
        ABAP_GLREFS_TAGS = ABAP_GLREFS_TAGS.

* Superclasses and Friends
    call method cross_friends_and_superclasses.

  endmethod.                    "crossref_scan

  method cross_friends_and_superclasses.

* Friends
    data: w_refclsname type seofriends-refclsname.

    if friends eq 'X'.
      loop at t_tadir into w_tadir
          where pgmid   eq c_ta_r3tr
            and object eq c_ta_clas.
        select distinct refclsname from seofriends
               into w_refclsname
               where clsname eq w_tadir-obj_name.
          if w_refclsname(1) eq c_z
          or w_refclsname(1) eq c_y.
            if not w_refclsname eq w_tadir-obj_name.
              " nicht sich selbst
              read table t_tadir_cross into w_tadir
                   with key pgmid     = c_ta_r3tr
                            object   = c_ta_clas
                            obj_name = w_refclsname.
              if sy-subrc ne 0.
                select single * from tadir into w_tadir
                          where pgmid eq c_ta_r3tr
                            and object eq c_ta_clas
                            and obj_name eq w_refclsname.
                if sy-subrc eq 0.
                  append w_tadir to t_tadir.
                endif.
              endif.
            endif.
          endif.
        endselect.
      endloop.
    endif.

* Superklassen
    loop at t_tadir into w_tadir
    where pgmid   eq c_ta_r3tr
          and object eq c_ta_clas.
      clear w_refclsname.
      select refclsname from vseoextend
           up to 1 rows
             into w_refclsname
             where clsname eq w_tadir-obj_name.
      endselect.
      if w_refclsname(1) eq c_z
      or w_refclsname(1) eq c_y.
        if not w_refclsname eq w_tadir-obj_name.    " nicht sich selbst
          read table t_tadir_cross into w_tadir
                 with key pgmid     = c_ta_r3tr
                          object   = c_ta_clas
                          obj_name = w_refclsname.
          if sy-subrc ne 0.
            select single * from tadir into w_tadir
                      where pgmid eq c_ta_r3tr
                        and object eq c_ta_clas
                        and obj_name eq w_refclsname.
            if sy-subrc eq 0.
              append w_tadir to t_tadir.
            endif.
          endif.
        endif.
      endif.
    endloop.

  endmethod.                    "friends_and_superclasses

  method crossref_tadir.

    data: ABAP_GLREFS_TAG type TABAP_GLREFS_TAG,
          name type tfdir-pname.

    loop at ABAP_GLREFS_TAGS INTO ABAP_GLREFS_TAG.

      if ABAP_GLREFS_TAG-name(1) eq c_z
      or ABAP_GLREFS_TAG-name(1) eq c_y.

        case ABAP_GLREFS_TAG-TAG.

          when 'TY'.                                          " Type
* Datenelemente, Strukturen, Tabellentypen, Tabellen, Views
* Klassen, Interfaces
            loop at t_tadir_cross into w_tadir
            where pgmid eq c_ta_r3tr
            and ( object eq c_ta_tabl
            or object eq c_ta_ttyp
            or object eq c_ta_view
            or object eq c_ta_dtel
            or object eq c_ta_clas
            or object eq c_ta_intf )
            and obj_name eq ABAP_GLREFS_TAG-name.
            endloop.
            if sy-subrc ne 0.
              select * from tadir appending table t_tadir
              where pgmid eq c_ta_r3tr
              and ( object eq c_ta_tabl
              or object eq c_ta_ttyp
              or object eq c_ta_view
              or object eq c_ta_dtel
              or object eq c_ta_clas
              or object eq c_ta_intf )
              and obj_name eq ABAP_GLREFS_TAG-name.
            endif.

          when 'FU'.
            loop at t_tadir_cross into w_tadir
              where pgmid eq c_ta_r3tr
                and  object eq c_ta_fugr
                and obj_name eq ABAP_GLREFS_TAG-name.
            endloop.
            if sy-subrc ne 0.
              select single pname from tfdir into name
                             where funcname eq ABAP_GLREFS_TAG-name.
              if sy-subrc eq 0.
                move space to name(4).
                shift name left deleting leading space.
                select * from tadir appending table t_tadir
                where pgmid eq c_ta_r3tr
                    and  object eq c_ta_fugr
                    and obj_name eq name.
              endif.
            endif.

          when 'TP'.                                          " Typepool
            loop at t_tadir_cross into w_tadir
              where pgmid eq c_ta_r3tr
                and  object eq c_ta_TYPE
                and obj_name eq ABAP_GLREFS_TAG-name.
            endloop.
            if sy-subrc ne 0.
              select * from tadir appending table t_tadir
              where pgmid eq c_ta_r3tr
              and   object eq c_ta_type
              and   obj_name eq ABAP_GLREFS_TAG-name.
            endif.

          when 'PR'.
* z.B. perform in program
            if ABAP_GLREFS_TAG-glref-grade > 0.
              loop at t_tadir_cross into w_tadir
                where pgmid eq c_ta_r3tr
                  and object eq c_ta_prog
                  and obj_name eq ABAP_GLREFS_TAG-name.
              endloop.
              if sy-subrc ne 0.
                select * from tadir appending table t_tadir
                where pgmid  eq c_ta_r3tr
                and   object eq c_ta_prog
                and   obj_name eq ABAP_GLREFS_TAG-name.
              endif.
            endif.

        endcase.

      endif.

    endloop.

  endmethod.                    "crossref_tadir

  method crossref_cl_abap_compiler.

* ABAP Compiler
    DATA: CL_ABAP_COMPILER type ref to CL_ABAP_COMPILER,
          result type SCR_GLREFS,
          w_result like line of result,
          tag type SCR_TAG,
          ABAP_GLREFS_TAG type TABAP_GLREFS_TAG.

    create object CL_ABAP_COMPILER
          exporting p_name    = i_name
                    p_include = i_include.

*>>>>>> Beginn ersetzt US20060112  XYXY
*    CALL METHOD CL_ABAP_COMPILER->GET_ALL_GLOBAL_REFS
**      EXPORTING
**        P_TYPES  =
**        P_GRADES =
*       IMPORTING
*         P_RESULT = result
**                P_ERROR  =
*        .
    CALL METHOD CL_ABAP_COMPILER->GET_ALL_REFS
      EXPORTING
         P_LOCAL       = ' '
*        P_TESTCODE    = ' '
*        P_TYPES       =
*        P_GRADES      =
*        P_NO_INCLUDES =
*        P_EXTENDED    =
       IMPORTING
         P_RESULT      = result
*        P_ERROR       =
*        P_ERRORS      =
        .
*>>>>>> Ende ersetzt US20060112 XYXY

    loop at result into w_result.

      CALL METHOD CL_ABAP_COMPILER->GET_TAG_OF_FULL_NAME
        EXPORTING
          P_FULL_NAME                = w_result-full_name
        RECEIVING
          P_TAG                      = tag
        EXCEPTIONS
          INCLUDE_NOT_FOUND          = 1
          OBJECT_NOT_FOUND           = 2
          PROGRAM_FATAL_SYNTAX_ERROR = 3
          others                     = 4.

      IF SY-SUBRC <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        move w_result-full_name+4 to ABAP_GLREFS_TAG-name.
        move w_result to ABAP_GLREFS_TAG-glref.
        move tag to ABAP_GLREFS_TAG-tag.
        if ABAP_GLREFS_TAG-name NA '\:'.
          append ABAP_GLREFS_TAG to ABAP_GLREFS_TAGS.
        endif.
        clear ABAP_GLREFS_TAG.
      ENDIF.

    endloop.

    free CL_ABAP_COMPILER.

  endmethod.                    "crossref_cl_abap_compiler

endclass.                    "crossreference IMPLEMENTATION
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:57 am    Post subject: Reply with quote

Code:
*---------------------------------------------------------------------*
*       CLASS selectoptions DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class selectoptions definition.

  public section.
    methods selectoptions exporting e_tadir type ttadir_table.

  private section.
* Attribute
    data: t_tadir_dev type standard table of tadir,
          w_tadir_dev like line of t_tadir_dev,
          t_tadir type standard table of tadir,
          w_tadir like line of t_tadir_dev,
          rcrosssource type ref to crosssource.

* Methods
    methods: devclass,
             table,
             views,
             tabletypes,
             searchelps,
             domains,
             dataelements,
             classes,
             interfaces,
             fgroups,
             programs,
             typegroups,
             crossreference,
             friends_and_superclasses,
             friends,
             superclasses,
             interfaces_classes_comprisings,
             interfaces_from_classes,
             comprisings,
             includes_in_programs,
             tables_from_view,
             tables_from_searchelps,
             tables_from_tabletypes,
             includes_appends_of_tables,
             dataelements_of_tables,
             domains_of_dataelements.

endclass.                    "selectoptions DEFINITION

*---------------------------------------------------------------------*
*       CLASS selectoptions IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class selectoptions implementation.

  method selectoptions.

    free t_tadir.

* Objekte aus Entwicklungsklasse
    call method devclass.

* Domaenen
    call method domains.

* Dataelements
    call method dataelements.

* Tables (transparente Tabellen und Strukturen)
    call method table.

* View
    call method views.

* Tabletype
    call method tabletypes.

* Searchhelp
    call method searchelps.

* Klassen
    call method classes.

* Interfaces
    call method interfaces.

* Funktionsgruppen
    call method fgroups.

* Programme
    call method programs.

* Typegroups
    call method typegroups.

* Cross Reference
    if nocross eq space.
      call method crossreference.
    endif.

* Rueckgabe
    move t_tadir to e_tadir.

  endmethod.                    "select

  method crossreference.

* Cross Ref
    if complete eq 'X'.
* Source scannen
      create object rcrosssource exporting i_tadir = t_tadir.
      call method rcrosssource->crosssource
        IMPORTING
          e_tadir = t_tadir.
      if not grade is initial.
* Superklassen immer ueber alle Ebenen
        call method superclasses.
      endif.
    else.
* Friends and Superclasses
      call method friends_and_superclasses.
    endif.

* Interfaces zu Klassen und Comprisings
    call method interfaces_classes_comprisings.

* Includes in Programs
    call method includes_in_programs.

* Tables from view
    call method tables_from_view.

* Tables from tabletype
    call method tables_from_tabletypes.

* Tables from Searchhelp
    call method tables_from_searchelps.

* Includestrukturen
    call method includes_appends_of_tables.

* dataelements von tables
    call method dataelements_of_tables.

* Domaenen von Datenelementen
    call method domains_of_dataelements.

  endmethod.                    "crossreference

  method includes_in_programs.

* Includes muessen nicht nochmal gescannt werden
    data: prognam type tadir-obj_name.
    data: COMPO type standard table of SCOMPO,
          CROSS_REF type standard table of CROSS,
          INC type standard table of D010INC,
          w_inc like line of inc.

    loop at t_tadir into w_tadir
         where pgmid eq c_ta_r3tr
           and object eq c_ta_prog.

      move w_tadir-obj_name to prognam.
      CALL FUNCTION 'RS_PROGRAM_INDEX'
      EXPORTING
        PG_NAME               = prognam
*         WITHOUT_TREE        = ' '
*       IMPORTING
*         MESSAGE_CLASS       =
      TABLES
        COMPO               = compo
        CROSS_REF           = cross_ref
        INC                 = inc
      EXCEPTIONS
        SYNTAX_ERROR        = 1
        OTHERS              = 2
              .

      if sy-subrc eq 0.
        loop at inc into w_inc
        where include(1) eq c_z
           or include(1) eq c_y.
          if prognam ne w_inc-include.            "nicht sich selbst
            read table t_tadir
              transporting no fields
                 with key
                 pgmid    = c_ta_r3tr
                 object   = c_ta_prog
                 obj_name = w_inc-include.
            if sy-subrc ne 0.
              select * from tadir appending table t_tadir
              where pgmid eq c_ta_r3tr
              and   object eq c_ta_prog
              and   obj_name eq w_inc-include.
            endif.
          endif.
        endloop.
      endif.

    endloop.

  endmethod.                    "includes_in_programs

  method tables_from_view.

* Evtl. Tabellen und Strukturen hinzunehmen
    data: tabname type dd26s-tabname.

    loop at t_tadir into w_tadir
         where pgmid  eq c_ta_r3tr
           and object eq c_ta_view.

      select tabname from dd26s
      into tabname
      where viewname eq w_tadir-obj_name
        and ( tabname like c_z%
         or   tabname like c_y% )
        and as4local eq 'A'.                  "only active
        read table t_tadir into w_tadir
             with key pgmid  = c_ta_r3tr
                      object = c_ta_tabl
                      obj_name = tabname.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
          where pgmid    eq c_ta_r3tr
            and object   eq c_ta_tabl
            and obj_name eq tabname.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.
    endloop.

  endmethod.                    "tables_from_view

  method tables_from_tabletypes.

* Evtl. Strukturen nachlesen
    data: w_dd40l type dd40l.
    loop at t_tadir into w_tadir
      where pgmid  eq c_ta_r3tr
        and object eq c_ta_TTYP.
      select * from dd40l
      into w_dd40l
      where TYPENAME eq w_tadir-obj_name
        and datatype eq 'STRU'
        and AS4LOCAL eq 'A'                      " only active
        and ( rowtype like c_z%
        or    rowtype like c_y% ).
        read table t_tadir into w_tadir
                with key pgmid  = c_ta_r3tr
                         object = c_ta_TABL
                         obj_name = w_dd40l-rowtype.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                 where pgmid    eq c_ta_r3tr
                   and object   eq c_ta_TABL
                   and obj_name eq w_dd40l-rowtype.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.

    endloop.

  endmethod.                    "tables_from_tabletypes

  method tables_from_searchelps.

* abhaengige Tabelle dazunehmen
    data: selmethod type dd30l-selmethod.

    loop at t_tadir into w_tadir
    where pgmid  eq c_ta_r3tr
      and object eq c_ta_shlp.
      select selmethod from DD30L
      up to 1 rows
      into selmethod
      where SHLPNAME eq w_tadir-obj_name
        and ( selmethod like c_z%
         or   selmethod like c_y% )
        and AS4LOCAL eq 'A'.                         " only active
* Tabelle lesen
        select count( * ) from dd02l                 " unnoetig
               where tabname eq selmethod
               and ( tabclass eq c_ta_INTTAB
                or   tabclass eq c_ta_TRANSP
                or   tabclass eq c_ta_APPEND ).
        if sy-subrc eq 0.
          read table t_tadir into w_tadir
               with key pgmid    = c_ta_r3tr
                        object   = c_ta_tabl
                        obj_name = selmethod.
          if sy-subrc ne 0.
            select single * from tadir into w_tadir
                   where pgmid  eq c_ta_r3tr
                     and object eq c_ta_tabl
                     and obj_name eq selmethod.
            if sy-subrc eq 0.
              append w_tadir to t_tadir.
            endif.
          endif.
        endif.
      endselect.
    endloop.

  endmethod.                    "tables_from_searchelps

  method devclass.

    if not package is initial.
      select * from tadir into table t_tadir_dev
              where devclass in package
                and pgmid eq 'R3TR'.
* Geschachtelte Packages
      loop at t_tadir_dev into w_tadir_dev
              where object eq 'DEVC'
                and ( obj_name(1) eq c_z
                 or   obj_name(1) eq c_y ).
        select devclass from tdevc into w_tadir_dev-obj_name
               where parentcl eq w_tadir_dev-obj_name.
          select * from tadir appending table t_tadir_dev
                where devclass eq w_tadir_dev-obj_name
                  and pgmid eq 'R3TR'.
        endselect.
      endloop.
    endif.

  endmethod.                    "devclass

  method table.

    data: t_dd02l type standard table of dd02l,
          w_dd02l type dd02l.

    if not table[] is initial.
      select * from dd02l
      into table t_dd02l
      where tabname in table
      and ( tabclass eq c_ta_INTTAB
       or   tabclass eq c_ta_TRANSP
       or   tabclass eq c_ta_APPEND )
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd02l into w_dd02l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_TABL
                      and obj_name eq w_dd02l-tabname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_TABL
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_TABL
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd02l
               where tabname eq w_tadir_dev-obj_name
               and ( tabclass eq c_ta_INTTAB
                or   tabclass eq c_ta_TRANSP
                or   tabclass eq c_ta_APPEND )
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "table

  method includes_appends_of_tables.

    data: precfield type dd03l-precfield.
    loop at t_tadir into w_tadir
    where pgmid   eq c_ta_r3tr
      and object  eq c_ta_tabl.
      select distinct precfield from dd03l
      into precfield
      where tabname eq w_tadir-obj_name
          and ( fieldname eq '.INCLUDE'
           or   fieldname eq '.INCLU--AP' )
          and ( precfield like c_z%
           or   precfield like c_y% )
          and AS4LOCAL eq 'A'.                        " only active
        read table t_tadir into w_tadir
             with key pgmid  = c_ta_r3tr
                      object = c_ta_tabl
                      obj_name = precfield.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                          where pgmid    eq c_ta_r3tr
                            and object   eq c_ta_tabl
                            and obj_name eq precfield.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.
    endloop.

  endmethod.                    "includes_appends_of_tables

  method dataelements_of_tables.

* Dataelements und domains dazulesen
    data: rollname type dd03l-rollname.

    loop at t_tadir into w_tadir
      where pgmid   eq c_ta_r3tr
        and object  eq c_ta_tabl.

      select distinct rollname from dd03l
      into rollname
      where tabname eq w_tadir-obj_name
          and ( rollname like c_z%
           or   rollname like c_y% )
          and AS4LOCAL eq 'A'.                        " only active
        read table t_tadir into w_tadir
             with key pgmid    = c_ta_r3tr
                      object   = c_ta_dtel
                      obj_name = rollname.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                     where pgmid   eq c_ta_r3tr
                       and object  eq c_ta_dtel
                       and obj_name eq rollname.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.

    endloop.

  endmethod.                    "dataelements_of_tables

  method domains_of_dataelements.

* Domains dazulesen
    data: DOMNAME type dd04l-DOMNAME.

    loop at t_tadir into w_tadir
      where pgmid   eq c_ta_r3tr
        and object  eq c_ta_dtel.

* Domaene dazulesen
      select distinct domname from dd04l
          into domname
          where rollname eq w_tadir-obj_name
            and ( domname like c_z%
             or   domname like c_y% )
            and   AS4LOCAL eq 'A'.                    " only active
        read table t_tadir into w_tadir
             with key pgmid    = c_ta_r3tr
                      object   = c_ta_doma
                      obj_name = domname.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                     where pgmid   eq c_ta_r3tr
                       and object  eq c_ta_doma
                       and obj_name eq domname.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.

    endloop.

  endmethod.                    "domains_of_dataelements

  method views.

    data: t_dd02l type standard table of dd02l,
         w_dd02l type dd02l.

    if not view[] is initial.
      select * from dd02l
      into table t_dd02l
      where tabname in view
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd02l into w_dd02l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_VIEW
                      and obj_name eq w_dd02l-tabname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_VIEW
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_VIEW
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd02l
               where tabname eq w_tadir_dev-obj_name
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "views

  method tabletypes.

    data: t_dd40l type standard table of dd40l,
          w_dd40l type dd40l.

    if not tabletyp[] is initial.
      select * from dd40l
      into table t_dd40l
      where typename in tabletyp
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd40l into w_dd40l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_TTYP
                      and obj_name eq w_dd40l-typename.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_TTYP
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_TTYP
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd40l
               where typename eq w_tadir_dev-obj_name
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "tabletypes

  method searchelps.

    data: t_dd30l type standard table of dd30l,
          w_dd30l type dd30l.

    if not searchlp[] is initial.
      select * from dd30l
      into table t_dd30l
      where shlpname in searchlp
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd30l into w_dd30l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_SHLP
                      and obj_name eq w_dd30l-shlpname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_SHLP
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_SHLP
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd30l
               where shlpname eq w_tadir_dev-obj_name
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "searchelps

  method domains.

    data: t_dd01l type standard table of dd01l,
          w_dd01l type dd01l.

* Domaenen selektieren
    if not domain[] is initial.
      select * from dd01l
      into table t_dd01l
      where domname in domain
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd01l into w_dd01l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_DOMA
                      and obj_name eq w_dd01l-domname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_DOMA
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_DOMA
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd01l
               where domname eq w_tadir_dev-obj_name
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "domains

  method dataelements.

    data: t_dd04l type standard table of dd04l,
          w_dd04l type dd04l.

    if not delement[] is initial.
      select * from dd04l
      into table t_dd04l
      where rollname in delement
      and AS4LOCAL eq 'A'.                       " only active
      if sy-subrc eq 0.
        loop at t_dd04l into w_dd04l.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_DTEL
                      and obj_name eq w_dd04l-rollname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_DTEL
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_DTEL
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from dd04l
               where rollname eq w_tadir_dev-obj_name
               and AS4LOCAL eq 'A'.            " only active
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "dataelements

  method classes.

    data: t_vseoclass type standard table of vseoclass,
          w_vseoclass type vseoclass.

    if not clsname[] is initial.
      select distinct * from vseoclass
      into table t_vseoclass
      where clsname in clsname.
      if sy-subrc eq 0.
        loop at t_vseoclass into w_vseoclass.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_CLAS
                      and obj_name eq w_vseoclass-clsname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_CLAS
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_CLAS
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from vseoclass
               where clsname eq w_tadir_dev-obj_name.
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "classes

  method friends_and_superclasses.

    call method friends.

    call method superclasses.

  endmethod.                    "friends_and_superclasses

  method friends.

* Friends
    data: w_refclsname type seofriends-refclsname.

    if friends eq 'X'.
      loop at t_tadir into w_tadir
          where pgmid   eq c_ta_r3tr
            and object eq c_ta_clas.
        select distinct refclsname from seofriends
               into w_refclsname
               where clsname eq w_tadir-obj_name.
          if w_refclsname(1) eq c_z
          or w_refclsname(1) eq c_y.
            read table t_tadir into w_tadir
                 with key pgmid     = c_ta_r3tr
                          object   = c_ta_clas
                          obj_name = w_refclsname.
            if sy-subrc ne 0.
              select single * from tadir into w_tadir
                        where pgmid eq c_ta_r3tr
                          and object eq c_ta_clas
                          and obj_name eq w_refclsname.
              if sy-subrc eq 0.
                append w_tadir to t_tadir.
              endif.
            endif.
          endif.
        endselect.
      endloop.
    endif.

  endmethod.                    "friends

  method superclasses.

* Superclasses
    data: w_refclsname type seofriends-refclsname.

    loop at t_tadir into w_tadir
    where pgmid   eq c_ta_r3tr
          and object eq c_ta_clas.
      clear w_refclsname.
      select refclsname from vseoextend
        up to 1 rows
             into w_refclsname
             where clsname eq w_tadir-obj_name.
      endselect.
      if w_refclsname(1) eq c_z
      or w_refclsname(1) eq c_y.
        read table t_tadir into w_tadir
               with key pgmid     = c_ta_r3tr
                        object   = c_ta_clas
                        obj_name = w_refclsname.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                    where pgmid eq c_ta_r3tr
                      and object eq c_ta_clas
                      and obj_name eq w_refclsname.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endif.
    endloop.

  endmethod.                    "superclasses

  method interfaces.

    data: t_vseointerf type standard table of vseointerf,
          w_vseointerf type vseointerf.

    if not intname[] is initial.
      select * from vseointerf
      into table t_vseointerf
      where clsname in intname.
      if sy-subrc eq 0.
        loop at t_vseointerf into w_vseointerf.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_INTF
                      and obj_name eq w_vseointerf-clsname.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_INTF
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_INTF
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from vseointerf
               where clsname eq w_tadir_dev-obj_name.
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "interfaces

  method interfaces_classes_comprisings.

* Interfaces zu Klassen
    call method interfaces_from_classes.

* Comprisings
    call method comprisings.

  endmethod.                    "interfaces_classes_comprisings

  method interfaces_from_classes.

    data: w_refclsname type seofriends-refclsname.

* Interfaces zu Klassen
    loop at t_tadir into w_tadir
    where pgmid   eq c_ta_r3tr
      and object eq c_ta_clas.

      select  refclsname from vseoimplem
             into w_refclsname
             where clsname eq w_tadir-obj_name.
        if w_refclsname(1) eq c_z
        or w_refclsname(1) eq c_y.
          read table t_tadir into w_tadir
               with key pgmid    = c_ta_r3tr
                        object   = c_ta_intf
                        obj_name = w_refclsname.
          if sy-subrc ne 0.
            select single * from tadir into w_tadir
                   where pgmid    eq c_ta_r3tr
                     and object   eq c_ta_intf
                     and obj_name eq w_refclsname.
            if sy-subrc eq 0.
              append w_tadir to t_tadir.
            endif.
          endif.
        endif.
      endselect.
    endloop.

  endmethod.                    "interfaces_from_classes

  method comprisings.

    data: w_refclsname type seofriends-refclsname.

    loop at t_tadir into w_tadir
     where pgmid   eq c_ta_r3tr
       and object  eq c_ta_intf.

      select refclsname from vseocompri
             into w_refclsname
             where clsname eq w_tadir-obj_name.
        read table t_tadir into w_tadir
               with key pgmid    = c_ta_r3tr
                        object   = c_ta_intf
                        obj_name = w_refclsname.
        if sy-subrc ne 0.
          select single * from tadir into w_tadir
                 where pgmid    eq c_ta_r3tr
                   and object   eq c_ta_intf
                   and obj_name eq w_refclsname.
          if sy-subrc eq 0.
            append w_tadir to t_tadir.
          endif.
        endif.
      endselect.
    endloop.

  endmethod.                    "comprisings

  method fgroups.

    data: t_enlfdir type standard table of enlfdir,
          w_enlfdir type enlfdir.

    if not funcarea[] is initial.
      select distinct * from enlfdir
      into table t_enlfdir
      where area in funcarea.
      if sy-subrc eq 0.
        delete adjacent duplicates from t_enlfdir comparing area.
        loop at t_enlfdir into w_enlfdir.
          select single * from tadir into w_tadir
                    where pgmid  = c_ta_R3TR
                      and object = c_ta_FUGR
                      and obj_name eq w_enlfdir-area.
          append w_tadir to t_tadir.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_FUGR
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_FUGR
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from enlfdir
               where area eq w_tadir_dev-obj_name.
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "fgroups

  method programs.

    if not program[] is initial.
      select * from tadir
      appending table t_tadir
      where pgmid  = c_ta_R3TR
        and object = c_ta_PROG
        and obj_name in program.
      if sy-subrc eq 0.
        loop at t_tadir into w_tadir
        where pgmid  = c_ta_R3TR
        and object = c_ta_PROG.
          select count( * ) from REPOSRC
* >>>> Beginn ersetzt US20060112 XYXY
*              where progname eq w_tadir_dev-obj_name.
               where progname eq w_tadir-obj_name.
* >>>> Ende ersetzt US200060112 XYXY
          if sy-subrc ne 0.
            delete t_tadir.
          endif.
        endloop.
      endif.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_PROG
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_PROG
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
* Existiert es ueberhaupt
        select count( * ) from REPOSRC
               where progname eq w_tadir_dev-obj_name.
        if sy-subrc eq 0.
          move w_tadir_dev to w_tadir.
          append w_tadir to t_tadir.
        endif.
      endif.
    endloop.

  endmethod.                    "programs

  method typegroups.

    if not typgroup[] is initial.
* Achtung, hier werden auch inaktive selektiert
      select * from tadir
             appending table t_tadir
             where pgmid  eq  C_ta_R3TR
               and object eq  C_ta_TYPE
               and obj_name in typgroup.
    endif.
* Evtl. Objekte aus Entwicklungsklasse dazunehmen
    loop at t_tadir_dev into w_tadir_dev
        where pgmid eq c_ta_R3TR
        and  object eq C_ta_type
        and ( obj_name(1) eq c_z
         or   obj_name(1) eq c_y ).
      read table t_tadir into w_tadir
           with key pgmid    = c_ta_R3TR
                    object   = c_ta_type
                    obj_name =  w_tadir_dev-obj_name.
      if sy-subrc ne 0.
        move w_tadir_dev to w_tadir.
        append w_tadir to t_tadir.
      endif.
    endloop.

  endmethod.                    "typegroups

endclass.                    "selectoptions IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS select_and_download DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class select_and_download definition.

  public section.
    methods: constructor importing i_tadir type ttadir_table,
             set_tadir importing i_tadir type ttadir_table,
             select_and_download exceptions error.

  private section.

    data: t_tadir type ttadir_table,
          w_tadir type tadir,
          rxml_download type ref to xml_download,
          rtxt_download type ref to txt_download,
          index type tindex_table,
          w_index like line of index,
          xmlsize type sytabix.

    methods: read_domains
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_dataelements
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_tables
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_views
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_tabletypes
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_shlps
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_classes
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_interfaces
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_fgroups
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_programs
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             read_typegroups
             exceptions error
                        error_writing_file
                        error_determine_size_xml
                        xml_file_too_big,
*
             write_xml_file
             importing name type localfile
                       px type tp
             exporting e_filename type localfile
             exceptions error_writing_file,
*
             check_size_write_xml
             importing name type localfile
                       px type tp
                       i_flg_source type as4flag optional
             exporting e_filename type localfile
             exceptions xml_file_too_big
                        error_writing_file
                        error_determine_size_xml,
*
             check_size
             importing   px type tp
                         i_flg_source type as4flag optional
             exceptions xml_file_too_big
                        error_determine_size_xml.

endclass.                    "select_and_download DEFINITION

*---------------------------------------------------------------------*
*       CLASS select_and_download IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class select_and_download implementation.

  method constructor.

    t_tadir = i_tadir.

  endmethod.                    "constructor

  method set_tadir.

    t_tadir = i_tadir.

  endmethod.                    "constructor

  method check_size.

    data: lv_xmlsize type sytabix.

    call method rxml_download->get_size_of_xml
      EXPORTING
        p      = px
      IMPORTING
        size   = lv_xmlsize
      EXCEPTIONS
        error  = 1
        others = 2.

    if sy-subrc ne 0.
      message I000(38) display like 'I'
      with 'Error, Determing size of XML'.
      raise error_determine_size_xml.
    endif.

* Falls der Source zusЇtzlich in cdata abgespeichert wird
    if i_flg_source eq 'X'
    and cdata eq 'X'.
      lv_xmlsize = lv_xmlsize * 2.
    endif.

* Wird eine einzelne XML-Datei zu gross ?
    xmlsize = xmlsize + lv_xmlsize.
    if xmlsize > c_size_max_xml.
      message I000(38) display like 'I'
      with 'Data volume of single XML-file exceeded maximum size of'
      c_size_max_xml
      'Bytes'.
      raise xml_file_too_big.
    endif.

  endmethod.                    "check_size

  method check_size_write_xml.


* Gresse ueberpruefen
    if save eq 'X'.      " es wird alles in eine Datei geschrieben

      call method check_size
        EXPORTING
          px                       = px
          i_flg_source             = i_flg_source
        EXCEPTIONS
          xml_file_too_big         = 1
          error_determine_size_xml = 2
          others                   = 3.

      case sy-subrc.
        when 1.
          raise xml_file_too_big.
        when 2.
          raise error_determine_size_xml.
        when 3.
          raise error_determine_size_xml.
      endcase.

    endif.

    if sfiles eq 'X'.        " es wird in mehrere Dateien geschrieben
* in einzelene XML-Datei schreiben
      free domain.
      call method write_xml_file
        EXPORTING
          name               = name
          px                 = px
        IMPORTING
          e_filename         = e_filename
        EXCEPTIONS
          error_writing_file = 1
          others             = 2.
      if sy-subrc ne 0.
        message I000(38) display like 'I'
        with 'Error writing XML File'.
        raise error_writing_file.
      endif.

    endif.

  endmethod.                    "check_size_write_xml

  method write_xml_file.

    data: filename type string.
    data: oasis type localfile.

    move name to filename.

* Dateiname ueberpruefen
    call method txt_download=>check_filename
      CHANGING
        filename = filename.

    concatenate filename '.XML' into filename.

    concatenate path filename into oasis.

    call method rxml_download->download_XML_single_file
      EXPORTING
        p        = px
        filename = oasis
      EXCEPTIONS
        error    = 1
        others   = 2.
    if sy-subrc ne 0.
      raise error_writing_file.
    endif.

* Rueckgabewert
    move filename to e_filename.

  endmethod.                    "write_xml_file

  method select_and_download.

* XML Objekt erzeugen
    create object rxml_download.

* TXT Objekt erzeugen
    if ctxt eq 'X'.
      create object rtxt_download.
    endif.

* Kommentar: Die Reihenfolge ist entscheidend fuer den Upload !!!

* Fgruppen lesen
    call method read_fgroups
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Programs lesen
    call method read_programs
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Klassen lesen
    call method read_classes
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Interfaces lesen
    call method read_interfaces
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Typegroups lesen
    call method read_typegroups
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Tabletypes lesen
    call method read_tabletypes
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Views lesen
    call method read_views
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Tables (Strukturen, Tabellen) lesen
    call method read_tables
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Searchhelps lesen
    call method read_shlps
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Dataelements lesen
    call method read_dataelements
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

* Domaenen lesen
    call method read_domains
      EXCEPTIONS
        error                    = 1
        error_writing_file       = 2
        error_determine_size_xml = 3
        xml_file_too_big         = 4
        others                   = 5.
    if sy-subrc ne 0.
      raise error.
    endif.

*************************
* Index-Datei in XML schreiben
*************************
    if sfiles eq 'X'.

* Umsortieren, umgekehrte Reihenfolge (wegen dem Upload)
* Es soll die richtige Reihenfolge beim Upload garantiert sein
      DATA: index_work like index.
      Loop at index into w_index.
        insert w_index into index_work index 1.
        delete index.
      Endloop.
      index = index_work.
      free index_work.

**************************
* XML-Datei sichern
**************************
      call method rxml_download->download_XML_index_file
        EXPORTING
          index  = index
        EXCEPTIONS
          error  = 1
          others = 2.
      if sy-subrc ne 0.
        raise error.
      endif.
    endif.

**************************
* XML Dokument runterladen (alle Daten in einem XML-Dokument)
**************************
    if save eq 'X'.
      if not p is initial.
        call method rxml_download->download_XML.
      endif.
    endif.

**************************
* Objekt freigeben
**************************
    free rxml_download.

  endmethod.                    "selection

  method READ_DOMAINS.

    data: domain type tdomain,
          DOMA_NAME TYPE RPY_DOMA-DOMANAME,
          rdomain type ref to domain_read.
    data: px type tp.
    data: name type localfile.

    if not rdomain is bound.
      create object rdomain.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_DOMA.

      move w_tadir-obj_name to doma_name.
* domain lesen
      free domain.
      call method rdomain->read_domain
        EXPORTING
          doma_name = doma_name
        IMPORTING
          e_domain  = domain
        EXCEPTIONS
          error     = 1
          others    = 2.

      if not domain is initial
      and sy-subrc eq 0.

        download_message 'Domain' doma_name.

        concatenate c_ch_domain '_' doma_name into name.

        free px.
        append domain to px-domains.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_domain to w_index-type.
          move doma_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append domain to p-domains.
        endif.

      endif.

      free px.
      free domain.

    endloop.

  endmethod.                    "READ_DOMAINS

  method READ_DATAELEMENTS.

    data: dataelement type tdataelement,
          DATAELEMENT_NAME TYPE RPY_DTEL-DTELNAME,
          rdataelement type ref to dataelement_read.

    data: px type tp.
    data: name type localfile.

    if not rdataelement is bound.
      create object rdataelement.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_DTEL.
      move w_tadir-obj_name to dataelement_name.
      free dataelement.
      call method rdataelement->read_dataelement
        EXPORTING
          DATAELEMENT_NAME = DATAELEMENT_NAME
        IMPORTING
          e_dataelement    = dataelement
        EXCEPTIONS
          error            = 1
          others           = 2.

      if not dataelement is initial
      and sy-subrc eq 0.

        download_message 'Dataelement' dataelement_name.

        concatenate c_ch_delement '_' dataelement_name into name.

        free px.
        append dataelement to px-dataelements.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_delement to w_index-type.
          move dataelement_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append dataelement to p-dataelements.
        endif.

      endif.

      free px.
      free dataelement.

    endloop.

  endmethod.                    "READ_DATAELEMENTS

  method READ_TABLES.

    data: table type ttable,
          TABLE_NAME TYPE RPY_TABL-TABLNAME,
          rtable type ref to table_read.

    data: px type tp.
    data: name type localfile.

    if not rtable is bound.
      create object rtable.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_TABL.
      move w_tadir-obj_name to table_name.
      free table.
      call method rtable->read_table
        EXPORTING
          TABLE_NAME = TABLE_NAME
        IMPORTING
          e_table    = table
        EXCEPTIONS
          error      = 1
          others     = 2.

      if not table is initial
      and sy-subrc eq 0.

        download_message 'Table' table_name.

        concatenate c_ch_table '_' table_name into name.

        free px.
        append table to px-tables.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_table to w_index-type.
          move table_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append table to p-tables.
        endif.

      endif.

      free px.
      free table.

    endloop.


  endmethod.                    "READ_TABLES

  method READ_VIEWS.

    data: view type tview,
          VIEW_NAME TYPE DDOBJNAME,
          rview type ref to view_read.

    data: px type tp.
    data: name type localfile.

    if not rview is bound.
      create object rview.
    endif.

    loop at t_tadir into w_tadir
       where pgmid    = c_ta_R3TR
         and object   = c_ta_VIEW.
      move w_tadir-obj_name to view_name.
      free view.
      call method rview->read_view
        EXPORTING
          VIEW_NAME = VIEW_NAME
        IMPORTING
          e_view    = view
        EXCEPTIONS
          error     = 1
          others    = 2.

      if not view is initial
      and sy-subrc eq 0.

        download_message 'View' view_name.

        concatenate c_ch_viewname '_' view_name into name.

        free px.
        append view to px-views.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_viewname to w_index-type.
          move view_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append view to p-views.
        endif.

      endif.

      free px.
      free view.

    endloop.


  endmethod.                    "READ_VIEWS

  method READ_TABLETYPES.

    data: tabletype type ttabletype,
          tabletype_name TYPE DDOBJNAME,
          rtabletype type ref to tabletype_read.

    data: px type tp.
    data: name type localfile.

    if not rtabletype is bound.
      create object rtabletype.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_TTYP.
      move w_tadir-obj_name to tabletype_name.
      free tabletype.
      call method rtabletype->read_tabletype
        EXPORTING
          TABLETYPE_NAME = TABLETYPE_NAME
        IMPORTING
          e_tabletype    = tabletype
        EXCEPTIONS
          error          = 1
          others         = 2.

      if not tabletype is initial
      and sy-subrc eq 0.

        download_message 'Tabletype' tabletype_name.

        concatenate c_ch_tabletype '_' tabletype_name into name.

        free px.
        append tabletype to px-tabletypes.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_tabletype to w_index-type.
          move tabletype_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append tabletype to p-tabletypes.
        endif.

      endif.

      free px.
      free tabletype.

    endloop.


  endmethod.                    "READ_TABLETYPES

  method READ_SHLPS.

    data: shlp type tshlp,
          shlp_name TYPE DDOBJNAME,
          rshlp type ref to shlp_read.

    data: px type tp.
    data: name type localfile.

    if not rshlp is bound.
      create object rshlp.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_SHLP.
      move w_tadir-obj_name to shlp_name.
      free shlp.
      call method rshlp->read_shlp
        EXPORTING
          SHLP_NAME = SHLP_NAME
        IMPORTING
          e_shlp    = shlp
        EXCEPTIONS
          error     = 1
          others    = 2.

      if not shlp is initial
      and sy-subrc eq 0.

        download_message 'Searchhelp' shlp_name.

        concatenate c_ch_searchelp '_' shlp_name into name.

        free px.
        append shlp to px-searchhelps.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_searchelp to w_index-type.
          move shlp_name to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append shlp to p-searchhelps.
        endif.

      endif.

      free px.
      free shlp.

    endloop.

  endmethod.                    "READ_SHLPS

  method READ_CLASSES.

    data: class type tclass.
    data: CIFKEY type  SEOCLSKEY.
    data: rclass type ref to class_read.

    data: px type tp.
    data: name type localfile.

    if not rclass is bound.
      create object rclass.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_CLAS.
      CIFKEY-CLSNAME = w_tadir-obj_name.
      free class.
      call method rclass->READ_CLASS
        EXPORTING
          i_cifkey = cifkey
        IMPORTING
          e_class  = class
        EXCEPTIONS
          error    = 1
          others   = 2.

      if not class is initial
      and sy-subrc eq 0.

        download_message 'Class' cifkey-clsname.

        concatenate C_ch_Class '_' cifkey-clsname into name.

        free px.
        append class to px-classes.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
            i_flg_source             = 'X'
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.


        if sfiles eq 'X'.
* Index-Datei erzeugen
          move C_ch_Class to w_index-type.
          move cifkey-clsname to w_index-name.
          append w_index to index.
        endif.

* Source in einzelne TXT-Datei schreiben
        if ctxt eq 'X'.
          call method rtxt_download->txt_source_classes
            EXPORTING
              p      = px
            EXCEPTIONS
              error  = 1
              others = 2.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append class to p-classes.
        endif.

      endif.

      free px.
      free class.

    endloop.

  endmethod.                    "READ_CLASSES
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Dec 30, 2007 11:57 am    Post subject: Reply with quote

Code:

  METHOD read_interfaces.

* Lokale Datendeklaration
    data: inter type tinter,
          intkey type SEOCLSKEY,
          rinterface type ref to interface_read.

    data: px type tp.
    data: name type localfile.

    if not rinterface is bound.
      create object rinterface.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_INTF.
      intkey-clsname = w_tadir-obj_name.
      free inter.
      call method rinterface->read_interface
        EXPORTING
          i_intkey = intkey
        IMPORTING
          e_inter  = inter
        EXCEPTIONS
          error    = 1
          others   = 2.

      if not inter is initial
      and sy-subrc eq 0.

        download_message 'Interface' intkey-clsname.

        concatenate c_ch_Interface '_' intkey-clsname into name.

        free px.
        append inter to px-inters.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_Interface to w_index-type.
          move intkey-clsname to w_index-name.
          append w_index to index.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append inter to p-inters.
        endif.

      endif.

      free px.
      free inter.

    endloop.

  ENDMETHOD.                    "read_interfaces

  method read_fgroups.

    DATA:  w_fgroup type tfgroup,
           area type enlfdir-area,
           rfgroup type ref to fgroup_read.

    data: px type tp.
    data: name type localfile.

    if not rfgroup is bound.
      create object rfgroup.
    endif.

    loop at t_tadir into w_tadir
         where pgmid    = c_ta_R3TR
           and object   = c_ta_FUGR.
      move w_tadir-obj_name to area.
      free w_fgroup.
      call method rfgroup->read_fgroup
        EXPORTING
          i_area   = area
        IMPORTING
          e_fgroup = w_fgroup
        EXCEPTIONS
          error    = 1
          others   = 2.
      if not w_fgroup is initial
      and sy-subrc eq 0.

        download_message 'Area' area.

        concatenate c_ch_Fgroup '_' area into name.

        free px.
        append w_fgroup to px-fgroups.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
            i_flg_source             = 'X'
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_Fgroup to w_index-type.
          move area to w_index-name.
          append w_index to index.
        endif.

* Source in einzelne TXT Datei schreiben
        if ctxt eq 'X'.
          call method rtxt_download->txt_source_fgroups
            EXPORTING
              p      = px
            EXCEPTIONS
              error  = 1
              others = 2.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append w_fgroup to p-fgroups.
        endif.

      endif.

      free px.
      free w_fgroup.

    endloop.

  endmethod.                    "read_fgroups

  method read_programs.

    data: program type tprogram,
          progname type trdir-name,
          rprogram type ref to program_read.

    data: px type tp.
    data: name type localfile.

    if not rprogram is bound.
      create object rprogram.
    endif.

    loop at t_tadir into w_tadir
    where pgmid    = c_ta_R3TR
      and object   = c_ta_PROG.
      move w_tadir-obj_name to progname.
      free program.
      call method rprogram->read_program
        EXPORTING
          i_progname = progname
        IMPORTING
          e_program  = program
        EXCEPTIONS
          error      = 1
          others     = 2.
      if not program is initial
      and sy-subrc eq 0.

        download_message 'Program' progname.

        concatenate c_ch_program '_' progname into name.

        free px.
        append program to px-programs.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
            i_flg_source             = 'X'
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_program to w_index-type.
          move progname to w_index-name.
          append w_index to index.
        endif.

* Source in einzelne TXT Datei schreiben
        if ctxt eq 'X'.
          call method rtxt_download->txt_source_programs
            EXPORTING
              p      = px
            EXCEPTIONS
              error  = 1
              others = 2.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append program to p-programs.
        endif.

      endif.

      free px.
      free program.

    endloop.

  endmethod.                    "read_programs

  method read_typegroups.

    data: typegroup type ttypegroup,
          typegroup_name TYPE trdir-name,
          rtypegroup type ref to typegroup_read.

    data: px type tp.
    data: name type localfile.

    if not rtypegroup is bound.
      create object rtypegroup.
    endif.

    loop at t_tadir into w_tadir
      where pgmid    = c_ta_R3TR
        and object   = c_ta_TYPE.
      move w_tadir-obj_name to typegroup_name.
* typegroup lesen
      free typegroup.
      call method rtypegroup->read_typegroup
        EXPORTING
          typegroup_name = typegroup_name
        IMPORTING
          e_typegroup    = typegroup
        EXCEPTIONS
          error          = 1
          others         = 2.

      if not typegroup is initial
      and sy-subrc eq 0.

        download_message 'Typegroup' typegroup_name.

        concatenate c_ch_typegroup '_' typegroup_name into name.

        free px.
        append typegroup to px-typegroups.

        clear w_index-file.
        call method check_size_write_xml
          EXPORTING
            name                     = name
            px                       = px
            i_flg_source             = 'X'
          IMPORTING
            e_filename               = w_index-file
          EXCEPTIONS
            xml_file_too_big         = 1
            error_writing_file       = 2
            error_determine_size_xml = 3
            others                   = 4.
        case sy-subrc.
          when 1.
            raise xml_file_too_big.
          when 2.
            raise error_writing_file.
          when 3.
            raise error_determine_size_xml.
          when 4.
            raise error.
        endcase.

        if sfiles eq 'X'.
* Index-Datei erzeugen
          move c_ch_typegroup to w_index-type.
          move typegroup_name to w_index-name.
          append w_index to index.
        endif.

* Source in einzelne TXT Datei schreiben
        if ctxt eq 'X'.
          call method rtxt_download->txt_source_typegroups
            EXPORTING
              p      = px
            EXCEPTIONS
              error  = 1
              others = 2.
        endif.

* In globale Gesamtvariable speichern
        if sfiles ne 'X'.
          append typegroup to p-typegroups.
        endif.

      endif.

      free px.
      free domain.

    endloop.

  endmethod.                    "read_typegroups

endclass.                    "process IMPLEMENTATION

*---------------------------------------------------------------------*
*       CLASS start_download DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_download definition.

  public section.
    methods: constructor,
             download.

  private section.
* Data
    data: t_tadir type ttadir_table.

    DATA: rselectoptions type ref to selectoptions,
          rchoose_download type ref to choose_download,
          rselect_and_download type ref to select_and_download.

endclass.                    "download DEFINITION

*---------------------------------------------------------------------*
*       CLASS download IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class start_download implementation.

  method constructor.

    create object rselectoptions.

  endmethod.                    "constructor

  method download.

* Slelektion bestimmen
    call method rselectoptions->selectoptions
      IMPORTING
        e_tadir = t_tadir.

    if not t_tadir is initial.
* Auswahlliste
      create object rchoose_download.
      call method rchoose_download->choose
        CHANGING
          t_tadir = t_tadir.
      if not t_tadir is initial.
* Daten selektieren und in Dateien abspeichern
        create object rselect_and_download
        EXPORTING
            i_tadir = t_tadir.
        call method rselect_and_download->select_and_download
          EXCEPTIONS
            error  = 1
            others = 2.
      endif.
    endif.

  endmethod.                    "downloading

endclass.                    "start_download IMPLEMENTATION

***********************************************************************
* Formroutinen
***********************************************************************
*&--------------------------------------------------------------------*
*&      Form  main
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form main.

  if download eq 'X'.

***********************************************************************
* Download
***********************************************************************
    perform download.

  elseif upload eq 'X'.

***********************************************************************
* Upload
***********************************************************************
    perform upload.

  endif.                                                    "US28022005

endform . " main


*&--------------------------------------------------------------------*
*&      Form  download
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form download.

  data: start_download type ref to start_download.

  create object start_download.
  call method start_download->download.

endform.                    "download

*&--------------------------------------------------------------------*
*&      Form  upload
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form upload.

* Klassenvariabeln
  DATA: rxml_upload type ref to xml_upload.
  create object rxml_upload.

* Referenzen
  data: start_upload_single type ref to start_upload_single.
  data: start_upload_index type ref to start_upload_index.

* Index Datei
  data: index type tindex_table.

******************
* einzelne Datei einspielen
******************
  if up_sing eq 'X'.
* Upload einer einzelnen Datei
    call method rxml_upload->upload_xml_file
      EXPORTING
        filename   = pcfile1
      IMPORTING
        dataobject = p
      EXCEPTIONS
        error      = 1
        others     = 2.
    if sy-subrc eq 0.
* Daten einspielen
      if not p is initial.
        create object start_upload_single.
        call method start_upload_single->upload.
      endif.
    endif.
*****************
* mehrere Dateien ueber index-Datei einspielen
*****************
  elseif up_index eq 'X'.
    call method rxml_upload->upload_xml_file
      EXPORTING
        filename   = pcfile1
      IMPORTING
        dataobject = index
      EXCEPTIONS
        error      = 1
        others     = 2.
    if sy-subrc eq 0.
* Upload ueber Index-Datei
      if not index is initial.
        create object start_upload_index
            exporting
              i_index       = index
              i_rxml_upload = rxml_upload.
* Daten einspielen
        call method start_upload_index->upload.
      endif.
    endif.
  endif.

endform.                    "upload

*&---------------------------------------------------------------------*
*&      Form  auswahl_download
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM auswahl_download
TABLES SELECTION STRUCTURE SHVALUE.

* Funktion wird dynamisch aufgerufen
  move space to flag_POPUP_abg.

endform.                    "auswahl_download

*&---------------------------------------------------------------------*
*&      Form  auswahl_upload
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM auswahl_upload
TABLES SELECTION STRUCTURE SHVALUE.

* Funktion wird dynamisch aufgerufen
  move space to flag_POPUP_abg.

endform.                    "auswahl_download

*&---------------------------------------------------------------------*
*&      Form  check_selection
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM check_selection .

  if download eq 'X'.

    if  clsname[] is initial
    and funcarea[] is initial
    and program[] is initial
    and package[] is initial
    and intname[] is initial
    and domain[]  is initial
    and delement[] is initial
    and table[] is initial
    and view[] is initial
    and tabletyp[] is initial
    and searchlp[] is initial
    and typgroup[] is initial.
      message E000(38) with 'Please restrict selection'.
    endif.

* Entwicklungsklassen ueberpruefen
    loop at package.
      if not package-low is initial.
        if package-low(1) ne c_z
        and package-low(1) ne c_y
        and package-low ne '$TMP'.
          message E000(38) with 'Package must begin with Z or Y'.
        endif.
      endif.
      if not package-high is initial.
        if package-high(1) ne c_z
        and package-high(1) ne c_y
        and package-high ne '$TMP'.
          message E000(38) with 'Package must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Table ueberpruefen
    loop at table.
      if not table-low is initial.
        if table-low(1) ne c_z
        and table-low(1) ne c_y.
          message E000(38) with 'Table must begin with Z or Y'.
        endif.
      endif.
      if not table-high is initial.
        if table-high(1) ne c_z
        and table-high(1) ne c_y.
          message E000(38) with 'Table must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Domain ueberpruefen
    loop at domain.
      if not domain-low is initial.
        if domain-low(1) ne c_z
        and domain-low(1) ne c_y.
          message E000(38) with 'Domain must begin with Z or Y'.
        endif.
      endif.
      if not domain-high is initial.
        if domain-high(1) ne c_z
        and domain-high(1) ne c_y.
          message E000(38) with 'Domain must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Dataelement ueberpruefen
    loop at delement.
      if not delement-low is initial.
        if delement-low(1) ne c_z
        and delement-low(1) ne c_y.
          message E000(38) with 'Delement must begin with Z or Y'.
        endif.
      endif.
      if not delement-high is initial.
        if delement-high(1) ne c_z
        and delement-high(1) ne c_y.
          message E000(38) with 'Delement must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Tabletyp ueberpruefen
    loop at tabletyp.
      if not tabletyp-low is initial.
        if tabletyp-low(1) ne c_z
        and tabletyp-low(1) ne c_y.
          message E000(38) with 'Tabletype must begin with Z or Y'.
        endif.
      endif.
      if not tabletyp-high is initial.
        if tabletyp-high(1) ne c_z
        and tabletyp-high(1) ne c_y.
          message E000(38) with 'Tabletype must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Dataelement ueberpruefen
    loop at searchlp.
      if not searchlp-low is initial.
        if searchlp-low(1) ne c_z
        and searchlp-low(1) ne c_y.
          message E000(38) with 'Searchhelp must begin with Z or Y'.
        endif.
      endif.
      if not searchlp-high is initial.
        if searchlp-high(1) ne c_z
        and searchlp-high(1) ne c_y.
          message E000(38) with 'Searchelp must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Klassenname ueberpruefen
    loop at clsname.
      if not clsname-low is initial.
        if clsname-low(1) ne c_z
        and clsname-low(1) ne c_y.
          message E000(38) with 'Classname must begin with Z or Y'.
        endif.
      endif.
      if not clsname-high is initial.
        if clsname-high(1) ne c_z
        and clsname-high(1) ne c_y.
          message E000(38) with 'Classname must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Funktionsgruppenname ueberpruefen
    loop at funcarea.
      if not funcarea-low is initial.
        if funcarea-low(1) ne c_z
        and funcarea-low(1) ne c_y.
          message E000(38) with 'Funcarea must begin with Z or Y'.
        endif.
      endif.
      if not funcarea-high is initial.
        if funcarea-high(1) ne c_z
        and funcarea-high(1) ne c_y.
          message E000(38) with 'Funcarea must begin with Z or Y'.
        endif.
      endif.
    endloop.

* Programs
    loop at program.
      if not program-low is initial.
        if program-low(1) ne c_z
        and program-low(1) ne c_y.
          message E000(38) with 'Program must begin with Z or Y'.
        endif.
      endif.
      if not program-high is initial.
        if program-high(1) ne c_z
        and program-high(1) ne c_y.
          message E000(38) with 'Program must begin with Z or Y'.
        endif.
      endif.
    endloop.

***********************
* Falls es in eine Datei geschrieben werden soll
    if save eq 'X'.
      if disp_onl is initial.
        if pcfile is initial.
          message E000(38) with 'Please enter path and filename'.
        else.
* check, if .XML
          perform check_if_xml_file using pcfile.
        endif.
      endif.
    endif.

***********************
* Falls es in mehrere Dateien aufgeteilt wird
    if sfiles eq 'X'
    or ctxt   eq 'X'.

* Pfad kontrollieren, ob initial
      if path is initial
      and sfiles eq 'X'.
        message E000(38) with 'Please enter path'.
      endif.

* Ist der Pfad fuer die .txt Dateien initial
      if path1 is initial
      and ctxt eq 'X'.
        message E000(38) with 'Please enter path'.
      endif.

* Pfad ueberpruefen
      data: length type i,
            path_xy like path,
            index_xy type sy-index.
      do 2 times.
        clear path_xy.
        move sy-index to index_xy.
        if index_xy eq 1.
          if sfiles eq 'X'.
            move path to path_xy.
          else.
            continue.
          endif.
        else.
          if ctxt eq 'X'.
            move path1 to path_xy.
          else.
            continue.
          endif.
        endif.

        if not path_xy is initial.
          length = strlen( path_xy ).
          if length < 3.
            message E000(38) with 'Please enter valid path'.
          endif.
          perform check_if_not_xml_file using path_xy.
          length = length - 1.
          if path_xy+length(1) ne '/'
          and path_xy+length(1) ne '\'.
            concatenate path_xy '\' into path_xy.
          endif.

          if index_xy eq 1.
            move path_xy to path.
          else.
            move path_xy to path1.
          endif.
        endif.

      enddo.

    endif.

* Macht keinen Sinn in diesem Fall das Pgm. aufzurufen
    if sfiles is initial
    and save is initial
    and display is initial
    and calledit is initial
    and ctxt is initial.
      message E000(38) with 'Please mark at least one checkbox'.
    endif.

  endif.

  if upload eq 'X'.
    DATA: file_oasis type localfile.
    move pcfile1 to file_oasis.
    SET LOCALE LANGUAGE 'D'.
    translate file_oasis to upper case.
    SET LOCALE LANGUAGE sy-langu.
* file_index.xml hochladen: Dateiname ueberpruefen
    if up_index eq 'X'.
      if not file_oasis cs c_file_index_xml.
        message E000(38) with 'Please enter file_index.xml'.
      endif.
      if not postfix is initial.
        clear postfix.
        message E000(38)
        with 'Please dont enter Postfix for file_index.xml uploads'.
      endif.
    endif.
* check, if .XML
    perform check_if_xml_file using pcfile1.
  endif.

ENDFORM.                    " check_selection

*&--------------------------------------------------------------------*
*&      Form  check_if_xml_file
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->FILENAME_XMtext
*---------------------------------------------------------------------*
form check_if_xml_file using filename_xml type localfile.

  data: length_xy type i.
  data: string_xy type string.

  length_xy = strlen( filename_xml ).
  if length_xy < 8.
    message E000(38) with 'Please enter valid path and .xml filename'.
  endif.
  length_xy = length_xy - 4.
  string_xy = filename_xml+length_xy(4).
  SET LOCALE LANGUAGE 'D'.
  translate string_xy to upper case.
  SET LOCALE LANGUAGE sy-langu.
  if string_xy ne '.XML'.
    message E000(38) with 'Please enter valid path and .xml filename'.
  endif.

endform.                    "check_if_xml_file

*&--------------------------------------------------------------------*
*&      Form  check_if_not_xml_file
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->FILENAME_XMtext
*---------------------------------------------------------------------*
form check_if_not_xml_file using filename_xml type localfile.

  data: length_xy type i.
  data: string_xy type string.

  length_xy = strlen( filename_xml ).
  if length_xy < 4.
    exit.
  endif.
  length_xy = length_xy - 4.
  string_xy = filename_xml+length_xy(4).
  SET LOCALE LANGUAGE 'D'.
  translate string_xy to upper case.
  SET LOCALE LANGUAGE sy-langu.
  if string_xy eq '.XML'.
    message E000(38) with 'Please enter valid path'.
  endif.

endform.                    "check_if_xml_file


*&---------------------------------------------------------------------*
*&      Form  on_value_request
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM on_value_request_pcfile1.

  data: filename type RLGRAP-FILENAME.

  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
*   EXPORTING
*     PROGRAM_NAME        = SYST-REPID
*     DYNPRO_NUMBER       = SYST-DYNNR
*     FIELD_NAME          = ' '
*     STATIC              = ' '
*     MASK                = ' '
    CHANGING
      FILE_NAME           = filename
    EXCEPTIONS
      MASK_TOO_LONG       = 1
      OTHERS              = 2
            .

  if sy-subrc eq 0.
    move filename to pcfile1.
  endif.

ENDFORM.                    " on_value_request
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary -> Migration All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.