Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

The following program compares 2 texts that you directly enter:

(click to zoom)

Execute, and the differences are displayed:

(click to zoom)

This program has been tested on a SAP Netweaver 7.0 system. It should work on any ECC, CRM, SRM, etc. based on that system.

Error rendering macro 'code': Invalid value specified for parameter 'lang'
REPORT  z_text_instant_comparator.
* Enter 2 free texts on initial screen and click Execute
* These 2 free texts are stored into 2 temporary programs
*   (names with 5 characters-prefix ZTMP_ followed by a random 25
*    characters GUID)
* RSVRSRS3 (program version comparator) displays the differences
* Temporary programs are deleted

CONSTANTS temp_program_prefix TYPE c LENGTH 5 VALUE 'ZTMP_'.

DATA go_splitter_container TYPE REF TO cl_gui_splitter_container.
DATA go_container_left TYPE REF TO cl_gui_container.
DATA go_container_right TYPE REF TO cl_gui_container.
DATA go_textedit_left TYPE REF TO cl_gui_textedit.
DATA go_textedit_right TYPE REF TO cl_gui_textedit.

PARAMETER: dummy(1).

AT SELECTION-SCREEN OUTPUT.
  PERFORM s1000_pbo.

AT SELECTION-SCREEN.
  PERFORM s1000_pai.

*---------------------------------------------------------------------*
*      Form  S1000_PBO
*---------------------------------------------------------------------*
FORM s1000_pbo.
  IF go_splitter_container IS INITIAL.
    CREATE OBJECT go_splitter_container
      EXPORTING
        parent  = cl_gui_container=>screen0
        rows    = 1
        columns = 2.
    go_container_left = go_splitter_container->get_container( row = 1 column = 1 ).
    go_container_right = go_splitter_container->get_container( row = 1 column = 2 ).
    CREATE OBJECT go_textedit_left
      EXPORTING
        parent = go_container_left.
    CREATE OBJECT go_textedit_right
      EXPORTING
        parent = go_container_right.
    CALL METHOD go_textedit_left->set_wordwrap_behavior
          EXPORTING
            wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
            wordwrap_position = 255.
    CALL METHOD go_textedit_right->set_wordwrap_behavior
          EXPORTING
            wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
            wordwrap_position = 255.
  ENDIF.
  SET TITLEBAR 'TIT' OF PROGRAM 'SAPLDSYP' WITH 'Text Instant Comparator'(001).
ENDFORM.                                                    "s1100_pbo

*---------------------------------------------------------------------*
*      Form  S1000_PAI
*---------------------------------------------------------------------*
FORM s1000_pai.
  DATA lt_textedit_left TYPE abaptxt255_tab.
  DATA lt_textedit_right TYPE abaptxt255_tab.
  DATA l_name_left TYPE syrepid.
  DATA l_name_right TYPE syrepid.

  IF sy-ucomm = 'ONLI'.

    CALL METHOD go_textedit_left->get_text_as_r3table
      IMPORTING
        table = lt_textedit_left.
    CALL METHOD go_textedit_right->get_text_as_r3table
      IMPORTING
        table = lt_textedit_right.

    PERFORM create_report USING lt_textedit_left CHANGING l_name_left.
    PERFORM create_report USING lt_textedit_right CHANGING l_name_right.

    COMMIT WORK AND WAIT.

    SUBMIT rsvrsrs3
          WITH objnam2 = l_name_right
          WITH objname = l_name_left
          WITH objtyp1 = 'REPS'
          WITH objtyp2 = 'REPS'
          WITH versno1 = 0
          WITH versno2 = 0
          AND RETURN.

    DELETE REPORT l_name_left.
    DELETE REPORT l_name_right.

* keep from going to START-OF-SELECTION event (it would restart the
* program and global variables would be reset = DATA LOSS)
    MESSAGE e001(00) WITH 'OK' DISPLAY LIKE 'S'.
  ENDIF.

ENDFORM.                                                    "s1100_pai

*---------------------------------------------------------------------*
*      Form  CREATE_REPORT
*---------------------------------------------------------------------*
FORM create_report
      USING
        lt_textedit TYPE STANDARD TABLE
      CHANGING
         l_name     TYPE clike.
  DATA l_guid_16 TYPE guid_16.
  TYPE-POOLS rssg.
  DATA l_guid_25 TYPE rssg_uni_idc25.
  DATA ls_trdir TYPE trdir.
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_16 = l_guid_16.
  CALL FUNCTION 'RSS_UNIQUE_CONVERT_TO_ID25'
    EXPORTING
      i_uni_idx         = l_guid_16
    IMPORTING
      e_uni_idc25       = l_guid_25
    EXCEPTIONS
      invalid_unique_id = 1
      OTHERS            = 2.
  CONCATENATE temp_program_prefix l_guid_25 INTO l_name.
  ls_trdir-name = l_name.
  ls_trdir-subc = 'I'.
  INSERT REPORT l_name FROM lt_textedit.
ENDFORM.                    "create_report
  • No labels