Hello Patrick,
it is quite simple like in TIA Portal for a S7-1500
1. Define an instance of an ProgramAlarm in the var section
2. With a pragma you configurate alarm classes and alarm message
3. In the alarm message you use the associated values in following format: @<SD number>%<format>@
4. Now in the method code section, you rise the alarm if you set the SIG input to true and with the optional parameter SD_1 to SD_10 you can pass tags to the alarm message. Note for passing values on the SD_x parameter you have to call al little system helper method pass(<tag>)
USING Siemens.Simatic.S71500.Alarming;
//...
CLASS FOO
//...
METHOD PRIVATE MyAlarming
VAR
// process values
fillLevel : UINT;
processFlags : WORD;
signal : BOOL;
{S7.Alarm = WithAck, "This is a demo alarm. Fill level=@1%u@ flags=@2%X@"}
myAlarm : ProgramAlarm;
END_VAR
// raise the alarm with alarm text with associated values
myAlarm(SIG := signal, SD_1 := pass(fillLevel), SD_2 := pass(processFlags), Status => status);
END_METHOD
END_CLASS
More Details find you in the documentation here
Happy coding
Kevin