How do I open a non-object window like IPREP (Preparation Plans) via code with full functionality

I've tried a couple of different ways of opening the IPREP window (Preparation Plan) from another screen - via code using SAISIE_CHAR subprog, and also via a custom Action. Both launch the window, but it doesn't behave the same as when you open it via the X3 menu. For instance, it doesn't pre-populate the Site, it doesn't load the PRL table (it produces such an error when selecting an existing Preparation List), and the Search button does not return any results.

I've been able to code most of these things, but the Search button still does not work.

My thinking - there's a better way to launch the IPREP window and have it behave as it would when you open it normally.

Any thoughts?

Here is the code, which seems to produce better functionality than the Action I have. Again, it launches okay, but the Search button on the IPREP window does not work:

Subprog B1_PRLNUM(VALEUR)
Variable Char VALEUR()
Local Char VALBOUT(1) : VALBOUT = ""
Local Char PARBOUT(4) : PARBOUT = "PREP"

  Call SAISIE_CHAR(VALBOUT,PARBOUT,"IPREP","TRTPREP","SPEPREP") From GSAISIE
End