Skip to Content

Capture spool by ABAP

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 03: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.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.