09-26-2006 5:52 PM
hi all
i am writing a report in which at the end i get a internal table as a output. i have to send this table output as a work item to agent.
now the question is even though the report will be running as a batch process. i have to send this output to spool and have to write code for that. i have already seen the search in SDN but was not able to find the right solution..
please help me out in this and post ur ans with sample code relevent to my example only..
thanks in advance
jai
please ask q's if i am not clear....
09-26-2006 5:54 PM
Hi,
If you running the report in the background and if you have write statements in your program. Automatically it will create a spool..
THanks,
Naren
09-26-2006 5:58 PM
yes i am running it in background but it is not having any write statement in it.
jai
09-26-2006 6:05 PM
Hi,
Spool will be generated same as output which you are getting, output will come when you write the write statment in the code, so loop your internal table and write the output, so when you run it in background the spool will be generated,
Regards
Sudheer
09-26-2006 6:13 PM
Hi,
LOOP AT the internal table and use WRITE statement to show the values in the SPOOL..
Thanks,
Naren
09-26-2006 11:05 PM
You can write to the spool like this:
DATA: LEVEL(2) VALUE '01'.
DATA: DMBTR LIKE BSEG-DMBTR VALUE 1000,
FRWEG LIKE VBWF15-FRWEG VALUE '0002',
WFVAR LIKE T001-WFVAR VALUE 'PEN'.
DATA: T_ACTOR TYPE SWHACTOR.
NEW-PAGE PRINT ON NO DIALOG.
*KEEP IN SPOOL 'X'
*IMMEDIATELY 'X'
WRITE: /001 SY-DATUM, SY-UZEIT, SY-MANDT.
WRITE: /001 ' LEVEL : ', LEVEL , ' DMBTR : ', DMBTR,
' FRWEG : ', FRWEG , ' WFVAR : ', WFVAR.
WRITE: /001 T_ACTOR.
NEW-PAGE PRINT OFF.
Greetings,
Blag.
09-27-2006 5:19 AM
Check this program it may help u,it is of similar requirement.
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.
Regards