ZCL_CI_DIFFERENCE_ENGINE      Release 620                System DEV                            
        _______________________________________________________________________________________________
                                                                                                       
                                                                                                       
                                                                                                       
        Class: ZCL_CI_DIFFERENCE_ENGINE                                                                
                                                                                                       
        Status: Active                                                                                 
                                                                                                       
        Attributes                                                                                     
        Description: Detect difference in two identical structures of data                             
        Instantiation: Public                                                                          
        Not final                                                                                      
        Not released                                                                                   
        Fixed pt.arithmetic                                                                            
        Category: General object type                                                                  
        Package: ZPOM_REPORTING                                                                        
        Original lang.: EN                                                                             
                                                                                                       
        Created by: GGQXD0                                                                             
        Created on: 05/05/2004                                                                         
        Last changed by: GGQXD0                                                                        
        Last changed on: 05/12/2004                                                                    
                                                                                                       
        Attribute                                                                                      
                                                                                                       
        Public attributes                                                                              
        Attrib.        Cat   Description           Ref. type           Init. value                     
        __________________________________________________________________________                     
        CHANGEDFIELDS  Inst  Table of field names  TYPE FIELDNAME_TAB                                  
        FIELDS         Inst  Table of field names  TYPE FIELDNAME_TAB                                  
        __________________________________________________________________________                     
        Private attribute                                                                              
        Attrib.        Cat   Description                                 Ref. type          Init.      
        value                                                                                          
        ______________________________________________________________________________________________ 
        _                                                                                              
        I_RSTRUCINFO   Inst  Component description of ABAP/4 types       TYPE I_RSTRUCINFO             
        I_RFIELDLIST   Inst  ABAP/4: List of global fields of a program  TYPE I_RFIELDLIST             
        PROGNAME       Inst  ABAP program name                           TYPE PROGNAME                 
        TEMP_PROGNAME  Inst  ABAP program name                           TYPE PROGNAME                 
        ______________________________________________________________________________________________ 
        _                                                                                              
        Methods                                                                                        
        Public methods                                                                                 
        CONSTRUCTOR                                                                                    
        Description: CONSTRUCTOR                                                                       
        Instance mthd                                                                                  
                                                                                                       
        Importing parameter                                                                            
         VALUE(PROGNAME) TYPE PROGNAME  (ABAP Program Name)                                            
         REF_STRUCTURE TYPE STRUKNAME  (Name of a structure)                                           
                                                                                                       
        METHOD constructor .                                                                           
          DATA: l_rstrucinfo TYPE rstrucinfo.                                                          
          DATA: l_rfieldlist TYPE rfieldlist.                                                          
          DATA: num_comps TYPE n.                                                                      
          DATA: code TYPE TABLE OF char72.                                                             
                                                                                                       
                                                                                                       
        _______________________________________________________________________________________________
        07/27/2004                      15:55:55                        1                              
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        ZCL_CI_DIFFERENCE_ENGINE      Release 620                System DEV                            
        _______________________________________________________________________________________________
                                                                                                       
                                                                                                       
          DATA: code_line TYPE char72.                                                                 
          DATA: prog(8), msg(120), lin(3), wrd(10), off(3).                                            
          APPEND:                                                                                      
          'PROGRAM SUBPOOL.'                                        TO code,                           
          'types:'                                                  TO code,                           
          'begin of line_type,'                                     TO code.                           
        *get components of the named structure                                                         
          CALL FUNCTION 'GET_COMPONENT_LIST'                                                           
               EXPORTING                                                                               
                    program    = progname                                                              
                    fieldname  = ref_structure                                                         
               TABLES                                                                                  
                    components = i_rstrucinfo.                                                         
          LOOP AT i_rstrucinfo INTO l_rstrucinfo.                                                      
            CLEAR code_line.                                                                           
            CASE l_rstrucinfo-type.                                                                    
              WHEN 'C'.                                                                                
                CONCATENATE l_rstrucinfo-compname '(' l_rstrucinfo-leng'),'                            
                  INTO code_line.                                                                      
                APPEND code_line TO code.                                                              
              WHEN 'D'.                                                                                
                CONCATENATE l_rstrucinfo-compname 'type dats,'                                         
                  INTO code_line SEPARATED BY space.                                                   
                APPEND code_line TO code.                                                              
              WHEN 'I'.                                                                                
                CONCATENATE l_rstrucinfo-compname 'type i,'                                            
                INTO code_line SEPARATED BY space.                                                     
                APPEND code_line TO code.                                                              
              WHEN 'N'.                                                                                
                CONCATENATE l_rstrucinfo-compname '(' l_rstrucinfo-leng')'                             
                INTO code_line.                                                                        
              CONCATENATE code_line 'type n,' INTO code_line SEPARATED BY space.                       
                APPEND code_line TO code.                                                              
              WHEN 'P'.                                                                                
                CONCATENATE l_rstrucinfo-compname '(' l_rstrucinfo-leng')'                             
                INTO code_line.                                                                        
                CONCATENATE code_line 'type p decimals'                                                
                         l_rstrucinfo-decs ','                                                         
                INTO code_line SEPARATED BY space.                                                     
                APPEND code_line TO code.                                                              
              WHEN 'T'.                                                                                
                CONCATENATE l_rstrucinfo-compname 'type t,'                                            
                INTO code_line SEPARATED BY space.                                                     
                APPEND code_line TO code.                                                              
            ENDCASE.                                                                                   
          ENDLOOP.                                                                                     
          APPEND:                                                                                      
          'end of line_type.'                                     TO code,                             
          'data:'                                                 TO code,                             
          'string_1 type string,'                                 TO code,                             
          'string_2 type string,'                                 TO code,                             
          'line1 type line_type,'                                 TO code,                             
          'line2 type line_type.'                                 TO code,                             
          'data: changed_fields type FIELDNAME_TAB.'              TO code,                             
                                                                                                       
                                                                                                       
        _______________________________________________________________________________________________
        07/27/2004                      15:55:55                        2                              
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        ZCL_CI_DIFFERENCE_ENGINE      Release 620                System DEV                            
        _______________________________________________________________________________________________
                                                                                                       
                                                                                                       
          'data: fieldnames     type FIELDNAME_TAB.'              TO code,                             
          'data: begin of fieldstruc,'                            TO code,                             
          'fieldname type fieldname,'                             TO code,                             
          'end of fieldstruc.'                                    TO code,                             
          'data: fieldname type fieldname.'                       TO code,                             
          'field-symbols: '                                       TO code,                             
          '<comp1> type any, '                                    TO code,                             
          '<comp2> type any. '                                    TO code,                             
          'form set_fieldnames'                                   TO code,                             
          'using fieldname type fieldname.'                       TO code,                             
          'append fieldname to fieldnames.'                       TO code,                             
          'endform. '                                             TO code,                             
          'form difference  '                                     TO code,                             
          'tables changed_fields structure fieldstruc  '          TO code,                             
          'using string_1 type string                  '          TO code,                             
          '      string_2 type string.                 '          TO code,                             
          'line1 = string_1.           '                          TO code,                             
          'line2 = string_2.           '                          TO code,                             
          'loop at fieldnames into fieldname.'                    TO code,                             
          'assign component sy-tabix of '                         TO code,                             
          'structure line1 to <comp1>.  '                         TO code,                             
          'assign component sy-tabix of '                         TO code,                             
          'structure line2 to <comp2>.  '                         TO code,                             
          'if <comp1> ne <comp2>.'                                TO code,                             
          'append fieldname to changed_fields.'                   TO code,                             
          'endif.'                                                TO code,                             
          'endloop.'                                              TO code,                             
          'endform.'                                              TO code.                             
          GENERATE SUBROUTINE POOL code NAME prog                                                      
          MESSAGE msg                                                                                  
          LINE lin                                                                                     
          WORD wrd                                                                                     
          OFFSET off.                                                                                  
          IF sy-subrc <> 0.                                                                            
            WRITE: / 'Error during generation in line', lin,                                           
                   / msg,                                                                              
                   / 'Word:', wrd, 'at offset', off.                                                   
          ELSE.                                                                                        
            me->temp_progname = prog.                                                                  
            LOOP AT i_rstrucinfo INTO l_rstrucinfo.                                                    
              PERFORM set_fieldnames IN PROGRAM (prog)                                                 
              USING  l_rstrucinfo-compname.                                                            
              append l_rstrucinfo-compname to me->fields.                                              
            ENDLOOP.                                                                                   
          ENDIF.                                                                                       
        ENDMETHOD.                                                                                     
                                                                                                       
                                                                                                       
        GET_CHANGED_FIELDS                                                                             
        Description: Get the changed fields                                                            
        Instance mthd                                                                                  
        Importing parameter                                                                            
         STRING_1 TYPE STRING  (STRING 1)                                                              
         STRING_2 TYPE STRING  (STRING 2)                                                              
                                                                                                       
                                                                                                       
        _______________________________________________________________________________________________
        07/27/2004                      15:55:55                        3                              
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        ZCL_CI_DIFFERENCE_ENGINE      Release 620                System DEV                            
        _______________________________________________________________________________________________
                                                                                                       
                                                                                                       
        Returning parameter                                                                            
         VALUE(CHANGED_FIELDS) TYPE FIELDNAME_TAB  (Table of field names)                              
                                                                                                       
        METHOD get_changed_fields.                                                                     
          CLEAR me->changedfields.                                                                     
          PERFORM difference IN PROGRAM (temp_progname)                                                
          TABLES changed_fields                                                                        
          USING string_1 string_2.                                                                     
          me->changedfields = changed_fields.                                                          
        ENDMETHOD.                                                                                     
                                                                                                       
        Redefined Methods                                                                              
                                                                                                       
                                                                                                       
        Local definitions                                                                              
                                                                                                       
        *"* local classes for public class ZCL_CI_DIFFERENCE_ENGINE                                    
        *"* use this source file for any type declarations you need                                    
        *"* in your method implementation                                                              
                TYPES: i_rstrucinfo TYPE STANDARD TABLE OF rstrucinfo.                                 
                TYPES: i_rfieldlist TYPE STANDARD TABLE OF rfieldlist.                                 
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        _______________________________________________________________________________________________
        07/27/2004                      15:55:55                        4                              
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        ZCL_CI_DIFFERENCE_ENGINE      Release 620                System DEV                            
        _______________________________________________________________________________________________
                                                                                                       
                                                                                                       
        Overview                                                                                       
                                                                                                       
        Attributes                                                      1                              
                                                                                                       
        Attribute                                                       1                              
         Public attributes                                              1                              
                                                                                                       
         Private attribute                                              1                              
        Methods                                                         1                              
                                                                                                       
         Public methods                                                 1                              
          CONSTRUCTOR                                                   1                              
          GET_CHANGED_FIELDS                                            3                              
         Redefined Methods                                              4                              
        Local definitions                                               4                              
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
                                                                                                       
        _______________________________________________________________________________________________
        07/27/2004                      15:55:55                        5