From d637463434d2b716a3646d2d19b627367746e240 Mon Sep 17 00:00:00 2001 From: TheWirtschaftsmann Date: Tue, 14 Feb 2017 13:49:50 +0200 Subject: [PATCH 1/3] Tran serialize texts, close #616 Serializing / deserializing of transaction names translations. --- src/zabapgit_object_tran.prog.abap | 60 +++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/zabapgit_object_tran.prog.abap b/src/zabapgit_object_tran.prog.abap index 18b030d4d..0099b6dcf 100644 --- a/src/zabapgit_object_tran.prog.abap +++ b/src/zabapgit_object_tran.prog.abap @@ -33,10 +33,19 @@ CLASS lcl_object_tran DEFINITION INHERITING FROM lcl_objects_super FINAL. cs_rsstcd TYPE rsstcd cs_tstcp TYPE tstcp cs_tstc TYPE tstc, + split_parameters_comp IMPORTING iv_type TYPE any iv_param TYPE any - CHANGING cg_value TYPE any. + CHANGING cg_value TYPE any, + + serialize_texts + IMPORTING io_xml TYPE REF TO lcl_xml_output + RAISING lcx_exception, + + deserialize_texts + IMPORTING io_xml TYPE REF TO lcl_xml_input + RAISING lcx_exception. ENDCLASS. "lcl_object_TRAN DEFINITION @@ -356,6 +365,9 @@ CLASS lcl_object_tran IMPLEMENTATION. lcx_exception=>raise( 'Error from RPY_TRANSACTION_INSERT' ). ENDIF. + " Texts deserializing (translations) + deserialize_texts( io_xml ). + ENDMETHOD. "deserialize METHOD lif_object~serialize. @@ -412,10 +424,56 @@ CLASS lcl_object_tran IMPLEMENTATION. ig_data = ls_tstcp ). ENDIF. + " Texts serializing (translations) + serialize_texts( io_xml ). + ENDMETHOD. "serialize METHOD lif_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result. ENDMETHOD. + METHOD serialize_texts. + + DATA lt_tpool_i18n TYPE TABLE OF tstct. + + " Skip master language - it was already serialized + " Don't serialize t-code itself + SELECT sprsl ttext + INTO CORRESPONDING FIELDS OF TABLE lt_tpool_i18n + FROM tstct + WHERE sprsl <> mv_language + AND tcode = ms_item-obj_name. + + IF lines( lt_tpool_i18n ) > 0. + SORT lt_tpool_i18n BY sprsl ASCENDING. + io_xml->add( iv_name = 'I18N_TPOOL' + ig_data = lt_tpool_i18n ). + ENDIF. + + ENDMETHOD. "serialize_texts + + METHOD deserialize_texts. + + DATA lt_tpool_i18n TYPE TABLE OF tstct. + + FIELD-SYMBOLS LIKE LINE OF lt_tpool_i18n. + + " Read XML-files data + io_xml->read( EXPORTING iv_name = 'I18N_TPOOL' + CHANGING cg_data = lt_tpool_i18n ). + + " Force t-code name (security reasons) + LOOP AT lt_tpool_i18n ASSIGNING . + -tcode = ms_item-obj_name. + ENDLOOP. + + IF lines( lt_tpool_i18n ) > 0. + MODIFY tstct FROM TABLE lt_tpool_i18n. + IF sy-subrc <> 0. + lcx_exception=>raise( 'Update of t-code translations failed' ). + ENDIF. + ENDIF. + + ENDMETHOD. "deserialize_texts ENDCLASS. "lcl_object_tran IMPLEMENTATION From 607a6cad5565f65ad04231533634006e40bc79d5 Mon Sep 17 00:00:00 2001 From: TheWirtschaftsmann Date: Tue, 14 Feb 2017 13:58:03 +0200 Subject: [PATCH 2/3] indentation fixes, close #613 Fix of indentation error. --- src/zabapgit_object_tran.prog.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zabapgit_object_tran.prog.abap b/src/zabapgit_object_tran.prog.abap index 0099b6dcf..bde7cd698 100644 --- a/src/zabapgit_object_tran.prog.abap +++ b/src/zabapgit_object_tran.prog.abap @@ -471,7 +471,7 @@ CLASS lcl_object_tran IMPLEMENTATION. IF lines( lt_tpool_i18n ) > 0. MODIFY tstct FROM TABLE lt_tpool_i18n. IF sy-subrc <> 0. - lcx_exception=>raise( 'Update of t-code translations failed' ). + lcx_exception=>raise( 'Update of t-code translations failed' ). ENDIF. ENDIF. From 45d82dc5d36810b847e9bc93996ea97d278022e1 Mon Sep 17 00:00:00 2001 From: TheWirtschaftsmann Date: Tue, 14 Feb 2017 14:05:36 +0200 Subject: [PATCH 3/3] Add. fix for domains, close #613 Fixing a bug in domains serializing (serializing doesn't work if there is translation to one language only). --- src/zabapgit_object_doma.prog.abap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zabapgit_object_doma.prog.abap b/src/zabapgit_object_doma.prog.abap index 53eacb1c6..de12805ee 100644 --- a/src/zabapgit_object_doma.prog.abap +++ b/src/zabapgit_object_doma.prog.abap @@ -278,7 +278,7 @@ CLASS lcl_object_doma IMPLEMENTATION. SORT lt_dd01_texts BY ddlanguage ASCENDING. SORT lt_dd07_texts BY ddlanguage ASCENDING. - IF lines( lt_i18n_langs ) > 1. + IF lines( lt_i18n_langs ) > 0. io_xml->add( iv_name = 'I18N_LANGS' ig_data = lt_i18n_langs ).