Hi all,
I've tried to set the value of an attribute of the type enumerator in a macro.
I tried the methods
Designer.setAttribute(myModel, myObj,Constants.AT_SAP_FUNC_TYPE, "Process", null) and Designer.setAttributePersistent(myObj, Constants.AT_SAP_FUNC_TYPE, "Project", null)The result was that in the first case, although no error was thrown, the attribute value remained unchanged. In the second case an error was thrown stating that an parameter of type String was passed instead of Integer. This error message doesn't make much sense: When I tried exactly the same statement with the attrTypeNum "AT_SHORT_DESC", it worked flawlessly.
When I try to do the same in a report by the following statement, the attribute is set without any problems:
ObjDef.Attribute(Constants.AT_SAP_FUNC_TYPE, Context.getSelectedLanguage).setValue("Process")Does anyone know whether there's a different way to set the value of enumerator attributes in a macro? Or has someone experienced a similar problem?
Thank you and best regards,
Philipp
Martin Schröder on
Hello Philipp,
I am afraid, the error message "string instead of integer" is right, but it refers to the rather hidden explanation in Aris Script Help: search for AT_SAP_FUNC_TYPE leads to the topic "Constants from AttrTypeTblNum". For an attribute of the type enumerator the list of allowed values consists again of numeric constants (attribute value types AVT_*), whereas you tried to set the attribute value to the strings "Process" or "Project".
For your purpose you should use AVT_PROC_1 (Process) or AVT_SOLAR_PROJECT (Project) resp. in macros.
Perhaps this holds strictly only for macros as Aris Script Help states for the setValue() method in report scripting (s. Help topic "Report class Attr - Method setValue") a more lax usage of strings instead of constants for numeric attribute value types.
"AT_SHORT_DESC" worked all right, because it is a string attribute.
Hope this helps, Martin