Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 


As you could see in my previous blog Use DDIC Interface based Regular Custom Adobe Form
We have generated a barcode for MATNR with data length of 40 CHAR.
Challenge: The value is generally coming in 10 CHAR or 18 CHAR (ECC length of MATNR) and as per that BARCODE generation covers the provided width, in layout having no option to auto-expand, making it visible as left/not-center aligned.

Solution: We need to handle the barcode appearing the whole width:

    1. Apply conversion approaches on MATNR value in the interface – it failed
    2. Change the data length of BARCODE in XML schema through scripting – worked, explained below:

In this blog post, we will cover the coding to Dynamically change the data length of UI variables as per the STRLEN of variable:


    1. Wrap the Barcode variable in a sub-form named ‘Barcode’.
    2. Go to Palletes -> Script Editor. opt for Form: Ready, Language: FormCalc, and write the below code
var strlen = len($.GV_MATNR_BAR.rawValue)

$.GV_MATNR_BAR.ui.#barcode.dataLength = strlen

Here, GV_MATNR_BAR is the variable name. Firstly, we will fetch the string length  ‘rawValue’ of the variable and then update the UI property ‘dataLength’.


Barcode Center Alignment Logic

3. So, it will change the data length of the Barcode, and the assigned width will be fully covered with the generated code.


Topic page:

ABAP Topic:,

Do give your comments and feedback.
Follow for more: Robin Thakral