class-pool. TYPES: i_rstrucinfo TYPE STANDARD TABLE OF rstrucinfo. TYPES: i_rfieldlist TYPE STANDARD TABLE OF rfieldlist. TYPES: i_rstrucinfo TYPE STANDARD TABLE OF rstrucinfo. TYPES: i_rfieldlist TYPE STANDARD TABLE OF rfieldlist. TYPES: i_rstrucinfo TYPE STANDARD TABLE OF rstrucinfo. TYPES: i_rfieldlist TYPE STANDARD TABLE OF rfieldlist. TYPES: i_rstrucinfo TYPE STANDARD TABLE OF rstrucinfo. TYPES: i_rfieldlist TYPE STANDARD TABLE OF rfieldlist. class ZCL_CI_DIFFERENCE_ENGINE definition public create public . public section. data CHANGEDFIELDS type FIELDNAME_TAB . data FIELDS type FIELDNAME_TAB . methods CONSTRUCTOR importing value(PROGNAME) type PROGNAME !REF_STRUCTURE type STRUKNAME . methods GET_CHANGED_FIELDS importing !STRING_1 type STRING !STRING_2 type STRING returning value(CHANGED_FIELDS) type FIELDNAME_TAB . protected section. private section. data I_RSTRUCINFO type I_RSTRUCINFO . data I_RFIELDLIST type I_RFIELDLIST . data PROGNAME type PROGNAME . data TEMP_PROGNAME type PROGNAME . endclass. "ZCL_CI_DIFFERENCE_ENGINE definition class ZCL_CI_DIFFERENCE_ENGINE implementation. METHOD constructor . DATA: l_rstrucinfo TYPE rstrucinfo. DATA: l_rfieldlist TYPE rfieldlist. DATA: num_comps TYPE n. DATA: code TYPE TABLE OF char72. 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, '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, ' type any, ' TO code, ' 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 . ' TO code, 'assign component sy-tabix of ' TO code, 'structure line2 to . ' TO code, 'if ne .' 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. 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. endclass. "ZCL_CI_DIFFERENCE_ENGINE implementation