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: 

send the data to spool request Number

Former Member
0 Kudos

Hi all,

I have a requirement to send the data from internal table to Spool request number. Please give me a solution to send the data to spool request number.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Manoj,

Use Function Module SLVC_TABLE_PS_TO_SPOOL.

A sample code snippet :-

REPORT ztest.
          DATA: BEGIN OF it_t001 OCCURS 0,       
         bukrs TYPE t001-bukrs,       
          butxt TYPE t001-butxt,       
         ort01 TYPE t001-ort01,       
         land1 TYPE t001-land1,    
         END OF it_t001.
 
      DATA: it_data TYPE TABLE OF lvc_s_1022,     
                 wa_data LIKE LINE OF it_data.
 
     DATA:spoolid TYPE rspoid.
     DATA:file_length TYPE  int4.
 
START-OF-SELECTION. 
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001. 
 
LOOP AT it_t001.   
CONCATENATE it_t001-bukrs              
                          it_t001-butxt             
                          it_t001-ort01             
                          it_t001-land1             
                         INTO wa_data SEPARATED BY space.   
 
APPEND wa_data TO it_data.   
CLEAR  wa_data. 
ENDLOOP. 
 
DESCRIBE TABLE it_data. file_length = sy-tfill * 1022.
 
 CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'   
EXPORTING     i_file_length = file_length   
IMPORTING     e_spoolid     = spoolid   
TABLES     it_textdata   = it_data. 
 
IF sy-subrc EQ 0.   
 
WRITE spoolid. 
 
ENDIF.

Also if the above function module isnt available in your version of SAP system, then use LIST_TO_SPOOL

Regards

Abhii

4 REPLIES 4

Former Member
0 Kudos

Hi Manoj,

Use this FM "SLVC_TABLE_PS_TO_SPOOL" to send data to spool.

pass i_file_length = sy-tfill * 1024

import spool id and

tables

it_textdata = internal table data

Former Member
0 Kudos

Hi Manoj,

u can check this thread almost the same problem.

regards,

Archana

Former Member
0 Kudos

Hi Manoj,

Use Function Module SLVC_TABLE_PS_TO_SPOOL.

A sample code snippet :-

REPORT ztest.
          DATA: BEGIN OF it_t001 OCCURS 0,       
         bukrs TYPE t001-bukrs,       
          butxt TYPE t001-butxt,       
         ort01 TYPE t001-ort01,       
         land1 TYPE t001-land1,    
         END OF it_t001.
 
      DATA: it_data TYPE TABLE OF lvc_s_1022,     
                 wa_data LIKE LINE OF it_data.
 
     DATA:spoolid TYPE rspoid.
     DATA:file_length TYPE  int4.
 
START-OF-SELECTION. 
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001. 
 
LOOP AT it_t001.   
CONCATENATE it_t001-bukrs              
                          it_t001-butxt             
                          it_t001-ort01             
                          it_t001-land1             
                         INTO wa_data SEPARATED BY space.   
 
APPEND wa_data TO it_data.   
CLEAR  wa_data. 
ENDLOOP. 
 
DESCRIBE TABLE it_data. file_length = sy-tfill * 1022.
 
 CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'   
EXPORTING     i_file_length = file_length   
IMPORTING     e_spoolid     = spoolid   
TABLES     it_textdata   = it_data. 
 
IF sy-subrc EQ 0.   
 
WRITE spoolid. 
 
ENDIF.

Also if the above function module isnt available in your version of SAP system, then use LIST_TO_SPOOL

Regards

Abhii

Former Member
0 Kudos

Hi Friend ,

Please do search first in the SDN for your Query .there will be lots of answers.

Regards,