Technical Articles
[Adobe Form]: Centre Alignment of BARCODE 128 with XML Schema
INTRODUCTION:
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:
- Apply conversion approaches on MATNR value in the interface – it failed
- 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:
MAIN CONTENT:
- Wrap the Barcode variable in a sub-form name ‘Barcode’.
- Go to Palletes -> Script Editor. opt for Form: Ready, Language: FormCalc and write 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
- So, it will change the data length of the Barcode, and the assigned width will be fully covered with the generated code.
Outcome:
Topic page:
ABAP Topic: https://community.sap.com/topics/abap,
Do give your comments and feedback.
Follow for more: Robin Thakral