Home > SAP Tips > SAP best practices > Display an output list in HTML format for the Web
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SAP BEST PRACTICES

Display an output list in HTML format for the Web


Ramakrishnan Suryanarayanan
09.17.2001
Rating: -4.43- (out of 5) Hall of fame tip of the month winner


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


Accepts a wild card '*' as input parameter as program input and then uses the variant table to generate the output. Calls 2 functions namely 'ws_download' and 'call_browser' and displays the output in HTML format. Call Browser calls the default setup browser (IE) or (Netscape) as the case may be.



Code

REPORT ZYSRM006 NO STANDARD PAGE HEADING.
************************************************************************
* Program to display the output list to html format.
* Date   : 04/10/1999.
************************************************************************
TABLES: VARIT.    "Variant directory
DATA: BEGIN OF ITAB OCCURS 10,
          WW_REPT LIKE SY-REPID,
          WW_VARID LIKE VARIT-VARIANT,
          WW_VTEXT LIKE VARIT-VTEXT,
      END OF ITAB.
DATA: FLDS LIKE W3FIELDS OCCURS 10.
DATA: F_HTML      LIKE W3HTML OCCURS 10 WITH HEADER LINE.
PARAMETERS : REPT LIKE SY-REPID OBLIGATORY. "Accepts Report/Prg Name.
IF REPT CS '*'.                        "Check for wild card character.
  WHILE ( SY-SUBRC EQ 0 ).
    REPLACE '*' WITH '%' INTO REPT.
  ENDWHILE.
ENDIF.
SELECT REPORT VARIANT VTEXT INTO
      (ITAB-WW_REPT, ITAB-WW_VARID, ITAB-WW_VTEXT)
       FROM VARIT
       WHERE REPORT LIKE REPT AND LANGU LIKE SY-LANGU.
  IF SY-SUBRC EQ 0.
    APPEND ITAB.
  ENDIF.
ENDSELECT.

CALL FUNCTION 'WWW_ITAB_TO_HTML'
     TABLES
          HTML   = F_HTML
          FIELDS = FLDS
          ITABLE = ITAB.
IF SY-SUBRC NE 0.
  WRITE: / 'Error in generating the html format'.
  EXIT.
ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'
     EXPORTING
          FILENAME         = 'c:test.html'
          MODE             = 'BIN'
     TABLES
          DATA_TAB         = F_HTML
     EXCEPTIONS
          FILE_OPEN_ERROR  = 1
          FILE_WRITE_ERROR = 2
          OTHERS           = 9.

IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
  WRITE: / 'Output Saved in file c:test1.html'.
ENDIF.

CALL FUNCTION 'CALL_BROWSER'
     EXPORTING
          URL                    = 'c:test1.html'
     EXCEPTIONS
          FRONTEND_NOT_SUPPORTED = 1
          FRONTEND_ERROR         = 2
          PROG_NOT_FOUND         = 3
          NO_BATCH               = 4
          UNSPECIFIED_ERROR      = 5
          OTHERS                 = 6.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

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
Web enablement
Top 10 SAP tips of 2007
How to integrate BW query iViews with a WebDynpro application
Content management solution for NetWeaver 04 Enterprise Portal
BSP vs Java
Web-enabled workitems
Access Tables Via RFC
Cascading Style Sheets
Function module for Web RFC
Enabling HTTPS in the Web Application Server
Workflow for generating an IAC

SAP best practices
Increase column width in a transaction screen
Select Text fields: Case-insensitive
Finding BADIs you can use
Updating an RT table entry in SAP HR Payroll -- without the ADDWTE option
Is this the quickest way to find a BADI?
Adding custom fields for retail product comparisons in SAP BW
ABAP Objects in SAP Workflow to provide improved performance
Top 10 SAP tips of 2007
Retrieve BI data with Web Services
Eliminate database read/write times with ABAP shared memory

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.

HomeNewsTopicsBlogsTipsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, 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