Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sabarna17
Contributor
1,839

Few days back we found a serious problem regarding Translation of the Labels of all the forms we were working on. The pressure came from the functional. As per there requirement they want to update a table(Constant table) and they want to reflect the changes in the adobe forms. Then things were getting little challenging. One of my senior created an method to fetch all the Translation details for any of the form. We were passing the values through the context of the forms. She created a structure with 200 fields. Among those fields anybody can pass max of 200 fields to a structure for translation. For our forms the number 200 was little high. Anyways after that we follow the below steps and successfully displayed the caption of the fields dynamically as per the system language.



this.resolveNode("this.caption.value.#text").value = data.Page1.Translations.FIELD_001.rawValue ;


The bold one is the field which contains translation and the italic one is the subform in which we wrapped the fields which contains translation.


Now the problem begins. Some of the field text needed to be like this as shown below.



  


Case A: For this case the caption is needed to be right aligned. The initial spaces may varies for different languages.




  • First calculate the total no of letters may fit in that field A. Say it is 50 char.

  • Then create an global field named 'i' set its value as 50 spaces. Goto Edit->Form Properties->Variables. Click on '+' and set the value as 50 spaces. It may change for other fields.

  • Then write the following code.


 
var label = 0 ;

var i_val = 0;

var i_len = 0;

var label_len = 0;

var space_len = 0;

var space_app = 0;

label = data.Page1Translations.FIELD_001.rawValue ;

i_val = String(i.value); //................................................... " For spaces

i_len = i_val.length; //................................................... " Checking the space length

label_len = label.length ; //.................................................... " Checking the label length

space_len = Number(i_len) - Number(label_len); //.................................................... " finding the no of spaces have to be appended to a field labels

space_app = i_val.substring(1,space_len); //............................" actual required spaces

this.resolveNode("this.caption.value.#text").value = space_app + label; //..........." Concatenating and displaying the labels..

 

Thus we achieved our requirement. Now I thought how to fulfill the next requirement...


Case B: I created another global variable named 'NXT_LINE' and set its value as 'enter'. (That means in the value I pressed only enter.. )


Then wrote the same code as before just passed NXT_LINE instead if 'i'. In the output it came like field B only.


At last the things are done with the forms. Then I started to write this document. Suddenly senior came and stood behind me and watched what I was writing.


I realized somebody behind.. Heard a little tough voice "Enough blogging something I have regarding MIGO tcode"... 


If any improvement is needed in this technique then please don't forget to write. The main implementation of this technique is to display the caption with your required alignment.



5 Comments
Labels in this area