01-21-2005 1:33 PM
Hello!
Is there a way to capture an event of creating a spool?
What do I mean exactly?
Almost every standard SAP functionality has possibility of creating variuos spool outputs (reports or forms). Classically, user clicks the "Print" command on a standard toolbar.
I'd like to create a generic functionality to capture the spool creation, without modification. At some point it would be an application-independant Z* ABAP which would know when a spool is created, know its number and do something about it. A sort of event listener, which reacts to an event "spool created".
For example, I could imagine a special output device which creates a spool and runs ABAP or fires event (detectable by event-waiting job), or whatever, and passes spool number as parameter. This is just an idea. I don't know is it possible. So when user wants to do something special about his output rather than immediate printing (for example, save the spool number to a Z* table), he justs selects this special output device.
Or it could be application-specific customer/user exits (are there such exits for printing?), which would then call generic Z* ABAP.
Or something else. All ideas are welcome!
Thanks in advance!
Kind regards,
Igor Barbaric
01-24-2005 3:18 PM
Hi Igor,
I do not believe it is possible (most of the ABAP persons would like to have some form of trigger mechamism to signal updates in tables).
However, with some work, you might be able to do the trick.
The spool requests are stored in transparant table TSP01 and the only thing that needs to be done is some kind of polling program to find out if there are difference between now and a moment ago.
TYPES: BEGIN OF ty_tbl.
rqident TYPE rspoid.
END OF ty_tbl.
DATA: old_tbl TYPE ty_tbl OCCURS 0,
cur_tbl TYPE ty_tbl OCCURS 0.
SELECT rqident
INTO TABLE old_tbl
WHERE rqclient EQ sy-mandt.
IF sypsubrc NE 0. EXIT. ENDIF.
DO.
SELECT rqident
INTO TABLE cur_tbl
WHERE rqclient EQ sy-mandt.
IF sy-subrc NE 0. EXIT. ENDIF.
IF cur_tbl[] NE old_tbl[].
Trigger event here (or do your trick)
ENDIF.
WAIT UP TO 1 SECONDS.
SELECT rqident
INTO TABLE old_tbl
WHERE rqclient EQ sy-mandt.
IF sy-subrc NE 0. EXIT. ENDIF.
You also need some failsafe to exit this loop
Something like this
IF sy-uzeit GT '180000'. EXIT. ENDIF.
ENDDO.
If a program like this is started it will run until 18:00:00 hours (06:00:00PM).
I known it is a bit crude, but you could approach your problem like this.
Regards,
Rob.
01-24-2005 3:18 PM
Hi Igor,
I do not believe it is possible (most of the ABAP persons would like to have some form of trigger mechamism to signal updates in tables).
However, with some work, you might be able to do the trick.
The spool requests are stored in transparant table TSP01 and the only thing that needs to be done is some kind of polling program to find out if there are difference between now and a moment ago.
TYPES: BEGIN OF ty_tbl.
rqident TYPE rspoid.
END OF ty_tbl.
DATA: old_tbl TYPE ty_tbl OCCURS 0,
cur_tbl TYPE ty_tbl OCCURS 0.
SELECT rqident
INTO TABLE old_tbl
WHERE rqclient EQ sy-mandt.
IF sypsubrc NE 0. EXIT. ENDIF.
DO.
SELECT rqident
INTO TABLE cur_tbl
WHERE rqclient EQ sy-mandt.
IF sy-subrc NE 0. EXIT. ENDIF.
IF cur_tbl[] NE old_tbl[].
Trigger event here (or do your trick)
ENDIF.
WAIT UP TO 1 SECONDS.
SELECT rqident
INTO TABLE old_tbl
WHERE rqclient EQ sy-mandt.
IF sy-subrc NE 0. EXIT. ENDIF.
You also need some failsafe to exit this loop
Something like this
IF sy-uzeit GT '180000'. EXIT. ENDIF.
ENDDO.
If a program like this is started it will run until 18:00:00 hours (06:00:00PM).
I known it is a bit crude, but you could approach your problem like this.
Regards,
Rob.
01-25-2005 11:49 AM
Hi, Rob!
Thanks for the hint. I could use this 'general spool collector' idea if I end up with nothing better after a while. However, I'd prefer something interactive and more exact. I'd like user to choose at the moment of spool creation wether he/she wants to perform this special activity or not. The best I could imagine would be a special output device, but don't know is it possible.
I'm thinking even of modification of a standard object, but still haven't found the most appropriate point in repository. It should be a generic standard program which contains the spool number. I could maybe see there other useful info like calling transaction etc.
Thanks!
Kind regards,
Igor Barbaric