Code: Alles auswählen.
FUNCTION Z_BC_READSFXML.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_FORM) TYPE TDSFNAME
*" VALUE(I_LANGU) TYPE SPRAS DEFAULT 'E'
*" TABLES
*" SFTAB STRUCTURE SMUM_XMLTB
*" RETURN STRUCTURE BAPIRET2 OPTIONAL
*" EXCEPTIONS
*" FORM_NOT_EXIST
*"----------------------------------------------------------------------
CONSTANTS: c_xml_ns_uri_sf(255) TYPE c
VALUE 'urn:sap-com:SmartForms:2000:internal-structure', "#EC NOTEXT
c_xml_ns_uri_ifr(255) TYPE c
VALUE 'urn:sap-com:sdixml-ifr:2000'. "#EC NOTEXT
TYPES tyt_tab_xml TYPE TABLE OF smum_xmltb.
TYPES: t_gnode TYPE ssfgnode,
t_gnodes TYPE tsfgnode.
DATA: l_filename TYPE string,
l_file_filter TYPE string,
l_user_action TYPE i.
DATA: l_element TYPE REF TO if_ixml_element.
DATA: l_language_str TYPE string,
l_language(2) TYPE c.
DATA: l_lines TYPE i,
l_splitted_name_tab TYPE TABLE OF string.
DATA: l_stylename TYPE tdssname,
l_stylevari TYPE tdvariant,
l_save_style TYPE tdssname.
DATA: g_ixml TYPE REF TO if_ixml,
xml_document TYPE REF TO if_ixml_document,
xml_element TYPE REF TO if_ixml_element,
xml_ns_prefix_sf TYPE string,
xml_ns_uri_sf TYPE string,
xml_ns_uri_ifr TYPE string,
xml_macro_name TYPE string,
xml_macro_rc TYPE i,
xml_macro_objt TYPE stxfobjt,
xml_macro_text TYPE stxftxt,
xml_macro_tline TYPE tline,
xml_upload_language TYPE tdspras.
TYPES: t_raw(250) TYPE x.
DATA: sform TYPE REF TO cl_ssf_fb_smart_form.
* Namen der aktuell bearbeiteten Objekte
DATA: formname TYPE tdsfname, " Name des Formulars
variant TYPE tdvariant, " Name der Formularvariante
language TYPE sy-langu, " Bearbeitungssprache
fmnumb TYPE tdfmnumb, " Nummer des zugeordneten Fb
fmnumb_test TYPE tdfmnumb. " Fb zum Test der inaktiven Fassung
DATA: gv_xml_xstring TYPE xstring,
gv_size TYPE sy-tabix.
DATA ls_admin TYPE stxfadm.
SELECT SINGLE * FROM stxfadm INTO ls_admin WHERE formname = i_form.
IF ls_admin IS INITIAL.
RAISE form_not_exist.
ELSE.
formname = i_form.
ENDIF.
IF i_langu IS INITIAL.
language = ls_admin-masterlang.
ELSE.
language = i_langu.
ENDIF.
* create form object
CREATE OBJECT sform.
CALL METHOD sform->load
EXPORTING
im_formname = formname
im_language = language
im_active = space
IMPORTING
ex_fmnumb = fmnumb
ex_fmnumb_test = fmnumb_test.
IF g_ixml IS INITIAL.
g_ixml = cl_ixml=>create( ).
ENDIF.
xml_document = g_ixml->create_document( ).
xml_ns_prefix_sf = 'sf'.
xml_ns_uri_sf = c_xml_ns_uri_sf.
xml_ns_uri_ifr = c_xml_ns_uri_ifr.
sform->xml_init( ).
* create XML for the entire smart form
CALL METHOD sform->xml_download
EXPORTING
parent = xml_document
CHANGING
document = xml_document.
* namespace
l_element = xml_document->get_root_element( ).
l_element->set_attribute( name = xml_ns_prefix_sf
namespace = 'xmlns'
value = xml_ns_uri_sf ).
l_element->set_attribute( name = 'xmlns'
value = xml_ns_uri_ifr ).
* language
WRITE language TO l_language.
l_language_str = l_language.
xml_macro_rc = l_element->set_attribute(
name = 'language'
namespace = xml_ns_prefix_sf
value = l_language_str ).
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
document = xml_document
* PRETTY_PRINT = ' '
IMPORTING
xml_as_string = gv_xml_xstring
size = gv_size
EXCEPTIONS
no_document = 1
OTHERS = 2.
*== Convert XML to itab
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = gv_xml_xstring
TABLES
xml_table = sftab
return = return.
ENDFUNCTION.
Code: Alles auswählen.
REPORT ztest_sf_comp.
TABLES: sscrfields.
* Info Destinationen
DATA: des1_info TYPE rfcsi,
des2_info TYPE rfcsi.
DATA lv_mandt1(3).
DATA lv_mandt2(3).
DATA rt_exc TYPE smum_xmltb-cname.
RANGES gr_excl FOR rt_exc.
START-OF-SELECTION.
SELECTION-SCREEN FUNCTION KEY 1.
PARAMETERS:
p_form1 TYPE tdsfname OBLIGATORY MATCHCODE OBJECT sh_stxfadm,
p_form2 TYPE tdsfname OBLIGATORY MATCHCODE OBJECT sh_stxfadm.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
PARAMETERS p_des1 TYPE rfcdes-rfcdest OBLIGATORY DEFAULT 'NONE'.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
PARAMETERS p_des2 TYPE rfcdes-rfcdest OBLIGATORY DEFAULT 'NONE'.
SELECTION-SCREEN END OF BLOCK a.
END-OF-SELECTION.
PERFORM check_avail.
IF des1_info IS INITIAL.
MESSAGE s368(00) DISPLAY LIKE 'E' WITH p_des1 ':RFC-Destination not reachable.' .
EXIT.
ENDIF.
IF des2_info IS INITIAL.
MESSAGE s368(00) DISPLAY LIKE 'E' WITH p_des2 ':RFC-Destination not reachable.' .
EXIT.
ENDIF.
PERFORM fill_exclude_range.
PERFORM compare_sf.
*&---------------------------------------------------------------------*
*& Form Check_avail
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->DEST text
*----------------------------------------------------------------------*
FORM check_avail.
DATA:
" info LIKE rfcsi,
msg_text(80) TYPE c. "Message text
CALL FUNCTION 'RFC_SYSTEM_INFO'
DESTINATION p_des1
IMPORTING
rfcsi_export = des1_info
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
CALL FUNCTION 'RFC_SYSTEM_INFO'
DESTINATION p_des2
IMPORTING
rfcsi_export = des2_info
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
ENDFORM. "Check_avail
*&---------------------------------------------------------------------*
*& Form write_for_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM write_for_display.
DATA: t1(80),t2(80).
DATA: info LIKE rfcsi,
msg_text(80) TYPE c. "Message text
FORMAT COLOR COL_HEADING.
WRITE: / '*** STATUS RFC-connectivity ***' , AT sy-linsz space.
ULINE.
FORMAT COLOR OFF.
CLEAR msg_text.
CALL FUNCTION 'RFC_PING'
DESTINATION p_des2
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
t1 = p_des2.
CONDENSE t1.
IF msg_text IS INITIAL.
CONCATENATE 'Destination :' t1 'reachable.' INTO t2 SEPARATED BY space.
FORMAT INTENSIFIED OFF.
WRITE: / icon_led_green AS ICON,
t2 COLOR COL_POSITIVE.
ELSE.
CONCATENATE 'Destination :' t1 'not reachable.' INTO t2 SEPARATED BY space.
FORMAT INTENSIFIED OFF.
WRITE: / icon_led_red AS ICON,
t2 COLOR COL_NEGATIVE.
ENDIF.
CLEAR msg_text.
CALL FUNCTION 'RFC_PING'
DESTINATION p_des1
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
t1 = p_des1.
CONDENSE t1.
IF msg_text IS INITIAL.
CONCATENATE 'Destination :' t1 'reachable.' INTO t2 SEPARATED BY space.
FORMAT INTENSIFIED OFF.
WRITE: / icon_led_green AS ICON,
t2 COLOR COL_POSITIVE.
ELSE.
CONCATENATE 'Destination :' t1 'not reachable.' INTO t2 SEPARATED BY space.
FORMAT INTENSIFIED OFF.
WRITE: / icon_led_red AS ICON,
t2 COLOR COL_NEGATIVE.
ENDIF.
ENDFORM. "write_for_display
AT SELECTION-SCREEN.
IF sy-ucomm = 'FC01'." n = 1 up to 5
* Teste Erreichbarkeit
PERFORM write_for_display.
CALL FUNCTION 'C14A_POPUP_LIST_DISPLAY'
EXPORTING
i_callback = 'WRITE_FOR_DISPLAY'
i_callback_program = sy-repid
i_title = 'RFC-connections'
i_col = 4
i_row = 4
i_width = 84
i_height = 10
* I_TEXT_WIDTH =
* I_FLG_SHOW_PRINT_BUTTON = ESP1_FALSE
EXCEPTIONS
no_callback_specified = 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.
ENDIF.
INITIALIZATION.
sscrfields-functxt_01 = '@FC@ Check RFC-Destinations'(003).
FORM compare_sf.
DATA t_sftab1 TYPE TABLE OF smum_xmltb.
DATA t_sftab2 TYPE TABLE OF smum_xmltb.
FIELD-SYMBOLS <sft> TYPE smum_xmltb.
DATA lt_t1 TYPE rswsourcet.
DATA lt_t2 TYPE rswsourcet.
DATA lv_equal(1).
DATA lt_xx TYPE TABLE OF rsedcresul WITH HEADER LINE.
DATA lv_str TYPE string.
DATA msg_text(80).
CALL FUNCTION 'Z_BC_READSFXML' DESTINATION p_des1
EXPORTING
i_form = p_form1
i_langu = ' '
TABLES
sftab = t_sftab1
* RETURN =
EXCEPTIONS
form_not_exist = 1
wrong_access_to_archive = 2
communication_failure = 3 MESSAGE msg_text
system_failure = 4 MESSAGE msg_text
OTHERS = 5.
LOOP AT t_sftab1 ASSIGNING <sft> WHERE cname IN gr_excl AND type NE 'A' .
CONCATENATE <sft>-cname <sft>-cvalue INTO lv_str.
APPEND lv_str TO lt_t1.
ENDLOOP.
CALL FUNCTION 'Z_BC_READSFXML' DESTINATION p_des2
EXPORTING
i_form = p_form2
i_langu = ' '
TABLES
sftab = t_sftab2
* RETURN =
EXCEPTIONS
form_not_exist = 1
wrong_access_to_archive = 2
communication_failure = 3 MESSAGE msg_text
system_failure = 4 MESSAGE msg_text
OTHERS = 5.
LOOP AT t_sftab2 ASSIGNING <sft> WHERE cname IN gr_excl AND type NE 'A' .
CONCATENATE <sft>-cname <sft>-cvalue INTO lv_str.
APPEND lv_str TO lt_t2.
ENDLOOP.
CALL FUNCTION 'RS_CMP_COMPUTE_DELTA'
EXPORTING
* COMPARE_MODE = '1'
* FLG_EXT_IGNORE = ' '
ignore_case_differences = ' '
* FLG_WB99 = ' '
IMPORTING
flg_equal = lv_equal
TABLES
text_tab1 = lt_t1
text_tab2 = lt_t2
text_tab_res = lt_xx
EXCEPTIONS
parameter_invalid = 1
difference_not_found = 2
OTHERS = 3.
IF lv_equal IS INITIAL.
MESSAGE s000(su) WITH 'Forms are not equal !' DISPLAY LIKE 'E'.
ELSE.
MESSAGE s000(su) WITH 'Forms are equal !'.
ENDIF.
ENDFORM.
FORM fill_exclude_range.
CLEAR gr_excl .
gr_excl-sign = 'E'.
gr_excl-option = 'EQ'.
gr_excl-low = 'FORMNAME'. APPEND gr_excl.
gr_excl-low = 'FIRSTUSER'. APPEND gr_excl.
gr_excl-low = 'FIRSTDATE'. APPEND gr_excl.
gr_excl-low = 'FIRSTTIME'. APPEND gr_excl.
gr_excl-low = 'LASTUSER'. APPEND gr_excl.
gr_excl-low = 'LASTDATE'. APPEND gr_excl.
gr_excl-low = 'LASTTIME'. APPEND gr_excl.
gr_excl-low = 'CAPTION'. APPEND gr_excl.
gr_excl-low = 'DEVCLASS'. APPEND gr_excl.
gr_excl-low = 'STATUS'. APPEND gr_excl.
gr_excl-low = 'LANGU'. APPEND gr_excl.
ENDFORM.