SAP table view in html format

SAP table view in html format

A simple report program. Through this you can view SAP Tables in HTML format.


REPORT ZTABLEHTML.
***********************************************************
* Developer        : S.Srini.
* Location         : Chennai,
*                  : Tamil Nadu,
*                  : India.
***********************************************************
* Column type P dose not support.
***********************************************************
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 0.
     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 = 'Table Browser'.
append HTMLVIEW.

HTMLVIEW-HTMLCODE = ' Table View : '.            append HTMLVIEW.

HTMLVIEW-HTMLCODE = TabName.                   append HTMLVIEW.
HTMLVIEW-HTMLCODE = ' 

 

'. append HTMLVIEW. *********************************************** PERFORM CHECK-TABLE-CLASS. PERFORM READ-DIRECT-TABLE. PERFORM

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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: ANZ_NUMB TYPE I. PERFORM GETTABLEINFO USING Tabname. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. LOOP AT ZDFIES. PERFORM HTMLHEADER USING ZDFIES-FIELDNAME. ENDLOOP. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. COLORVAL = 1. 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 = ''. append HTMLVIEW. ELSE. HTMLVIEW-HTMLCODE = ''. 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 = ''. append HTMLVIEW. CLEAR: W_AREA1. ENDSELECT. HTMLVIEW-HTMLCODE = ''. 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~1INTERN~1IEXPLORE.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 = ''. append HTMLVIEW. ENDFORM. ******************************************************** FORM HTMLHEADER USING NAME TYPE C. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. ENDFORM.

This was first published in October 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

'. append HTMLVIEW. HTMLVIEW-HTMLCODE = NAME. append HTMLVIEW. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. HTMLVIEW-HTMLCODE = NAME. append HTMLVIEW. HTMLVIEW-HTMLCODE = '