Hi Ro66an
This questions seems a bit too general purpose which might not attract the best answers. Here are three ideas -
For example you could set the flag true as the very first instruction in OB1 and then reset it as the very last instruction in OB1. That would have the desired effect. You decide what the logic conditions for these two events are to be.
Alternatively there is the built-in one-shot instruction which could be triggered anywhere.
If you want a first-scan signal (rather than an any scan signal) the usual convention in S7 is to use one of the start-up OBs (say OB100), set the flag true there, and then reset it as the last instruction in OB1 once the first scan has completed.
Regards
Ken