Hi Patrick,
in SIMATIC AX, it is currently only possible to declare global variables as RETAIN. This can be done by creating a VAR_GLOBAL RETAIN section: https://docs.industrial-operations-x.siemens.cloud/r/en-us/ax/st-docs/10.2.82/language-guide/program-structure/variable-sections/retentive-variables-retain
So the way to go would be to write the local variables of FBs that should be retained to the global retain variable and also get it from there in case of a warm start --> e.g. by using an init method.
Best regards,
Johannes