Column header using OdiSqlUnload

hi,
I am using the ODISQLUNLOAD utility to create a a csv from a couple of tables in database. Though the file is generated properly, i am unable to append column headers in the file. Can u plz guide me as to how shud i add the column headings. My command is as follows
OdiSqlUnload "-FILE=#FILE_PATH/#FILE_NAME" "-DRIVER=<%=odiRef.getInfo("SRC_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("SRC_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("SRC_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("SRC_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-FIELD_SEP=," "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1" "-FETCH_SIZE=1000" "-QUERY=SELECT RPAD(CI_FT_GL.GL_ACCT, 31, ' '),LPAD(CASE WHEN CI_FT.CURRENCY_CD != CI_FT_GL_EXT.DIVISION_CURCY_CD THEN sum(CI_FT_GL_EXT.DIVISION_AMT) ELSE sum(CI_FT_GL.AMOUNT) END,17,' '),' ',RPAD(CI_DST_CD_CHAR.CHAR_VAL, 25, ' '),RPAD(CI_DST_CD_CHAR.DST_ID, 8, ' '),'RMB ',' ',RPAD(to_char(sysdate, 'YYYYMMDD'), 8, ' ') FROM CI_DST_CD_CHAR CI_DST_CD_CHAR,CI_FT CI_FT,CI_FT_GL CI_FT_GL,CI_FT_GL_EXT CI_FT_GL_EXT where (CI_FT.FT_ID = CI_FT_GL.FT_ID) AND (CI_FT_GL.FT_ID = CI_FT_GL_EXT.FT_ID(+)) AND CI_FT_GL.GL_SEQ_NBR = CI_FT_GL_EXT.GL_SEQ_NBR(+) AND (CI_FT_GL.DST_ID = CI_DST_CD_CHAR.DST_ID) AND (CI_DST_CD_CHAR.CHAR_TYPE_CD = 'DTLREF1') AND (trim(CI_FT_GL.GL_ACCT) is not null) AND (CI_FT.XFER_TO_GL_DT is null) AND (CI_FT.GL_DISTRIB_STATUS in ('G','M')) AND (trunc(CI_FT.SCHED_DISTRIB_DT) <= trunc(sysdate)) AND CI_FT.CIS_DIVISION = '#DIVISION' GROUP BY CI_FT_GL.GL_ACCT,CI_DST_CD_CHAR.CHAR_VAL,CI_DST_CD_CHAR.DST_ID,CI_FT.CURRENCY_CD,CI_FT_GL_EXT.DIVISION_CURCY_CD"

Wen i executed the jython code given in above link i got the following error:
org.apache.bsf.BSFException: exception from Jython:
SyntaxError: ("mismatched input '' expecting EOF", ('<string>', 10, 2, " if string.find(my_query, '*') > 0:\n"))
     at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
     at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
     at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
     at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
My code is as follows:
import string
import java.sql as sql
import java.lang as lang
import re
sourceConnection = odiRef.getJDBCConnection("SRC")
output_write=open('d:/Bijal/output.csv','r+')
myStmt = sourceConnection.createStatement()
my_query = "SELECT RPAD(CI_FT_GL.GL_ACCT, 31, ' '),LPAD(CASE WHEN CI_FT.CURRENCY_CD != CI_FT_GL_EXT.DIVISION_CURCY_CD THEN sum(CI_FT_GL_EXT.DIVISION_AMT) ELSE sum(CI_FT_GL.AMOUNT) END,17,' '),' ',RPAD(CI_DST_CD_CHAR.CHAR_VAL, 25, ' '),RPAD(CI_DST_CD_CHAR.DST_ID, 8, ' '),'RMB ',' ',RPAD(to_char(sysdate, 'YYYYMMDD'), 8, ' ') FROM CI_DST_CD_CHAR CI_DST_CD_CHAR,CI_FT CI_FT,CI_FT_GL CI_FT_GL,CI_FT_GL_EXT CI_FT_GL_EXT where (CI_FT.FT_ID = CI_FT_GL.FT_ID) AND (CI_FT_GL.FT_ID = CI_FT_GL_EXT.FT_ID(+)) AND CI_FT_GL.GL_SEQ_NBR = CI_FT_GL_EXT.GL_SEQ_NBR(+) AND (CI_FT_GL.DST_ID = CI_DST_CD_CHAR.DST_ID) AND (CI_DST_CD_CHAR.CHAR_TYPE_CD = 'DTLREF1') AND (trim(CI_FT_GL.GL_ACCT) is not null) AND (CI_FT.XFER_TO_GL_DT is null) AND (CI_FT.GL_DISTRIB_STATUS in ('G','M')) AND (trunc(CI_FT.SCHED_DISTRIB_DT) <= trunc(sysdate)) AND CI_FT.CIS_DIVISION = '#DIVISION' GROUP BY CI_FT_GL.GL_ACCT,CI_DST_CD_CHAR.CHAR_VAL,CI_DST_CD_CHAR.DST_ID,CI_FT.CURRENCY_CD,CI_FT_GL_EXT.DIVISION_CURCY_CD"
my_query=my_query.upper()
if string.find(my_query, '*') > 0:
myRs = myStmt.executeQuery(my_query)
md=myRs.getMetaData()
collect=[]
i=1
while (i <= md.getColumnCount()):
collect.append(md.getColumnName(i))
i += 1
header=','.join(map(string.strip, collect))
elif string.find(my_query,'||') > 0:
header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')
else:
header = my_query[7:string.find(my_query, 'FROM')]
print header
old=output_write.read()
output_write.seek(0)
output_write.write (header+'\n'+old)
sourceConnection.close()
output_write.close()
Plz assist me.. I am not quite familiar with jython lang

Similar Messages

  • How can I change excel column header using Labile.

    Dear Experts,
                          How can i change excel column header using LabVIEW.
    Thanks for any and all help!
    M.S.Sivaraj.
    Sivaraj M.S
    CLD

    As I said in my previous post, column headers in Excel are merely row 1 cells. May be I missing something here, so please be more explicit with your question.
    I guess you are using the Excel Report tools, and you want to modify an existing sheet. From my limited experience with the Excel Report tools, it is not possible to open an existing woorkbook (except as template...), so the answer to your question should be "Forget it"...
    The work around is to use the example I pointed for you before, and either to write the whole new colum headers as a string array, starting in A1, or to write a single string to a given cell in row 1.
    Hope this helps 
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to show the VALUE as the Column Header using SQL query?

    Hi
    I have a requirement to show the picked value as the column header using SQL query.
    Example:
    ======
    SELECT EMPNO FROM EMP
    WHERE EMPNO=7934;
    Result Should be:
    7934
    7934

    I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
    SQL> set verify on
    SQL> def e =  7934
    old: SELECT empno "&&e"  FROM emp  WHERE empno = &&e
    new: SELECT empno "7934"  FROM emp  WHERE empno = 7934
    SQL> SELECT empno "7934"  FROM emp  WHERE empno = 7934
          7934
          7934
    1 row selected.

  • Show the period value in column header using Text Variable

    We are using Posting Period & Financial Year to calculate YTD & MTD, for current year and previous years. These posting period and financial year characteristics are custom created characteristics we are using due to customer specific requirement.
    Input values are posting period, financial year and numeric value. To calculate previous year, I need to subtract numeric value from the input financial year. Every thing is working fine up to this.
    In the report I need to show the posting period and financial year values dynamically in each column header of the report for MTD, YTD for current year & previous year. I tried to achieve this using Text Variables, but I didn’t succeed. If some one can give me some idea to resolve this, it would be very helpful.
    I am excellent in ABAP coding. If you can specify me to code in User Exit, I can do it.
    Column headers should be 08.1999 Sales Qty, 08.2008 Sales Qty, 1999 Sales Qty, 2008 Sales Qty.

    Hi Abhinav,
    Try using the content text variables 0T_FYEAR and 0T_FPER3, when used in the head these variable should display the year and period specified in the RKF.
    e.g
    &0T_FPER3&. &0T_FYEAR& Sales Qty = 08.1999 Sales Qty
    If that doesnt work, try creating text replacement path variables referencing the variables you created for the year and period input. To do this click on the RKF and click on the dropdown by the yellow box next to the description on the general tab and select New Variable, enter the description, tech name and set processng by to Replacment Path, then select period as the ref. characteristic, then on the replacement path tab change replace variable with to variable and then select the variable you are using for the period input, save then hit ok, this is now a text representation of the variable your are inputing for period and can be used in the column headers, you will need to repeat the process for the fiscal year.
    Hope this helps
    Josh

  • How to insert additional column header using dataTable

    Hi everyone, I am using MyFaces 1.1.3, tomahawk 1.1.3, tomahawk-sandbox 1.1.5
    I have to add one column header "Proficiency" as in image [http://www.nabble.com/file/p17206601/screenshot.jpg]
    This is JSF code without "Proficiency":
    <t:dataTable id="data" value="#{commonBean.tableList}" styleClass="standardTable" headerClass="table_header" rowClasses="table_row1, table_row2" columnClasses="standardTable_Checkbox_Column,standard_text,standardTable_Checkbox_Column,standardTable_Checkbox_Column" var="value" preserveSort="true" rows="10" width="100%" border="0" sortColumn="#{commonBean.sortColumn}" sortAscending="#{commonBean.ascending}" cellpadding="2" cellspacing="1" rowIndexVar="tableRowIndex">
         <h:column>
              <f:facet name="header">
                        <h:panelGrid styleClass="table_header2">
                                  <h:outputText value="#{msg['select']}" />
                        </h:panelGrid>
              </f:facet>
              <h:selectBooleanCheckbox id="select" value="#{value.select}" />
         </h:column>
         <h:column>
              <f:facet name="header">
                        <t:commandSortHeader columnName="languageSkill" arrow="true" styleClass="table_header">
                                  <h:outputText value="#{msg['language.skill']}" />
                        </t:commandSortHeader>
              </f:facet>
              <h:commandLink action="#{commonBean.editAction}" actionListener="#{commonBean.editActionListener}">
                        <h:outputText value="#{value.languageSkill}" />
              </h:commandLink>
              <f:param id="object" value="#{value}" />
         </h:column>
         <h:column>
              <f:facet name="header">
                        <h:outputText value="#{msg['spoken']}" />
              </f:facet>
              <h:outputText value="#{value.spokenDescription}" styleClass="standardText"/>
         </h:column>
         <h:column>
              <f:facet name="header">
                        <h:outputText value="#{msg['written']}" />
              </f:facet>
              <h:outputText value="#{value.writtenDescription}" styleClass="standardText"/>
         </h:column>
    </t:dataTable>How to do ?
    Thanks for your help
    Edited by: nvduc82 on May 13, 2008 12:09 PM
    Edited by: nvduc82 on May 13, 2008 8:46 PM

    I see 2 possibilities:
    1. Merge two last columns. And then use panelGrid inside the cells.
    2. Use JSTL and tag forEach. I found it much easy-to-use.

  • Problem in displaying Column Heading using JTable

    I am using JTable component in my applet. I am trying to retrieve records from a database and want to display the same in the table using JTable component. In that procees my data is shown in the table but I am not able to display the column heading.
    Please suggest.

    you could user JScrollPane to show the column's head.
    if you don't want to use JScrollPane ,you should use the getTableHeader() method and add the header into the pane

  • Column header customization using rowspan and colspan

    Hi,
    I want to implement customized column header using rowspan and colspan.
    This can be done in html easily but not sure how I can implement in HTML DB.
    Anybody has idea?
    Thanks in advance,
    <table border="1">
    <!-- begin header -->
    <tr>
    <td rowspan="2">COL1</td>
    <td rowspan="2">COL2</td>
    <td rowspan="2">COL3</td>
    <td colspan="3">COL4</td>
    <td colspan="3">COL5</td>
    </tr>
    <tr>
    <td>COL4-1</td>
    <td>COL4-2</td>
    <td>COL4-3</td>
    <td>COL5-1</td>
    <td>COL5-2</td>
    <td>COL5-3</td>
    </tr>
    <!-- begin data -->
    <tr>
    <td>VALUE1</td>
    <td>VALUE2</td>
    <td>VALUE3</td>
    <td>VALUE4-1</td>
    <td>VALUE4-2</td>
    <td>VALUE4-3</td>
    <td>VALUE5-1</td>
    <td>VALUE5-2</td>
    <td>VALUE5-3</td>
    </tr>
    </table>

    Thanks Raj,
    you'd want to do this kind of formatting from your report template. we have a technote out on report templates at...
    http://www.oracle.com/technology/pub/notes/technote_htmldb_format.html
    ...and, so you know, you'd want to enter your custom col header html into the "Before Rows" field of your template definition screen (kinda like step 8 that's above Figure 5 in the technote).
    hope this helps,
    raj

  • Creating a Link on the Column Heading

    Good afternoon,
    I know with reports, you can create a link for each cell in the report attributes section. My question is it there's any way to create a link for the column header without hard coding it into the query that generating the results.
    Thanks in advance,
    Ivan

    Ivan,
    If you are using the classical reports, you have the option of creating column header using pl-sql block which will be dynamic. Thanks
    Regards,
    Manish

  • Selection screen data in column heading

    Hi,
    My requirement is to show the value entered in the selection screen in the report output column heading using text elements.
    I am using text element to show the column heading. how can i add a variable to the text element and pass the value to it ?
    Thanks,
    Prasad.

    Hi,
    Its not possible to pass on the variables with the text elements, as text elements are used storing the text written by you in the program and not the values of the variable.
    hence if you want to display the column heading with the variable you can directly write text element first and then write the variable,
    write : text-001, w_variable.
    Regards,
    Siddarth

  • Dynamic table  with  multilevel  column header

    Hi all ,
    Can u please tell me how to create dynamic internal table and display which has two level column header using alv.
    For example : |  amount   | year | Month     |
    in $
    in #
    oct
    nov
    Thanks in advance ,
    SA

    Hi SA,
    For your first question - Creating dynamic table refer code below...
    PARAMETERS: p_input TYPE i OBLIGATORY.
    START-OF-SELECTION.
    DATA: v_fieldname TYPE char30.
    DATA: v_char TYPE numc4.
    DATA: it_fldcat TYPE lvc_t_fcat.
    DATA: wa_it_fldcat LIKE LINE OF it_fldcat.
    DATA: gp_table TYPE REF TO data.
    FIELD-SYMBOLS: <gt_table> TYPE table.
    DO p_input TIMES.
    v_fieldname = 'COL'.
    v_char = sy-index.
    CONCATENATE v_fieldname v_char INTO v_fieldname.
    CONDENSE v_fieldname.
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = v_fieldname.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-outputlen = 5.
    wa_it_fldcat-intlen = 5.
    APPEND wa_it_fldcat TO it_fldcat .
    ENDDO.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING it_fieldcatalog = it_fldcat
    IMPORTING ep_table = gp_table.
    ASSIGN gp_table->* TO <gt_table>.
    Now you can use <gt_table> ..
    2. It is not possible to have multiple format column for ALV..
    Hope this solves ur prob..
    Enjoy SAP.
    Pankaj Singh.

  • Image in column header of user matrix

    Hi,
    does anybody know how i can show an image in the column header of a matrix. I'm using a user matrix.
    thanks for help.
    Markus

    1. SBO 2004 will not allow this action. The Header Column item is a EditBox type and you can not override this directly.
    2. What you can do is "paste" an image item on the column header (using Screenpainter). This will allow you to display a picture. You must just make sure the form can't be resized OR "move" the image item when the column is moved about.
    This - to my knowledge - is your only option.

  • How to I hide column heading completely ?

    There is a similar post on 10g - How to I hide column heading completely ?
    The solution is - To achieve this, go to Edit Table View, open Table View Properties. Here you should see an option called 'Display table and column Headings'. Here set its value to 'No column or table headings'.
    I'm on 11.1.1.5 and when I go to Edit Table view -> Table View properties -> Display Folder & Column Headings , I see four values as below but there is no value 'No column or table headings'. The values are -
    -Only column headings
    -As separate rows
    -As Folder.column
    -As Folder.column (where needed)
    Is this 'No column or table headings' value no more available in 11.1.1.5 ? Is there any alternative method to achieve this?
    I'm able to hide the column header using various ways e.g. setting Display Heading option, but when I download the results it has either the header present or an empty row. In 10g the option 'No column or table headings' removed the header completely from the download file.
    Any suggestions please?

    Anybody has any thoughts on why 'No column or table headings' option is removed from 11g or is it just 11.1.1.5?
    Is this a bug or any other feature has been provided to achieve the same?

  • JTable Column Header Problem, Please help me

    What Listener I have to used to get the column index when user change the width of column header using mouse.

    There is no listener that reports this activity. The TableColumnModelListener can only tell you if columns change position or are added/removed from the column model.
    To detect changes, you will need to use a brute force mechanism, namely, to extend the JTableHeader class just a bit.
    When the user clicks on a header to resize a column, there is a property in JTableHeader called ResizingColumn that has a type of TableColumn. It is set by the UI delegate when the drag operation starts to the column being resized. When the drag operation ends, the value of ResizingColumn is set to null. You might start with something like this:
      JTable table = new JTable(...);
      MyTableHeader header = new MyTableHeader();
      table.setHeader(header);
      table.setModel(...);
    class MyTableHeader extends JTableHeader
        public void setResizingColumn(TableColumn column)
            super.setResizingColumn(column);
            if (column != null)
                System.out.println("Resizing Column #" + column.getModelIndex());
            else
                System.out.println("Resizing Ended");
    }This will only work for user resizing of columns, not for sizes changed programmatically or by the automatic sizing features of the header.
    Mitch Goldstein
    Author, Hardcore JFC (Cambridge Univ Press)
    [email protected]

  • Field Header / Column Header Dynamic Name change

    Hi,
    I have built a query using SQ02 and SQ01. I have a question, what is the easiest way of changing the Column Header using ABAP Code? I have 3 columns which i have added myself,
    1st colum name should be the current month
    2nd column name should be current month +1
    3rd column name should be current month + 3
    ANy help would be appreciated
    thanks
    Adeel

    Hi Friend,
    For changing column name according to your requirement in ALV:
    take a variable type p (for example ws_month);
    pass month number.
    Go to table T247 and take month text and pass to
      WA_FIELDCAT-SELTEXT_M = 'Month Text'.
    Increment the month number by 1 and follow the same logic.
    You can implement the same logic for report also.
    Regards
    Krishnendu
    Read the question carefully before answering. Irrelevant and misleading answers will lead to your account being locked.
    Edited by: Durairaj Athavan Raja (Moderator)on Jul 12, 2008 12:10 PM

  • Retarded Column Heading of JTable

    I have a JTable where I allow automatic resizing of the columns because the user may choose between things of varying lengths to add to the table from a list. I have disabled reordering and resizing in the Table Header. However, the first column heading, "Response Variable", always shows up as "Response.." until you select at least one item from the list. It is driving me crazy. Why won't the entire column name show up all the time, regardless of how many rows the table has?

    try setting the TableColumn minWidth to the minimum size of the column heading. use the method setMinWidth(int minWidth) located in the TableColumn class. This should fix the problem. Let me know

Maybe you are looking for

  • How to Sort the report by clicking the column_header at runtime?

    Hi,<br /><br />Im New to Crystal Reports.<br /><br />Im Using Crystal report server XI. and JSP<br /><br />I need to  <strong>Sort</strong> the report by clicking the<strong> column_header</strong> at runtime.<br /><br />How to implement this ?<br />

  • How can i schedule concurrent program for every one hour from back end

    Hi , I want to schedule concurrent program for every one hour from back end . Example 1) xyz is the concurrent program that should run for every one hour with a parameter 111 and the SAME concurrent program that should run every 2 hours with a differ

  • Location of iweb file

    I purchased a new mac pro tower.  I removed the drive from my previous mac pro tower and installed it in the new tower.  I started the new mac pro tower and at the appropriate locaiton asked to have my previous files and settings transferred to the n

  • Error clicking on item in notification center

    When I click on an item in the notification centre, the respective app/website won't launch as it used to. Please help. Mac Pro. OS X 10.9.3.

  • Adding OneClickDigital Media Manager to Blackberry Q10

    I wanted to use my Blackberry to listen to library audiobooks, using OneClickDigital - the system used by my local library.  I don't seem to be able to get the Media Manager downloaded onto my phone.  Could anyone help, please?  I have registered wit