Oooook... we can overcome communication problems if just try enough times, hard enough
Is the program generating spool running in the background, too? If ZTEST will be executed in background, the table TBTC_SPOOLID will contain the entry for the spool, from which the job and job step can be read and the job step will contain the name of ABAP program. ok, that was replied already.
If the program generating the spool is not running as a batch job... you are out of luck I'm afraid.
I'll look around some more, but don't believe spool system itself stores the name of ABAP program creating spool anywhere (or anywhere it's accessible from outside). In the background it is retrievable only because background processing environment has stored the information in its own tables.
cheers
Jānis