Dynamically Pass the Column Name cursor. || Dynamic Column Name

Hi,
I need to dynamically pass the column name based on a Mapping table in a loop ( Right now i have hardcoded stuff )just like using Execute immediate.... Inside the procedure, I have commented as where i hit the problem.
Thanks for all of your time...
Thanks
Muthu
CREATE OR REPLACE PROCEDURE xml_testing_clob AS
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
user_node xmldom.DOMNode; item_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
item_elmt xmldom.DOMElement;
item_text xmldom.DOMText;
item_test xmldom.DOMText;
nodelist xmldom.DOMNodeList;
sub_variable varchar2(4000);
x varchar2(200);
y varchar2(200);
sub_var varchar2(4000);
CURSOR get_users IS
SELECT FIRST_NAME,LAST_NAME,ROWNUM FROM USER_INFO_TBL WHERE WEIN_NUMBER = '1234' ;
CURSOR get_cdisc_name IS
select CTS_COL_NAME,CDISC_NAME from CTS2CDISC_DICTIONARY where CTS_TABLE_NAME = 'USER_INFO_TBL';
BEGIN
-- get document
doc := xmldom.newDOMDocument;
doc := xmldom.NewDomDocument;
xmldom.setVersion(doc, '1.0');
xmldom.setStandalone(doc, 'no');
xmldom.setCharSet(doc, 'ISO-8859-1');
-- create root element main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(doc,'AdminData');
root_node := xmldom.appendChild(main_node,xmldom.makeNode(root_elmt));
FOR get_users_rec IN get_users LOOP
item_elmt := xmldom.createElement(doc,'User');
xmldom.setAttribute(item_elmt,'OID' , get_users_rec.rownum);
user_node := xmldom.appendChild(root_node,xmldom.makeNode(item_elmt));
FOR cv_get_cdisc_name IN get_cdisc_name LOOP
EXIT WHEN get_cdisc_name%NOTFOUND;
sub_var := cv_get_cdisc_name.cts_col_name;
sub_variable := 'get_users_rec.';
sub_variable := 'get_users_rec.'||cv_get_cdisc_name.cts_col_name;
x := sub_variable;
dbms_output.put_line(x); -------------- Here i just see the literal string
y := get_users_rec.FIRST_NAME;
dbms_output.put_line(y); -------------- Here i just see actual value ( data )
item_elmt := xmldom.createElement(doc,cv_get_cdisc_name.cdisc_name);
item_node := xmldom.appendChild(user_node,xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc,x ); ---- This is the place i am hitting with an error .
If i use variable X then i am able to see only the literal
string in the output. BUT if i put cursor name.coulmname,
then the resumt (XML) is fine.I wanted acheive this
dynamically just like execute Immediate
item_node := xmldom.appendChild( item_node , xmldom.makeNode(item_text));
END LOOP;
END LOOP;
-- write document to file using default character set from database
xmldom.WRITETOCLOB(doc,);
xmldom.writeToFile(doc, 'c:\ash\testing_out.xml');
-- free resources
xmldom.freeDocument(doc);
END;
+++++++++++++++++++++++++++++++++++ XML OUTPUT +++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" ?>
- <AdminData>
- <User OID="1">
<FirstName>get_users_rec.FIRST_NAME</FirstName>
<LastName>get_users_rec.LAST_NAME</LastName> </User>
- <User OID="2">
<FirstName>get_users_rec.FIRST_NAME</FirstName>
<LastName>get_users_rec.LAST_NAME</LastName>
</User>
- <User OID="3">
<FirstName>get_users_rec.FIRST_NAME</FirstName>
<LastName>get_users_rec.LAST_NAME</LastName>
</User>
- <User OID="4">
<FirstName>get_users_rec.FIRST_NAME</FirstName>
<LastName>get_users_rec.LAST_NAME</LastName>
</User>
- <User OID="5">
<FirstName>get_users_rec.FIRST_NAME</FirstName>
<LastName>get_users_rec.LAST_NAME</LastName>
</User>
++++++++++++++++++++++++++++++++++++++++++++++++++++ MAPPING TABLE DETAILS +++++++++++++++++
CTS_COL_NAME     CDISC_NAME     CTS_TABLE_NAME     XML_TAG     -----------> Column Name
FIRST_NAME     FirstName     USER_INFO_TBL     Element     -----------> Records
LAST_NAME     LastName     USER_INFO_TBL     Element     -----------> Records

