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

Single spool request contains multiple splitters data

Former Member
0 Likes
5,105

Hi Team,

I have a requirement like,I was created an ALV report with 8 splitter containers ,while executing it is displaying fine,Now i enabled standard Print button

from menu bar by using user status,If i click on print button i am getting spool request ,but i am getting only one splitter container data.

I want in single spool request all 8 splitter containers data,How can i achieve this?Can you please help me it is urgent for me.

Thanks in advance.

26 REPLIES 26
Read only

Juwin
Active Contributor
0 Likes
4,993

Looking at the screen here, I am guess you coded for the PRINT button. Am I correct? If yes, what logic have you used there?

Thanks,

Juwin

Read only

Former Member
0 Likes
4,993

Hi Juwin,

I am using method set_table_for_first_display for display.

I am using below code for Print button  .

l_lay = 'X_65_132'.

l_lines = 65.

l_cols = 132.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

n_archive_parameters = lw_arcpar

in_parameters = lw_pripar

layout = l_lay

line_count = l_lines

line_size = l_cols

no_dialog = 'X'

IMPORTING

out_archive_parameters = lw_arcpar

out_parameters = lw_pripar

valid = l_val.

IF l_val <> space AND sy-subrc = 0.

*  LOOP AT  lt_arc_params INTO wa_arc_params.

lw_pripar-prrel = space.

lw_pripar-primm = space.

NEW-PAGE PRINT ON

NEW-SECTION

PARAMETERS lw_pripar "wa_pri_params

ARCHIVE PARAMETERS lw_arcpar "wa_arc_params

NO DIALOG.

Read only

Juwin
Active Contributor
0 Likes
4,993

The method has a hardcoded LEAVE SCREEN statement and due to this, it causes the program logic to leave from the current screen, without proceeding with the next set of prints.

Because of this, I don't think you can use the method set_table_for_first_display for printing multiple ALV outputs.

Thanks,

Juwin

Read only

Former Member
0 Likes
4,993

</p

gvhgjbkjb

Read only

Juwin
Active Contributor
0 Likes
4,993

???

Read only

Former Member
0 Likes
4,993

Hi Juwin,

Thanks for your reply,I understood that ,Can you please suggest me How can i do That same output and Print as well,I.e Inst-ed of Set_table_for_first_table method any alternate.

Read only

Juwin
Active Contributor
0 Likes
4,993

From the User command, you can call REUSE ALV function module to print one after other.

Thanks

Read only

Former Member
0 Likes
4,993

Hi Juwin,

I followed your advise,In user command i used REUSE ALV function module ,but it is getting seperate spool request for each splitter,I want all splitters data in single spool .

Read only

Juwin
Active Contributor
0 Likes
4,993

In the print parameters to the ALV, you can specify where to create new spool or not. Can you check if you have passed X for that? Can you paste here the values you are passing to the print parameters?

Thanks,

Juwin

Read only

Former Member
0 Likes
4,993

Hi Juwin,

In REUSE ALV function module i added  wa_print_3-no_new_page 'X' from 2nd splitter  except 1st splitter,Still It is generating multiple spools and 1st splitter is comming first and last.I don't want come last as first splitter.

Read only

Former Member
0 Likes
4,993
Read only

Juwin
Active Contributor
0 Likes
4,993

Please pass all these parameters:

prnt-print = 'N'.

prnt-prnt_info = prnt-no_new_page = prnt-no_change_print_params = abap_true.

call function 'GET_PRINT_PARAMETERS'

   exporting

     destination            = 'LOCL'

     immediately            = space

     no_dialog              = abap_true

   importing

     out_parameters         = prnt-print_ctrl-pri_params

   exceptions

     archive_info_not_found = 1

     invalid_print_params   = 2

     invalid_archive_params = 3

     others                 = 4.

prnt-print_ctrl-pri_params-pdest = 'LOCL'.

prnt-print_ctrl-pri_params-prrel = prnt-print_ctrl-pri_params-primm = space.

prnt-print_ctrl-pri_params-prnew = 'X'.

Now, call the 1st Grid Display

Next,

prnt-print_ctrl-pri_params-prnew = space.


Now, call the remaining Grid Displays in the required order.


It will generate a single spool for all the ALVs.


Example code is attached.


Thanks, Juwin



Read only

Former Member
0 Likes
4,991

Hi Juwin,

I used your code still i am getting individual spools for each splitter.In my requirement each table have different structure.

My code is below

delete lt_energy from 11.

delete lt_billing to 11. delete lt_billing from 11.

delete lt_coll to 21. delete lt_coll from 11.

delete lt_new to 31. delete lt_new from 11.

delete lt_power to 41. delete lt_power from 11.

delete lt_nonpmt to 51. delete lt_nonpmt from 11.

delete lt_power1 to 61. delete lt_power1 from 11.

delete lt_power2 to 71. delete lt_power2 from 11.

wa_print-print = 'N'.

wa_print-prnt_info = wa_print-no_new_page = wa_print-no_change_print_params = abap_true.

call function 'GET_PRINT_PARAMETERS'

    exporting

      destination            = 'LOCL'

      immediately            = space

      no_dialog              = abap_true

    importing

      out_parameters         = wa_print-print_ctrl-pri_params

    exceptions

      archive_info_not_found = 1

      invalid_print_params   = 2

      invalid_archive_params = 3

      others                 = 4.

wa_print-print_ctrl-pri_params-pdest = 'LOCL'.

wa_print-print_ctrl-pri_params-prrel = wa_print-print_ctrl-pri_params-primm = space.

