In an SAP Adobe Forms form, the content of a field is to be displayed at a certain font height. However, it can be that the variable exceeds the size of the field when a certain number of characters are exceeded. In this case, the font height should be reduced.

In the following a workaround is presented, how this can be achieved.

Requirement

In a WM-TO form, the post-storage location should be clearly visible in font height = 50pt. Usually, the storage location is less than 6 characters. In a few cases, however, the storage space is larger than 6 characters. To ensure that the storage space fits into the field in these cases, the font height should be reduced to 30pt.

SAP Adobe Forms Überschreiten Fonthöhe 1

The variable does not fit into the field

Insert code with JavaScript

Zum Zeitpunkt “Initialize” wird folgendes JavaScripting eingefügt.

var len;
len = this.rawValue.length;

if (len>8){
//this.font.size = “50pt”;
} else {
this.font.size = “30pt”;
}

SAP Adobe Forms JavaScript

First, a variable “len” is defined. The method “length” determines the current number of characters in the field.

The field is larger than 7 characters. The font height is reduced to 30pt. In all other fields, the font height remains as defined on the Character Format palette.

SAP Adobe Forms Überschreiten Fonthöhe 2

After inserting the JavaScripts, the variable will fit into the field

Further information

Spezial topics to SAP forms
Fixed price SAP forms
SAP form development