2006 Oct 12 10:47 AM
I have a requirement to move the spool to the internal table.
I have a spool request number and internal table with me,and iam using FM RSPO_RETURN_SPOOLJOB and from the internal table i need to download it to the excel file.can any one give solution for this.
And let me know the parameters that need to be passed to the FM RSPO_RETURN_SPOOLJOB in detail if possible.
with regards,
Ramu
2006 Oct 12 11:01 AM
https://www.sdn.sap.com/irj/sdn/collaboration
try this link here is the reply given for same situation try this reward if help ful
2006 Oct 12 11:06 AM
Hello Ramu,
Only pass the Spoll number like this
DATA: l_va_rqident LIKE tsp01-rqident, "INT4
DATA: l_it_content TYPE TABLE OF soli.
<b> MOVE l_va_spono TO l_va_rqident.</b>
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = l_va_rqident
FIRST_LINE = 1
LAST_LINE =
desired_type =
IMPORTING
REAL_TYPE =
TABLES
buffer = l_it_content
BUFFER_PDF =
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8
.
The tables will have the content of the spoll.
If useful reward.
Vasanth
2006 Oct 12 12:01 PM
Hi vasanth,
thanks for ur reply,
i have written the code in the same way, but for getting displayed that data at the output i used the write statement to write the data that fetched in to the internal table but its giving error saying that
"l_it_content cannot be converted to charecter-type field"
2006 Oct 12 12:07 PM
Check this sample program:
&----
*& Report YPRA_SAMPLE38 *
*& *
&----
*& *
*& *
&----
REPORT ypra_sample38.
*Type Declarations
TYPES: BEGIN OF ty_rdidata,
line(1000) TYPE c,
END OF ty_rdidata.
DATA: ws_spool LIKE tsp01-rqident,
i_rdidata TYPE STANDARD TABLE OF ty_rdidata,
wa_rdidata TYPE ty_rdidata.
PARAMETERS: p_sp TYPE tsp01-rqident.
ws_spool = '0000019125'.
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB_RAW'
EXPORTING
rqident = ws_spool
FIRST_LINE = 1
LAST_LINE =
TABLES
buffer = i_rdidata
EXCEPTIONS
no_such_job = 1
not_abap_list = 2
job_contains_no_data = 3
selection_empty = 4
no_permission = 5
can_not_access = 6
read_error = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename =
'C:\Documents and Settings\P.Ramu\Desktop\RDI1.xls'
TABLES
data_tab = i_rdidata
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2006 Oct 13 6:44 AM
hi Prakash Ramu,
iam very thank full to u, the code which you have written is working fine,iam able to download the excel file but the thing is it was not downloading proper into excel sheet.All the data was comming in the same coloumn,thing is that i want to get the excel sheet in such a way that each field should come in each coloumn.
The code which i have written is below.
REPORT zmm_spool_test1 .
Type Declarations
TYPES: BEGIN OF ty_rdidata,
line(1000) TYPE c,
END OF ty_rdidata.
DATA: ws_spool LIKE tsp01-rqident,
it_data TYPE STANDARD TABLE OF ty_rdidata WITH HEADER LINE,
wa_data TYPE ty_rdidata,
v_down_path TYPE string.
PARAMETERS: p_spool TYPE tsp01-rqident,
p_path LIKE ibipparms-path LOWER CASE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
To get F4 help for Output File Path
PERFORM filename_f4.
START-OF-SELECTION.
ws_spool = '23576'.
Function module to read data from spoolo to internal table.
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
EXPORTING
rqident = ws_spool
FIRST_LINE = 1
LAST_LINE =
TABLES
buffer = it_data.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE it_data FROM 1 TO 2.
LOOP AT it_data .
WRITE:/ it_data-line.
WHILE sy-subrc EQ 0.
REPLACE '|' WITH ',' INTO it_data-line.
ENDWHILE.
MODIFY it_data.
ENDLOOP.
v_down_path = p_path.
Function module to download data from internal table to excel file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_down_path
filetype = 'ASC'
APPEND = ' '
write_field_separator = ','
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&----
*& Form filename_f4
&----
text
----
--> p1 text
<-- p2 text
----
FORM filename_f4.
DATA : v_path_l LIKE ibipparms-path," Local file for upload/download
v_scrnno_l TYPE sy-dynnr, " Screen Number
v_pgname TYPE syrepid.
v_scrnno_l = sy-dynnr. " Number of Current Screen
v_pgname = sy-repid.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = v_pgname
dynpro_number = v_scrnno_l
field_name = 'P_PATH'
IMPORTING
file_name = v_path_l
EXCEPTIONS
OTHERS = 1.
CHECK sy-subrc EQ 0.
Fill the parameter with the path selected by the user
p_path = v_path_l.
ENDFORM. " filename_f4