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

Spool to HTML Function Module

Former Member
0 Likes
1,174

Hi Experts,

Can anyone help me please. Is there any FM that can convert spool to HTML? Just like converting spool to PDF but only I need it in HTML. I can't use spool to PDF because I'm having problems when it comes to massive pages, but if it's only 5 pages it actually works but not with 100 pages or more. So please, if anyone can help me with spool to html. Points will be given and also to those who tried. Thanks.

Anna

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
793

Hi,

First convert the spool to internal table by using FM

RSPO_RETURN_ABAP_SPOOLJOB

Next from internal table to HTML....

Link: /people/rammanohar.tiwari/blog/2006/01/29/abap-utility-print-screen-to-html

or try the following

Please try the follwoing:

1. define HTML internal table with ref to type W3HTML

2. download it as BIN type and give total lenght of the strings as a parameter in the down load.

See the code extract below:

describe table html lines entries.

read table html into w_html index entries.

size = ( entries - 1 ) * 255 + strlen( w_html ).

concatenate p_path file into file.

call function 'WS_DOWNLOAD'

exporting

bin_filesize = size

filename = file

filetype = 'BIN'

tables

data_tab = html

Pls. reward if useful....

4 REPLIES 4
Read only

Former Member
0 Likes
794

Hi,

First convert the spool to internal table by using FM

RSPO_RETURN_ABAP_SPOOLJOB

Next from internal table to HTML....

Link: /people/rammanohar.tiwari/blog/2006/01/29/abap-utility-print-screen-to-html

or try the following

Please try the follwoing:

1. define HTML internal table with ref to type W3HTML

2. download it as BIN type and give total lenght of the strings as a parameter in the down load.

See the code extract below:

describe table html lines entries.

read table html into w_html index entries.

size = ( entries - 1 ) * 255 + strlen( w_html ).

concatenate p_path file into file.

call function 'WS_DOWNLOAD'

exporting

bin_filesize = size

filename = file

filetype = 'BIN'

tables

data_tab = html

Pls. reward if useful....

Read only

former_member156446
Active Contributor
0 Likes
793

hi check this sample code..

data: list type table of  abaplist with header line.
data: htmllines type table of w3html with header line.
 
data: maildata   like sodocchgi1.
data: mailtxt    like solisti1 occurs 10 with header line.
data: mailrec    like somlrec90 occurs 0  with header line.
 
start-of-selection.
 
* Produce a list
  do 100 times.
    write:/ sy-index, at 30 sy-index, at 50 sy-index.
  enddo.
 
* Save the list
  call function 'SAVE_LIST'
       tables
            listobject         = list
       exceptions
            list_index_invalid = 1
            others             = 2.
 
* Convert the list
  call function 'WWW_LIST_TO_HTML'
       tables
            html = htmllines.
 
* Send mail
  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test Subject'.
 
  loop at htmllines.
    mailtxt = htmllines.
    append mailtxt.
  endloop.
 
  mailrec-receiver = 'you at yourcompany.com'.
  mailrec-rec_type  = 'U'.
  append mailrec.
 
  call function 'SO_NEW_DOCUMENT_SEND_API1'
       exporting
            document_data              = maildata
            document_type              = 'HTM'
            put_in_outbox              = 'X'
       tables
            object_header              = mailtxt
            object_content             = mailtxt
            receivers                  = mailrec
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_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.

Read only

0 Likes
793

Hi again. Thanks for your reply. But I'm actually having a problem with the list variable. My dilemma actually is how I can transfer the jtab grabphical spool to the abaplist. Please, please help me and check what went wrong. I'm actually trying to download the graphical spool to an html format. Thanks.

TABLES: TBTCO, TBTCP, TSP01.

TYPE-POOLS: truxs.

DATA: BEGIN OF itab OCCURS 0,

sp_name TYPE tbtco-jobname,

br_code(1),

dumon(7),

sp_numb TYPE TSP01-rqident,

ofc(7),

END OF itab.

DATA: BEGIN OF btab OCCURS 5,

fld1(24),

fld2(12),

END OF btab.

DATA: htmllines TYPE TABLE OF w3html WITH HEADER LINE,

w_jtab TYPE TABLE OF ABAPLIST WITH HEADER LINE.

DATA: BEGIN OF jtab OCCURS 0,

fld1(11),

fld2(41),

fld3(21),

fld4(11),

fld5(10),

fld6(22),

fld7(72),

END OF jtab.

INITIALIZATION.

START-OF-SELECTION.

PERFORM download_html.

&----


*& Form download_html

&----


  • text

----


FORM download_html.

DATA: lv_file TYPE string,

lv_string TYPE string,

lt_conv TYPE truxs_t_text_data.

SORT itab BY sp_name br_code dumon.

LOOP AT itab.

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = itab-sp_numb "Spool Number

TABLES

BUFFER = btab.

LOOP AT btab WHERE fld1 = 'BROKER REPORT ID'.

PERFORM get_month.

MOVE: btab-fld2+4(1) TO itab-br_code,

date TO itab-dumon.

MODIFY itab.

ENDLOOP.

  • Move to jtab for Conversion HTML

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = itab-sp_numb "Spool Number

TABLES

BUFFER = jtab.

****SPOOL TO HTML

CALL FUNCTION 'SAVE_LIST'

TABLES

listobject = jtab

EXCEPTIONS

list_index_invalid = 1

others = 2.

CALL FUNCTION 'WWW_LIST_TO_HTML'

TABLES

html = htmllines.

AT NEW sp_name.

CONCATENATE: p_file itab-sp_name '\' INTO p_file.

ENDAT.

AT NEW br_code.

PERFORM get_brcode.

CONCATENATE: p_file brc '\' INTO p_file.

ENDAT.

AT NEW dumon.

CONCATENATE: p_file itab-dumon '\' INTO p_file.

ENDAT.

CONCATENATE: p_file itab-ofc '.HTML' INTO p_file.

IF sy-subrc = 0.

IF p_pres EQ 'X'.

MOVE p_file TO lv_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_file

filetype = 'BIN'

TABLES

data_tab = it_pdf_output.

IF sy-subrc <> 0.

MESSAGE e398(00) WITH 'Error creating file' p_file.

ELSE.

MESSAGE i398(00) WITH 'File Created' p_file.

ENDIF.

ELSE.

APPEND LINES OF it_pdf_output TO lt_conv.

IF lt_conv[] IS NOT INITIAL.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc EQ 0.

LOOP AT lt_conv INTO lv_string.

TRANSFER lv_string TO p_file.

ENDLOOP.

CLOSE DATASET p_file.

IF sy-subrc EQ 0.

MESSAGE i398(00) WITH 'File Created' p_file.

ELSE.

MESSAGE e398(00) WITH 'Error closing file' p_file.

ENDIF.

ELSE.

MESSAGE e398(00) WITH 'Error creating file' p_file.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. "convert_spool_to_pdf

Edited by: Anna Bechayda on Apr 23, 2008 10:18 AM

Read only

0 Likes
793

When called twice, the second time it displays the list twice.

How to refresh the spool ? I trye LIST_FREE_MEMORY but same problem.