Home > SAP software/management Tips > SAP ABAP/Java developer tips > SAP table view in html format
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SAP ABAP/JAVA DEVELOPER TIPS

SAP table view in html format


Srini S
10.04.2001
Rating: -3.77- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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



Code

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 = '

Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
SAP ABAP/Java developer tips
How to do additional dialog processing after SAP COMMIT WORK statement
How to find a piece of SAP ABAP code without debugging
How to read an SAP transaction in an ABAP code
How to provide an SAP R/3 4.5B application server with a Web service interface
How to find owners and transports of deleted ABAP programs
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



NetWeaver SAP White Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts