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

Generating spool request

kumud
Active Contributor
0 Likes
7,384

Hi Experts,

My rquirement is to generate spool request without getting the output displayed on the screen.

<fs_outtab> is the dynamic internal table containing data. It will have several fields.

I want to send this data to spool so that it can be seen when the background job runs.

But I do not want the output to be displayed on the screen.

<< Removed >> Please don't forward links as it cannot be opened in my system.

Thanks.

Edited by: Rob Burbank on Jun 25, 2010 11:17 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,347

I am not sure about the req ..But when you run a prog in background ,you will get the spool if you have output for that internal table.

Try new page print on .

23 REPLIES 23
Read only

Former Member
0 Likes
4,348

I am not sure about the req ..But when you run a prog in background ,you will get the spool if you have output for that internal table.

Try new page print on .

Read only

kumud
Active Contributor
0 Likes
4,347

I do not want to output , the internal table. I only want to generate the spool request.

How do I see the spool generated?

Read only

JerryWang
Product and Topic Expert
Product and Topic Expert
0 Likes
4,347

Hello friend,

please check the following codes:

NEW-PAGE PRINT ON.
loop at <int table>
write: <the internal table>.
endloop.
NEW-PAGE PRINT OFF.

This works well and it was used in REPORT programming.

and yes sy-spono will contain spool number.

FORM write_to_spool.

DATA : l_f_list_name LIKE pri_params-plist,
l_f_destination LIKE pri_params-pdest,
l_f_spld LIKE usr01-spld,
l_f_layout LIKE pri_params-paart,
l_f_line_count LIKE pri_params-linct,
l_f_line_size LIKE pri_params-linsz,
l_f_out_parameters LIKE pri_params,
l_f_valid.

l_f_line_size = 255.
l_f_line_count = 65.
l_f_layout = 'X_65_255'.
l_f_list_name = sy-repid.

* to get defult spool device for the user
SELECT SINGLE spld INTO l_f_spld FROM usr01 WHERE bname = sy-uname.
IF sy-subrc = 0.
MOVE l_f_spld TO l_f_destination.
ENDIF.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
* ARCHIVE_ID = C_CHAR_UNKNOWN
* ARCHIVE_INFO = C_CHAR_UNKNOWN
* ARCHIVE_MODE = C_CHAR_UNKNOWN
* ARCHIVE_TEXT = C_CHAR_UNKNOWN
* AR_OBJECT = C_CHAR_UNKNOWN
* ARCHIVE_REPORT = C_CHAR_UNKNOWN
* AUTHORITY = C_CHAR_UNKNOWN
* COPIES = C_NUM3_UNKNOWN
* COVER_PAGE = C_CHAR_UNKNOWN
* DATA_SET = C_CHAR_UNKNOWN
* DEPARTMENT = C_CHAR_UNKNOWN
destination = l_f_destination
* EXPIRATION = C_NUM1_UNKNOWN
immediately = 'X'
* IN_ARCHIVE_PARAMETERS = ' '
* IN_PARAMETERS = ' '
layout = l_f_layout
line_count = l_f_line_count
line_size = l_f_line_size
list_name = l_f_list_name
* LIST_TEXT = C_CHAR_UNKNOWN
* MODE = ' '
* NEW_LIST_ID = C_CHAR_UNKNOWN
* NO_DIALOG = C_FALSE
* RECEIVER = C_CHAR_UNKNOWN
* RELEASE = C_CHAR_UNKNOWN
* REPORT = C_CHAR_UNKNOWN
* SAP_COVER_PAGE = C_CHAR_UNKNOWN
* HOST_COVER_PAGE = C_CHAR_UNKNOWN
* PRIORITY = C_NUM1_UNKNOWN
* SAP_OBJECT = C_CHAR_UNKNOWN
* TYPE = C_CHAR_UNKNOWN
* USER = SY-UNAME
IMPORTING
* OUT_ARCHIVE_PARAMETERS =
out_parameters = l_f_out_parameters
valid = l_f_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4
.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

IF l_f_valid NE space.
NEW-PAGE PRINT ON PARAMETERS l_f_out_parameters.
WRITE : /5 'Material No.',
25 'Message Type',
40 'Message Issued'.
ULINE.
LOOP AT g_t_message_table WHERE type = 'E'.
WRITE : / g_t_message_table-matnr UNDER 'Material No.',
g_t_message_table-type UNDER 'Message Type',
g_t_message_table-message UNDER 'Message Issued'.
ENDLOOP.
NEW-PAGE PRINT OFF.
ENDIF.

ENDFORM. " WRITE_TO_SPOOL

Read only

kumud
Active Contributor
0 Likes
4,347

Hi Jerry,

There are two parts of the code that you have suggested. I could not much correlate them......

Futher to confirm the understanding:

My requirement is to send the output to a spool request.

Kindly elaborate the logic a little....sorry for expecting more...

I will try the code and would award points.Thanks.

Read only

0 Likes
4,347

Hi Singh,

You need not do any thing as specified by other friends, just you need to pass Print params structure IS_PRINT to the FM REUSE_ALV_GRID_DISPLAY.

See the sample print params I passed to my ALV Grid.

&----


*& Form BUILD_PRINTPARAMS

&----


  • text

----


  • <--P_GS_PRNTPARAMS text

----


FORM build_printparams CHANGING fp_s_prntparams TYPE slis_print_alv.

fp_s_prntparams-reserve_lines = '3'. "Lines reserved for footer

fp_s_prntparams-no_coverpage = 'X'.

fp_s_prntparams-print = 'X'.

fp_s_prntparams-prnt_title = 'X'.

fp_s_prntparams-prnt_info = 'X'.

ENDFORM. " BUILD_PRINTPARAMS

Also, performing my Grid Functionality by passing this structure as per below.

FORM disp_data USING fp_t_download TYPE ty_t_download

fp_s_layout TYPE slis_layout_alv

fp_s_prntparams TYPE slis_print_alv

fp_t_fieldcat TYPE slis_t_fieldcat_alv

fp_t_events TYPE slis_t_event.

gv_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gv_repid

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = fp_s_layout

it_fieldcat = fp_t_fieldcat

i_save = 'A'

it_events = fp_t_events

is_print = fp_s_prntparams

TABLES

t_outtab = fp_t_download

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

I could able to generate the Spool Request No, dont forget to pass the Destination like "LOCL" or LPO1 etc. with out passing the destination at runtime, the spool request cannot be generated.

Furthermore, go the T-code SP01 to view your Spool content.

Thanks and Regards,

Santosh Kumar Mukka.

Read only

kumud
Active Contributor
0 Likes
4,347

Hi Santosh,

Thanks for the reply. I am trying this now.

I need to run the program in background.

Would this work in background as well.

Read only

0 Likes
4,347

Hi Singh,

This will surely work in Background also.

Regards,

Santosh Kumar Mukka.

Read only

kumud
Active Contributor
0 Likes
4,347

I did execute this code but it asked for Printing device.....who will provide that in background.

Read only

0 Likes
4,347

Hi,

You can default the output device as "LOCL" while sending to spool.

Regards,

Mansi.

Read only

kumud
Active Contributor
0 Likes
4,347

Hi SAP uSER,

Which parameter defaults the output device. I tried finding out but could not find one.

Read only

0 Likes
4,347

HI Singh,

Try to pass SY-PDEST as the default Output device.

If your Output devices is not as per the Clients specification, ask your BASIS guys to setup the default Output device proposed by the client.

I mean that the parameter which you pass "gs_prntparams-print_ctrl1-pdest = sy-pdest"

This will work definitely.

Regards,

Santosh Kumar Mukka.

Edited by: santosh kumar on Jun 28, 2010 4:42 PM

Edited by: santosh kumar on Jun 28, 2010 4:44 PM

Read only

kumud
Active Contributor
0 Likes
4,347

Hi Santosh,

Where do I find this parameter:

"gs_prntparams-print_ctrl1-pdest = sy-pdest"

Excuse me for bothering much.

Read only

0 Likes
4,347

Hi,

Go to T-code SE11.

Type-Groups: SLIS

Check for the Types:

types: begin of slis_print_alv1,

no_print_selinfos(1) type c, " display no selection infos

no_coverpage(1) type c, "

no_new_page(1) type c, "

reserve_lines type i, " lines reserved for end of page

no_print_listinfos(1) type c, " display no listinfos

no_change_print_params(1) type c, " don't change linesize

no_print_hierseq_item(1) type c, "don't expand item

print_ctrl type ALV_S_Pctl, -


> This is a deep structure with Print Control parameters

end of slis_print_alv1.

Now double click on "ALV_S_Pctl". You will se the Deep Structure inside:

PRI_PARAMS PRI_PARAMS

ARC_PARAMS ARC_PARAMS.

