Skip to Content
Author's profile photo Eitan Rosenberg

SmartForm Translation – Reducing the Burden

Not long ago I had to create a smartform that will be printed in English and Japanese.

I must admit that my Japanese is not so good…..

Then it hits that me !! we do have in the dictionary some languages Japanese included .

Can we use the dictionary also in our print out ?

If we can transfer the Data element texts translation to the form we can.

To the code:

The input is based on tables scarr,spfli .

Class Y_R_EITAN_TEST_31_05_CL will hold the data types that will be transferred to the smartform.

Types tp_meta_x and tp_meta_1 are the carriers of the of the Data element translation . 

    TYPES: BEGIN OF tp_meta_x .
    TYPES: ddtext      TYPE dd04t-ddtext  ,
           reptext     TYPE dd04t-reptext ,
           scrtext_s   TYPE dd04t-scrtext_s ,
           scrtext_m   TYPE dd04t-scrtext_m ,
           scrtext_l   TYPE dd04t-scrtext_l .
    TYPES: END OF tp_meta_x .

    TYPES  BEGIN OF tp_meta_1 .
    TYPES  s_carr_id   TYPE tp_meta_x .
    TYPES  s_carrname  TYPE tp_meta_x .
    TYPES  s_currcode  TYPE tp_meta_x .
    TYPES  s_from_cit  TYPE tp_meta_x .
    TYPES  s_fromairp  TYPE tp_meta_x .
    TYPES  s_to_city   TYPE tp_meta_x .
    TYPES  s_toairp    TYPE tp_meta_x .
    TYPES  s_airpname  TYPE tp_meta_x .
    TYPES  s_dep_time  TYPE tp_meta_x .
    TYPES  s_arr_time  TYPE tp_meta_x .
    TYPES  s_distance  TYPE tp_meta_x .
    TYPES  s_distid    TYPE tp_meta_x .
    TYPES  END OF tp_meta_1 .
   

Program Y_R_EITAN_TEST_31_05 .

The thing to note in this program is FORM get_meta_1 here we populate  st_meta_1 which is type y_r_eitan_test_31_05_cl=>tp_meta_1 .
 
For each entry we call function ‘DDIF_DTEL_GET’ and fill its tp_meta_x  .

Here is what we have at the end of form get_meta_1:

/wp-content/uploads/2013/10/capture_20131017_103409_299549.png

SmartForm Y_R_EITAN_TEST_31_05 .

/wp-content/uploads/2013/10/capture_20131017_105142_299551.png

As expected we have st_meta_1 as import parameter.

The only thing that remain to do is to drag the fields as usual (better then typing ) .

This also apply to the headings of tables.

Exceptions: When we canot use the SAP standard translations the structure can be filled from different text repository (e.g. text symbol, ztables  ).

/wp-content/uploads/2013/10/capture_20131017_110337_299582.png

Running the program

Parameters:

/wp-content/uploads/2013/10/capture_20131017_111906_299583.png

The output in different language:

/wp-content/uploads/2013/10/capture_20131017_112744_299592.png

/wp-content/uploads/2013/10/capture_20131017_112800_299593.png

/wp-content/uploads/2013/10/capture_20131017_112833_299594.png

This one is in right to left language (Hebrew) the SAP translation is not complete but we can see that RL applied .

/wp-content/uploads/2013/10/capture_20131017_113136_299595.png

That’s all folks and happy translations.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo nabheet madan
      nabheet madan

      Hi Eitan

      Thanks for sharing with the community. I would say very nice innovative idea One observation though imagine that you have a table  in MAIN window with 10 columns so the column header length may be an issue. Because it may happen that in English a word has 10 characters where as in German/Japanese it has 20 character so spacing can lead to formatting issue.

      Thanks

      Nabheet

      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg
      Blog Post Author

      Thanks.

      You are right of course testing is required as usual.

      You have to take into account the space greedy languages.

      Regards.

      Author's profile photo Former Member
      Former Member

      Hi eitan

      is this CLASS Y_R_EITAN_TEST_31_05_CL global or local class?

      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg
      Blog Post Author

      Hi,

      A global one .

      We need the definition of the data accessible to the program and the form .

      Regards.