Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
The extended Computer Aided Test Tool (eCATT) stores its scripts in the table ecscr_line. Also it stores the SAP GUI scripts in XML format in the table ecscr_xml_str. Here an ABAP report which downloads the whole set of all eCATT scripts with its SAP GUI scripts of an SAP system to the frontend server. Each script is stored in a single file. Nothing exciting but sometimes quite useful.
"-Begin-----------------------------------------------------------------
REPORT Z_GET_ALL_ECATT_SCRIPTS.

DATA:
lt_line TYPE STANDARD TABLE OF ecscr_line,
ls_line TYPE ecscr_line,
ls_ec_line TYPE ecscr_line,
lt_lines TYPE STANDARD TABLE OF string,
lv_filename TYPE string,
lt_ecscr_xml TYPE STANDARD TABLE OF ecscr_xml_str,
lo_conv_in TYPE REF TO cl_abap_conv_in_ce,
lv_str TYPE string
.

FIELD-SYMBOLS:
<ls_ecscr_xml> TYPE ecscr_xml_str
.

SELECT *
FROM ecscr_line
INTO TABLE lt_line
ORDER BY name version xml_lnr.

LOOP AT lt_line INTO ls_line GROUP BY ( name = ls_line-name
version = ls_line-version ).

CLEAR lt_lines.

LOOP AT GROUP ls_line INTO ls_ec_line.
APPEND ls_ec_line-xml_line TO lt_lines.
ENDLOOP.

lv_filename = ls_line-name.
REPLACE ALL OCCURRENCES OF '/' IN lv_filename WITH '_'.

cl_gui_frontend_services=>gui_download(
EXPORTING
filename = 'C:\Dummy\eCATT\' && lv_filename && '_' &&
ls_line-version && '.eCATT'
CHANGING
data_tab = lt_lines
EXCEPTIONS
others = 1
).
IF sy-subrc <> 0.

ENDIF.

"-Save XML data from Gui Scripting of an eCATT script---------------
SELECT * FROM ecscr_xml_str INTO TABLE lt_ecscr_xml
WHERE name = ls_line-name AND version = ls_line-version.
CHECK sy-subrc = 0.

LOOP AT lt_ecscr_xml ASSIGNING <ls_ecscr_xml>.

lo_conv_in = cl_abap_conv_in_ce=>create(
input = <ls_ecscr_xml>-pxml_stream
).
lo_conv_in->read( IMPORTING data = lv_str ).

CHECK lv_str CS '<GuiScripting'.

CLEAR lt_lines.
APPEND lv_str TO lt_lines.

cl_gui_frontend_services=>gui_download(
EXPORTING
filename = 'C:\Dummy\eCATT\' && lv_filename && '_' &&
ls_line-version && '.' && <ls_ecscr_xml>-pname && '.xml'
CHANGING
data_tab = lt_lines
EXCEPTIONS
others = 1
).
IF sy-subrc <> 0.

ENDIF.

ENDLOOP.

ENDLOOP.

"-End-------------------------------------------------------------------