My scenario is little different, let me explain:
My columns will remain same but values changes (based on column formula) according to the selected prompt value
If I select 'Oct' from prompt then
Curr will contain data for 'Oct' only
Next1 will contain data for 'Nov' only
Next2 will contain data for 'Dec' only
Next3 will contain data for 'Jan' of next year only.
Later if I select 'Jul' from prompt then
Curr will contain data for 'Jul' only
Next1 will contain data for 'Aug' only
Next2 will contain data for 'Sep' only
Next3 will contain data for 'Oct' only.
I don't have different columns for each months but the columns are capable to reflect data for any month.
So, how can I reflect the column name as month name for which that contains data.
Regards,
S Anand

Similar Messages

  • Is it possible to pass the Interactive Form on dynamic?

    Hi,
    Is it possible to pass the Interactive Form on dynamic?
    In webdynpro I am handling the header part that will be common for the entire input screen, based on the application name I want to call the different interactive forms. I have seen in template source there is no option to provide binding with context.
    Regards,
    Mahesh.Gattu

    Hi Mahesh,
    You can create different views with different PDF forms in their template source and dynamically navigate to the required view/ make the required view visible.
    say on your main view, create the header part with the necesaary UI elements and insert multiple view containers below it. Embed a pdf view in the respectve view containers.
    Create a context node UI_RENDER .. cardinality 1..1
    Create attributes pdf1_visible type wdui_visibility
    pdf2_visible and so on. Bind these to the visible property of the respective view container.
    based on the application name, set them to either visible or invisible.
    Hope this helps.
    Regards,
    Reema.

  • Dynamically passing the URL

    Hi
    In the receiver SOAP Adapter I got to send the Target URL ( Connection Parameters.....> Target URL) dynamically on the basis of URL that I get from payload. Is it possible to do this by using UDF ?? If so could you plz explain how we can do this ?? Plz point me it there are any materials/blogs/threads available on  this topic ??
    Regards
    kumar

    Hi palnati
    you can use Adapter Specific Identifiers and set the SOAP URL and SOAP Action dynamically.
    Here is the link for doc which can help u out :
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
    look this thread also
    Setting interface name dynamically from client for SOAP Adapter...
    Regds
    Abhishek

  • Dynamically passing the fields to the data base through bdc

    hi,
         I need to pass the fields dynamically to the database uploading. Can anyone tell me, how we can get the 'datatype and length' of all fields in hr module. Is there any table for it.
        Please give me the answer if anyone know this.
    thanks & regards,
    sekhar.

    hi,
        This is the fm to get the datatype and length of the field. Where as i want to pass my irregular format of my presentation file to the database by sorting the fields as per the structure of database fields.
    bye.

  • Dynamically pass the date to all the programs in a chain

    Hi,
    I have a requirement to pass the date to all the programs in the chain. The first step when the chain starts should be to calculate the next batch date from a oracle table, and then pass that date as an argument to all the programs.
    For example,
    This should be the sequence of steps once the chain has started.
    1. Start Chain
    2. Step1 - Calculate the next batch date from the oracle table.
    3. Step2 - After the successful completion of Step1, run the program with the input parameter as date which is calculated from Step1.
    4. End Chain
    Please help.

    Hi,
    The recommended way of doing this is to store tha data to be passed (in this case the date) in a table and have the other steps access it.
    If you have many chains, or the same chain used several times, you can use the job name and owner as the primary key for the table. You can then pass the job name and owner into every program as metadata arguments (see define_metadata_argument) so every step knows what job is a part of and can select the data from the table.
    Hope this helps,
    Ravi.

  • Dynamically passing the Columns values

    HI all,
    I am trying a pl/sql block which which take a string and execute it dynamically. Suppose below is string
    M_COL := Q'[(P_CODE=> ':DEPTNO',P_CODE_TYPE => 'STATE')]';
    Now trying to execute it. using below
    M_STR := 'SELECT CHK_DEPT' || M_COL || ' FROM EMP WHERE EMPNO=''7499''';
      EXECUTE IMMEDIATE M_STR
        INTO M_DATE;
    Now what i want is M_STR vairable to executed as
    SELECT CHK_DEPT(P_CODE=> DEPTNO,P_CODE_TYPE => 'STATE') FROM EMP WHERE EMPNO='7499'
    instead of
    SELECT CHK_DEPT(P_CODE=> 'DEPTNO',P_CODE_TYPE => 'STATE') FROM EMP WHERE EMPNO='7499'
    other in other way in parameter P_CODE Column value of DEPTNO should be passed.Also note that DEPTNO column in string M_COL is Dynamic.i.e
    M_COL := Q'[(P_CODE=> ':DEPTID',P_CODE_TYPE => 'STATE')]'; OR
    M_COL := Q'[(P_CODE=> ':EMP_ID',P_CODE_TYPE => 'STATE')]';
    Any suggestions, Please share with me.

    ibney 
    Actually you can use it by using the EMP and DEPT Table. If you Require EMP and DEPT tables structure and data, then let me know.
    Function which i created is below.
    CREATE OR REPLACE FUNCTION CHK_DEPT(P_CODE NUMBER,P_CODE_TYPE VARCHAR2) RETURN VARCHAR2 IS
      M_NAME DEPT.DNAME%TYPE;
    BEGIN
      FOR I IN (SELECT DNAME FROM DEPT WHERE DEPTNO = P_CODE) LOOP
        M_NAME := I.DNAME;
      END LOOP;
      RETURN M_NAME;
    END;

  • Dynamically passing the source table name to OWB mapping

    I am building a mapping wherein one of the source tables is a view. The view name varies with the time parameter I pass in. I am looking at ways to pass in the time parameter to the mapping procedure such that it first gets the view name from a table and uses that view as the source table to fetch data. Any directions?
    In normal PL/SQL coding, I can first get the view name and use this view name to buld a dynamic query, which can be then executed.

    This is a common question. The best way to do this is to use a synonym.
    Create the synonym in the database and import into OWB. Use the synonym in your mapping. Have your mapping accept a mapping input for the table you want the synonym to point to. Setup a premapping process to re-create the synonym with the table you want to use.
    Here is the procedure that I use. It defaults to a private synonym. Remember, the synonym will be created in the same schema that the mapping is deployed to.
    CREATE OR REPLACE PROCEDURE "CAWDATA"."CREATE_SYNONYM_PRC" ("P_SYNONYM_NAME" IN VARCHAR2,  "P_OBJECT_NAME" IN VARCHAR2,
    "P_IS_PUBLIC_SYNONYM" IN BOOLEAN DEFAULT false)    IS
    BEGIN
    if p_is_public_synonym = true then
    execute immediate 'create or replace public synonym '|| p_synonym_name || ' for '|| p_object_name;
    else
    execute immediate 'create or replace synonym '|| p_synonym_name || ' for '|| p_object_name;
    end if;
    exception
    when others
    then
          raise_application_error(sqlcode,sqlerrm) ;
    END;

  • How to make fields grow dynamically within the same page and in column wise

    Hi,
    Like the newspaper format: Where contents of news are shown columns wise.
    We need to make the fields in a page grow column wise within that same page.
    For example, in a page:
    Column 1 Column 2
    ASDASDASDGKASHDGKAA | ASDFASGFHSJFAJKSD
    ASDFASDFASDJFASGJKDFHA | ASDFASDASDFASDFASD
    AFSDFASDFASDHGFKASDFASD | ASDFASDFASDFASDFASDFA
    ASDFSDGFJASHDGFJKASHDGKFAS |
    ASDFAGASDHFKASHDGFHASDJKFHASJKHF |
    ASDFHASGDKFASDJGHFASDFJKSDGFJKAGSDJ |
    If the Column 1 is full with the fields in the page it should start filling the column 2 which is also in the same page.
    If the Column 2 is also full then only it should move to the next page and should continue the same scenario.
    Please suggest a better way to do this in the Adobe Output Designer.
    Thanks and regards,
    Gurunath V.
    E-Mail: [email protected]
    P.S: Please also mail to my e-mail ID.

    Hi Gurunath, if you steel need a solution on this problem, I think this could help:
    1- place two fields on the form (JF01, JF02), one under each other.
    2- Make two subform with them (Sline1, Sline2)
    3- Make the field JF02 expand on same subform.
    4- Modify the preamble in this way:
    ^define group:D_line1 \field$POSITION\reserve"0.333",in\subformSline1.\positionsave,"first_line"
    ^define group:JF01!OnOverflow \groupG_Sline2.\fieldJF02.
    ^define group:G_Sline2!OnBOF \positionrestore,"first_line"\positionright,"3.65",in
    In the data file put all the text in JF01.
    -The first line say:
    When JF01 is called, save it's y position (\positionsave,"first_line")
    -The second line means:
    when the text overflow JF01 put it in JF02.
    (cause JF02 overflow on itself all the remaining data is overflowed in JF02)
    -The third line means:
    if JF02 arrives at the end of the page (OnBOF), restore the saved position ( \positionrestore,"first_line") and move to the right of "3,65" inches (\positionright,"3.65",in).
    In other words, when JF02 arrive at the and of the age, the next field JF02 is positioned at the same height of JF01 and is shifted on the right
    Take care that in this way JF02 cannot anymore go o a new page.
    Hope this help.
    Andrea

  • Dynamically passing the values to search help

    hi
    can I pass some values dynamically to search help input field.
    If I select a profit centre value from a drop down in separate field it should reflect the corresponding values in
    search help which is cost centre input field ( i/p fields is in a column of a UI element table).
    If I add one more row also the corresponding column should bears the search help...
    thanx in advance.......

    Data dictionary based search helps can have multiple importing parameters within Web Dynpro.  There are few rules that are documented in the online help however:
    Be aware that import and export parameters for the search help are determined only within the same context node (see also Transport of Values for the Input Help), and even then only if a Dictionary structure is assigned to the node.
    http://help.sap.com/saphelp_nw70/helpdata/EN/35/bdb6e2c48411d1950800a0c929b3c3/frameset.htm

  • Dynamically passing the values to IN query in JDBC

    Hi,
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob). Please help me in this?
    Thanks.

    797836 wrote:
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob).So basically you need to output the List (capital 'L') as a comma-delimited list (small 'l').
    The procedure for that is usually something like:
    1. Output the first element.
    2. For any further elements:
    2a. Output ","
    2b. Output the element.
    Winston

  • Dynamically pass the username and password to report server to invoke reports

    Hi
    The scenario is as follows:-
    9iAS is installed under - Windows 2000 (web server and report Server 6i) and everything works fine.
    We have developed a page using pl/sql cartrige (oracle 8i), from that a report is invoked with some parameters. However, the userid and password is stored under keymap file (cgicmd.dat).
    Is there anyway to pass dynamically the username and password to report server in order to invoke the report.?
    Can any one advise?
    null

    Check out
    http://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • How to pass the Dynamically table name and RELID in IMPORT  x TO y FROM DATABASE dbtab(ar) ID Key

    Hello Expert,
    I wanted to know is there any way through which we can dynamically pass the table name in IMPORT condition.
    For e.g.
    DATA : PCLT TYPE DD03L-TABNAME.
    DATA: SET_RELID TYPE T52RELID-RELID.
    DATA: key TYPE PCLKEY.
    DATA: text_version TYPE PVRSN.
    DATA: BEGIN OF ptext OCCURS 132.
    DATA: line(132).
    DATA: END OF ptext.
    SET_RELID = 'TX'.
    PCLT = 'PCL1'.
    KEY = '00001000004005     9999123119960101000'.
    TEXT_VERSION = '01'.
    IMPORT TEXT_VERSION PTEXT FROM DATABASE <PCLT>(<SET_RELID>) ID KEY.
    If i use this then it gives me error message "The Dictionary structure or table "<PCLT>" is either not active or does not exist."
    Kindly help me in this matter.
    Thanks
    Srikanth

    Hi Srikanth
    I dont know if there is another solution, but this is what i did using a dynamic subroutine, please check it
    just add this lines to your code
    DATA: prog  TYPE c LENGTH 8,
           mess TYPE string,
           sid  TYPE string,
           wrd  TYPE string,
           dir  TYPE trdir,
           OFF(3).
    DATA: lt_code TYPE TABLE OF rssource-line.
    DATA: ls_code TYPE rssource-line.
    perform call_import using pclt set_relid key.
    form call_import USING p_pclt p_set_relid p_key.
       ls_code = 'PROGRAM SUBPOOL.'.
       append ls_code to lt_code.
       ls_code = 'form get_text tables ptext using p_key changing text_version.'.
       append ls_code to lt_code.
       ls_code = 'IMPORT text_version ptext from database'.
       append ls_code to lt_code.
       concatenate p_pclt '(' p_set_relid ')' into ls_code.
       append ls_code to lt_code.
       ls_code = 'id p_key.'.
       append ls_code to lt_code.
       ls_code = 'endform.'.
       append ls_code to lt_code.
       generate subroutine pool lt_code
                           name prog
                           message mess
                           SHORTDUMP-ID sid
                           WORD WRD
                           OFFSET OFF.
       IF SY-SUBRC EQ 0.
         perform GET_TEXT IN PROGRAM (prog) tables ptext
                                              USING p_key
                                              CHANGING text_version .
       ENDIF.
    endform.
    Hope this help
    Regards
    MC

  • How to pass the value dynamically in exp/imp utilities of oracle

    I want to pass the value of org_grp_i dynamically,instead of passing the value
    19.Can you please tell how to write the script to this
    exp fas/xxxxxx@fasbd001 file=audit_grn_28aug.dmp tables=audit_grn query=\"where org_grp_i=19 \"
    where xxxxxx is the password
    Thanks

    You need to make use of command line arguments. You can go through this link for example.
    http://www.freeos.com/guides/lsst/ch02sec14.html
    In your shell script(say test.sh) you can have
    exp fas/xxxxxx@fasbd001 file=audit_grn_28aug.dmp tables=audit_grn query=\"where org_grp_i=$1 \"$1 indicates it accepts the first argument from command line. if you want to pass 19, add that next to the script you're executing.
    From command line you can call this shell script say test.sh 19

  • Dynamic Passing of the Parameters In Inforview URL

    Hi,
    I have a requirement wherein I need to dynamically pass the prompt values through the infoview url. I am able to successfully pass the parameter value in the url and the report renders data based on the prompt value passed.
    When the report is opened when clicked on the link....there is  Refresh option to the user. My requirement is such that I do not want the user to be able to run the prompt again upon clicking the refresh button. Is there a way to restrict the user to be able not to see the prompt  ( for which the value is passed in the url)....The user needs to refresh the report to be able to enter values for other prompts that are declared ( date prompts )....but not the ones where its ids are passed...
    The url link which works is here  :
    http://development/businessobjects/enterprise115/InfoView/scripts/opendocument.aspxsType=wid&sRefresh=Y&sDocName=Prompt_Test&sWindow=New&lsSEnter%20Lines:=Leather&sPath=[A],[EFashionSamples]
    Please advice...
    Thanks,

    Hi,
    I have a requirement wherein I need to dynamically pass the prompt values through the infoview url. I am able to successfully pass the parameter value in the url and the report renders data based on the prompt value passed.
    When the report is opened when clicked on the link....there is  Refresh option to the user. My requirement is such that I do not want the user to be able to run the prompt again upon clicking the refresh button. Is there a way to restrict the user to be able not to see the prompt  ( for which the value is passed in the url)....The user needs to refresh the report to be able to enter values for other prompts that are declared ( date prompts )....but not the ones where its ids are passed...
    The url link which works is here  :
    http://development/businessobjects/enterprise115/InfoView/scripts/opendocument.aspxsType=wid&sRefresh=Y&sDocName=Prompt_Test&sWindow=New&lsSEnter%20Lines:=Leather&sPath=[A],[EFashionSamples]
    Please advice...
    Thanks,

  • Dynamically setting the values for the Adapter Configuration in BPEL

    We are configuring the JMS adapter to put into an MQ topic. For this we are giving all the values for the configuration parameters like
    Factory Properties.
    JMS connection Factory
    Transacted
    Destination Type
    Username
    Password
    Destination Name, etc...
    and we are able to produce message on the MQ.
    Our requirement is to dynamically pass the values for the above parameters from some configuraion files(other than oc4j-ra.xml), which will have value for each obove parameters.
    Any help on this is highly appreciated.
    Regards,
    Suman

    Re: JMS Properties setup
    this thread will explain how to do it.

Maybe you are looking for