How to get the spool list of a job

Question: Hi,

When I run a job in background I only see my last spool request. (even if I have multiple in SP01).

I want a function or whatever to retrieve the spool list from my job.

Please help.

Best regards,
Yoolb
_________________
PRO IT
Consulting for You and Me
Http://www.proit.be

Answer:
Well here is the answer.

with FM 'WFMC_MESSAGES_EXTEND' you can fill the message details.

then you need to find the spool request number with FM RSPO_ISELECT_SPOOLREQS. After that you have to find your job name and job count to fetch the recipient details.
YOu can do this with FM GET_JOB_RUNTIME_INFO.

Select the necessary data from table TBTCO and call function module
rspo_spooljob_to_office to send your spool requests to the required recipient (with your output as a PDF file).

Best regards,
Yoolb
_________________
PRO IT
Consulting for You and Me
Http://www.proit.be

Answer:
Yoolb, don't be lazy and give Yoolb thanks for the answer to your question... then you will mark your topic as [solved] adding that to its subject.

Congratulations on your success, and thanks in advance

P.S.: Oh! and thanks for share that info.
_________________
Brief History of the Tuly Idiots
Bad advices, wrong answers, bigotism
sapfans GD

Ad by Viiiiiic

Answer:
usted está consiguiendo en mis tits con este crap [ solucionado ]

Answer:
usted está consiguiendo en mis tits con este crap [ solucionado ]

Uh? It's the normal problem when someone uses automatic translation... re-post your message in english, I will understand better. If you use your registered account, I will be happier...

And if you had to use the search button, you will understand why I love to find [solved] threads when I do. I'm sure if I keep my "please [solve]" attitude only one or two more years, I will see more [solved] threads in my searches.

Now I have the need of type some words not allowed... but I will post a smile, makes the life easier...
_________________
Brief History of the Tuly Idiots
Bad advices, wrong answers, bigotism
sapfans GD

Ad by Viiiiiic

Answer:
usted está consiguiendo en mis tits con este crap [ solucionado ]

Uh? It's the normal problem when someone uses automatic translation... re-post your message in english, I will understand better. If you use your registered account, I will be happier...

And if you had to use the search button, you will understand why I love to find [solved] threads when I do. I'm sure if I keep my "please [solve]" attitude only one or two more years, I will see more [solved] threads in my searches.

Now I have the need of type some words not allowed... but I will post a smile, makes the life easier...

Hi Lozano,

What do you mean by putting the topic as SOLVED ?

Best regards,
Yoolb
_________________
PRO IT
Consulting for You and Me
Http://www.proit.be

Answer:
He means, edit your original message and add the text [SOLVED] to the header - this way when someone searching gets a list of topics to look at they can go directly to solved ones rather than reading threads which have no answer...
_________________
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru

Answer:
YoolB,

I have a question, these days i m also trying to send spool in mail to sap office of a desired user...using the same FM, but i do not understand how am i going to provide the userid in FM interface as there is no provision for this as the reciever table contains some object id, type etc...and those details are predefined in TBTCO table....

just make me understand how to send it to desired user..an example will do
thanks
Praveen

Answer:
This initially looked very good, however, there's no reference in table TBTCO to the spool table!. Therefore having obtained your info (?) from table TBTCO how can you then pass this info onto FM 'rspo_spooljob_to_office' as it's first parameter is a Spool ID.
I'm trying to obtain the Spool number from within the batch job which is running. I can get all the batch details as Yoolb says using FM'GET_JOB_RUNTIME_INFO' but after that I can't seem to find a link to spool table TSP01 no matter which tables I try to join on. There must be a way because SM37 works. Perhaps I'm being lazy and should debug SM37.:]

Well here is the answer.

with FM 'WFMC_MESSAGES_EXTEND' you can fill the message details.

then you need to find the spool request number with FM RSPO_ISELECT_SPOOLREQS. After that you have to find your job name and job count to fetch the recipient details.
YOu can do this with FM GET_JOB_RUNTIME_INFO.

Select the necessary data from table TBTCO and call function module
rspo_spooljob_to_office to send your spool requests to the required recipient (with your output as a PDF file).

Best regards,
Yoolb
_________________
"In the middle of difficulty lies opportunity" - Albert Einstein
"Money isn't everything in life, unless you don't have it". David King
"Fail to plan, plan to fail"
"Success is a journey, not a destination."

Answer:
Perhaps I posted a little too early.

You (obviously) can use FM BP_JOB_READ with an Opcode of '20' to see the spool info, having already obtained the job details using the FM GET_JOB_RUNTIME_INFO. Whether this works within the job itself I'll soon find out. Maybe the spool is not completed until the application (ABAP) has exit and therefore may not update the relavent tables. I'll let you know tomorrow (Friday).

Regards

Dr Sidewalk
_________________
"In the middle of difficulty lies opportunity" - Albert Einstein
"Money isn't everything in life, unless you don't have it". David King
"Fail to plan, plan to fail"
"Success is a journey, not a destination."

Answer:
As promised, yes it's possible, but then most of you guys probably already knew that.
Just in case though, here's a small snippet of code that should work okay.

FORM f_log_spoolnumber.
.
  DATA: lw_jobcount     TYPE TBTCM-JOBCOUNT,
        lw_jobname      TYPE TBTCM-JOBNAME,
        lw_stepcount    TYPE TBTCM-STEPCOUNT,
        lt_steplist     LIKE TABLE OF TBTCSTEP WITH HEADER LINE,
        lt_spool_attrib LIKE TABLE OF BAPIXMSPOOLID WITH HEADER LINE,
        lw_spool        TYPE tbtcstep-listident,
        lw_spoolchar    TYPE symsgv.

* Only execute if in batch mode
  IF sy-batch EQ 'X'.
*   Get Job/batch details
    CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
     IMPORTING
       JOBCOUNT                      = lw_jobcount
       JOBNAME                       = lw_jobname
       STEPCOUNT                     = lw_stepcount
     EXCEPTIONS
       NO_RUNTIME_INFO               = 1
       OTHERS                        = 2.

    IF SY-SUBRC EQ 0.
*     Read spool number, must be opcode 20.
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          JOB_READ_JOBCOUNT           = lw_jobcount
          JOB_READ_JOBNAME            = lw_jobname
          JOB_READ_OPCODE             = '20'
          JOB_STEP_NUMBER             = lw_stepcount
        TABLES
          JOB_READ_STEPLIST           = lt_steplist
          SPOOL_ATTRIBUTES            = lt_spool_attrib
        EXCEPTIONS
          INVALID_OPCODE              = 1
          JOB_DOESNT_EXIST            = 2
          JOB_DOESNT_HAVE_STEPS       = 3
          OTHERS                      = 4.
      IF SY-SUBRC EQ 0.
        READ TABLE lt_steplist INDEX 1.
        lw_spool = lt_steplist-listident. lw_spoolchar = lw_spool.
      ENDIF.
    ENDIF.
  ENDIF.
* Now record the spool number in the interface Framework detail message
....


Dr Sidewalk
_________________
"In the middle of difficulty lies opportunity" - Albert Einstein
"Money isn't everything in life, unless you don't have it". David King
"Fail to plan, plan to fail"
"Success is a journey, not a destination."
Copyright ?2007 - 2008 www.jt77.com