Skip to Content

Hi all,

I wrote a small report  Z_WDA_COMP_COMPARE, which you can use to compare two different Webdynpro ABAP components like the SE39 comparison (One component on the left, one on the right side showing differences).

I want to share this one with you.

It’s quite easy… Functiongroup WDY_COMPARE_VERSION is used to compare WDA components, so my report uses its functionmodules.

Functionmodule WDY_WB_COMPARE_VC is used to compare controllers (e.g. views or the componentcontrollers).

Functionmodule WDY_WB_COMPARE_COMP is used to compare the components.

The only drawback is that module WDY_WB_COMPARE_VC checks the versions to be compared. It is actually designed to compare different versions of an single component, so it checks if the compared version numbers are the same. To avoid this check I copied functiongroup WDY_COMPARE_VERSION and its modules to Z*-objects and modified ZWDY_WB_COMPARE_VC.

Modification of ZWDY_WB_COMPARE_VC to avoid version-check:

there are just two if-conditions in which you have to remove the checks.

In the first one (line 49) you have to remove “( p_versno1 = p_versno2 and p_log_dest is initial )”.

In the second one (line 59) you have to remove “ ( p_versno1 <> p_versno2 OR NOT p_log_dest IS INITIAL )“.

It should look like this afterwards.

FUNCTION ZWDY_WB_COMPARE_VC.
*”——————————————————————–
[……]

* check parameter
   if p_ref_controller_1 is initial and p_ref_controller_2 is initial. “called by WDYC_COMPARE_VERSION
     if p_objname1 is initial or p_objname2 is initial. “or ( p_versno1 = p_versno2 and p_log_dest is initial ).
       message I510(SWDP_WB_TOOL) display like ‘E’.
       return.
     endif.
   endif.

*  17.10.05 cr: if this function module is called with controller and/or view references, no
*  versions have to be determinded. in this case, start the comparison directly
*   if not p_versno1 is initial and not p_versno2 is initial and not p_objname1 is initial and not p_objname2 is initial.
*  IF ( p_versno1 <> p_versno2 OR NOT p_log_dest IS INITIAL ) AND NOT p_objname1 IS INITIAL AND NOT p_objname2 IS INITIAL.
   IF NOT p_objname1 IS INITIAL AND NOT p_objname2 IS INITIAL.


[……]

Thus you are ready to implement the report.

*&———————————————————————*
*& Report  Z_WDA_COMP_COMPARE
*&
*&———————————————————————*
*& “>>> i.Durmaz 31.12.2015 13:03:48
*& You can use this report to compare two Webdynpro ABAP Components in SE39 manner.
*& – You can choose if you want to compare the components or specific controllers (like views or the Componentcontrollers)
*& – You can also select which versions (of versionhistory) you want to compare, whereas version 0 (or blank) is the active one.
*& “<<< i.Durmaz 31.12.2015 13:03:48
*&———————————————————————*

REPORT  z_wda_comp_compare.

PARAMETERS:
” Object No. 1 is displayed on the left, No2. is displayed on the right right
p_comp1 TYPE wdy_component_name OBLIGATORY,
p_cont1 TYPE wdy_controller_name OBLIGATORY,
p_ver1  TYPE  vrsdversno,
p_comp2 TYPE wdy_component_name OBLIGATORY,
p_cont2 TYPE wdy_controller_name OBLIGATORY,
p_ver2  TYPE  vrsdversno,
p_cmp as CHECKBOX. “If checked compare Components, else controllers.

START-OF-SELECTION.
   DATA: lv_objnam1 TYPE vrsdobjname.
   DATA: lv_objnam2 TYPE vrsdobjname.
   CONCATENATE p_comp1 p_cont1 INTO lv_objnam1 RESPECTING BLANKS.
   CONCATENATE p_comp2 p_cont2 INTO lv_objnam2 RESPECTING BLANKS.

if p_cmp is INITIAL.
   CONCATENATE p_comp1 p_cont1 INTO lv_objnam1 RESPECTING BLANKS.
   CONCATENATE p_comp2 p_cont2 INTO lv_objnam2 RESPECTING BLANKS.
   CALL FUNCTION ‘ZWDY_WB_COMPARE_VC’    “You can use WDY_WB_COMPARE_VC as well, but you have to choose different versions                                                                                     “in this case.
    EXPORTING
      p_objname1             = lv_objnam1
      p_objname2             = lv_objnam2
      p_versno1                = p_ver1
      p_versno2                = p_ver2.
else.
   CALL FUNCTION ‘WDY_WB_COMPARE_COMP’
    EXPORTING
      P_OBJNAME1           = lv_objnam1
      P_OBJNAME2           = lv_objnam2
      P_VERSNO1             = p_ver1
      P_VERSNO2             = p_ver2.
endif.

How to use:

in selectionscreen you have to add the necessary information, whereas:

– left/right component are the webdynpro component names

– left/right cotroller are the webdynpro controller names

          – e.g. name of the specific views or COMPONENTCONTROLLER

– left/right version: version number from history you want to compare. if left blank, the active version is chosen.

– compare component: if checked the component itself is compared, if blank the chosen controllers are compared.

Drawback:

As far as I checked this report works fine. But one problem is, that there can be a dump e.g. if you try to display differences of view-contexts. There seems to be a problem with the tree-control which is used to display the differences. If you can find a solution for that let me know….

Have fun

ismail

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply