cancel
Showing results for 
Search instead for 
Did you mean: 

S4Cloud: Adobe Form - custom field hardcoded text not displayed on output

KatjaS
Explorer
0 Kudos
339

Dear Expert Community,

I have an Adobe output form (DEBIT MEMO) in S4Hana public cloud where I have added a field. The field is visible/invisible on the printout as expected, but the hardcoded value of the field remains empty / doesn't display. The caption of the field is correctly displayed (or not) as prompted by the conditions, proving that the active/inactive conditions work correctly. Just the value of the field doesn't get displayed.

The active/inactive condition of this field, as well as the hardcoded value, are controlled by a piece of java code as shown below (in the below, the real Partner number is replaced by XXXXXX):

<script contentType="application/x-javascript">if(this.parent.Partner.rawValue =="XXXXXX") {this.rawValue =="TEST"}; else
{
this.presence = "inactive";
}
</script>

What could be the reason and what could be done? 

Best regards,

Katja

 

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
SAP Champion
SAP Champion
0 Kudos

this.rawValue =="TEST". you have to remove one =

 

== is for comparison, = is for assignment

KatjaS
Explorer
0 Kudos
Hello Junwu, I tried with one =, but it didn't change the outcome. Also, I tried with 3 x ===, but it didn't change the outcome either. On this site Java Operators it says == means equal to, but if you say there's a difference between comparison and assignment purposes, I'll start keeping it in mind, thanks! Meanwhile, I also made the field invisible and then visible again, and made a test print of both cases, to confirm that the field is responsive to changes. Confirming that it is.
KatjaS
Explorer
0 Kudos
Sorry, the Java Operators URL didn't get printed; not sure if I can paste it as URL here, but I'll try: https://www.w3schools.com/java/java_operators.asp:
junwu
SAP Champion
SAP Champion
0 Kudos
don't know what you are talking. do you have any general programming experience? don't blindly talk about = == ===, the palce you need comparison, you use ==, when you want to assign a value to a variable, you use =.
junwu
SAP Champion
SAP Champion
0 Kudos
and the coding here is javascript, not java
KatjaS
Explorer
0 Kudos
Thanks for pointing that out Junwu. You are right, I have very limited or basic programming experience and hardly any formal training in it, so pardon my vocabulary. I'm learning by doing. So far, I have managed to get most of our output management changes up and running, but this one I can't figure out. I'm not sure it relates to the javarscript or if it could be some other type of issue.
junwu
SAP Champion
SAP Champion
0 Kudos
post your latest code, let's see what is going on.
KatjaS
Explorer
0 Kudos
Do you mean all code from the whole output form template, or just from this field? The full code is obviously long and could contain sensitivities. Here below is all code from that particular field (with the customer code partly censored). Most of it is copied from another field, but the field name, the caption and the piece of javascript are specific to this field. </field> <field name="CustomerVATRegistrationCH" w="150mm" h="6.15mm"> <ui> <textEdit> <border presence="hidden"/> <margin/> </textEdit> </ui> <font size="9pt" typeface="Calibri"/> <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/> <para vAlign="middle"/> <caption reserve="60mm"> <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/> <value> <text xliff:rid="A047A429-4532-493D-8F02-BB7E1BC7EFB9">VAT No.CH:</text> </value> <font size="9pt" typeface="Calibri" weight="bold" baselineShift="0pt"/> </caption> <border> <edge presence="hidden"/> <corner/> <corner presence="hidden"/> <corner/> <corner presence="hidden"/> </border> <bind match="none"/> <event activity="initialize" name="event__initialize"> &lt;script contentType="application/x-javascript">if(this.parent.Partner.rawValue =="100XXX") {this.rawValue ="TEST";} else { this.presence = "inactive"; } &lt;/script&gt; </event> <value> <text maxChars="20"/> </value> </field>
KatjaS
Explorer
0 Kudos
Unfortunately, I can't get it pasted with formatting
junwu
SAP Champion
SAP Champion
0 Kudos
do you know what is code????
KatjaS
Explorer
0 Kudos
This is S4Hana public cloud. This is all code (xml, javascript) I can get to. As said, I'm not familiar with programming jargon and I realize I don't use it correctly.
relax... that's okay, we all started with everything at some point 😉 I will try reproducing this case. I'm not that familiar with Javascript coding in Adobe Forms, but, based on my experience, the little things are the things that cause the error.. I need some time, I hope you find the error before that, let's see 😄
KatjaS
Explorer
0 Kudos
It may have been misleading of me to post the piece of javascript in the first place, because I don't know if that's what causes the problem. It was as FYI. The problem is that the hardcoded value doesn't get displayed.
0 Kudos

Do you have a Screenshot from the dataelement in the livecycle designer with all the needed information? If it runs through the if statement in the javascript I don't think there is a problem with the element itself, but who knows. Maybe you can have a look into the link i sent you -> Scripting basics.

