raise exception type zcx_es_btf_framework
exporting btf_name = me->btf_name
btf_object = me->btf_object
btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcs_es_btf_name_doesnt_exists.
method constructor.
*@78QImporting@ I_OBJECT TYPE ZZES_BTF_TTXOB BTF Texts: application object
*@78QImporting@ I_TDID TYPE ZZES_BTF_TDID Text ID
*@78QImporting@ I_NAME TYPE TDOBNAME OPTIONAL Name
*@78QImporting@ I_SPRAS TYPE SPRAS DEFAULT SY-LANGU Language Key
*@78QImporting@ I_ENCODING TYPE CSEQUENCE DEFAULT 'utf-8' Character Encoding
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
****Set Keys
btf_name = i_name.
btf_object = i_object.
btf_spras = i_spras.
btf_tdid = i_tdid.
btf_encoding = i_encoding.
****Check Object
data: l_btf_obj like me->btf_object.
select single btf_obj from zes_btf_obj into l_btf_obj
where btf_obj = me->btf_object.
if sy-subrc ne 0.
raise exception type zcx_es_btf_framework
exporting btf_object = me->btf_object
textid = zcx_es_btf_framework=>zcx_es_btf_object_error.
endif.
****Check ID
data: l_btf_id like me->btf_tdid.
select single btf_id from zes_btf_id into l_btf_id
where btf_id = me->btf_tdid. if sy-subrc ne 0.
raise exception type zcx_es_btf_framework
exporting btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcx_es_btf_id_error.
endif.
****Check Combinatin of ID and Object
select single btf_id from zes_btf_id into l_btf_id
where btf_obj = me->btf_object
and btf_id = me->btf_tdid.
if sy-subrc ne 0.
raise exception type zcx_es_btf_framework
exporting btf_id = me->btf_tdid
btf_object = me->btf_object
textid = zcx_es_btf_framework=>zcx_es_btf_id_object_match.
endif.
****Initialize BTF
me->initialize_btf( ).
endmethod.
method get_current_keys.
*@79QExporting@ E_OBJECT TYPE ZZES_BTF_TTXOB BTF Texts: application object
*@79QExporting@ E_TDID TYPE ZZES_BTF_TDID Text ID
*@79QExporting@ E_NAME TYPE TDOBNAME Name
*@79QExporting@ E_SPRAS TYPE SPRAS Language Key
*@79QExporting@ E_ENCODING TYPE STRING Character Encoding
e_object = btf_object.
e_tdid = btf_tdid.
e_name = btf_name.
e_spras = btf_spras.
e_encoding = btf_encoding.
endmethod.
method get_encoding_from_language.
*@78QImporting@ I_SPRAS TYPE SPRAS DEFAULT SY-LANGU Language Key
*@7BQReturning@ VALUE( R_ENCODING ) TYPE STRING Character Encoding
constants: kind type cpattrkind value 'H'.
data: codepage type cpcodepage.
****Get Code Page for the language
call function 'SCP_CODEPAGE_FOR_LANGUAGE'
exporting
language = i_spras
importing
codepage = codepage
exceptions
no_codepage = 1
others = 2.
if sy-subrc <> 0.
r_encoding = 'utf-8'.
exit.
endif.
****Get the encoding for the Code Page
select single cpattr from tcp00a into r_encoding
where cpcodepage = codepage
and cpattrkind = kind.
if r_encoding is initial.
r_encoding = 'utf-8'.
endif.
endmethod.
method initialize_btf.
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
****Create BTF Master Object
btf = cl_btf=>get_reference( ).
****Create an Empty BTF Document
document = btf->create_document( btf_spras ).
endmethod.
method intialize_document.
*@78QImporting@ I_TEXT TYPE STRING OPTIONAL Initialization Text
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
data x_text type xstring.
if document is initial.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcx_es_btf_id_doc_init.
endif.
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = i_text
importing
buffer = x_text
exceptions
failed = 1
others = 2.
if sy-subrc <> 0.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcs_es_btf_content_cast.
endif.
document->set_content( text = x_text
encoding = btf_encoding ).
endmethod.
method read_text.
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_PARAMETER_INVALID_RANGE Parameter with Invalid Range
*@03QException@ CX_SY_BUFFER_OVERFLOW System Exception: Buffer too Short
*@03QException@ CX_SY_COMPRESSION_ERROR System Exception: Compression Error
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
****Load the Persistent Object
clear btf_content.
try.
btf_content = zca_es_pers_zes_btf_content=>agent->get_persistent(
i_btf_obj = me->btf_object
i_btf_id = me->btf_tdid
i_btf_spras = me->btf_spras
i_btf_name = me->btf_name ).
catch cx_os_object_not_found.
raise exception type zcx_es_btf_framework
exporting btf_name = me->btf_name
btf_object = me->btf_object
btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcs_es_btf_name_doesnt_exists.
endtry.
me->content = btf_content->get_btf_content( ).
****Un-Compress the Object
if me->content is not initial.
call method cl_abap_gzip=>decompress_binary
exporting
gzip_in = me->content
importing
raw_out = me->content.
endif.
****Set Content into the BTF Document
if document is initial.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcx_es_btf_id_doc_init.
endif.
data: l_encoding type string.
l_encoding = btf_content->get_encoding( ).
document->set_content( text = me->content
encoding = l_encoding ).
endmethod.
method save_text.
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_PARAMETER_INVALID_RANGE Parameter with Invalid Range
*@03QException@ CX_SY_BUFFER_OVERFLOW System Exception: Buffer too Short
*@03QException@ CX_SY_COMPRESSION_ERROR System Exception: Compression Error
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
****Get the Content from the BTF Document
if document is initial.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcx_es_btf_id_doc_init.
endif.
document->get_content( importing
text = me->content ).
****Uncompress the Content
call method cl_abap_gzip=>compress_binary
exporting
raw_in = me->content
importing
gzip_out = me->content.
****Setup the Persistent Object
btf_content->set_btf_content( me->content ).
btf_content->set_btf_uuser( sy-uname ).
btf_content->set_btf_udate( sy-datum ).
btf_content->set_btf_utime( sy-uzeit ).
endmethod.
method create_text.
*@78QImporting@ I_NAME TYPE TDOBNAME
*@78QImporting@ I_TEXT TYPE STRING
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
****Is the Text Name already specified in the object
if btf_name is not initial.
raise exception type zcx_es_btf_framework
exporting btf_name = me->btf_name
textid = zcx_es_btf_framework=>zcs_es_btf_name_spec.
endif.
****Where we given a duplicate Name?
data: l_btf_id like me->btf_tdid.
select single btf_id from zes_btf_content into l_btf_id
where btf_obj = me->btf_object
and btf_id = me->btf_tdid
and btf_spras = me->btf_spras
and btf_name = i_name.
if sy-subrc = 0.
raise exception type zcx_es_btf_framework
exporting btf_name = i_name
btf_object = me->btf_object
btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcs_es_btf_name_exists.
endif.
****Set Parameters and intialize the BTF Document
clear me->content.
me->btf_name = i_name.
me->intialize_document( i_text ).
****Initialize the Persistent Object
clear btf_content.
try.
data: l_encoding type cpattr.
l_encoding = me->btf_encoding.
btf_content = zca_es_pers_zes_btf_content=>agent->create_persistent(
i_btf_obj = me->btf_object
i_btf_id = me->btf_tdid
i_btf_spras = me->btf_spras
i_btf_name = me->btf_name
i_btf_user = sy-uname
i_btf_date = sy-datum
i_btf_time = sy-uzeit
i_encoding = l_encoding
i_btf_content = me->content ).
catch cx_os_object_existing.
raise exception type zcx_es_btf_framework
exporting btf_name = me->btf_name
btf_object = me->btf_object
btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcs_es_btf_name_exists.
endtry.
endmethod.
method delete_text.
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
try.
zca_es_pers_zes_btf_content=>agent->delete_persistent(
i_btf_obj = me->btf_object
i_btf_id = me->btf_tdid
i_btf_spras = me->btf_spras
i_btf_name = me->btf_name ).
catch cx_os_object_not_existing.
raise exception type zcx_es_btf_framework
exporting btf_name = me->btf_name
btf_object = me->btf_object
btf_id = me->btf_tdid
textid = zcx_es_btf_framework=>zcs_es_btf_name_doesnt_exists.
endtry.
endmethod.
method serialize_me.
*@78QImporting@ I_ME TYPE REF TO ZCL_ES_BTF_FRAMEWORK Kimball BTF Text Framework
*@7BQReturning@ VALUE( R_XML ) TYPE XSTRING
*@03QException@ CX_XSLT_EXCEPTION XSLT Exception
call transformation id
source model = i_me
result xml r_xml
options
data_refs = 'embedded'.
endmethod.
method deserialize_me.
*@78QImporting@ I_XML TYPE XSTRING
*@7BQReturning@ VALUE( R_ME ) TYPE REF TO ZCL_ES_BTF_FRAMEWORK Kimball BTF Text Framework
call transformation id
source xml i_xml
result model = r_me.
r_me->initialize_btf( ).
endmethod.
method download_btf_text.
*@78QImporting@ I_FILE TYPE CSEQUENCE
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
data: l_file type string.
l_file = i_file.
if l_file is initial.
data: l_filename type string,
l_path type string,
l_fullpath type string,
window_t type string.
window_t = 'Download BTF Text'(001).
call method cl_gui_frontend_services=>file_save_dialog
exporting
window_title = window_t
default_extension = 'HTM'
file_filter = 'HTML files (*.HTML, *.HTM)|*.HTML;*.HTM|'
changing
filename = l_filename
path = l_path
fullpath = l_fullpath
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
if sy-subrc <> 0.
endif.
l_file = l_fullpath.
endif.
check l_file is not initial.
****Get the Content from the BTF Document
if document is initial.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcx_es_btf_id_doc_init.
endif.
document->get_content( importing
text = me->content ).
types: t_data(255) type x.
data: data_tab type table of t_data.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = me->content
tables
binary_tab = data_tab.
call method cl_gui_frontend_services=>gui_download
exporting
filename = l_file
filetype = 'BIN'
write_lf = ''
changing
data_tab = data_tab
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
others = 24.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endmethod.
method view_btf_text.
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
data: l_file type string.
data: temp_dir type string.
call method cl_gui_frontend_services=>get_temp_directory
changing
temp_dir = temp_dir
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
if sy-subrc <> 0.
endif.
cl_gui_cfw=>flush( ).
concatenate temp_dir
' tf.html'
into l_file.
me->download_btf_text( l_file ).
call method cl_gui_frontend_services=>execute
exporting
document = l_file
exceptions
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
others = 10.
if sy-subrc <> 0.
endif.
cl_gui_cfw=>flush( ).
endmethod.
method edit_btf_text.
*@03QException@ ZCX_ES_BTF_FRAMEWORK Exception Class for BTF Framework
*@03QException@ CX_BTF_RUNTIME_ERROR BTF Exception: Runtime Error
*@03QException@ CX_BTF_PARAMETER_ERROR BTF Exception: Parameter Error
****Get the Content from the BTF Document
if document is initial.
raise exception type zcx_es_btf_framework
exporting textid = zcx_es_btf_framework=>zcx_es_btf_id_doc_init.
endif.
clear dialogbox.
create object dialogbox
exporting
* PARENT =
width = 30
height = 50
* STYLE =
* REPID =
* DYNNR =
* LIFETIME = lifetime_default
* TOP = 0
* LEFT = 0
* CAPTION =
* NO_AUTODEF_PROGID_DYNNR =
* METRIC = 0
* NAME =
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
event_already_registered = 6
error_regist_event = 7
others = 8.
if sy-subrc <> 0.
endif.
set handler me->on_dialogbox_close for
dialogbox.
try.
data: btf_system_exception type ref to cx_btf_system_error,
btf_exception_text type string.
data: design_mode type i.
clear btf_editor.
clear btf_editor_options.
design_mode = if_btf_editor_constants=>co_design_mode_on.
btf_editor = btf->create_editor( document ).
call method btf_editor->initialize
exporting
ctrl_parent = dialogbox
design_mode = design_mode.
btf_editor_options ?= btf_editor.
btf_editor_options->set_local_printing( if_btf_editor_options=>co_local_printing_on ).
btf_editor_options->set_local_operations( if_btf_editor_options=>co_local_operations_on ).
btf_editor_options->set_windows_fonts( if_btf_editor_options=>co_windows_fonts_on ).
catch cx_btf_system_error into btf_system_exception.
btf_exception_text = btf_system_exception->get_text( ).
if btf_system_exception->textid = cx_btf_system_error=>unsupported_gui_for_action.
message i208(00) with btf_exception_text.
else.
message e208(00) with btf_exception_text.
endif.
endtry.
endmethod.
method on_dialogbox_close.
call method btf_editor->get_content( ).
document = btf_editor->get_document( ).
cl_gui_cfw=>flush( ).
call method document->get_content
importing
text = content.
btf_editor->free( ).
clear btf_editor.
free btf_editor.
call method dialogbox->free
exceptions
others = 1.
free dialogbox.
clear dialogbox.
endmethod.
class lcl_my_unit_test definition for testing.
private section.
methods test_init_class for testing.
methods test_encoding_from_lang for testing.
methods test_serialize for testing.
methods test_create_delete for testing.
endclass. "zcl_my_unit_test DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_my_unit_test IMPLEMENTATION
*---------------------------------------------------------------------*
**---------------------------------------------------------------------*
class lcl_my_unit_test implementation.
method test_init_class.
data: btf type ref to zcl_es_btf_framework.
try.
create object btf
exporting
i_object = '640_TRAIN'
i_tdid = '0001'
i_name = 'TEST01'.
endtry.
data: l_object type zzes_btf_ttxob,
l_tdid type zzes_btf_tdid,
l_spras type spras,
l_name type tdobname,
l_encoding type string.
call method btf->get_current_keys
importing
e_object = l_object
e_tdid = l_tdid
e_name = l_name
e_spras = l_spras
e_encoding = l_encoding.
cl_aunit_assert=>assert_equals( act = l_object
exp = '640_TRAIN2'
msg = 'Incorrect BTF Text Object'(a03) ).
cl_aunit_assert=>assert_equals( act = l_tdid
exp = '0001'
msg = 'Incorrect BTF Text ID'(a04) ).
cl_aunit_assert=>assert_equals( act = l_name
exp = 'TEST01'
msg = 'Incorrect BTF Text Name'(a05) ).
cl_aunit_assert=>assert_equals( act = l_spras
exp = sy-langu
msg = 'Incorrect BTF Text Language'(a06) ).
cl_aunit_assert=>assert_equals( act = l_encoding
exp = 'utf-8'
msg = 'Incorrect BTF Text Encoding'(a07) ).
cl_aunit_assert=>assert_not_initial( act = btf->document
msg = 'BTF Document Object is initial'(a08) ).
btf->read_text( ).
data: l_text type string.
data: l_date(10) type c.
data: l_time(8) type c.
write sy-datum to l_date.
write sy-uzeit to l_time.
concatenate 'Unit Test Text inserted on'
l_date
l_time
'by'
sy-uname
into l_text
separated by space.
btf->intialize_document( l_text ).
btf->save_text( ).
commit work and wait.
data: icontent type zes_btf_content.
select single * from zes_btf_content into icontent
where btf_obj = '640_TRAIN'
and btf_id = '0001'
and btf_name = 'TEST01'
and btf_spras = sy-langu.
cl_aunit_assert=>assert_equals( act = icontent-encoding
exp = 'utf-8'
msg = 'BTF Encoding Not Set'(a20) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_uuser
exp = sy-uname
msg = 'BTF Last Updated By Not Set'(a09) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_udate
exp = sy-datum
msg = 'BTF Last Updated Date Not Set'(a10) ).
cl_aunit_assert=>assert_not_initial( act = icontent-btf_content
msg = 'BTF Content on Update is initial'(a16) ).
data: begin_time type syuzeit.
begin_time = sy-uzeit - 60.
if icontent-btf_utime < begin_time or
icontent-btf_utime > sy-uzeit.
cl_aunit_assert=>fail( msg = 'BTF Last Update Time is not within acceptable bounds'(a11) ).
endif.
* IF sy-batch IS INITIAL.
* CALL METHOD btf->view_btf_text( ).
* ENDIF.
endmethod. "test_init_class
method test_encoding_from_lang.
data: lang_latin1 type sylangu.
data: lang_latin2 type sylangu.
data: output_encode type string.
lang_latin1 = 'E'. "English
clear output_encode.
output_encode = zcl_es_btf_framework=>get_encoding_from_language( lang_latin1 ).
cl_aunit_assert=>assert_equals( act = output_encode
exp = 'iso-8859-1'
msg = 'Incorrect encoding for English'(a01) ).
lang_latin2 = 'L'. "Polish
clear output_encode.
output_encode = zcl_es_btf_framework=>get_encoding_from_language( lang_latin2 ).
cl_aunit_assert=>assert_equals( act = output_encode
exp = 'iso-8859-2'
msg = 'Incorrect encoding for Polish'(a02) ).
endmethod. "test_encoding_from_lang
method test_serialize.
data: btf type ref to zcl_es_btf_framework.
data: btf2 type ref to zcl_es_btf_framework.
try.
create object btf
exporting
i_object = '640_TRAIN'
i_tdid = '0001'
i_name = 'TEST01'.
endtry.
btf->read_text( ).
data: xml type xstring.
call method zcl_es_btf_framework=>serialize_me
exporting
i_me = btf
receiving
r_xml = xml.
cl_aunit_assert=>assert_not_initial( act = xml
msg = 'Serialization Failed'(a13) ).
clear btf.
call method zcl_es_btf_framework=>deserialize_me
exporting
i_xml = xml
receiving
r_me = btf2.
cl_aunit_assert=>assert_not_initial( act = btf2
msg = 'Deserialization Failed'(a14) ).
data: l_object type zzes_btf_ttxob,
l_tdid type zzes_btf_tdid,
l_spras type spras,
l_name type tdobname,
l_encoding type string.
call method btf2->get_current_keys
importing
e_object = l_object
e_tdid = l_tdid
e_name = l_name
e_spras = l_spras
e_encoding = l_encoding.
cl_aunit_assert=>assert_equals( act = l_object
exp = '640_TRAIN'
msg = 'Incorrect BTF Text Object'(a03) ).
cl_aunit_assert=>assert_equals( act = l_tdid
exp = '0001'
msg = 'Incorrect BTF Text ID'(a04) ).
cl_aunit_assert=>assert_equals( act = l_name
exp = 'TEST01'
msg = 'Incorrect BTF Text Name'(a05) ).
cl_aunit_assert=>assert_equals( act = l_spras
exp = sy-langu
msg = 'Incorrect BTF Text Language'(a06) ).
cl_aunit_assert=>assert_equals( act = l_encoding
exp = 'utf-8'
msg = 'Incorrect BTF Text Encoding'(a07) ).
cl_aunit_assert=>assert_not_initial( act = btf2->document
msg = 'BTF Document Object is initial'(a08) ).
endmethod. "test_serialize
method test_create_delete.
data: btf type ref to zcl_es_btf_framework.
try.
create object btf
exporting
i_object = '640_TRAIN'
i_tdid = '0001'.
endtry.
data: l_name type tdobname.
data: i_number type i.
data: s_number(25) type c.
data: random_int type ref to cl_abap_random.
data: l_seed type i.
l_seed = cl_abap_random=>seed( ).
random_int = cl_abap_random=>create( l_seed ).
i_number = random_int->intinrange( low = 1
high = 999999999 ).
write i_number to s_number.
concatenate 'ABAP_UNIT_CREATE_TEST_'
s_number
into l_name.
condense l_name no-gaps.
data: l_text type string.
data: l_date(10) type c.
data: l_time(8) type c.
write sy-datum to l_date.
write sy-uzeit to l_time.
concatenate 'Unit Test Text inserted on'
l_date
l_time
'by'
sy-uname
into l_text
separated by space.
call method btf->create_text
exporting
i_name = l_name
i_text = l_text.
btf->save_text( ).
commit work and wait.
data: icontent type zes_btf_content.
select single * from zes_btf_content into icontent
where btf_obj = '640_TRAIN
' and btf_id = '0001'
and btf_name = l_name
and btf_spras = sy-langu.
cl_aunit_assert=>assert_equals( act = icontent-encoding
exp = 'utf-8'
msg = 'BTF Encoding Not Set'(a20) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_user
exp = sy-uname
msg = 'BTF Created By Not Set'(a17) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_date
exp = sy-datum
msg = 'BTF Created Date Not Set'(a18) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_uuser
exp = sy-uname
msg = 'BTF Last Updated By Not Set'(a09) ).
cl_aunit_assert=>assert_equals( act = icontent-btf_udate
exp = sy-datum
msg = 'BTF Last Updated Date Not Set'(a10) ).
cl_aunit_assert=>assert_not_initial( act = icontent-btf_content
msg = 'BTF Content on Create is initial'(a15) ).
data: begin_time type syuzeit.
begin_time = sy-uzeit - 60.
if icontent-btf_utime < begin_time or
icontent-btf_utime > sy-uzeit.
cl_aunit_assert=>fail( msg = 'BTF Last Update Time is not within acceptable bounds'(a11) ).
endif.
begin_time = sy-uzeit - 60.
if icontent-btf_time < begin_time or
icontent-btf_time > sy-uzeit.
cl_aunit_assert=>fail( msg = 'BTF Create Time is not within acceptable bounds'(a19) ).
endif.
btf->delete_text( ).
commit work and wait.
select single * from zes_btf_content into icontent
where btf_obj = '640_TRAIN'
and btf_id = '0001'
and btf_name = l_name
and btf_spras = sy-langu.
if sy-subrc = 0.
cl_aunit_assert=>fail( msg = 'BTF Delete Failed'(a21) ).
endif.
endmethod. "test_create_delete
endclass. "lcl_my_unit_test IMPLEMENTATION
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
43 | |
25 | |
17 | |
15 | |
11 | |
7 | |
7 | |
6 | |
6 | |
6 |