wa_print-print_ctrl-pri_params-prnew = 'X'.

     PERFORM field_cat_Nopower1.

     PERFORM field_cat_meter1.

   PERFORM field_cat_billrelated1.

   PERFORM field_cat_billstattus1.

   PERFORM field_cat_newconnection1.

   PERFORM field_cat_collection1.

   PERFORM field_cat_nonpayment1.

   PERFORM field_cat_energy1.

   PERFORM display_data1.

In side of Display i written code for reuse alv funtionmodule.

Read only

Juwin
Active Contributor
0 Likes
4,991

Please check my code. You need to clear off PRNEW field, after the first call to ALV.

thanks

Read only

Former Member
0 Likes
4,991

Hi Juwin,

I am clearing PRNEW field .See below code.

**** 1st Display

call function 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    I_CALLBACK_PROGRAM                = sy-repid

*   I_CALLBACK_PF_STATUS_SET          = ' '

    I_STRUCTURE_NAME                  = 'TY_ENERGY'

    I_GRID_TITLE                      = 'Input Energy(MU)'

    IS_LAYOUT                         = wa_layout_8

    IT_FIELDCAT                       = lt_fcat_8

    IS_PRINT                          = wa_print

   tables

     t_outtab                          = lt_energy

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

           .

** 2nd display


wa_print-print_ctrl-pri_params-prnew = space.

call function 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    I_CALLBACK_PROGRAM                = sy-repid

*   I_CALLBACK_PF_STATUS_SET          = ' '

    I_STRUCTURE_NAME                  = 'TY_BILLING'

    I_GRID_TITLE                      = 'Billing Status'

    IS_LAYOUT                         = wa_layout_4

    IT_FIELDCAT                       = lt_fcat_4

    IT_SORT                           = lt_sort_4

    IS_PRINT                          = wa_print

   tables

     t_outtab                          = lt_billing

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

           .

Read only

Juwin
Active Contributor
0 Likes
4,991

If you copy-paste my code into your system, without making any changes, does it still create multiple spools from my code?

Thanks

Read only

Former Member
0 Likes
4,991

Hi Juwin,


Thanks for giving reply,

In your code you are taking same structure MAKT for two ALV display,


but my code i have different structures for each ALV display ,I.e Each splitter display data have different structures.


Read only

Juwin
Active Contributor
0 Likes
4,991

You still didn't answer my question. Does it work with my code?

Thanks

Read only

Former Member
0 Likes
4,991

I Pasted your code in new program it is creating single spool request.

Read only

Former Member
0 Likes
4,991

Hi Juwin,

I Pasted your code in new program it is creating single spool request.

Read only

Former Member
0 Likes
4,991

Hi Juwin,

I Pasted your code in new program it is creating single spool request.

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,991

I let you answer to Juwin.

If it still doesn't work, please compare the attributes of 2 of the spool requests, and tell us which spool attribute is different. That could be interesting to know, for further helping you.

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,991

Hurrah! So now you just need to check the différences between Juwin's code and yours!

Read only

Juwin
Active Contributor
0 Likes
4,991

Ok good. I just wanted to make sure that your user settings is not overriding what is written in the code.

Now, the structures being same in my code doesn't matter to the ALV. If you pass all the parameters I have passed, as-is, it will create single spool.

Example with multiple structures:

report zalv.

data:t1   type standard table of makt,

      t2   type standard table of mara,

      t3   type standard table of marc,

      t4   like t1,

      t5   like t1,

      prnt type slis_print_alv.

*Selecting and Splitting data into example tables

select * up to 5 rows from makt into table t1 where spras = sy-langu.

select * up to 5 rows from mara into table t2.

select * up to 5 rows from marc into table t3.

prnt-print = 'N'.

prnt-prnt_info = prnt-no_new_page = prnt-no_change_print_params = abap_true.

call function 'GET_PRINT_PARAMETERS'

   exporting

     destination            = 'LOCL'

     immediately            = space

     no_dialog              = abap_true

   importing

     out_parameters         = prnt-print_ctrl-pri_params

   exceptions

     archive_info_not_found = 1

     invalid_print_params   = 2

     invalid_archive_params = 3

     others                 = 4.

prnt-print_ctrl-pri_params-pdest = 'LOCL'.

prnt-print_ctrl-pri_params-prrel = prnt-print_ctrl-pri_params-primm = space.

prnt-print_ctrl-pri_params-prnew = 'X'.

*1st call

call function 'REUSE_ALV_GRID_DISPLAY'

   exporting

     i_structure_name = 'MAKT'

     is_print         = prnt

   tables

     t_outtab         = t1.

*Remaining calls

prnt-print_ctrl-pri_params-prnew = space.

call function 'REUSE_ALV_GRID_DISPLAY'

   exporting

     i_structure_name = 'MARA'

     is_print         = prnt

   tables:

     t_outtab         = t2.

call function 'REUSE_ALV_GRID_DISPLAY'

   exporting

     i_structure_name = 'MARC'

     is_print         = prnt

   tables:

     t_outtab         = t3.

Read only

Former Member
0 Likes
4,991

Hi Juwin,

In Main screen under user command ,Under function code i enter your code ,But it is not working

I followed same code ,still i am getting multiple spool requests.

Read only

Juwin
Active Contributor
0 Likes
4,991

Boss, you must be missing something in the code. You have already proven that the logic works independently. I can't tell you what is missing, without looking at your whole program. Hence, I think this is something which you have find yourselves. There are only hardly 3-5 flags to setup correctly for this to happen.

Thanks,

Juwin