Problem solve Get help with specific problems with your technologies, process and projects.

SAP table view in html format

A simple report program. Through this you can view SAP Tables 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 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.
'. append HTMLVIEW. HTMLVIEW-HTMLCODE = NAME. append HTMLVIEW. HTMLVIEW-HTMLCODE = ''. append HTMLVIEW. HTMLVIEW-HTMLCODE = NAME. append HTMLVIEW. HTMLVIEW-HTMLCODE = '
This was last published in October 2001

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close