How to dynamicly create a field name AND access it
All,
I am trying to build a code block that will access what amounts to a table structure inside a table. I have 38 occurances if a set of 3 fields. (Source system had an internal array/occurs clause that was converted for our ODS into individual fields) I am returning a single row as a row type and have addressability to all fields. What I am trying to avoid is coding my logic block 38 times, 1 for each occurance.
FOR X IN 1 .. 38 LOOP
V_CAT_CD_X := 'CAT_'||X||'_CD';
End Loop;
The following is the display of the correctly built field:
--> Loop Cat CD: CAT_1_CD Rec count:1 Loop counter:1
--> Loop Cat CD: CAT_2_CD Rec count:1 Loop counter:2
--> Loop Cat CD: CAT_3_CD Rec count:1 Loop counter:3
--> Loop Cat CD: CAT_4_CD Rec count:1 Loop counter:4
My problem is that my row cursor PP1 is addressable hardcoding PP1.CAT_1_CD or PP1.CAT_2_CD ect, however I am having problems using my created string to access the field.
What do I need to do to gain accessability via this method?
I do have the ability to select the column names from the system tables but even then, I am lacking addressability to my ROW type using the selected field name.
Thanks
Greg
Not sure if this is what you are looking for:
SQL> ed
Wrote file afiedt.buf
1 declare
2 my_cur SYS_REFCURSOR;
3 v_rec mytest%rowtype;
4 cursor c1 is select column_name from all_tab_cols where table_name = 'MYTEST';
5 v_sql_stmt VARCHAR2(1000) := NULL;
6 BEGIN
7 v_sql_stmt := 'SELECT ';
8 FOR I IN c1 LOOP
9 v_sql_stmt := v_sql_stmt||I.column_name||',';
10 end loop;
11 v_sql_stmt := RTRIM(v_sql_stmt,',');
12 v_sql_stmt := v_sql_stmt||' FROM mytest';
13 open my_cur for v_sql_stmt;
14 LOOP
15 FETCH my_cur INTO v_rec;
16 EXIT WHEN my_cur%NOTFOUND;
17 dbms_output.put_line(v_rec.a);
18 END LOOP;
19 close my_cur;
20* end;
SQL> /
1
2
PL/SQL procedure successfully completed.
SQL> Edited by: AP on Nov 17, 2010 5:29 AM
Similar Messages
-
How can I create a new name and itunes acct
I want to give my old 2nd generation ipod nano to my son. Can I create a new device name and itunes for the ipod?
Yes. I would suggest creating a separate user account for him on your PC to use to store his own separate iTunes library. See Method 1 from this Apple support document for more information and assistance.
How to use multiple iPods, iPads, or iPhones with one computer
When he connects the iPod to this new iTunes library he'll need to Erase and Sync (or restore) the iPod allowing him to set it up as his own iPod and everything just as if you had just taken it out of the box.
B-rock -
How to dynamically define a file name and its path in a web application
Hi, I want to create a simple web application that reads from an XML file and displays the data back to the user. The xml file is created independent of my application on the same machine that the Application Server runs. How can I define my xml file name and/or path to be independent of my code and not hard-coded in my application?
By an external configurationfile? That can be a propertiesfile, a xml file, an ini file, a plain vanilla txt file, etcetera.
-
How to dynamically populate a manager name and level for any user who login
Hi All,
I need some help in doing this in my DB:
Table 1 is the the manager hierarchy {which basically shows the structure of every employee's org).
Table 2 is a list of all people manager ( all these usernames will also be in table 1). What i need to find is using the username from Table 2, the highest level that username exists in the manager hierarchy.
For ex:
Table 1: { What this shows is Sam is CEO and Jeff reports to him. So for Sam, he will exist on all 15 levels and Jeff will have Sam has his top level manager and then Jeff will repeat for all remaining levels till 15.
Manager Level 0 Level 1 Level 2 Level 3...Level15
Sam Sam Sam Sam Sam
Sam Jeff Jeff Jeff Jeff
Now in Table 2:
User Name Manager Level/Name
Sam Manager Level 0 Sam
Jeff Manager Level 1 Jeff
As you see, for each user name in Table i want to populate their high level from the manager hierarchy {their record in manager hierarchy).
Hope This helps to clear the confusion.
ThanksHello,
this is the forum for the tool {forum:id=260}. Please mark this question as answered, so others know that they can ignore it.
Then post again in {forum:id=75}
Regards
Marcus -
Dynamic form... field names and values...
Boy-Howdy. I wish I had the opportunity to stop by this forum and hang out at a time when I am not having issue, but, alas... I appreciate the brain power of the great minds that populate this forum.
I have an issue: I think I am close on this but cannot identify where my syntax is going awry. Here is a simplified edition of my situation.
I have a form with a set of dropdown menus that filter a recordset. The group of drop downs are dynamic from a database and will vary depending on what category of products a visitor is viewing.
If I browse to FRUIT: I get three options that let me filter for:
Fruit Type
- Apples
- Bananas
- Pears
Fruit Grown By:
- Organic
- Any
Fruit From:
- Domestic
- South America
- European
However, if I browse to LUMBER I get:
Wood Type:
- Pine
- Walnut
- Oak
Wood Prep:
- Pre Cut
- RAW Timber
Wood Origin:
- North America
- South America
- Europe
I have the variable naming and database values worked out. My only issue is when I browse to friuit and select apples I want apples to remain selected as I page through results.
So, the dropdown field names are dynamic. Currently set to zgen1, zgen2, zgen3. I set a variable named sr and increment it to build the progressive 1,2,3 after the field name zgen.
<cfparam name="sr" default="1">
<cfoutput group="ft_id" query="oompa2">
<strong>#f_ftrname#:</strong><br>
<select name="zgen#variables.sr#">
<OPTION value="">select...</OPTION>
<cfoutput>
<OPTION value="#ft_id#_#fs_id#">#ft_options#</OPTION>
</cfoutput>
</select>
<br><br>
<cfset sr=#sr# + 1>
</cfoutput>
But when zgen1 has a value (in this case "Apples") I can't figure out how to dynamically test for the presence of a value for each dropdown. I have dynamically created the field names (cfset xvalue="FORM.zgen#variables.sr#") to test against. However this creates a value of FORM.zgen1, FORM.zgen2, FORM.zgen3 as it loops when I want it to be Apples, Organic, Domestic.
Example:
The code:
<OPTION value="#ft_id#_#fs_id#"<cfif xvalue IS "#ft_id#_#fs_id#"> SELECTED</cfif>>#ft_options#</OPTION>
which is translating to:
<OPTION value="15_5"<cfif FORM.zgen1 IS "15_5"> SELECTED</cfif>>Apples</OPTION>
When I want it to be:
<OPTION value="15_5"<cfif 15_5 IS "15_5"> SELECTED</cfif>>Apples</OPTION>
I hope I am making sense. I would greatly appreciate it if someone could help me noodle this. I have a feeling it is not as complicated as my mind is trying to make it. Thoughts?Three selects related type code was not the way to go - because I need each filter to be independent. I created a custom tag that argues the state for each separately up to ten filters.
-
HR - dynamic selections field name and field value in the program
HI all,
I am using dynamic selections for a HR report.
I have created a view with 20 fields and added it to HR report category ___00003(All fields suppressed).
I need to check these fields in the program. But i am not able to get the field name and value in the program for dynamic selections fields.
Please let me know how to get the field names and values in the program for dynamic selections .
Thanks,
Kranthi.You have to read the itab <i>pnpdynse</i> in your Program to obtain the Dynamic Selection values. This itab has a deep structure.. you can set a break point in one of the events before <b>get pernr</b> & in the debug mode, you will able to display the itab <i>pnpdynse</i>.. you can then identify how to get the values into your code..
~Suresh -
How to get the co-ordinates of a dynamically created input field
Hello Frn's
i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
as i am thinking ...i should first of all get info about the co-ordinates of dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of text View .
Please suggest your thoughts .
Thanks and Regards
Priyank DixitHi,
There is no provision in WD for getting screen coordinates and then placing the UI element.
You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
still,For dynamic creation you can refer to following wiki:
http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
regards
Manas Dua -
How to delete Dynamically created input field UI Element
Hi all,
I want to delete dynamically created input field and label.
Is there any method please tell.
Thanks in advance
HemalathaHi,
In the WDEVENT parameter of the action handler you can find the event id.
***Variables
DATA:
lv_selected type string. "Selected tab value
***Structure and internal table for the Events and messages
DATA:
lt_events type WDR_EVENT_PARAMETER_LIST,
ls_events type WDR_EVENT_PARAMETER.
***Field symbols
field-symbols: <fs_value> type any. "Attribute value in events table
***Move the event table to lt_events
lt_events = wdevent->parameters.
read table lt_events into ls_events with key name = 'SAVE'. "Button Id
if sy-subrc eq 0.
assign ls_events-value->* to <fs_value>.
if sy-subrc eq 0.
lv_selected = <fs_value>.
endif. "IF sy-subrc eq 0.
endif. "IF sy-subrc eq 0.
Regards,
Lekha. -
How do I create one Apple ID and iTunes user name and password for all of my Apple products: iPad, iPhone, and iPod plus iTunes on my PC?
Yes, I do have multiple devices and it appeared to me that every time I tried to sync or log onto iTunes, the password was incorrect. Consequently, I was and am constantly changing it. Wouldn't it be nice if Apple would simply say that you only need one Apple ID and one password regardless of the number of Apple devices you intend to sync via iTunes.
Barring the above, how about a way to merge all of the Apple IDs and passwords into one. -
How to identify field names and table names as per the client requirement
Dear All,
i am preparing reports for my client of their own requirement, but in sap how can i find the field name, table names like for eg: doc.no, issue,revision no, revision date, date of issue,date of completion, job card no,identificatin no, part no , accept,inspected,testedby, remarks, issue, process.
so please tell what is the path to find the field names and table naeHi,
You can select the field which field name and table you want to know, just press F1 button, one more window will open. There you need to select the technical information icon, then you will get the required field name and its table.
Regards,
V. Suresh -
How to find Field Name and Table Name
Hi All,
I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
Is there any way i can do it.
Points will be rewarded for all useful answers.
Regards
ABHi All,
I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
Is there any way i can do it.
Points will be rewarded for all useful answers.
Regards
AB
Hi Abuser,
now u have legacy data. now u want to do upload this data from legacy to r/3 by using one sap transaction. yes ok na..
first of all u want to know the data is relevant to the which transaction...
without knowing the transaction u cant trasfer the data..
then open transaction put cursor on i/p field and click on f1
and find out the field name & table..
this is one method to find the field name and table name. -
How do i have subsequent fields label and values move down the page dynamic
how do i have subsequent fields label and values move down the page dynamicly...
the field in question "can grow" and can become quite big...overlaping the content of the fileds below...how can i make the fields below this large field move dyanmically so there is no overlap?if it is the same field and it is set to can grow you just need to make sure you put space between by inserting a section below
-
Hi All,
I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
Is there any way i can do it.
Points will be rewarded for all useful answers.
Regards
ABif you know the transaction code you use to post the uploaded data in SAP, you just need to do BDC recording in using transation SM35. Record the whole process and create a program from the recording... and you wont even need to know the tables and field names-- almost everything will be done for you....
All you need to do is replace record data with upload data.
You can also try to look for a standard Function Module / BAPI which can do the processing for you and provide it with a table containing the upload data ...
Reward points if useful -
How set dynamically created query in GridControl?
How set dynamically created query in GridControl?
Thank youIf your dynamic query is based on an Entity object, then you can probably use RowSetInfo setQueryInfo method.
The argument to this method is a 'Query' object. There are three flavours provided in the oracle.dacf.dataset
package.
oracle.dacf.dataset.QueryViewInfo
defines an updateable SQL query based on a predefined BC4J View Object.
oracle.dacf.dataset.QueryStatementInfo
Creates a view object based on an arbitrary SQL statement.
oracle.dacf.dataset.QueryInfo
Creates a View Object from an Entity Object and additional SQL clauses. The View Object will have
that Entity Object as its sole Entity Object base.
If in your application you are able to specify the name of the entity, then you can use the QueryInfo method to define your
query. Please try the following.
SessionInfo si = ....
void runDynamicQuery()
RowSetInfo rsi = new RowSetInfo();
AttributeInfo ai = new AttibuteInfo(..);
ai.setName(..);
rsi..addChild(ai);
si.addChild( rsi)
rsi.setQueryInfo( new QueryInfo( ...../* include entity name */ .... ));
rsi.setName(....);
rsi.open(true);
grid.setDataItemName(...);
Hope this helps,
Sathish. -
How do I create a Skype Name in this new environme...
For a variety of reasons, I have created a new Microsoft Account. In attempting to set it up with Skype, I was never asked to create a Skype Name. This has created issues sining into Skype, as well as telling people how to Skype me. I do NOT want to give them my email address as my Skype contact. A Skype name is much more suited for this situation.
How do I create a Skype name that people can use to call me?
This beggs the question of why Loging into Skype and idnetification is co complicated. Associated with this one account there are the following methods of primary identification: Skype Name, Microsoft Account, Display Name, Skype Community Name, and there seems to be an additional display name for each Skype accont in the Community which begins with live: and then a modified form of the user's email address. That is A LOT to remember. I had a difficult time just logging in because it asks for my Skype name and the blank would not accept any of the aforementioned identifications. I had to get here by signing into Skype Desktop and then clicking a link to go through rather than signing in. The sign in would not accept my credentials.
Bottom line is all these issues would go away if I could figure out how to get a skype name.See this:
http://community.skype.com/t5/Security-Privacy-Trust-and/New-to-Skype-and-having-trouble-signing-in/...
Maybe you are looking for
-
Laserjet pro 400 dw horizontal printing alignment problem
I have only printed just over 7,000 pages. When it prints it is crooked horizontally across the page. It is on a small home network with a router running wireless. Here is what I've tried: using the on board services option to clean the page. chang
-
DM 4.5, software issues message "Cannot find system in table file"
Serious error in Desktop Manager Software V 4.5Windows XP SP3MS OutlookDesktop Manager Software V 4.5, accompanies new RIM Blackberry Curve package purchased retail Bell MobilityJune 2009 After installation DM 4.5, software issues message "Cannot fin
-
Datamigration from Legacy Systems to OM
Hi, Can somebody give me info. about how to migrate from legacy systems to OM. Have anybody a concept. How can i find the datamodel of Order Management. Send me please the Info. to [email protected]
-
Indesign & Illustrator CS6 both freeze on startup.
Hi, My Indesign & Illustrator products seem to be crashing at startup. As well as Adobe Reader, sometimes. Photoshop and Bridge seem to work fine. I have tried to run the programs with nothing else to ensure they have plenty of memory, have cleare
-
Hello, I need help in removing duplicates from a string that contains years and "-". Example: 1988-1997-2000-2013-1998-1965-1997-1899 I know this can be done in regular expressions but have no experience in this subject. select REGEXP_REPLACE(.....)