Expand PRI_PARAMS.

This nested structure gives the following fields.

PDEST SYPDEST -


> This field is your Output device. Pass SY-PDEST to this field.

PRCOP SYPRCOP

PLIST SYPLIST

PRTXT SYPRTXT

PRIMM SYPRIMM

PRREL SYPRREL

PRNEW SYPRNEW

PEXPI SYPEXPI

LINCT SYLINCT

LINSZ SYLINSZ

PAART SYPAART

PRBIG SYPRBIG

PRSAP SYPRSAP

PRREC SYPRREC

PRABT SYPRABT

PRBER SYPRBER

PRDSN SYPRDSN

PTYPE SYPTYPE

ARMOD SYARMOD

FOOTL SYFOOTL

PRIOT SYPRIOR

PRUNX SYPRUNX

PRKEYEXT SYPRKEY

PRCHK SYCHECK

Regards,

Santosh Kumar Mukka.

Read only

kumud
Active Contributor
0 Likes
4,347

Santosh sir,

I am using 4.6C version of SAP and could not find this particular parameter withing the specified type

print_ctrl type ALV_S_Pctl, -


> This is a deep structure with Print Control parameters

Read only

kumud
Active Contributor
0 Likes
4,347

YOu are a STAR!!!

I have awarded you points......Thanks.

Read only

kumud
Active Contributor
0 Likes
4,347

I am in the process of trying this....

Will award points.

Read only

Former Member
0 Likes
4,347

Hi,

You can use function module 'RSPO_WRITE_SPOOLREQUEST' to write all output to a spool request.

Hope this is helpful for you.

Regards,

Mansi.

Read only

kumud
Active Contributor
0 Likes
4,347

Hi,

Thanks for the reply.

Function Module RSPO_WRITE_SPOOLREQUEST -


How does it write the data to spool.

I have a dynamic internal table <fs_outtab> , I don't know the fields.

Moreover how do I see the spool generated, will it generate a spool id.?

Read only

Former Member
0 Likes
4,347

Hi

This requirement either smartform, sapscript or write statement .

let me know then i will inform to ur solution..

Thanks

Regards

I.Muthukumar.

Read only

kumud
Active Contributor
0 Likes
4,347

Hi,

Requirement is:

There are two reports , say R1 and R2. Both will run in background.

Report R1 calls Report R2 with the help of submit statement.

Report R2 has to generate a spool without output getting displayed on screen.

How do I get to know the spool generated from R2?

Thanks.

Read only

0 Likes
4,347

SUBMIT TO SAP-SPOOL.

Check on thsi option.Submit your program with thsi option.

Thanks!

Read only

Former Member
0 Likes
4,347

See try to make an alv grid diaplay program for the internal table.( like this)

form fill_catalogue .

wa_fieldcatalog-fieldname = 'WERKS'.

wa_fieldcatalog-seltext_m = 'Plant'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'LGORT'.

wa_fieldcatalog-seltext_m = 'St.Loc'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'SHKZG'.

wa_fieldcatalog-seltext_m = 'Iss/Rec'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'BUDAT'.

wa_fieldcatalog-seltext_m = 'Posting Date'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'CHALAN'.

wa_fieldcatalog-seltext_m = 'Document No'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'BOLNR'.

wa_fieldcatalog-seltext_m = 'Bill of Lading'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'BRGEW'.

wa_fieldcatalog-seltext_m = 'Gross Wt.'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'NTGEW_CH'.

wa_fieldcatalog-seltext_m = 'Net Chargeable Wt.'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'SHIP_PARTY'.

wa_fieldcatalog-seltext_m = 'Customer/Vendor/Plant'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'SAL_GRP'.

wa_fieldcatalog-seltext_m = 'Sales Group'.

wa_fieldcatalog-tabname = 'IT_FINAL'.

  • wa_fieldcatalog-emphasize = 'X'.

append wa_fieldcatalog to fieldcatalog.

clear wa_fieldcatalog.

endform. "fill_catalogue

&----


*& Form display

&----


  • text

----


form display .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

it_fieldcat = fieldcatalog[]

tables

t_outtab = it_final

exceptions

program_error = 1

others = 2.

Then you must be accepting some parameters fromthe screen. just take the values from the selection screen

press F9, and proceed as your requirement is.

endform. "display

Read only

kumud
Active Contributor
0 Likes
4,347

Solved with using IS_PRINT parameter of ALV GRID DISPLAY