KatjaS
Explorer
0 Kudos
Thanks a million Fabienne; I can't check it today anymore but will get back to this tomorrow. I suppose you mean the data binding for the "Partner", which is present elsewhere in the form, but I'll further check tomorrow.
KatjaS
Explorer
0 Kudos
Hello Jennifer - I can't paste a screenshot here, or don't see how. The Payer party referred to in the piece of script is derived from a field in an underlying subform. It comes from data binding <bind match="dataRef" ref="$.PayerParty.Partner"/>.
0 Kudos
Hi Katja, hm, you are not working with the Adobe Livecycle Designer? I don't know how it works exactly in the Public Cloud. I am using the designer. I created a textfield on my own and had a look at the XML coding. So the assignement with this.rawValue should work... your textfield is shown, isn't it? So it is not always hidden? But the hidden logic is working, correct? Just the assignement of the value doesn't work? The fieldlength is enough?
KatjaS
Explorer
0 Kudos
Hi Jennifer - I am working with Adobe Lifecycle Designer. After editing, I save and upload the reworked template back to S4Hana Cloud and test. My text field is indeed shown when the condition of finding the Payer is met, and the field is inactive when this condition is not met. So the field logic seems to function as expected. The field length is enough, it's 20 characters. I have also tried making the border of the field visible so I can confirm that not only the caption, but also the rest of the field is displayed. I confirm this is the case. It all displayes as one big field and not two fields (1 caption, 1 value), but I believe this is correct. It's identical with the properties of the other surrounding fields which work fine. So, does your work confirm that it's not the javascript that causes this?

Hi Katja, good question.. I made a little Adobe form with just one textfield and the assignement via Javascript.. that works fine for me:

 

<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeLiveCycleDesigner_V11.0.9.20230422.1.42_SAP" APIVersion="3.6.23111.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2025-04-23T07:31:33Z" uuid="624e300a-56fe-4812-bfb9-020e615f49ec">
<template xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" xmlns="http://www.xfa.org/schema/xfa-template/3.3/">
<?formServer defaultPDFRenderFormat acrobat10.0dynamic?>
<subform layout="tb" locale="de_DE" name="data" restoreState="auto">
<pageSet>
<pageArea id="Page1" name="Seite1">
<contentArea h="284.3mm" w="197.3mm" x="0.25in" y="0.25in"/>
<medium long="297mm" short="210mm" stock="a4"/>
<?templateDesigner expand 1?></pageArea>
<?templateDesigner expand 1?></pageSet>
<subform h="284.3mm" w="197.3mm">
<field h="9mm" name="Test" w="62mm" x="57.15mm" y="79.375mm">
<ui>
<textEdit>
<border>
<edge stroke="lowered"/>
</border>
<margin/>
</textEdit>
</ui>
<font typeface="Arial"/>
<margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/>
<para vAlign="middle"/>
<caption reserve="18.0838mm">
<para vAlign="middle"/>
<value>
<text xliff:rid="7175D1FB-772F-4459-94CD-FD4DAE9583F4">Textfeld</text>
</value>
</caption>
<bind match="none"/>
<event activity="initialize" name="event__initialize">
<script contentType="application/x-javascript">this.rawValue = "TEST";

</script>
</event>
</field>
<?templateDesigner expand 1?></subform>
<proto/>

KatjaS
Explorer
0 Kudos
Hi Fabienne - I finally did find the reason. This probably comes down to inexperience with xml. My field where the issue occurs resides in a subform, lets call it "Subform1". The field "Partner", which my field checks with, resides in another subform, let's call it "Subform2". Both subforms reside under the same main form, but "Subform1" isn't a parent to "Subform2". "Subform2" is hidden. I haven't yet studied the link you provided (not fluent enough in German, so it'll take some time), but I suppose my if(this.parent...) didn't work this way. When I moved the "Partner" data binding into "Subform1", it did work. It's confusing though that we have numerous other fields that also fetch data from "Subform2", and which are organized similarly in relation to "Subform2" as my field is, but which don't have the same issue. I have faced this often enough to have checked it in the past, so I still don't quite get why it was an issue now. Also, it's confusing that the logic of my field still clearly worked, just the value didn't get displayed. Anyhow, I thank you for your time and patience, for the very useful link and for validating that it wasn't the piece of javascript that caused it. That pushed me re-checking assumptions I already thought I had checked before.
0 Kudos

Hi,

I'm not that fit in Javascript via Adobe Forms, but it seems suspicious that you have two '=' signs. Maybe you can try = 'TEST' instead of == 'TEST'.

Does your logic even reach the If statement? There are many ways to fetch the parent values. Maybe you have to change that part. There is a way to fetch it via strings.. maybe that works.

Hope that helps

KatjaS
Explorer
0 Kudos
Hi Fabienne,
KatjaS
Explorer
0 Kudos
Hi Fabienne, Thanks for the suggestion! The double "=" -signs are as instructed by Java syntax, and they are successfully used that way in numerous other places in our output forms. Sometimes, I have seen even === recommended, but I usually stick to ==. I do think the if-statement is reached because I can see the caption displayed if the condition Partner = XXXXXX is met, and - converserly - not displayed if this condition isn't met. Also, I should add that the field length for the value is 20 characters and the value itself is less. The other properties of the field are identical with other fields that do work correctly.
0 Kudos

Hi Katja, got it. Does the code check work? Maybe you have to put the semicolon directly after the "TEST" Like that: == "TEST"; }

KatjaS
Explorer
0 Kudos
Hi Fabienne, You are right, thanks! I must have missed that at some point, or inadvertently reversed it. However, I changed and retested it, and it didn't solve the issue.
Hi Katja, maybe that link will help you. It is in german but you can translate it via google. It always helped me when it comes to javascript development in adobe forms:https://www.berater-wiki.de/JavaScript_und_FormCalc_Scripting_im_LiveCycle_Designer
KatjaS
Explorer
Thanks Fabienne, much appreciated!