Application Development 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: 

Build report for looping Cycle-Runs

carsten_klatt
Explorer
0 Kudos

Dear ABAP-Specialists,

actually i am building up a report for running RKGALKSU5 multiple times for different variants.

This works well fort starting and having the reports run by using the statement:

submit (LV_PROG) using selection-set LV_VARID

exporting list to memory

and return.

The issue is that this created different separated spools, which are not transfered into the acutal spool by using:

--


Collect spool from report run to gt_list--

call function 'LIST_FROM_MEMORY'

tables

LISTOBJECT = GT_LIST

exceptions

NOT_FOUND = 1

others = 2.

if SY-SUBRC = 0.

--


Write output List to Screen (from table gt_list)--

call function 'WRITE_LIST'

tables

LISTOBJECT = GT_LIST.

Now my question is, how can i manage to get the content of all the separate spools collected together and displayed / stored in the spool of my own report.

Any ideas or solutions for this issue?

Thanks a lot in advance

Best regards

Carsten Klatt

3 REPLIES 3

andreas_mann3
Active Contributor
0 Kudos

Hallo Carsten,

look F1 to submit

and

try to use addition : SPOOL PARAMETERS pri_params and here field PRNEW

here onyl helps trial and error...

hope taht helps

Andreas

Former Member
0 Kudos

Hi,

Get all the variants and within the LOOP you submit .

Best Regards,

M.Vimala

Edited by: vimala on Feb 7, 2012 1:40 PM

0 Kudos

Well how the program should work in general is clear, but it does not work for the mentioned program as in this case the result is created by a program which is generated and run in background from the first one which is started via submit.

The actual coding of this idea was following:

----


  • Data definitions and Select-Options

----


DATA: gt_list TYPE TABLE OF abaplist,

valid_flag TYPE c LENGTH 1.

DATA: lv_prog TYPE rs38m-programm,

lt_prog TYPE TABLE OF rs38m-programm,

lv_varid TYPE rsvar-variant,

lt_varid TYPE TABLE OF rsvar-variant,

lv_index TYPE integer.

SELECT-OPTIONS: so_prog FOR lv_prog,

so_varid FOR lv_varid.

----


  • Start of Report

----


--


Fetch variant-ID from selection-table-structure--

LOOP AT so_varid INTO lv_varid.

lv_varid = lv_varid+3.

APPEND lv_varid TO lt_varid.

ENDLOOP.

--


Loop all entries of program selection table--

LOOP AT so_prog INTO lv_prog.

lv_prog = lv_prog+3.

lv_index = sy-tabix.

--


Check if assigned variant is existing for report--

READ TABLE lt_varid INDEX lv_index INTO lv_varid.

SELECT SINGLE variant FROM varit INTO lv_varid WHERE report = lv_prog

AND variant = lv_varid.

--


If variant is not existing skip processing--

IF sy-subrc NE 0.

WRITE: 'Error: Variant does not exist for the selected report:', ' ', lv_varid, ' ', lv_prog, ' ', 'Execution skipped!'.

ELSEIF sy-subrc = 0.

--


If variant is existing create header and run report--

WRITE: 'Start of Report' color COL_TOTAL, ' ',

lv_prog color COL_TOTAL, ' ',

'with Variant' color COL_TOTAL, ' ',

lv_varid color COL_TOTAL.

Uline.

SUBMIT (lv_prog) USING SELECTION-SET lv_varid

EXPORTING LIST TO MEMORY

AND RETURN.

--


In case report can not be executed successfully stop-----

IF sy-subrc NE 0.

EXIT.

ENDIF.

--


Collect spool from report run to gt_list--

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = gt_list

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

--


Write output List to Screen (from table gt_list)--

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = gt_list.

ENDIF.

ENDIF.

--


Create foot note for each program output list--

Uline.

WRITE: 'End of Report' color COL_TOTAL, ' ',

lv_prog color COL_TOTAL, ' ',

'with Variant' color COL_TOTAL, ' ',

lv_varid color COL_TOTAL.

Uline.

ENDLOOP.

But this still does not help to get the result of the started reports into the Spool.

This happens due to the used FM K_ALLOCATIONS_RUN, which is creating a new Report and runs it.

Edited by: Carsten Klatt on Feb 7, 2012 2:42 PM