11-14-2007 9:05 AM
Hello Experts,
I need to do the following:-
There are certain list of transactions that gives ALV List as output and reading data directly from that list is not possible.
So we need to run transactions like IW58 in background and generate a spool job. Then we need to pick the spool via spool number and read the data in it.
How do we pick data from our spool and process that through XI and update the data base.
Regards
Saras Jain
11-14-2007 3:43 PM
hi
good
try this
RSPO_RETURN_ABAP_SPOOLJOB Fetch printer spool according to the spool number informed
thanks
mrutyun^
11-15-2007 7:14 AM
Hi Saras Jain,
Here is a method which i have return to get the spool id later using this spool id i'll show the report in PDF. In your case its XI. But the logic is same.
* * *
* Purpose: Print remuneration Statements of the given payroll area for the current period;
* Excecute the report RPCEDTK0 (Remuneration Statements for Canada) in backgound mode
* and send the output to the print spool. Return the generated spool request number and spool type
* * *
py_available = space. " Remuneration statements are not available initially
* Get Print Parameters
DATA: l_valid TYPE c, "#EC NEEDED
ls_params TYPE pri_params.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
layout = 'X_65_132'
IMPORTING
valid = l_valid
out_parameters = ls_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
DATA: l_jobcount TYPE tbtcjob-jobcount,
l_jobname TYPE tbtcjob-jobname VALUE 'RPCEDTK0' .
* Open a background job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
* Submit the report RPCEDTK0 in background mode and send the output to
* the spool; PCS_HR_CA_CALC is standard variant and part of the R2R content.
SUBMIT rpcedtk0
USING SELECTION-SET 'BP_HR_CA_CALC' "#EC CI_SUBMIT
* with andruck ...
* with anz-test ...
WITH bondt EQ space " Off-cycle Payroll Payment Date for Special Run
WITH chk_ess EQ space " Check ESS
* with compress ...
WITH cur_alt EQ space " Ouput Currency: Alternative currency
WITH cur_fp EQ 'X' " Ouput Currency: For-period
WITH cur_ip EQ space " Ouput Currency: In-period
WITH cur_val EQ space " Ouput Currency: Alternative currency value
* with exp_frm ...
* with formular ...
* with impmem ...
WITH only EQ space " Print Superlines
WITH payid EQ space " Payroll Identifier for Special Run
WITH payty EQ space " Payroll Type for Special Run
WITH pnpabkrs EQ abkrs " Payroll Area for Selection
* with pnpansvh ...
* with pnpbegda ...
* with pnpbegps ...
* with pnpbtrtl ...
* with pnpbukrs ...
* with pnpdisbd ...
* with pnpdised ...
* with pnpdispj ...
* with pnpdispp ...
* with pnpename ...
* with pnpendda ...
* with pnpendps ...
* with pnpesscf ...
* with pnpfistl ...
* with pnpfkber ...
* with pnpgeber ...
* with pnpgrant ...
* with pnpgsber ...
* with pnpindex ...
* with pnpjuper ...
* with pnpkokrs ...
* with pnpkoktl ...
* with pnpkostl ...
* with pnpmasng ...
* with pnpmassg ...
* with pnpmassn ...
* with pnpmcide ...
* with pnpmcstr ...
* with pnpmstbr ...
* with pnpobjid ...
* with pnporgeh ...
* with pnpotype ...
WITH pnppabrj EQ space " Payroll Year
WITH pnppabrp EQ space " Payroll Period
* with pnppernr ...
* with pnppernr ...
* with pnppersg ...
* with pnppersk ...
* with pnpplans ...
* with pnpplvar ...
* with pnpsacha ...
* with pnpsachp ...
* with pnpsachz ...
* with pnpsasba ...
* with pnpsasbp ...
* with pnpsasbz ...
* with pnpsbmod ...
* with pnpsname ...
* with pnpsortf ...
* with pnpsortt ...
* with pnpstat1 ...
* with pnpstat2 ...
* with pnpstat3 ...
* with pnpstatu ...
* with pnpstell ...
* with pnptimed ...
* with pnptimr1 ...
* with pnptimr2 ...
* with pnptimr3 ...
* with pnptimr4 ...
* with pnptimr5 ...
* with pnptimr6 ...
WITH pnptimr9 EQ 'X' " Current Period
WITH pnptimra EQ space " Other Period
* with pnpvdsk1 ...
* with pnpwerks ...
WITH pnpxabkr EQ abkrs " Payroll Area for Selection
* with pnpxbwbk ...
* with pnpxpgpk ...
WITH prt_prot EQ space " Output Log
* with pyabrj0 ...
* with pyabrj1 ...
* with pyabrp0 ...
* with pyabrp1 ...
* with pyarch ...
* with pybegda ...
* with pyct_per ...
* with pyendda ...
* with pyeval ...
* with pypa03r0 ...
* with pypa03r1 ...
* with pyparaid ...
* with pyscreen ...
* with pysortt ...
* with pyvw0 ...
* with pyvw0_0 ...
* with pyvw0_1 ...
* with pyvw1 ...
* with pyvw1_0 ...
* with pyvw1_1 ...
* with pyvw2 ...
* with pyvw2_0 ...
* with pyxabkr ...
* with rueckd ...
* with rueckr ...
* with sort_rr ...
* with sprache ...
VIA JOB l_jobname NUMBER l_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO SPOOL PARAMETERS ls_params
AND RETURN.
IF sy-subrc <> 0.
ENDIF. " SUBMIT rpcedtk0
* Schedule and close job.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc IS INITIAL.
* Retreive the latest spool of the logged in user
DATA: l_job_read_jobhead TYPE tbtcjob,
it_job_read_steplist TYPE TABLE OF tbtcstep,
wa_job_read_steplist TYPE tbtcstep.
DO.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = l_jobcount
job_read_jobname = l_jobname
job_read_opcode = 20
IMPORTING
job_read_jobhead = l_job_read_jobhead
TABLES
job_read_steplist = it_job_read_steplist
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
IF l_job_read_jobhead-status EQ 'F'.
READ TABLE it_job_read_steplist INDEX 1 INTO wa_job_read_steplist.
py_spool_id = wa_job_read_steplist-listident.
py_spool_type = 'A'.
IF NOT py_spool_id IS INITIAL.
py_available = 'X'.
ENDIF.
EXIT.
ENDIF.
ENDIF. " BP_JOB_READ
ENDDO.
ENDIF. " JOB_CLOSE
ENDIF. " JOB_OPEN
ENDIF. " GET_PRINT_PARAMETERS
Reward points if useful,
Aleem.