Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP Reports arrow Output List Manipulation
Output List Manipulation PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Wednesday, 31 January 2007
Here is an example of manipulating lists (the output of a report) in several different ways. It includes saving the list in various formats (HTML, DAT (tab delimited, good for sending to spreadsheet/database programs), ASCII, or RTF (good for sending to word processors). Source Code Listing
*-----------------------------------------------------------------------
* Demonstrate various things that can be done with lists
* The first example shows how to have a list go to memory instead of the
* screen or a spool, and how to write out that list.
*
* The second set of examples shows how to save the screen list in
* various formats
*-----------------------------------------------------------------------
REPORT ZKBTST31.
DATA: MTAB_REPORT_LIST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
DATA: MTAB_REPORT_HTML LIKE W3HTML OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF MTAB_REPORT_ASCII OCCURS 0,
LINE(255) TYPE C,
END OF MTAB_REPORT_ASCII.
START-OF-SELECTION.
*-- Submit a report. This one is the chart of accounts
SUBMIT RFSKPL00
EXPORTING LIST TO MEMORY " Save list in memory
AND RETURN. " Return control to this program
END-OF-SELECTION.
*-- Get the list from memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = MTAB_REPORT_LIST
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
*-- Write the list out
*-- This is a trivial example. A better use would be when the
*-- requirement is to have one report print out several different
*-- reports on the same list level.



CALL FUNCTION 'WRITE_LIST'
TABLES
LISTOBJECT = MTAB_REPORT_LIST
EXCEPTIONS
EMPTY_LIST = 1
OTHERS = 2.
************************************************************************
* The examples below this line do not require that the report be *
* submitted to memory when run. All that they require is that the *
* report has been written to the screen. *
************************************************************************
*-- Take the current list that has been written to screen, and format
*-- as an HTML file.
CALL FUNCTION 'WWW_LIST_TO_HTML'
TABLES
HTML = MTAB_REPORT_HTML
EXCEPTIONS
OTHERS = 1.
*-- Save the list. Same as using System->List->Save->Local File or
*-- entering %pc in the OKCODE box. This function does not need the
*-- include <%_LIST> in a program.
*-- Method can be:
*-- NOCO - No conversion
*-- RTF - Rich Text Format
*-- DAT - Tab delimited Format
*-- When no method is given, a selection screen is presented for the
*-- user to choose the method.
CALL FUNCTION 'LIST_DOWNLOAD'
EXPORTING
METHOD = 'NOCO'
EXCEPTIONS
OTHERS = 1.

Program Texts
R List functions

Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 333
Sample Code: 164
Total Contributions: 550

Member Activity
Members: 6176 since 2/1/2007!
New: 3 since yesterday!
Visitors: 1009415
We have 2 guests online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor