Skip to Content

Hello,

we generally  login to english to create a  report /table/ data types.

When we are working for the customers like German,Arab country people etc, we sometimes forget to do the transaltion to different languages.

So, when we are doing code review, I developed one object, which which will checks the translation maintained or not.

*&———————————————————————*

*& Report  YTEST_TEXTS                                                 *

*&                                                                     *

*&———————————————————————*

*&                                                                     *

*&                                                                     *

*&———————————————————————*

REPORT  ytest_texts.

TYPE-POOLS : rmdi.

SELECTION-SCREEN BEGIN OF BLOCK block WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) text-s01 MODIF ID m3.

PARAMETERS: p_rp RADIOBUTTON GROUP serv USER-COMMAND m1

                                         MODIF ID m3 DEFAULT ‘X’.

SELECTION-SCREEN POSITION 33.

PARAMETERS: p_rp_obj TYPE rs38m-programm MODIF ID m3.

*                               DEFAULT ‘C:\temp\INPUT FILE’.  “#EC NOTEXT

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(26) text-s02 MODIF ID m1.

PARAMETERS: p_tb RADIOBUTTON GROUP serv MODIF ID m1.

SELECTION-SCREEN POSITION 33.

PARAMETERS: p_tb_obj LIKE dcobjdef-name MODIF ID m1.

*                         DEFAULT text-013.

PARAMETERS: p_post  TYPE xfeld NO-DISPLAY.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK block.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-005.

*PARAMETERS : P_OBJ TYPE SOBJ_NAME.

PARAMETERS : p_s_lang TYPE sy-langu  DEFAULT ‘EN’.

PARAMETERS : p_langu TYPE sy-langu OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK block1.

DATA : l_tpkey TYPE trkey.

DATA : e_fields TYPE rmdi_tabfld_t,

        wa_fields LIKE LINE OF e_fields.

DATA : e_s_ddtxt  TYPE  rmdi_ddtxt,

e_s_hdtxt TYPE  rmdi_hdtxt,

e_s_stxt  TYPE  rmdi_stxt,

e_s_mtxt  TYPE  rmdi_mtxt,

e_s_ltxt  TYPE  rmdi_ltxt,

e_t_ddtxt TYPE  rmdi_ddtxt,

e_t_hdtxt TYPE  rmdi_hdtxt,

e_t_stxt  TYPE  rmdi_stxt,

e_t_mtxt  TYPE  rmdi_mtxt,

e_t_ltxt  TYPE  rmdi_ltxt.

DATA:   lprogram  LIKE rs38m-programm,

         llangu    LIKE sy-langu,

         texts     LIKE textpool OCCURS 50 WITH HEADER LINE.

DATA : l_result TYPE i.

DATA : lt_texts TYPE TABLE OF textpool,

        wa_texts like line of lt_texts.

DATA : l_dd02t     TYPE dd02t .

DATA : lt_dd07v  TYPE TABLE OF dd07v,

        wa_dd07v  LIKE LINE OF lt_dd07v,

        lt_t_dd07v  TYPE TABLE OF dd07v,

        wa_t_dd07v  LIKE LINE OF lt_dd07v.

TYPES : begin of ty_final,

          TYPE(15),

          obj(40),

          text(60),

        end of ty_final.

DATA : it_final type table of ty_final,

        wa_final like line of it_final,

        l_ddtxt TYPE AS4TEXT.

AT SELECTION-SCREEN.

   if p_rp = ‘X’.

     IF p_rp_obj is initial.

       message ‘Please Enter Valid report ID’ TYPE ‘E’.

     endif.

   endif.

   if P_TB = ‘X’.

     IF p_tb_obj is initial.

       message ‘Please Enter Valid Table/Structure ID’ TYPE ‘E’.

     endif.

   ENDIF.

AT SELECTION-SCREEN OUTPUT.

*  IF p_rp = ‘X’.

*    LOOP AT SCREEN.

*      IF screen-name = ‘P_RP_OBJ’.

*        screen-required = ‘1’.

*        MODIFY SCREEN.

*      ENDIF.

*    ENDLOOP.

*  ENDIF.

*  IF p_tb = ‘X’.

*    LOOP AT SCREEN.

*      IF screen-name = ‘P_TB_OBJ’.

*        screen-required = ‘1’.

*        MODIFY SCREEN.

*      ENDIF.

*    ENDLOOP.

*  ENDIF.

START-OF-SELECTION.

   IF p_rp = ‘X’.

     LOOP AT SCREEN.

       IF screen-name = ‘P_RP_OBJ’.

         screen-required = ‘1’.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

   IF p_tb = ‘X’.

     LOOP AT SCREEN.

       IF screen-name = ‘P_TB_OBJ’.

         screen-required = ‘1’.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

   IF p_rp = ‘X’.

*  l_tpkey-devclass = ‘ZTVC’.

     l_tpkey-obj_type  = ‘PROG’.

     l_tpkey-obj_name = p_rp_obj.

     l_tpkey-sub_name = p_rp_obj.

     l_tpkey-sub_type = ‘REPT’.

     SELECT SINGLE devclass FROM tadir INTO l_tpkey-devclass  WHERE object = l_tpkey-obj_type AND

                                                            obj_name = p_rp_obj.

     CALL FUNCTION ‘Y_GET_REPORT_TEXTELEMENT’

       EXPORTING

         program     = p_rp_obj

         langu_s     = sy-langu

         langu_t     = p_langu

       IMPORTING

         RESULT      = l_result

       TABLES

         texts_final = lt_texts.

*  CALL FUNCTION ‘Y_GET_REPORT_TEXTELEMENT’

*    EXPORTING

*      program = p_rp_obj

*      langu_s = sy-langu

*      langu_t = p_langu

*    IMPORTING

*      RESULT  = l_result.

     .

     IF l_result = 4.

       BREAK-POINT.

*PERFORM test_data.

*INCLUDE YTEST_TEXTS_CHECK_TEXTSF01.

       MESSAGE ‘German transaltions are not maintained’(002) TYPE ‘I’.

*      CALL FUNCTION ‘YRS_TEXTLOG_TRANSLATION_TOOL’

*        EXPORTING

*          master_language     = p_langu

*          transport_key       = l_tpkey

*        EXCEPTIONS

*          incompatible_method = 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.

     ELSE.

       MESSAGE ‘German transaltions are maintained’(003) TYPE ‘S’.

     ENDIF.

   ENDIF.

   IF p_tb = ‘X’.

     SELECT SINGLE * FROM dd02t INTO l_dd02t WHERE tabname = p_tb_obj AND

                                                   ddlanguage = p_langu.

     IF sy-subrc NE 0.

      wa_final-type = ‘TABLE’.

      wa_final-obj = P_TB_OBJ.

      WA_FINAL-TEXT = ‘Trnslation Not maintained for the table text’.

      append wa_final to it_final.

      clear : wa_final.

*    ENDIF.

       CALL FUNCTION ‘RM_TABLE_INFO_GET’

         EXPORTING

           i_tabname           = p_tb_obj

*         I_FIELDNAME         =

          i_langu             =  p_s_lang

          i_read_texts        =  ‘X’

        IMPORTING

*         E_TABHEADER         =

*         E_TABFIELD_W        =

          e_tabfields_t       =  e_fields

        EXCEPTIONS

          not_found           = 1

          ddic_error          = 2

          OTHERS              = 3.

       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.

     LOOP AT e_fields INTO wa_fields.

       CALL FUNCTION ‘RM_DDIC_TEXTS_GET’

         EXPORTING

           i_name                = WA_FIELDS-ROLLNAME

           i_type                = ‘DTEL’

           i_langu               = p_s_lang

         IMPORTING

           e_ddtxt               = e_s_ddtxt

           e_hdtxt               = e_s_hdtxt

           e_stxt                = e_s_stxt

           e_mtxt                = e_s_mtxt

           e_ltxt                = e_s_ltxt

         EXCEPTIONS

           objtype_not_supported = 1

           illegal_input         = 2

           OTHERS                = 3.

*** FOR TARGET LANGUAGE

       CALL FUNCTION ‘RM_DDIC_TEXTS_GET’

         EXPORTING

           i_name                = WA_FIELDS-ROLLNAME

           i_type                = ‘DTEL’

           i_langu               = p_langu

         IMPORTING

           e_ddtxt               = e_t_ddtxt

           e_hdtxt               = e_t_hdtxt

           e_stxt                = e_t_stxt

           e_mtxt                = e_t_mtxt

           e_ltxt                = e_t_ltxt

         EXCEPTIONS

           objtype_not_supported = 1

           illegal_input         = 2

           OTHERS                = 3.

       IF ( e_s_ddtxt IS NOT INITIAL AND e_t_ddtxt IS INITIAL ) OR

          ( e_s_hdtxt IS NOT INITIAL AND e_t_hdtxt IS INITIAL ) OR

          ( e_s_stxt  IS NOT INITIAL AND e_t_stxt  IS INITIAL ) OR

          ( e_s_mtxt  IS NOT INITIAL AND e_t_mtxt IS INITIAL ) OR

          ( e_s_ltxt  IS NOT INITIAL AND e_t_ltxt IS INITIAL ).

* APPEND THE data type

          wa_final-type = ‘Data Element’.

          wa_final-obj  = WA_FIELDS-ROLLNAME.

          wa_final-text = ‘Translation not maintained for data element’.

          APPEND wa_final TO it_final.

          clear : wa_final.

       ENDIF.

       IF wa_fields-domname+0(1) = ‘Z’.

         SELECT single ddtext from DD01T into l_ddtxt where domname = wa_fields-domname

            and DDLANGUAGE = p_s_lang.

          IF l_ddtxt is  initial.

             wa_final-type = ‘Domain’.

             wa_final-obj  = wa_fields-domname.

             WA_final-text = ‘Translation not maintained for domain’.

             clear : wa_final.

           endif.

         CALL FUNCTION ‘DD_DOMVALUES_GET’

           EXPORTING

             domname              = wa_fields-domname

            text                 = ‘X’

            langu                =  p_s_lang

*       BYPASS_BUFFER        = ‘ ‘

*     IMPORTING

*       RC                   =

           TABLES

             dd07v_tab            =  lt_dd07v

          EXCEPTIONS

            wrong_textflag       = 1

            OTHERS               = 2.

         CALL FUNCTION ‘DD_DOMVALUES_GET’

             EXPORTING

               domname              = wa_fields-domname

              text                 = ‘X’

              langu                =  p_langu

*       BYPASS_BUFFER        = ‘ ‘

*     IMPORTING

*       RC                   =

             TABLES

               dd07v_tab            =  lt_t_dd07v

            EXCEPTIONS

              wrong_textflag       = 1

              OTHERS               = 2.

         endif.

         LOOP AT lt_dd07v INTO wa_dd07v.

*          READ TABLE lt_t_dd07v INTO wa_t_dd07v WITH KEY domname = wa_dd07v-domname

*                                         valpOS = wa_dd07v-valpOS.

           CALL FUNCTION ‘DD_DOMVALUE_TEXT_GET’

             EXPORTING

               domname             =  wa_dd07v-domname

               value               =  wa_dd07v-DOMVALUE_L

              LANGU               =  p_langu

*             BYPASS_BUFFER       = ‘ ‘

            IMPORTING

              DD07V_WA            = wa_t_dd07v

*             RC                  =

                     .

*          IF sy-subrc EQ 0.

             IF ( wa_dd07v-domvalue_l IS NOT INITIAL AND wa_t_dd07v-domvalue_l IS INITIAL ) OR

                ( wa_dd07v-domvalue_h IS NOT INITIAL AND wa_t_dd07v-domvalue_h IS INITIAL ) OR

                ( wa_dd07v-ddtext IS NOT INITIAL AND wa_t_dd07v-ddtext IS INITIAL )         OR

                ( wa_dd07v-domval_ld IS NOT INITIAL AND wa_t_dd07v-domval_ld IS INITIAL )   OR

                ( wa_dd07v-domval_hd IS NOT INITIAL AND wa_t_dd07v-domval_hd IS INITIAL ).

                   wa_final-type = ‘Domain Value’.

                   wa_final-obj = wa_dd07v-domvalue_l.

                   wa_final-text = ‘Translation is not maintained for domain value’.

                   APPEND wa_final to it_final.

                   clear : wa_final.

             ENDIF.

*            ENDIF.

             CLEAR : wa_dd07v, wa_t_dd07v.

           ENDLOOP.

           CLEAR : wa_fields.

         ENDLOOP.

       ENDIF.

   END-OF-SELECTION.

   IF p_rp = ‘X’.

     IF lt_texts[] is initial.

       write : TEXT-003.

     else.

       WRITE : TEXT-002,

               / p_rp_obj.

       LOOP AT lt_texts into wa_texts.

         WRITE : / wa_texts-id,

                 /10 wa_texts-key,

                 /135 wa_texts-entry.

       clear : wa_texts.

       endloop.

      endif.

   ENDIF.

  IF p_tb = ‘X’.

    write : p_tb_obj.

    IF it_final IS NOT INITIAL.

      loop at IT_FINAL INTO WA_FINAL.

       write : / wa_final-type,

                    wa_final-obj,

                    wa_final-text.

         clear : wa_final.

      ENDLOOP.

     ELSE.

       write : text-006.

     ENDIF.

  ENDIF.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply