download list in html format

Question:
Hi gurus,
I would like to download the list in html format, just like the standard SAP menu performs: list->save->file... ->choose html format.
Anybody could throw some lights on that?
Thanks a lot!
Answer:
what about
System -> List -> Save -> Local file
Choose HTML format.
wkr
Lasse
Answer:
Hey Lasse, you mis-understand my question.
What I wanna know is how to in-build this functionality into my code.
Thanks for your response.
Answer:
Hi,
Here is the code which can covert a Table in to Html format.
I hope this can solve ur problem.
Alternatively try this "WWW_LIST_TO_HTML"
Regards
Prasad
REPORT ZR4_MM_KVP_HTML .
***********************************************************
* Column type P not supported.
***********************************************************
TABLES dd02l.
DATA: zx030l LIKE x030l,
p_number TYPE i,
tablefound TYPE i.
DATA: colorval TYPE i.
DATA: packval TYPE p, totalrows TYPE n.
DATA: w_area1(5000) TYPE c,charval(20) TYPE c.
DATA: tablen TYPE i VALUE 255.
DATA: BEGIN OF htmlview OCCURS 0,
htmlcode(500) TYPE c,
END OF htmlview.
DATA BEGIN OF zdfies OCCURS 1000.
INCLUDE STRUCTURE dfies.
DATA END OF zdfies.
DATA: BEGIN OF flditab OCCURS 0,
fldname(11) TYPE c,
END OF flditab.
**************
PARAMETERS: tabname LIKE dd02l-tabname OBLIGATORY.
**************
htmlview-htmlcode = '<HTML><HEAD><TITLE>Table Browser</TITLE>'.
APPEND htmlview.
htmlview-htmlcode = '<BODY BGCOLOR="#404040"><FONT COLOR="#00FFFF"
face="Arial Black"> Table View : '.
APPEND htmlview.
htmlview-htmlcode = tabname. APPEND htmlview.
htmlview-htmlcode = '</FONT> <p>&nbsp;</p>'. APPEND htmlview.
***********************************************
PERFORM check-table-class.
PERFORM read-direct-table.
PERFORM downloadhtml.
PERFORM showhtml.
********************************************
FORM check-table-class.
tablefound = -1.
SELECT * FROM dd02l
WHERE tabname EQ tabname.
IF dd02l-tabclass CS 'TRANSP' OR
dd02l-tabclass CS 'POOL' OR
dd02l-tabclass CS 'CLUSTER '.
tablefound = 1.
EXIT.
ENDIF.
ENDSELECT.
IF tablefound < 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH 'Table Not Found.... or Table Class Not in "TRANSP","POOL",
"CLUSTER"'.
STOP.
ENDIF.
ENDFORM.
************************************************************************
FORM read-direct-table.
DATA: offs TYPE i.
DATA: len2(5) TYPE n.
DATA: anz_numb TYPE i.
PERFORM gettableinfo USING tabname.
htmlview-htmlcode = '<table border="0" width="100%">'. APPEND htmlview.
htmlview-htmlcode = '<tr valign="middle" BGCOLOR="#5F5F5F">'.
APPEND htmlview.
htmlview-htmlcode = '<FONT SIZE="3" COLOR="#FFBF18" FACE= "Courier
new">'.
APPEND htmlview.
LOOP AT zdfies.
PERFORM htmlheader USING zdfies-fieldname.
flditab-fldname = zdfies-fieldname.
APPEND flditab.
ENDLOOP.
htmlview-htmlcode = '</B></tr>'. APPEND htmlview.
colorval = 1.
SELECT COUNT(*) FROM (tabname) INTO totalrows.
WRITE :/ totalrows.
anz_numb = 0.
SELECT * FROM (tabname) INTO w_area1.
ADD 1 TO anz_numb.
IF anz_numb GT 100. " U can alter the Hits, now Max. is 100
EXIT.
ENDIF.
IF colorval > 0 .
htmlview-htmlcode = '<tr valign="middle" BGCOLOR="#F7F7F7"><FONT
size="1" COLOR="#008080" FACE="Arial Narrow">'.
APPEND htmlview.
ELSE.
htmlview-htmlcode = '<tr valign="middle"
bgcolor="#D2D2D2"><FONT SIZE="1" COLOR="#9F000F" FACE="Arial Narrow">'.
APPEND htmlview.
ENDIF.
colorval = colorval * -1 .
*************
LOOP AT zdfies.
charval = w_area1+zdfies-offset(zdfies-intlen).
CASE zdfies-inttype.
WHEN 'P'.
* PACKVAL = W_AREA1+ZDFIES-OFFSET(ZDFIES-INTLEN).
* CHARVAL = PACKVAL.
ENDCASE.
PERFORM htmlfield USING w_area1+zdfies-offset(zdfies-intlen).
ENDLOOP.
*************
htmlview-htmlcode = '</FONT></tr>'. APPEND htmlview.
CLEAR: w_area1.
ENDSELECT.
htmlview-htmlcode = '</body></html>'. APPEND htmlview.
ENDFORM.
****************************************************************
FORM downloadhtml.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:\TABLEVIEW.HTM'
TABLES
data_tab = htmlview.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
***************************************************************
FORM showhtml.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = 'c:\tableview.htm'
program = 'C:\PROGRA~1\INTERN~1\IEXPLORE.EXE'.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
************************************************************************
FORM gettableinfo USING tname.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
only = space
tabname = tname
withtext = 'X'
IMPORTING
header = zx030l
TABLES
fieldtab = zdfies
EXCEPTIONS
internal_error = 01
no_texts_found = 02
table_has_no_fields = 03
table_not_activ = 04.
CASE sy-subrc.
WHEN 0.
LOOP AT zdfies.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-subrc.
ENDCASE.
ENDFORM.
********************************************************
FORM htmlfield USING name TYPE c.
htmlview-htmlcode = '<td >'. APPEND htmlview.
htmlview-htmlcode = name. APPEND htmlview.
htmlview-htmlcode = '</td>'. APPEND htmlview.
ENDFORM.
********************************************************
FORM htmlheader USING name TYPE c.
htmlview-htmlcode = '<td >'. APPEND htmlview.
htmlview-htmlcode = name. APPEND htmlview.
htmlview-htmlcode = '</td>'. APPEND htmlview.
ENDFORM.
Answer:
Use function module LIST_DOWNLOAD. There is documentation available for this FM.
_________________
BR
Zernov M.

More Articles:

ok-code in subscreenscreen exitpls.?
with line select box?
Outer join for match code?
how can I read HR Q tables of the INFOTYPES?
4.6c ALV OO vs Function?
Search helps /Matchcodes?