Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Comparing programs

Former Member
0 Likes
1,344

I want to compare a program to another program reg. the differences in the version. Is it possible?

(I don't mean a comparison of a program to a version in Quality or Production, I know about that, I mean if it is possible to compare two different programs).

Any help is appreciated.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,212

hi Nuren,

Use T-code <b>SE39</b>

11 REPLIES 11
Read only

Former Member
0 Likes
1,213

hi Nuren,

Use T-code <b>SE39</b>

Read only

0 Likes
1,212

From SE38, click utilities, more utilities, split screen editor.

Regards,

Rich Heilman

Read only

0 Likes
1,212

Rich/santosh,

So it is comparing visually by scrolling?

Is it possible to compare it like the one we do for version management comparison (this gives a detailed list of where the changes are made, where the lines differeing etc)

Thanks.

Read only

0 Likes
1,212

hi Nuren,

I guess that way it is possible only by using Version Management option...i.e, UTILITIES->VERSION->VERSION MANAGEMENT

Read only

0 Likes
1,212

Yes, this is a visual comparison. I don't think that there is way to compare(like version manangement) across two different programs.

Regards,

Rich Heilman

Read only

0 Likes
1,212

Hi Nuren,

Please close this thread by marking helpful answers

in case if your problem is resloved.

Read only

Former Member
0 Likes
1,212

I concurr with Santosh, SE39 has a nice way of comparing two programs. You can even choose whether you want the default, active, or inactive programs.

Read only

0 Likes
1,212

I know this is not a fool proof way. But maybe it will server your immediate purpose.



report  zrich_0005.

types: begin of source ,
        line(100) type c,
       end of source.

data: isource1 type table of source with header line.
data: isource2 type table of source with header line.

parameters: p_prg1 type trdir-name.
parameters: p_prg2 type trdir-name.

read report p_prg1 into isource1.
read report p_prg2 into isource2.

loop at isource1.
  read table isource2 index sy-tabix.
  check sy-subrc = 0.
  if isource1 <> isource2.

    write:/ 'Source code inconsistant!!!!'.
    write:/ isource1.
    write:/ isource2.
    skip 1.
  endif.

endloop.

Regards,

Rich Heilman

Read only

0 Likes
1,212

Guys,

I had a requirement to compare all programs including SAP standard programs as part of our Upgrade project from 4.6c to ECC6.0

I was browsing the web for my solution. I found some help in one of the forum (sorry I forgot the person's name) and finally developed a program using that help. It really come up well. So, I thought I will share this with all ABAP Guru's every where in the world.

Note: It took 16 hours approx. to compare 2.47 million programs in ECC6.0

Please send me your suggestion to improve this further.

REPORT z_mass_compare_program.

  • Tables

TABLES : rpy_prog. " rfcdes.

  • Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SKIP.

SELECT-OPTIONS: s_prn1 FOR rpy_prog-progname.

PARAMETERS : p_rfcde1 TYPE rfcdes-rfcdest.

PARAMETERS : p_rfcde2 TYPE rfcdes-rfcdest.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002,

BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(32) text-100 FOR FIELD p_check.

PARAMETER: p_check AS CHECKBOX.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

  • DATA DECLARATION

TYPES : BEGIN OF gty_finaltab,

progname TYPE progname ,

version1 TYPE versno ,

version2 TYPE versno ,

changeon1 TYPE rdir_udate,

changeon2 TYPE rdir_udate,

changeby1 TYPE unam ,

changeby2 TYPE unam ,

count_abap1 TYPE sytabix ,

count_abap2 TYPE sytabix ,

error_abap TYPE sytabix ,

error_text TYPE sytabix ,

gen_text(60) TYPE c ,

selk TYPE c ,

color TYPE lvc_t_scol, " color

END OF gty_finaltab.

DATA : gt_source1 TYPE STANDARD TABLE OF abapsource.

DATA : gt_source11 TYPE STANDARD TABLE OF abaptxt255.

DATA : ls_source1 TYPE abaptxt255.

DATA : gt_source2 TYPE STANDARD TABLE OF abapsource.

DATA : gt_source22 TYPE STANDARD TABLE OF abaptxt255.

DATA : ls_source2 TYPE abaptxt255.

DATA : gt_textelem1 TYPE STANDARD TABLE OF textpool.

DATA : ls_textelem1 TYPE textpool.

DATA : gt_textelem2 TYPE STANDARD TABLE OF textpool.

DATA : ls_textelem2 TYPE textpool.

DATA : ls_progdata1 TYPE rpy_prog.

DATA : ls_progdata2 TYPE rpy_prog.

DATA : ld_error_abap TYPE sytabix.

DATA : ld_error_text TYPE sytabix.

DATA : ld_count_abap1 TYPE sytabix.

DATA : ld_count_abap2 TYPE sytabix.

DATA : ld_count1 TYPE sytabix.

DATA : ld_percent TYPE i.

DATA : ld_text(50) TYPE c.

DATA : ld_text_pro(4) TYPE c.

DATA : ld_i_save TYPE c.

DATA : gt_finaltab TYPE STANDARD TABLE OF gty_finaltab.

DATA : ls_finaltab TYPE gty_finaltab.

DATA : ls_bdcdata TYPE bdcdata.

DATA : gt_bdcdata TYPE STANDARD TABLE OF bdcdata.

      • ALV DATA ***

CONSTANTS : lc_pick(7) TYPE c VALUE 'PICK'.

TYPE-POOLS: slis.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

ls_fieldcat TYPE slis_fieldcat_alv,

id_layout TYPE slis_layout_alv,

repname TYPE syrepid,

gt_events TYPE slis_t_event.

  • Cell color

DATA: ls_cellcolor_tab TYPE lvc_s_scol,

lt_cellcolor_tab TYPE lvc_t_scol,

ls_color TYPE lvc_s_colo.

  • CONSTANTS : lc_fname TYPE char7 VALUE 'STATUS'.

  • START-OF-SELECTION

START-OF-SELECTION.

  • Check Whether You Want To Check SAP Standard Programs

IF p_check IS INITIAL.

SORT s_prn1.

DELETE ADJACENT DUPLICATES FROM s_prn1.

DESCRIBE TABLE s_prn1 LINES ld_count1.

  • Loop Around The Program Internal Table

LOOP AT s_prn1.

CLEAR: ld_error_abap , ld_error_text, ld_count_abap1,

ld_count_abap2, ls_finaltab.

PERFORM progressbar USING sy-tabix ld_count1.

  • Initialise The Variables

CLEAR: gt_source1, gt_source11, gt_textelem1, ls_progdata1.

  • Get Local Version Of The Program

CALL FUNCTION 'RPY_PROGRAM_READ'

  • DESTINATION p_rfcde1

EXPORTING

language = sy-langu

program_name = s_prn1-low

with_includelist = ''

only_source = ' '

only_texts = ' '

read_latest_version = 'X'

with_lowercase = ' '

IMPORTING

prog_inf = ls_progdata1

TABLES

SOURCE = gt_source1

source_extended = gt_source11

textelements = gt_textelem1

EXCEPTIONS

cancelled = 1

not_found = 2

permission_error = 3

communication_failure = 4

system failure = 5.

CASE sy-subrc.

WHEN 0.

  • Delete Empty Lines

DELETE gt_source11 WHERE LINE IS INITIAL.

  • Ignore Program Name In Text

DELETE gt_textelem1 WHERE id = 'R'.

DELETE gt_textelem1 WHERE id = 'H'.

  • Number Of Lines In ABAP Program

DESCRIBE TABLE gt_source11[] LINES ld_count_abap1 .

ENDCASE.

  • Initialise The Variables

CLEAR: gt_source2, gt_source22, gt_textelem2, ls_progdata2.

  • Second RFC Call For Program Details

  • Get Remote Version

CALL FUNCTION 'RPY_PROGRAM_READ'

DESTINATION p_rfcde2

EXPORTING

language = sy-langu

program_name = s_prn1-low

with_includelist = ''

only_source = ' '

only_texts = ' '

read_latest_version = 'X'

with_lowercase = ' '

IMPORTING

prog_inf = ls_progdata2

TABLES

SOURCE = gt_source2

source_extended = gt_source22

textelements = gt_textelem2

EXCEPTIONS

cancelled = 1

not_found = 2

permission_error = 3

communication_failure = 4

system failure = 5.

CASE sy-subrc.

WHEN 0.

  • Delete Empty Lines

DELETE gt_source22 WHERE LINE IS INITIAL.

  • Ignore Program Name In Text

DELETE gt_textelem2 WHERE id = 'R'.

DELETE gt_textelem2 WHERE id = 'H'.

  • Number Of Lines In ABAP Program

DESCRIBE TABLE gt_source22[] LINES ld_count_abap2 .

ENDCASE.

  • Remove All Spaces

LOOP AT gt_source11 INTO ls_source1.

CONDENSE ls_source1-line NO-GAPS.

MODIFY gt_source11 FROM ls_source1 TRANSPORTING line.

ENDLOOP.

LOOP AT gt_source22 INTO ls_source2.

CONDENSE ls_source2-line NO-GAPS .

MODIFY gt_source22 FROM ls_source2 TRANSPORTING line.

ENDLOOP.

  • Compare ABAP SOURCE

CLEAR ld_error_abap.

LOOP AT gt_source11 INTO ls_source1.

READ TABLE gt_source22 INTO ls_source2 INDEX sy-tabix.

TRANSLATE ls_source1-line TO LOWER CASE.

TRANSLATE ls_source2-line TO LOWER CASE.

IF ls_source2-line NE ls_source1-line.

ld_error_abap = ld_error_abap + 1.

ENDIF.

ENDLOOP.

  • Compare Texts

CLEAR ld_error_text.

LOOP AT gt_textelem1 INTO ls_textelem1.

READ TABLE gt_textelem2 INTO ls_textelem2 INDEX sy-tabix.

TRANSLATE ls_textelem2-entry TO LOWER CASE.

TRANSLATE ls_textelem1-entry TO LOWER CASE.

IF ls_textelem2-id NE ls_textelem1-id OR

ls_textelem2-key NE ls_textelem1-key OR

ls_textelem2-entry NE ls_textelem1-entry.

ld_error_text = ld_error_text + 1.

ENDIF.

ENDLOOP.

  • Put to ALV output table

ls_finaltab-progname = s_prn1-low.

ls_finaltab-version1 = ls_progdata1-version.

ls_finaltab-version2 = ls_progdata2-version.

ls_finaltab-changeon1 = ls_progdata1-mod_date.

ls_finaltab-changeon2 = ls_progdata2-mod_date.

ls_finaltab-changeby1 = ls_progdata1-mod_user.

ls_finaltab-changeby2 = ls_progdata2-mod_user.

ls_finaltab-count_abap1 = ld_count_abap1.

ls_finaltab-count_abap2 = ld_count_abap2.

ls_finaltab-error_abap = ld_error_abap.

  • Adding the color.

IF ls_finaltab-error_abap IS INITIAL.

ls_color-col = 5. "green

ELSE.

ls_color-col = 6. "red

ENDIF.

CLEAR ls_cellcolor_tab.

CLEAR lt_cellcolor_tab.

CLEAR ls_finaltab-color.

ls_cellcolor_tab-fname = 'ERROR_ABAP'. " Field name to color

ls_color-int = 1.

ls_color-inv = 0.

MOVE ls_color TO ls_cellcolor_tab-color.

INSERT ls_cellcolor_tab INTO TABLE lt_cellcolor_tab.

INSERT lines of lt_cellcolor_tab INTO TABLE ls_finaltab-color.

ls_finaltab-error_text = ld_error_text.

  • Adding the color.

IF ls_finaltab-error_text IS INITIAL.

ls_color-col = 5. "green

ELSE.

ls_color-col = 6. "red

ENDIF.

CLEAR ls_cellcolor_tab.

CLEAR ls_finaltab-color.

ls_cellcolor_tab-fname = 'ERROR_TEXT'." Field name to color

ls_color-int = 1.

ls_color-inv = 0.

MOVE ls_color TO ls_cellcolor_tab-color.

INSERT ls_cellcolor_tab INTO TABLE lt_cellcolor_tab.

INSERT lines of lt_cellcolor_tab INTO TABLE ls_finaltab-color.

  • Move to internal table

APPEND ls_finaltab TO gt_finaltab.

ENDLOOP.

ELSE.

  • Compare SAP Programs

PERFORM compare_sap_programs.

ENDIF.

CLEAR ls_finaltab.

  • Display Only If There Is Any Difference

PERFORM display_output.

  • Build ALV Report

PERFORM fieldcat.

PERFORM f4000_events CHANGING gt_events.

PERFORM layout_build USING id_layout.

PERFORM grid_disp.

************************************************************************

  • FORM f4000_events_init *

************************************************************************

FORM f4000_events CHANGING i_events TYPE slis_t_event.

  • Local Variable

DATA: line_event TYPE slis_alv_event.

CLEAR line_event.

line_event-name = 'USER_COMMAND'.

line_event-form = 'F4300_USER_COMMAND'.

APPEND line_event TO i_events.

ENDFORM. " f3000_events_init

************************************************************************

  • FORM layout_build *

************************************************************************

FORM layout_build USING p_layout TYPE slis_layout_alv.

p_layout-box_fieldname = 'SELK'. " Checkbox

p_layout-get_selinfos = 'X'.

p_layout-f2code = 'PICK' . " Double Click Function

p_layout-key_hotspot = 'X'.

p_layout-info_fieldname = 'COL'.

p_layout-coltab_fieldname = 'COLOR'.

p_layout-zebra = 'X'. " Stripes

p_layout-colwidth_optimize = 'X'. " Optimize

ENDFORM. " layout_build

************************************************************************

  • FORM GRIDDISP *

************************************************************************

FORM grid_disp.

  • Assign Current Program Name

repname = sy-repid.

  • Main Call To Display The Output In ALV Grid

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = repname

is_layout = id_layout

it_fieldcat = gt_fieldcat[]

i_default = 'X'

i_save = ld_i_save

it_events = gt_events[]

TABLES

t_outtab = gt_finaltab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " grid_disp

************************************************************************

  • Form fieldcat *

************************************************************************

FORM fieldcat.

DATA: pos TYPE i.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'PROGNAME'.

ls_fieldcat-seltext_m = 'Program Name'.

ls_fieldcat-seltext_s = 'Program Name'.

ls_fieldcat-seltext_l = 'Program Name'.

ls_fieldcat-ddictxt = 'L'.

ls_fieldcat-hotspot = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'VERSION1'.

ls_fieldcat-seltext_m = 'Version 1'.

ls_fieldcat-seltext_s = 'Version 1'.

ls_fieldcat-seltext_l = 'Version 1'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'VERSION2'.

ls_fieldcat-seltext_m = 'Version 2'.

ls_fieldcat-seltext_s = 'Version 2'.

ls_fieldcat-seltext_l = 'Version 2'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'CHANGEON1'.

ls_fieldcat-seltext_m = 'Changed On 1'.

ls_fieldcat-seltext_s = 'Changed On 1'.

ls_fieldcat-seltext_l = 'Changed On 1'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'CHANGEON2'.

ls_fieldcat-seltext_m = 'Changed On 2'.

ls_fieldcat-seltext_s = 'Changed On 2'.

ls_fieldcat-seltext_l = 'Changed On 2'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'CHANGEBY1'.

ls_fieldcat-seltext_m = 'Changed By 1'.

ls_fieldcat-seltext_s = 'Changed By 1'.

ls_fieldcat-seltext_l = 'Changed By 1'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'CHANGEBY2'.

ls_fieldcat-seltext_m = 'Changed By 2'.

ls_fieldcat-seltext_s = 'Changed By 2'.

ls_fieldcat-seltext_l = 'Changed By 2'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'COUNT_ABAP1'.

ls_fieldcat-seltext_m = 'Count 1'.

ls_fieldcat-seltext_s = 'Count 1'.

ls_fieldcat-seltext_l = 'Count 1'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'COUNT_ABAP2'.

ls_fieldcat-seltext_m = 'Count 2'.

ls_fieldcat-seltext_s = 'Count 2'.

ls_fieldcat-seltext_l = 'Count 2'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'ERROR_ABAP'.

ls_fieldcat-seltext_m = 'ABAP Diff.'.

ls_fieldcat-seltext_s = 'ABAP Diff.'.

ls_fieldcat-seltext_l = 'ABAP Diff.'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'ERROR_TEXT'.

ls_fieldcat-seltext_m = 'Text Diff.'.

ls_fieldcat-seltext_s = 'Text Diff.'.

ls_fieldcat-seltext_l = 'Text Diff.'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-tabname = 'gt_fulltab'.

ls_fieldcat-fieldname = 'GEN_TEXT'.

ls_fieldcat-seltext_m = 'Status'.

ls_fieldcat-seltext_s = 'Status'.

ls_fieldcat-seltext_l = 'Status'.

ls_fieldcat-ddictxt = 'L'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. " fieldcat

************************************************************************

  • Form progressbar *

************************************************************************

FORM progressbar USING p_tabix p_count.

ld_percent = 100 * ( p_tabix - 1 ) / p_count.

MOVE ld_percent TO ld_text_pro.

ld_text = '% of programs processed'.

CONCATENATE ld_text_pro ld_text

INTO ld_text

SEPARATED BY space.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

percentage = ld_percent

text = ld_text.

ENDFORM. " progressbar

************************************************************************

  • FORM f4300_user_command *

************************************************************************

FORM f4300_user_command USING ucomm LIKE sy-ucomm

ls_selfield TYPE slis_selfield.

  • Per default, keep position and refresh screen with DISPLAY

ls_selfield-col_stable = 'X'.

ls_selfield-row_stable = 'X'.

ls_selfield-refresh = 'X'.

CASE ucomm.

  • Double-click **********************

WHEN lc_pick. " Doubleclick anywhere on line + hotspot

READ TABLE gt_finaltab INDEX ls_selfield-tabindex

INTO ls_finaltab.

CLEAR gt_bdcdata.

PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.

PERFORM bdc_field USING 'RS38M-FUNC_EDIT' 'X'.

PERFORM bdc_field USING 'rs38m-programm' ls_finaltab-progname.

PERFORM bdc_field USING 'BDC_OKCODE' '=SHOP'.

CALL TRANSACTION 'SE38' USING gt_bdcdata MODE 'E'.

WHEN OTHERS.

ENDCASE.

CLEAR ucomm.

ENDFORM. " f4300_user_command

************************************************************************

  • Form bdc_dynpro *

************************************************************************

FORM bdc_dynpro USING program dynpro.

CLEAR ls_bdcdata.

ls_bdcdata-program = program.

ls_bdcdata-dynpro = dynpro.

ls_bdcdata-dynbegin = 'X'.

APPEND ls_bdcdata TO gt_bdcdata.

ENDFORM. " bdc_dynpro

************************************************************************

  • FORM BDC_FIELD *

************************************************************************

FORM bdc_field USING fnam fval.

CLEAR ls_bdcdata.

ls_bdcdata-fnam = fnam.

MOVE fval TO ls_bdcdata-fval .

APPEND ls_bdcdata TO gt_bdcdata.

ENDFORM. " bdc_field

************************************************************************

  • Form Compare_SAP_Programs *

************************************************************************

FORM compare_sap_programs .

TYPES: BEGIN OF t_trdir,

name TYPE reposrc-progname,

END OF t_trdir.

  • Local Variables

DATA: i_trdir TYPE STANDARD TABLE OF t_trdir,

wa_trdir TYPE t_trdir.

SELECT name

INTO TABLE i_trdir

FROM trdir.

  • WHERE name in s_prn1.

SORT i_trdir.

DELETE ADJACENT DUPLICATES FROM i_trdir.

DESCRIBE TABLE i_trdir LINES ld_count1.

  • Loop Around The Program Internal Table

LOOP AT i_trdir INTO wa_trdir.

CLEAR: ld_error_abap , ld_error_text, ld_count_abap1,

ld_count_abap2, ls_finaltab.

PERFORM progressbar USING sy-tabix ld_count1.

  • Initialise The Variables

CLEAR: gt_source1, gt_source11, gt_textelem1, ls_progdata1.

  • Get Local Version Of The Program

CALL FUNCTION 'RPY_PROGRAM_READ'

EXPORTING

language = sy-langu

program_name = wa_trdir-name

with_includelist = ''

only_source = ' '

only_texts = ' '

read_latest_version = 'X'

with_lowercase = ' '

IMPORTING

prog_inf = ls_progdata1

TABLES

SOURCE = gt_source1

source_extended = gt_source11

textelements = gt_textelem1

EXCEPTIONS

cancelled = 1

not_found = 2

permission_error = 3

communication_failure = 4

system failure = 5.

CASE sy-subrc.

WHEN 0.

  • Delete Empty Lines

DELETE gt_source11 WHERE LINE IS INITIAL.

  • Ignore Program Name In Text

DELETE gt_textelem1 WHERE id = 'R'.

DELETE gt_textelem1 WHERE id = 'H'.

  • Number Of Lines In ABAP Program

DESCRIBE TABLE gt_source11[] LINES ld_count_abap1 .

  • WHEN OTHERS.

  • CONTINUE.

ENDCASE.

  • Initialise The Variables

CLEAR: gt_source2, gt_source22, gt_textelem2, ls_progdata2.

  • Second RFC Call For Program Details

  • Get Remote Version

CALL FUNCTION 'RPY_PROGRAM_READ'

DESTINATION p_rfcde2

EXPORTING

language = sy-langu

program_name = wa_trdir-name

with_includelist = ''

only_source = ' '

only_texts = ' '

read_latest_version = 'X'

with_lowercase = ' '

IMPORTING

prog_inf = ls_progdata2

TABLES

SOURCE = gt_source2

source_extended = gt_source22

textelements = gt_textelem2

EXCEPTIONS

cancelled = 1

not_found = 2

permission_error = 3

communication_failure = 4

system failure = 5.

CASE sy-subrc.

WHEN 0.

  • Delete Empty Lines

DELETE gt_source22 WHERE LINE IS INITIAL.

  • Ignore Program Name In Text

DELETE gt_textelem2 WHERE id = 'R'.

DELETE gt_textelem2 WHERE id = 'H'.

  • Number Of Lines In ABAP Program

DESCRIBE TABLE gt_source22[] LINES ld_count_abap2 .

ENDCASE.

  • Remove All Spaces

LOOP AT gt_source11 INTO ls_source1.

CONDENSE ls_source1-line NO-GAPS.

MODIFY gt_source11 FROM ls_source1 TRANSPORTING line.

ENDLOOP.

LOOP AT gt_source22 INTO ls_source2.

CONDENSE ls_source2-line NO-GAPS .

MODIFY gt_source22 FROM ls_source2 TRANSPORTING line.

ENDLOOP.

  • Compare ABAP SOURCE

CLEAR ld_error_abap.

LOOP AT gt_source11 INTO ls_source1.

READ TABLE gt_source22 INTO ls_source2 INDEX sy-tabix.

TRANSLATE ls_source1-line TO LOWER CASE.

TRANSLATE ls_source2-line TO LOWER CASE.

IF ls_source2-line NE ls_source1-line.

ld_error_abap = ld_error_abap + 1.

ENDIF.

ENDLOOP.

  • Compare Texts

CLEAR ld_error_text.

LOOP AT gt_textelem1 INTO ls_textelem1.

READ TABLE gt_textelem2 INTO ls_textelem2 INDEX sy-tabix.

TRANSLATE ls_textelem2-entry TO LOWER CASE.

TRANSLATE ls_textelem1-entry TO LOWER CASE.

IF ls_textelem2-id NE ls_textelem1-id OR

ls_textelem2-key NE ls_textelem1-key OR

ls_textelem2-entry NE ls_textelem1-entry.

ld_error_text = ld_error_text + 1.

ENDIF.

ENDLOOP.

  • Put to ALV output table

ls_finaltab-progname = wa_trdir-name.

ls_finaltab-version1 = ls_progdata1-version.

ls_finaltab-version2 = ls_progdata2-version.

ls_finaltab-changeon1 = ls_progdata1-mod_date.

ls_finaltab-changeon2 = ls_progdata2-mod_date.

ls_finaltab-changeby1 = ls_progdata1-mod_user.

ls_finaltab-changeby2 = ls_progdata2-mod_user.

ls_finaltab-count_abap1 = ld_count_abap1.

ls_finaltab-count_abap2 = ld_count_abap2.

ls_finaltab-error_abap = ld_error_abap.

  • Adding the color.

IF ls_finaltab-error_abap IS INITIAL.

ls_color-col = 5. "green

ELSE.

ls_color-col = 6. "red

ENDIF.

CLEAR ls_cellcolor_tab.

CLEAR lt_cellcolor_tab.

CLEAR ls_finaltab-color.

ls_cellcolor_tab-fname = 'ERROR_ABAP'. " Field name to color

ls_color-int = 1.

ls_color-inv = 0.

MOVE ls_color TO ls_cellcolor_tab-color.

INSERT ls_cellcolor_tab INTO TABLE lt_cellcolor_tab.

INSERT lines of lt_cellcolor_tab INTO TABLE ls_finaltab-color.

ls_finaltab-error_text = ld_error_text.

  • Adding the color.

IF ls_finaltab-error_text IS INITIAL.

ls_color-col = 5. "green

ELSE.

ls_color-col = 6. "red

ENDIF.

CLEAR ls_cellcolor_tab.

CLEAR ls_finaltab-color.

ls_cellcolor_tab-fname = 'ERROR_TEXT'." Field name to color

ls_color-int = 1.

ls_color-inv = 0.

MOVE ls_color TO ls_cellcolor_tab-color.

INSERT ls_cellcolor_tab INTO TABLE lt_cellcolor_tab.

INSERT lines of lt_cellcolor_tab INTO TABLE ls_finaltab-color.

  • Move to internal table

APPEND ls_finaltab TO gt_finaltab.

ENDLOOP.

ENDFORM. " Compare_SAP_Programs

************************************************************************

  • Form display_output *

************************************************************************

FORM display_output .

  • Local Variables

DATA: l_abap TYPE i ,

l_text TYPE i .

  • Loop Around Ther Internal Table gt_finaltab

LOOP AT gt_finaltab INTO ls_finaltab.

  • Assign The Values To Variables

l_abap = ls_finaltab-error_abap.

l_text = ls_finaltab-error_text.

IF l_abap > 0 OR

l_text > 0.

ELSE.

DELETE TABLE gt_finaltab FROM ls_finaltab.

ENDIF.

ENDLOOP.

ENDFORM. " display_output

Read only

Former Member
0 Likes
1,212

Use split screen editor (Tcode SE39)

Thanks

Seshadri G

Read only

0 Likes
1,212

Yes. You can use split screen editor or SE39 for single program. But when you compare 2.47 million programs.