Is the Vara dynamic or static? According to documentation, if you are trying to update a Dynamic Vara then you will get a runtime error.
3.4.8 :PUT_VAR
Script Statement: Stores a value in a Variable object.
Syntax
:PUT[_VAR] Variable, [Key], Value, [Value], [Value], [Value], [Value]
Syntax Description/Format
Variable The name of the Variable object to which one or several values should be
assigned.
Format: AE name or script variable
Key The line in which the value should be stored.
Format: script literal, script variable or script function
Value Entries that should be written to the particular value columns. Values of nonspecified
columns are deleted. Existing values are overwritten.
Format: script literal, script variable or number specified without quotation marks
Should you use this statement with the Variable object XML, only
complete (i.e. well-formed) XML is allowed.
CommentsA runtime error occurs if a dynamic variable (source: SQL, SQL internal, multi or data type) is used inthis script element. Only static Variable objects can be filled using :PUT_VAR.The following general rules apply:
l Key and Value are added if the variable does not contain a value.
l Value is replaced, if the variable contains a value of the same Key.
Separate the individual values by using commas, if you want to fill several value columns of a variable.
Static variables are limited to 5 value columns.
If a key is not specified for a static Variable object, the system automatically selects the key based the
Scope setting on the Attributes tab of the Variable object.
The parameter Key is optional if the setting Scope - "no validity key" is selected in the Attributes tab.
In this case, the variable contains only one value. Ensure that the commas are set in the statement
even if Key is not used.
You can also specify the individual values without using inverted commas. Commas are used as
separators.
Variable objects may have different numbers of values. If you enter more values than the object
provides, an error message is displayed.
When using this script statement with the static Variable object XML, the values for XML data type will
be beautified automatically. That means, you may use XML in a single script line for example, but in the
object the value will be rearranged according to the XML standard.
------------------------------
Cheers,
Gary Chismar
Manager, Automic, PeopleSoft HCM/FI
Florida State University
Florida
------------------------------
Original Message:
Sent: 08-21-2019 03:39 AM
From: Dominic Irudayasamy
Subject: AE Application interface-SaveObject NullPointerExceptionException
Hi All,
I tried to update an existing Variable table, but I end with java nullpointexception at SaveObject function, Am I missing something?
code:
private void jobvar() throws IOException{private void jobvar() throws IOException{ UC4ObjectName name =new UC4ObjectName("VARA.TST.BCK"); OpenObject open = new OpenObject(name); uc4.sendRequestAndWait(open); UC4Object getobj =open.getUC4Object(); Variable var1= (Variable) getobj; var1.add("server2","month","11:00","Backup","",""); SaveObject save = new SaveObject(var1); uc4.sendRequestAndWait(save); uc4.sendRequestAndWait(new CloseObject(var1)); }
error:
Exception in thread "main" java.lang.NullPointerExceptionException in thread "main" java.lang.NullPointerException at com.dhl.ca.GoAutomic.jobvar(GoAutomic.java:71) at com.dhl.ca.GoAutomic.demo(GoAutomic.java:31) at com.dhl.ca.GoAutomic.main(GoAutomic.java:26)