How do I set a value dynamically in SAP Adobe Forms using JavaScript

14,864

To enable the JavaScript Debugger for LiveCycle Designer and execute code from the JavaScript Console, you must enable JavaScript and the JavaScript Debugger in Acrobat Professional. You need to enable the JavaScript Debugger to access the JavaScript Console because the console window is a component in the JavaScript Debugger interface.

You can enable the JavaScript Debugger in Adobe Reader if you have LiveCycle Reader Extensions installed. To enable the JavaScript Debugger in Adobe Reader, you need to get the debugger.js file and then edit the Microsoft Windows Registry. For more information about enabling the JavaScript Debugger in Adobe Reader, see Developing Acrobat Applications Using JavaScript at partners.adobe.com/public/developer/acrobat/devcenter.html (English only). (from Help in Adobe designer) I hope it helpful..) Anyway you can use "this.isNull" instead of data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == null And event.. usually I use event form:ready for such cases.

Share:
14,864
user2568701
Author by

user2568701

SAP ABAP Developer

Updated on June 04, 2022

Comments

  • user2568701
    user2568701 almost 2 years

    I'm creating a form based on the SAP standard Adobe form F140_CUS_STAT_01.

    In the "Document" column I have the requirement to display field REBZG if it contains a value, or BELNR if not.

    I have done the following:

    if ( data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == null ||
         data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == '' ) 
      {  data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue = 
         data.CustomerStatement.ItemTable.TableOpenItem.BELNR.rawValue; }
    

    BELNR is a hidden field in TableOpenItem

    Unfortunately nothing happens.

    Is there something wrong with my syntax?; Should I be using a specific event? Do I have to treat the internal table fields differently?

    Also, how do I debug javascript in the SAP context. I have tried both "Alert" and print to console, but neither has any effect.