Generic pretty print of DB content

Hi,
is there a better (generic) way to pretty print the content of a few records?
So far i have this:
set serveroutput on;
create or replace function MakeDynamicBrowser(
     browserName in varchar2,
     tableName in varchar2)
return integer
is
     type StringTable_t is table of varchar2(256);
     columnNamesOrg StringTable_t;
     columnNames StringTable_t;
     types StringTable_t;
     stmt varchar2(32000);
     tableNameUpper varchar2(256) := upper(tableName);
begin
     SELECT      column_name, translate(column_name, '-', '_') ,
          case data_type
          when 'NUMBER' then
               decode(data_precision,
                    null, decode(data_scale,
                              null, data_type, data_type || '('  || data_precision || ')'),
                    decode(data_scale,
                         null, data_type, data_type || '('  || data_scale ||' , ' || data_precision || ')')
          when 'VARCHAR2' then
               case char_length
               when null then
                    data_type
               else
                    data_type || '(' || char_length     || ' char)'
               end
          when 'TIMESTAMP(3) WITH TIME ZONE' then
               data_type
          when 'DATE' then
               data_type
          when 'RAW' then
               data_type || '(' || data_length || ')'
          else
               'unknown'
          end
     bulk collect into columnNamesOrg, columnNames, types
     from all_tab_columns
     where table_name = tableNameUpper
     order by column_id;
     if columnNames.count <= 0 then
          dbms_output.put_line(tableNameUpper || ': no columns!');
          return -1;
     end if;
     stmt :=
     'create or replace function ' || browserName || '( '                    || chr(10) ||
     '     headline in varchar2, '                                   || chr(10) ||
     '     curStr in varchar2) '                                   || chr(10) ||
     'return integer '                                        || chr(10) ||
     'as '                                                  || chr(10) ||
     '     cur sys_refcursor; '                                   || chr(10) ||
     '     type object_t is record ( '                              || chr(10);
     for i in columnNames.first..columnNames.last loop
          if i <> columnNames.first then
               stmt := stmt ||     '     ,';
          end if;
          stmt := stmt || columnNames(i) || ' ' || types(i)               || chr(10);
     end loop;
     stmt := stmt ||
     '     ); '                                             || chr(10) ||
     '     type data_t is table of object_t; '                         || chr(10) ||
     '     data data_t; '                                        || chr(10) ||
     'begin '                                             || chr(10) ||
     '     dbms_output.put_line(headline); '                         || chr(10) ||
     '     open cur for curStr; '                                   || chr(10) ||
     '     fetch cur bulk collect into data; '                         || chr(10) ||
     '     if data.count = 0 then '                              || chr(10) ||
     '          dbms_output.put_line(''  ' || tableNameUpper || ': no data found!''); '
                                                       || chr(10) ||
     '     else '                                             || chr(10) ||
     '          for i in data.first..data.last loop '                    || chr(10) ||
     '          dbms_output.put_line('' #'' || i || '':''); '               || chr(10);
     for i in columnNames.first..columnNames.last loop
          stmt := stmt ||
     '               dbms_output.put_line(''  ' ||  columnNamesOrg(i) || ' = '' || data(i).' || columnNames(i)|| ');'
                                                       || chr(10);
     end loop;
     stmt := stmt ||
     '          end loop; '                                   || chr(10) ||
     '     end if; '                                        || chr(10) ||
     '     close cur; '                                        || chr(10) ||
     '     return 0; '                                        || chr(10) ||
     ' '                                                  || chr(10) ||
     'exception '                                             || chr(10) ||
     'when others then '                                        || chr(10) ||
     '     if cur%isopen then close cur; end if; '                         || chr(10) ||
        '     dbms_output.put_line(''' || browserName || '(): exception!''); '     || chr(10) ||
     '     return -1; '                                        || chr(10) ||
     'end; '                                                  || chr(10);
     execute immediate stmt;
     return 0;
end;
declare
     ret integer;
begin
     ret := MakeDynamicBrowser('MyBrowser', 'V_$SESSION');
     execute immediate 'call MyBrowser' || '(''headline'', ''select * from V$SESSION where audsid = ' ||  userenv ('sessionid') || ''') into :ret' using out ret;
end;
/Output:
SQL> @/tmp/test.sql
Function created.
headline
#1:
SADDR = 000000043B569268
SID = 174
SERIAL# = 55746
AUDSID = 2964800
PADDR = 000000043B430AF0
USER# = 33
USERNAME = USER
COMMAND = 3
OWNERID = 2147483644
TADDR =
LOCKWAIT =
STATUS = ACTIVE
SERVER = DEDICATED
SCHEMA# = 33
SCHEMANAME = USER
OSUSER = oracle
PROCESS = 26326
MACHINE = padsol40
TERMINAL = pts/42
PROGRAM = sqlplus@padsol40 (TNS V1-V3)
TYPE = USER
SQL_ADDRESS = 00000003FD230BB8
SQL_HASH_VALUE = 2822516303
SQL_ID = 2rz6khyn3sbkg
SQL_CHILD_NUMBER = 0
PREV_SQL_ADDR = FFFFFFFF7D7C0DC0
PREV_HASH_VALUE = 0
PREV_SQL_ID = 0000000000000
PREV_CHILD_NUMBER = 0
PLSQL_ENTRY_OBJECT_ID = 4177672
PLSQL_ENTRY_SUBPROGRAM_ID = 1
PLSQL_OBJECT_ID =
PLSQL_SUBPROGRAM_ID =
MODULE = SQL*Plus
MODULE_HASH = 3669949024
ACTION =
ACTION_HASH = 0
CLIENT_INFO =
FIXED_TABLE_SEQUENCE = 5800888
ROW_WAIT_OBJ# = -1
ROW_WAIT_FILE# = 0
ROW_WAIT_BLOCK# = 0
ROW_WAIT_ROW# = 0
LOGON_TIME = 02-AUG-11
LAST_CALL_ET = 0
PDML_ENABLED = NO
FAILOVER_TYPE = NONE
FAILOVER_METHOD = NONE
FAILED_OVER = NO
RESOURCE_CONSUMER_GROUP =
PDML_STATUS = DISABLED
PDDL_STATUS = ENABLED
PQ_STATUS = ENABLED
CURRENT_QUEUE_DURATION = 0
CLIENT_IDENTIFIER =
BLOCKING_SESSION_STATUS = NOT IN WAIT
BLOCKING_INSTANCE =
BLOCKING_SESSION =
SEQ# = 103
EVENT# = 116
EVENT = db file sequential read
P1TEXT = file#
P1 = 1
P1RAW = 0000000000000001
P2TEXT = block#
P2 = 133185
P2RAW = 0000000000020841
P3TEXT = blocks
P3 = 1
P3RAW = 0000000000000001
WAIT_CLASS_ID = 1740759767
WAIT_CLASS# = 8
WAIT_CLASS = User I/O
WAIT_TIME = -1
SECONDS_IN_WAIT = 0
STATE = WAITED SHORT TIME
SERVICE_NAME = testsys.padsol40.domain.com
SQL_TRACE = DISABLED
SQL_TRACE_WAITS = FALSE
SQL_TRACE_BINDS = FALSE
PL/SQL procedure successfully completed.It's incomplete for the types being recognized.
And the reason for need to deal with the types in the first place is:
Some tables use hyphen in columns names (e.g. v$transaction: DSCN-B, DSCN-W).
That's why i need translation from '-' to '_' to be able to print.
Otherwise '-' is recognized as minus operator (is there another way around w/o dealing with the types?).
Another question:
Is it possible to extend this to work with result of some cursor
- e.g. returning result of joining #2 tables?
best regards,
Frank
Edited by: user8704911 on Aug 2, 2011 4:52 AM

Tom Kyte's print_table functionality?
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1035431863958

Similar Messages

  • Any ideas on a nice BSP view pretty printer?

    Hi there,
    I am wondering whether somebody already tried to extend the SAP standard pretty printer by an own functionality which fits better for pages with mixed content, containing not only BSP-elements but also HTML-tags.
    The standard pretty printer considers everything as plain text which is not a BSP-element and leaves it unaltered. Only BSP-elements are arranged according to their tree structure.
    This produces ugly results for pages with mixed content.
    1.) Requirement
    A Pretty Printer for HTML-based BSP views should cover the following:
    (a) HTML-Tags and BSP-elements together form the chain. As in following example:
    <z:table table_id="testTab" binding="//test/gt_test" rows="5">
      <z:tableBody position="top">
        <colgroup>
          <col width="4%">
          <col width="96%">
        </colgroup>
      </z:tableBody>
      <z:column name="type" header="<%=zcl_bsp_util=>dtel_text_s('EDI_TTYP')%>"
                listPos="10"/>
      <z:column name="text" listPos="20"></z:column>
    </z:table>
    (b) Certain HTML formatting tags like I, B, etc. should not be added to the stack but be treated inline.
    (c) HTML-attribute names should be converted to lower case, the attribute values should be quoted.
    (d) Like for BSP-elements, there should be a threshold after which the attributes should appear in separate lines. Instead of a certain maximum "number of attributes", this could also be a maximum number of characters per line.
    (e) Scripting Tags (<% ... %>) should start at a new line, if the content contains new-lines.
    (f) Evaluation Scripting (<%= ... %>) should be inline, if they are contained within text nodes (and not within HTML oder BSP element nodes).
    (g) The Pretty Printer should be parametrizable (with parameters like indent-depth,... ).
    2.) Exits?
    Of course, one could always use an external HTML editor and write an add-on for that editor which produces the desired result. Or one could take the view content into the clipboard, paste it into a plain text editor like UltraEdit or TextPad which allows external commands, apply an external, self-written pretty printer to it and then paste the result back into the View. But it would be easier to use the "Pretty Printer" button directly to get the result. Therefore the question arises at which point the standard Pretty Printer Functionality could be modified or extended.
    I didn't find an exit. But the pretty-print itself is doubly-decoupled in the standard which minimizes the number of points where an extension has to be made:
    2.a) First decoupling point: The Fcode handler method pretty_printer_ext( ) in cl_o2_page is calling
    dynamically a method in cl_o2_co2_processor:
    * call pretty printer
      create object pp type ('CL_O2_CO2_PROCESSOR').
      appl_str = me->pagekey-applname.
      page_str = me->pagekey-pagekey.
      try.
          CALL METHOD pp->('PRETTY_PRINT')
            EXPORTING
              indent              = 2
              ATTRIBUTE_NORMALIZE = 'X'
              ATTRIBUTE_THRESHOLD = 2
              BSP_UNFORMATTED     = source
              appl                = appl_str
              page                = page_str
            IMPORTING
              test_ok             = test_ok
              BSP_FORMATTED       = pp_source.
        catch cx_o2_co2_exception into o2ex.
    2.b) Second decoupling point:
    The method pretty_print() of class cl_o2_co2_processor (fancy names, by the way. It seems that many former chemistry students had joined the BSP team ),
    there is a second delegation, to a local class, as follows:
      data pretty type ref to LCL_BSP_PRETTY_PRINT.
      pretty = LCL_BSP_PRETTY_PRINT=>getInstance( processor = me ).
    The real logic for doing the Pretty Print, finally, is performed in this local class.
    3.) Implementation.
    Since, up to my knowledge, there is no HTML parser in the ABAP world,
    the implementation could be based on existing HTML Parsers, like the Perl module Parser::HTML, or the Java package http://htmlparser.sourceforge.net/ . The pretty printer could then be called as external OS command.
    Are there any ideas out there? Or is there somebody who already worked in this direction?
    Regards,
    Rüdiger

    For those who are interested. I found out that the Dave Ragget's classic "HTML Tidy" (see <a href="http://tidy.sourceforge.net/">http://tidy.sourceforge.net/</a> )  is available in ABAP! There is a class CL_HTMLTIDY (at least here in my SAP_BASIS 700 system) which wraps calls of HTML Tidy by kernel modules.
    The class is undocumented, but there are 2 OSS notes of this year for it, so it might well be that it is alive.
    HTML Tidy can surely not directly be used for Pretty Printing BSP views, but for designing test cases or for doing things like HTML parsing, it might be a helpful tool.

  • How to pretty print XML alerts

    Hi!
    I'd like to generate mail alerts in OSB which include a XML content. I need XML to be human friendly printed (that is with indentation) but XML is printed in a single line.
    Is there any way to pretty print XML content in alerts (and also in alerts emails).
    Thank you in advance.

    The example of what the OP wants it to look like I thought was quite plain. Its right at the top of the post.
    Unfortunately it is also quite difficult to accomplish using System.out.print statements.
    You have to print out the root of the tree first (its at the top)
    However you don't know how far along to the right you need to print it without traversing the child nodes already (you need to know how deep the tree is, and how far to the left the tree extends from the root)
    So you will need to traverse the tree at least twice.
    Once to work out the offsets, and again to print out the values.
    The working out of offsets would have to be a depth search traversal I think
    The printing of the values in this fashion would be a breadth first traversal.
    I remember (ages ago) doing a similar assignment, except we printed the tree sideways.
    ie the root was on the left, the leaves of the tree on the right of the screen.
    That meant you could do an inorder depth traversal of the tree to just print it once.
    hope this helps,
    evnafets

  • Is there better way to do this?  (Xml Pretty Print | node removing)

    Hi all, I have been working at home on a small project to help my Java Jedi training. :-)
    My app saves quotes from authors in an xml file.
    I have a class [XmlRepository extends Thread] that holds control of an xml file to handle requests for Nodes.
    When I remove a node I get a Line Space above the node that was removed, or better put my node gets replaced by a empty line.
    Pretty print or correct Node removing.
    part of my xml is like this (I have resumed it for readability):
        <entities forUser="ffffffff-ffff-ffff-ffff-ffffffffffff">
            <quotes/>
            <authors>
                <author id="f156c570-c676-4d69-9b15-ae7d859ff771" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Poe</lastNames>
                    <firstNames>Edgar Allan</firstNames>
                </author>
                <author id="35dc0c5a-3813-4a10-af49-8d4ea1c2cee0" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Wilde</lastNames>
                    <firstNames>Oscar</firstNames>
                </author>
                <author id="317f72ea-add6-4bd2-8c63-d8b373a830ab" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Christie</lastNames>
                    <firstNames>Agatha</firstNames>
                </author>
                <author id="28047c89-b647-4c40-b6c7-677feaf2dfda" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Shakespeare</lastNames>
                    <firstNames>William</firstNames>
                </author>
            </authors>
        </entities>If I remove A Node ( Edgar Allan Poe (1st in this case)) the resulting Xml when saved is like this (I have added the space indentation just as it is outputted by my code):
        <entities forUser="ffffffff-ffff-ffff-ffff-ffffffffffff">
            <quotes/>
                <author id="35dc0c5a-3813-4a10-af49-8d4ea1c2cee0" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Wilde</lastNames>
                    <firstNames>Oscar</firstNames>
                </author>
                <author id="317f72ea-add6-4bd2-8c63-d8b373a830ab" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Christie</lastNames>
                    <firstNames>Agatha</firstNames>
                </author>
                <author id="28047c89-b647-4c40-b6c7-677feaf2dfda" languageCode="en" regenerateAs="com.fdt.cognoscere.entities.sources.Author">
                    <lastNames>Shakespeare</lastNames>
                    <firstNames>William</firstNames>
                </author>
            </authors>
        </entities>this is how I initialize the XML DOM Handlers, and the method for removing a Node:
         * Initializes factory instances and member variables.
        private void initialize() {
            //obtain an instance of a documentFactory create a document documentBuilder
            this.documentFactory = DocumentBuilderFactory.newInstance();
            //Configure the documentFactory to be name-space aware and validate trough an xsd file
            this.documentFactory.setNamespaceAware(true);
            this.documentFactory.setValidating(true);
            this.documentFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
            try {
                //obtain an instance of an XPathFactory
                this.xpathFactory = XPathFactory.newInstance(XPathFactory.DEFAULT_OBJECT_MODEL_URI);
                //obtain an instance of the xpath evaluator object
                this.xpathEvaluator = this.xpathFactory.newXPath();
                //set namespace mapping configurations
                NamespaceContextMap namespaceMappings = new NamespaceContextMap();
                namespaceMappings.put("xml", "http://www.w3.org/XML/1998/namespace");
                namespaceMappings.put("xmlns", "http://www.w3.org/2000/xmlns/");
                namespaceMappings.put("xsd", "http://www.w3.org/2001/XMLSchema");
                namespaceMappings.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
                namespaceMappings.put(this.schemaNamespaceMapping, this.schemaNamespace);
                //add mappings
                this.xpathEvaluator.setNamespaceContext(namespaceMappings);
            } catch (XPathFactoryConfigurationException ex) {
                Logger.getLogger(XmlRepository.class.getName()).log(Level.SEVERE, null, ex);
            try {
                //obtain a trasformer factory to save the file
                this.transformerFactory = TransformerFactory.newInstance();
                this.transformerFactory.setAttribute("indent-number", 4);
                //obtain the transforme
                this.transformer = this.transformerFactory.newTransformer();
                //setup transformer
                this.transformer.setOutputProperty(OutputKeys.METHOD, "xml");
                this.transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                this.transformer.setOutputProperty(OutputKeys.MEDIA_TYPE, "text");
                this.transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
            } catch (TransformerConfigurationException tcex) {
                Logger.getLogger(XmlRepository.class.getName()).log(Level.SEVERE, null, tcex);
         * Removes a node by evaluating the XPATH expression.
         * @param xpath A String instance with the XPATH expression representing the element to remove.
         * @throws com.fdt.cognoscere.storage.exceptions.UnableToRemoveException When an exception occurs that prevents the repository to execute the remove statement.
        public void removeNode(final String xpath) throws UnableToRemoveException {
            Node nodeToRemove = null;
            Node parentNode = null;
            //verify xpath
            if (xpath == null)
                throw new IllegalArgumentException("The xpath argument cannot be null.");
            //verify that the repository is loaded
            if (!this.loaded)
                throw new IllegalStateException("The XmlRepository faild to load properly and it is in an invalid state. It cannot perfom any operation.");
            try {
                //get the node to remove out of the xpath expression
                nodeToRemove = this.getNode(xpath);
                //throw an exception if no node was found to remove
                if (nodeToRemove == null)
                    throw new UnableToFindException("The node element trying to be remove does not exist.");
                //obtain the parent node to remove its child
                parentNode = nodeToRemove.getParentNode();
                //remove the node from the parent node
                nodeToRemove = parentNode.removeChild(nodeToRemove);
            } catch.......removed to save space{
            } finally {
                //normalize document
                this.document.normalize();
        }Please tell me if I could do this better,
    thanks,
    f(t)

    franciscodiaztrepat wrote:
    When I remove a node I get a Line Space above the node that was removed, or better put my node gets replaced by a empty line.Replaced? No, there's already a new-line character after the node that was removed. And there was one before that node too. You didn't remove either of those, so after the removal there are two consecutive new-line characters. As you can see.
    And no, trying to pretty-print the XML document won't remove any of those. It might add whitespace to make the document nicely indented, but it won't ever remove whitespace. If you want whitespace removed then you'll have to do it yourself.
    For example, after you remove a node, also remove the node following it if it's a whitespace text node. Or something like that.

  • How to add generic USB printer

    Hi-we have an old Samsung ML 6060 laser printer that we have had networked via ethernet to 2 macs and a PC. Has always worked fine. Now we have added a new HP photo printer to our system and have it hooked up via the ethernet. Since we don't have enough spaces on our router for both printers, we want to use a USB connection for the old Samsung. We have it connected directly to our intel iMAc and want to use print sharing to our Macbook Pro. Problem is getting the USB connection up and printing. System profiler sees the printer. The driver is old and probably not very functional on the new system although it worked fine with the ethernet connection. Samsung no longer issues new mac drivers for this printer. Printer set-up utility has a hard time finding the printer when we delete and try to re-add it. We have managed to get a test to print once only. Otherwise, the dialog box says it is printing but the data light on the printer does not flash as normal and nothing is printed and everything hangs this way. So we thought we could try adding it under the generic USB printer description but not sure how to fill in the "Device URI" window USB://_________. Can anyone help with this or do we have to go out and get a new laser printer ( my husband prefers it to the ink-jet for printing music scores ) Thanks for any help!

    Never mind, I figured it out. Thanks anyway!

  • How to print PDF file content from ABAP in background?

    Hi,
    Is it possible to print PDF file content from ABAP in background?
    I have some PDF content which I need to print it, these PDF files are generated outside the SAP.
    Please have you any suggestions?
    Thank you
    Tomas

    <b><u>Solution:</u></b><br>
    <br>
    The target output device must support PDF print, this is only one limitation.<br>
    <br>
    REPORT  z_print_pdf.
    TYPE-POOLS: abap, srmgs.
    PARAMETERS: p_prnds LIKE tsp01-rqdest OBLIGATORY DEFAULT 'LOCL',
                p_fname TYPE file_table-filename OBLIGATORY LOWER CASE,
                p_ncopi TYPE rspocopies OBLIGATORY DEFAULT '1',
                p_immed AS CHECKBOX.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
      DATA: lv_rc     TYPE i,
            lv_filter TYPE string.
      DATA: lt_files TYPE filetable.
      FIELD-SYMBOLS: <fs_file> LIKE LINE OF lt_files.
      CONCATENATE 'PDF (*.pdf)|*.pdf|' cl_gui_frontend_services=>filetype_all INTO lv_filter.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          file_filter             = lv_filter
        CHANGING
          file_table              = lt_files
          rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 1.
      IF sy-subrc NE 0 AND lv_rc EQ 0.
        MESSAGE 'Error' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      READ TABLE lt_files ASSIGNING <fs_file> INDEX 1.
      IF sy-subrc EQ 0.
        p_fname = <fs_file>-filename.
      ENDIF.
    AT SELECTION-SCREEN.
      DATA: lv_name   TYPE string,
            lv_result TYPE boolean.
      lv_name = p_fname.
      CALL METHOD cl_gui_frontend_services=>file_exist
        EXPORTING
          file                 = lv_name
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          OTHERS               = 1.
      IF sy-subrc NE 0.
        MESSAGE 'Bad file!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      IF lv_result NE abap_true.
        MESSAGE 'Bad file!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
    START-OF-SELECTION.
    END-OF-SELECTION.
      PERFORM process.
    FORM process.
      DATA: lv_name     TYPE string,
            lv_size     TYPE i,
            lv_data     TYPE xstring,
            lv_retcode  TYPE i.
      DATA: lt_file TYPE srmgs_bin_content.
      lv_name = p_fname.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename                = lv_name
          filetype                = 'BIN'
        IMPORTING
          filelength              = lv_size
        CHANGING
          data_tab                = lt_file
        EXCEPTIONS
          OTHERS                  = 1.
      IF sy-subrc NE 0.
        MESSAGE 'Read file error!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_data
        TABLES
          binary_tab   = lt_file
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
      IF sy-subrc NE 0.
        MESSAGE 'Binary conversion error!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      PERFORM print USING p_prnds lv_data CHANGING lv_retcode.
      IF lv_retcode EQ 0.
        WRITE: / 'Print OK' COLOR COL_POSITIVE.
      ELSE.
        WRITE: / 'Print ERROR' COLOR COL_NEGATIVE.
      ENDIF.
    ENDFORM.                    " PROCESS
    FORM print USING    iv_prndst  TYPE rspopname
                        iv_content TYPE xstring
               CHANGING ev_retcode TYPE i.
      DATA: lv_handle    TYPE sy-tabix,
            lv_spoolid   TYPE rspoid,
            lv_partname  TYPE adspart,
            lv_globaldir TYPE text1024,
            lv_dstfile   TYPE text1024,
            lv_filesize  TYPE i,
            lv_pages     TYPE i.
      CLEAR: ev_retcode.
      CALL FUNCTION 'ADS_SR_OPEN'
        EXPORTING
          dest            = iv_prndst
          doctype         = 'ADSP'
          copies          = p_ncopi
          immediate_print = p_immed
          auto_delete     = 'X'
        IMPORTING
          handle          = lv_handle
          spoolid         = lv_spoolid
          partname        = lv_partname
        EXCEPTIONS
          OTHERS          = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ADS_GET_PATH'
        IMPORTING
          ads_path = lv_globaldir.
      CONCATENATE lv_globaldir '/' lv_partname '.pdf' INTO lv_dstfile.
      OPEN DATASET lv_dstfile FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      TRANSFER iv_content TO lv_dstfile.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CLOSE DATASET lv_dstfile.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ZBAP_RM_PDF_GET_PAGES'
        EXPORTING
          iv_content = iv_content
        IMPORTING
          ev_pages   = lv_pages.
      lv_filesize = XSTRLEN( iv_content ).
      CALL FUNCTION 'ADS_SR_CONFIRM'
        EXPORTING
          handle   = lv_handle
          partname = lv_partname
          size     = lv_filesize
          pages    = lv_pages
          no_pdf   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ADS_SR_CLOSE'
        EXPORTING
          handle = lv_handle
        EXCEPTIONS
          OTHERS = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
    ENDFORM.                    " PRINT

  • How to pretty printer of a code in enhance framework of a standard FM

    Hi,
           I have written a code in a <b>enhancement point of a standard Function Module</b>. But i am unable to pretty printer that portion of code. Doed any one have any idea how to do that??
    Thanks & Regards,
    Abhishek Sarkar

    Hi,
    Pritty printer gives a pritty view to your code, so that it can be easily readable.
    You can set the functionality of pritty printer by doing some setting.
    The path for setting is
    Utilities>Setting>ABAP Editor-->Pritty Printer.
    Thanks.

  • Can't get proper HP printer settings dialog, only featureless generic Windows Print settings.

    So I have an HP Deskjet 3050 J610, connected via wifi.  I can print from it just fine, but I only have the standard Windows printing options, which are very limited.  I don't get any color options, or printing on both sides, or anything like that.  Basically my only options are "print in grayscale" and "print in Max DPI".  So I presume I am using generic printer drivers, instead of the proper HP drivers.  I remember I once had it working right, and it had a nice HP dialog with pictures that would ask me if I want to print for a presentation, or draft, or print on both sides, etc.
    But I already have the proper HP drivers installed.  So I run "HP Deskjet 3050 J610 series.exe" in the HP printer drivers folder.  I click "connect to a new printer".  I click 'wireless'.  It finds my printer.  I select it under "model name", and press 'next'.  It sets up the printer properly, but when I try to go and print with it, I'm still presented with the crippled generic windows print dialog!
    How do I get the nice HP drivers settings dialog back again?
    EDIT: I'm on Windows 8.1 Preview.  I have also tried to set up the printer on a Windows 7 laptop, using the same driver download from the official HP website, and that laptop too also only gets to use the generic windows printing dialog!  What am I doing wrong?

    bonsguy wrote:
    the same info is not under Help or in the Pages manual under printing options.
    Perfectly normal.
    The Print dialog doesn't belong to Pages but to the operating system.
    So, it's use is described in the operating system help.
    Here is an example of what we may find in this help :
    Yvan KOENIG (VALLAURIS, France) vendredi 10 juin 2011 16:13:18
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • File Print on the list item doesn't print the whole content in IE8

    Hi,
    I have this issue happened on my customer side. Their IE version is 8.0.7600.16385.
    By using this version of IE to do a file > print of a list item with long html content, the html content will get chop off. Refer to the screenshots.
    Print Preview
    List Item
    HTML code in the "Content" column
    <div class="ExternalClass1BFFAF9C72F744C7899695B11ADC69F3"><p>Printing Issue Simulation</p>
    <p><img alt="XXX.jpg" src="XXX.jpg" style="margin: 5px; width: 647px; height: 1000px"/><br/><br/>2012-06-18 17:29:47 - Processor architecture is (9)<br/>2012-06-18 17:29:47 - Reading the following string value/name...<br/>2012-06-18 17:29:47 - Common Startup<br/>2012-06-18 17:29:47 - from the following registry location...<br/>2012-06-18 17:29:47 - SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders<br/>2012-06-18 17:29:47 - The value is... <br/>2012-06-18 17:29:47 - C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup<br/>2012-06-18 17:29:47 - Trying to remove the startup task if there is any.<br/>2012-06-18 17:29:47 - C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\SharePointServerPreparationToolStartup_0FF1CE14-0000-0000-0000-000000000000.cmd<br/>2012-06-18 17:29:47 - Error: Startup task doesn&#39;t exist. This is not a continuation after a restart.<br/>2012-06-18 17:29:47 - Analyzing the following command line argument:<br/>2012-06-18 17:29:47 - /unattended<br/>2012-06-18 17:29:47 - Unattended installation<br/>2012-06-18 17:29:47 - Analyzing the following command line argument:</p>
    <p><img alt="XXX.jpg" src="XXX.jpg" style="margin: 5px; width: 647px; height: 1000px"/></p>
    <p>&#160;</p>
    <p>​</p></div>
    If file > print is done in higher IE version, it can be printed out nicely.
    Is there a way to fix this issue as customer side may not able to upgrade to the higher IE version? e.g. CSS
    Thanks in advance.
    jingzo (^_^)

    Hi,
    According to your description, my understanding is that the print function of IE8 doesnot print the whole content of SharePoint list item.
    For troubleshooting your issue, please turn off Protection Mode for the IE8.
    You can refer to the thread:
    https://social.technet.microsoft.com/Forums/en-US/b8ab8f65-9b27-4a90-9323-0ca5b7e4466e/print-preview-print-of-web-pages-doesnt-work-in-ie8?forum=w7itproperf
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • ABAP Mapping Pretty Print

    Hi Everybody,
    I have an issue with linefeed in ABAP Mapping.The ouput document generated by ABAP Mapping is as follow:
    <?xml version="1.0" encoding="utf-8" ?<Header Node><T_H><SEND_ID value="XYZ"/>
    <REC_ID value="PQR"/>
    <DATE value="2007"/>
    </T_H>
    <O_H><L_NO value="252517"/>
    <W_NO value="298"/>
    <U_NO value="298"/>
    </O_H>
    </Header Node>
    If we can see the above payload, i have the <Header Node> coming in the same line as that of the utf-8 and also the subnode <T_H> starting in the same line and its first field <SEND_ID > in the same line.The same is repeating for the second subnode <O_H>. I want to do a pretty print for this payload.I have used the method <b>set_pretty_print( )</b> in the ABAP Mapping, but there is no effect of this on the output.
    To make it clear let me give the required output Xml
    <?xml version="1.0" encoding="utf-8" ?
    <Header Node>
    <T_H>
    <SEND_ID value="XYZ"/>
    <REC_ID value="PQR"/>
    <DATE value="2007"/>
    </T_H>
    <O_H>
    <L_NO value="252517"/>
    <W_NO value="298"/>
    <U_NO value="298"/>
    </O_H>
    </Header Node>
    Can anybody help me out on this.
    Thanks & Regards,
    Zabiula

    Insert a new line character as per the ABAP rules in the generated XML. It is normally "/n" for microsoft based languages. Not sure what it is in ABAP. May be an ABAPer must be able to help you.
    VJ

  • Xerces 2.6, setIndent(0), 1.4.2 not working. XML always pretty printing

    Hello.
    I would like to take a string that contains xml and strip out all new lines, whitespace between tags, etc. So basically everything will be on one line.
    So I thought one simple way would be to run an XMLSerializer or use a Transformer. However, it's turning out to be a nightmare. I probably could have written a parser already. :)
    I've tried all possible combinations of
    XMLSerializer
    outputFormat.setIndenting(false)
    outputFormat.setIndent(0)
    outputFormat.setLineWidth(0)
    Transformer
    transformer.setOutputProperty("indent", "no")
    transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "0");For some reason, my XML is always pretty printed. And I can't figure it why. I was able to get the XMLSerializer version all on one line with an indent of 1, but the minute I switch to 0 it gets pretty printed.
    Here's some Transformer code I'm using:
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse( new InputSource( new StringReader(input)) );                      
    DOMSource source = new DOMSource(doc);
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "no");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "0");
    transformer.transform(source, new StreamResult(System.out));Output:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <trans_data>
      <input_data>
        <cc>1</cc>
      </input_data>
    </trans_data>I've tried both 2.6.2 and 2.5.0 of Xerces and my classpath only has XercesImpl.jar and xml-apis.jar in it. I'm using 1.4.2-07.
    Thanks,
    -- Jason

    public class XMLPrinter
         private static final String CLASSNAME = "XMLPrinter(): ";
         public static String print( String input )
            String methodName = "print(): ";
               String output = "";
            try
                DocumentBuilderFactory docBuilderFactory =
                    DocumentBuilderFactory.newInstance();
                DocumentBuilder docBuilder =
                    docBuilderFactory.newDocumentBuilder();
                Document doc = docBuilder.parse(
                    new InputSource( new StringReader(input)) );
                StringWriter stringWriter = new StringWriter();
                OutputFormat format = new OutputFormat( doc );
                                                 format.setIndenting( false );
                format.setLineWidth( 0 );
                format.setIndent( 0 );
                XMLSerializer serializer =
                   new XMLSerializer( stringWriter, format );
                serializer.serialize(doc);
                output = stringWriter.toString();
            catch (Exception e)
                output = null;
            return output;
         public static void main(String[] args)
            String XML =
            "<xml> <output>junk</output>    <output2>junk2</output2>\r\n<output3>output3</output3>\r\n</xml>\r\n";
            System.out.println(XMLPrinter.print(XML));
         }returns
    <?xml version="1.0" encoding="UTF-8"?>
    <xml> <output>junk</output>    <output2>junk2</output2> <output3>output3</output3> </xml>Switching to
    format.setLineWidth( 0 );
    format.setIndenting( true );
    format.setIndent( 10 );returns
    <?xml version="1.0" encoding="UTF-8"?>
    <xml>
              <output>junk</output>
              <output2>junk2</output2>
              <output3>output3</output3>
    </xml>

  • Printing web page content from android tablet

    When I attempt to eprint a web page, the web address line prints just fine (with a lower line that reads:"sent from Samsung tablet"), but none of the content, even though the print preview showed everything on the page that I needed. PLEASE HELP!   Is the web page content considered an attachment and if so, how do I get the attachment to print?
    This question was solved.
    View Solution.

    Hi TurboLady,
    Thank you for the update.  I appreciate it.  You read the document correctly.
    The best way to print the web content is to print the web page using the browser found in the HP ePrint app.  Please download and install the HP ePrint Mobile app from the Google Play store. For reference I’ve included the HP ePrint Mobile App FAQ document.
    Please let me know how that works for you.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Xml formatting (pretty print, etc)

    Our MXML is getting a bit messy. (we also need a pretty
    printer and simple
    xml exploration and editing) for soap feeds.
    1. Is there something in Eclipse now that does this?
    2. Is there a publicly available plug-in
    3. Is there some simple (i.e. cheap or free tool) for doing
    this. XMLSpy
    would be overkill.

    Excellent directions, Yes, this is exactly what I needed to
    know. It now
    works fine.
    Only one item to note. Even though I did not set XMLBuddy as
    the default for
    *.mxml
    -- If I do the context menu (right click) and choose xml
    buddy, then it will
    stay sticky for that file the next time. The same as with
    using the
    FlexBuilder mxml editor. Not a real problem but what does
    "default" mean any
    more if the IDE is trying to be so smart as to decide for me
    what my default
    should be :-)
    "Mark Shepherd" <[email protected]> wrote in message
    news:[email protected]...
    > There is no XML or MXML formatting built-in to
    FlexBuilder or Eclipse.
    >
    > But don't despair, there are 100's of plugins available
    for eclipse, here
    > is one way that works...
    >
    > 1. install the XMLBuddy eclipse plug-in from
    xmlbuddy.com
    > 2. in flexbuilder, go to Window > Preferences >
    General > Editors > File
    > Associations
    > 3. select *.mxml in the top panel, then click "Add" in
    the bottom panel
    > 4. choose XMLBuddy, then OK, then OK
    >
    > You can now open any MXML file using the XML editor
    (xmlbuddy) rather than
    > FlexBuilder's normal MXML editor. To do this, select the
    file in the
    > Navigator panel, then right-click and choose Open With
    > XMLBuddy. Once
    > you are in the XML editor, you can select a range of
    text (or the entire
    > file, if you like) and choose Format from the XML menu.
    >
    > This technique will work for any XML-based file format,
    including MXML,
    > soap documents, RSS feeds, etc.
    >
    > There are probably other way to do this. Does anybody
    have other
    > suggestions?
    >
    > Mark Shepherd
    > FlexBuilder Engineering
    >
    >
    > Yechezkal Gutfreund wrote:
    >> Our MXML is getting a bit messy. (we also need a
    pretty printer and
    >> simple xml exploration and editing) for soap feeds.
    >>
    >> 1. Is there something in Eclipse now that does this?
    >>
    >> 2. Is there a publicly available plug-in
    >>
    >> 3. Is there some simple (i.e. cheap or free tool)
    for doing this. XMLSpy
    >> would be overkill.
    >>
    >>

  • Pretty Print

    Hi,
    Is there a 'pretty-print' extension, similar to the function
    in XML Spy except for HTML and Dreamweaver?
    Basically, it takes something like (a)
    And turns it into (b)
    Thanks
    Example:

    Um, do you mean somthng like the DW menu: Commands > Apply
    Source Formatting - ?
    Corona

  • Pretty print of a binary tree

    Hi, I have to pretty print a binary tree composed of "key" values like 75, 70, 15, 2, etc. I have no idea how to create a dynamic method that can output a tree in the order that they are in. The tree is supposed to look like this:
                  15      
                  37
                       13
             75
                       90
                                 58
                             2
                  70
                       24The 15 is supposed to be in the top middle of the tree. Can anyone give me any help or hints to get started? Thanks.

    I guess you mean this
             15
      13              37
    2            24           75
                        58       90
                          70

Maybe you are looking for

  • Multiple copies of one photo in Aperture

    Hi, I have just bought Aperture, and I'm dying to get started. However, a very basic thing annoys me quite a lot. I would like to make an Album with photos I can perform experiments on, but no matter what I do, the changes also apply to the "original

  • Disable explicit content in iTunes store on iPad

    In iTunes preferences on my Mac I can go to Parental Preferences and click on restrict explicit content, how do I do the same thing for the iTunes store on the iPad? I know how to restrict explicit content from being played on the iPad, but I can't s

  • Subcontracting Vendor and Purchase Vendor

    Dear All, I have created separate Pricing Procedure for Subcontracting PO, since the requirement is to calculate the price on issuing qty. I have put Formula Based Condition type. We issue 100 KG of material and receive less than 10 KG (say 90-95 KG)

  • Photo download

    When i connect nokia 6230i to pc suite i cannot get a connection to the pc, i am using a DKU 2 usb lead. after a few hours of trying i managed to download two images, but i do not know how i did it! i do remember that the computer flaged up new hardw

  • Sizing of flash in webpage

    I have a flash document that I want to always take up the entire web page. Setting to 100% width & 100% height doesn't do the trick, because if the window dimensions aren't right, white space will show on the sides/top and bottom. Is there a way to g