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

Submit statement

Former Member
0 Likes
447

Hi,

Am making use of submit statement via a job.Once i submit the report using the job after completing, it must do further processing.I no need to generate a spool in the job log.How to do it.Its enough to have the job started and job finished in the job.How to do it?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
391

Search on SCN with keywords JOB_OPEN, JOB_SUBMIT, JOB_CLOSe. these are the functions used for background job processing.

regards,

Advait

2 REPLIES 2
Read only

Former Member
0 Likes
392

Search on SCN with keywords JOB_OPEN, JOB_SUBMIT, JOB_CLOSe. these are the functions used for background job processing.

regards,

Advait

Read only

Former Member
0 Likes
391

Hi Lakshmi,

Here is a Piece of code which clears all of your doubts...

  • Write statement to represent report output. Spool request is created

  • if write statement is executed in background. This could also be an

  • ALV grid which would be converted to PDF without any extra effort

WRITE 'Hello World'.

new-page.

commit work.

new-page print off.

IF sy-batch EQ 'X'.

PERFORM get_job_details.

PERFORM obtain_spool_id.

      • Alternative way could be to submit another program and store spool

      • id into memory, will be stored in sy-spono.

*submit ZSPOOLTOPDF2

  • to sap-spool

  • spool parameters %_print

  • archive parameters %_print

  • without spool dynpro

  • and return.

  • Get spool id from program called above

  • IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.

PERFORM convert_spool_to_pdf.

if p_delspl EQ 'X'.

PERFORM delete_spool.

endif.

IF sy-sysid = c_dev.

wait up to 5 seconds.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = 'X'

AND RETURN.

ENDIF.

ELSE.

SKIP.

WRITE:/ 'Program must be executed in background in-order for spool',

'request to be created.'.

ENDIF.

FORM obtain_spool_id.

CHECK NOT ( gd_jobname IS INITIAL ).

CHECK NOT ( gd_jobcount IS INITIAL ).

SELECT * FROM tbtcp

INTO TABLE it_tbtcp

WHERE jobname = gd_jobname

AND jobcount = gd_jobcount

AND stepcount = gd_stepcount

AND listident <> '0000000000'

ORDER BY jobname

jobcount

stepcount.

READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.

IF sy-subrc = 0.

message s004(zdd) with gd_spool_nr.

gd_spool_nr = wa_tbtcp-listident.

MESSAGE s004(zdd) WITH gd_spool_nr.

ELSE.

MESSAGE s005(zdd).

ENDIF.

ENDFORM.

FORM get_job_details.

  • 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

EXCEPTIONS

no_runtime_info = 1

OTHERS = 2.

ENDFORM.

FORM convert_spool_to_pdf.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = gd_spool_nr

no_dialog = c_no

dst_device = c_device

IMPORTING

pdf_bytecount = gd_bytecount

TABLES

pdf = it_pdf_output.

CHECK sy-subrc = 0.

  • Transfer the 132-long strings to 255-long strings

LOOP AT it_pdf_output.

TRANSLATE it_pdf_output USING ' ~'.

CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.

ENDLOOP.

TRANSLATE gd_buffer USING '~ '.

DO.

it_mess_att = gd_buffer.

APPEND it_mess_att.

SHIFT gd_buffer LEFT BY 255 PLACES.

IF gd_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

ENDFORM.

FORM delete_spool.

DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.

ld_spool_nr = gd_spool_nr.

CHECK p_delspl <> c_no.

CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'

EXPORTING

spoolid = ld_spool_nr.

ENDFORM.

Thanks & regards,

Dileep .C