Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to get spool data?

Former Member
0 Likes
4,046

Hi ,

We have requirement where a SAP query need to be converted to a ABAP program completly with the Output options available for the Query. As no modification is to be done to the logic, challenge is to get the data and place to Application server.

Options available on Selection Screen for out put.

1.SAP Viewer

2. ALV list

3. Table display

4. File path

5. Graphics

A wraper program is created where in this programe is submitted to memory and then using FM LIST_TO_MEMORY fetching object list but the ouput is not correct, infact junk data.

Regards

Mohinder SIngh Chauhan

Edited by: Mohinder Singh Chauhan on Sep 17, 2009 8:45 AM

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
2,368

Hi, Try this way.


CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    SRC_SPOOLID   = G_SPOOL_NO
    NO_DIALOG     = ' '
  IMPORTING
    PDF_BYTECOUNT = L_NO_OF_BYTES
    PDF_SPOOLID   = L_PDF_SPOOLID
    BTC_JOBNAME   = L_JOBNAME
    BTC_JOBCOUNT  = L_JOBCOUNT
  TABLES
    PDF           = I_PDF.
<li>Use OPEN DATASET , TRANSFER and CLOSE DATASET to send the data to application server. Thanks Venkat.O

4 REPLIES 4
Read only

venkat_o
Active Contributor
0 Likes
2,369

Hi, Try this way.


CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    SRC_SPOOLID   = G_SPOOL_NO
    NO_DIALOG     = ' '
  IMPORTING
    PDF_BYTECOUNT = L_NO_OF_BYTES
    PDF_SPOOLID   = L_PDF_SPOOLID
    BTC_JOBNAME   = L_JOBNAME
    BTC_JOBCOUNT  = L_JOBCOUNT
  TABLES
    PDF           = I_PDF.
<li>Use OPEN DATASET , TRANSFER and CLOSE DATASET to send the data to application server. Thanks Venkat.O

Read only

Former Member
0 Likes
2,368

Hi,

Thanks for the reply, FM is useful however it doesnt suffice to the condition. Getting output is still an issue.

Here is the code .

call function 'JOB_OPEN'

exporting

jobname = name

importing

jobcount = number

if sy-subrc = 0.

submit aqfpz_bw_team===zcom_details== to sap-spool

spool parameters print_parameters

without spool dynpro

via job name number number

and return.

call function 'JOB_CLOSE'

exporting

jobcount = number

jobname = name

strtimmed = 'X'

*CALL FUNCTION 'LIST_FROM_MEMORY'

  • TABLES

  • listobject = list_tab

*IF sy-subrc = 0.

  • CALL FUNCTION 'WRITE_LIST'

  • TABLES

  • listobject = list_tab.

*

  • call function 'LIST_TO_ASCI'

  • tables

  • listasci = alistreturn

  • listobject = listreturn

  • Get current job details

call function 'GET_JOB_RUNTIME_INFO'

importing

eventid = gd_eventid

eventparm = gd_eventparm

external_program_active = gd_external_program_active

jobcount = gd_jobcount

jobname = gd_jobname

stepcount = gd_stepcount

select * from tbtcp

into table it_tbtcp

where jobname = name

and jobcount = number.

  • and listident <> '0000000000'

  • order by jobname

  • jobcount

  • stepcount.

read table it_tbtcp into wa_tbtcp index 1.

spool_id = wa_tbtcp-listident.

break-point.

call function 'RSPO_RETURN_ABAP_SPOOLJOB'

exporting

rqident = spool_id

  • FIRST_LINE = 1

  • LAST_LINE =

tables

buffer = spool_list

Regards

Mohinder SIngh Chauhan

Edited by: Mohinder Singh Chauhan on Sep 21, 2009 7:47 AM

Edited by: Mohinder Singh Chauhan on Sep 21, 2009 7:48 AM

Edited by: Mohinder Singh Chauhan on Sep 21, 2009 7:53 AM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,368

check this blog.

here its demonstrated how to get data from backgorund job ( spool )

Hope it meets your requirement

link:[Displaying ALV Grid in Background Job|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID0899989750DB10582890596782339563End?blog=/pub/wlg/5898]

Read only

Former Member
0 Likes
2,368

Thanks for the reply