Select statement on table of objects
My table is like this :-
CREATE OR REPLACE TYPE VALUE_T AS OBJECT ( PROPERTYVALUE VARCHAR2(4000) );
CREATE OR REPLACE TYPE PROPERTY_T AS OBJECT ( PROPERTYNAME VARCHAR2(128) , PROPERTYVALUE VALUE_T );
CREATE TABLE TEMP ( SESSIONID , PROPERTY PROPERTY_T );
Can i do query on column of type object and how? Something like this
SELECT * FORM TEMP WHERE PROPERTY.PROPERTYNAME='XYZ';
thanx
I got solution myself. It is
select t.command.command from T_AEDOIP t;
select t.command.objectname from T_AEDOIP t;
thanks to those who read this prob
Similar Messages
-
How to write SELECT statement using tables ekko,ekpo and eket?
Hi,
I got a problem in performance tuning using below tables?
how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause) use only fields
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0
eket~rsnum NE space.
Thanks in Advance.
bye.Hi,
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0 " Remove this from where clause
eket~rsnum NE space. " Remove this from where clause
' instead delete the entries after fetching into the table
DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
Regards
Bala Krishna -
Stop auditing select statements issued against SYS objects
Hi,
My current client has a requirement to track destructive updates (i.e. insert, update, delete) issued by users who can connect directly to the database. At the moment though, SELECT statements issued against SYS-owned objects are also being captured to the Oracle audit trail. For the time being at least these need to be disabled.
I've issued NOAUDIT SELECT TABLE/SEQUENCE and NOAUDIT SELECT ANY TABLE/SEQUENCE commands, as has a user with the SYSDBA privilege, and they're still being logged. Is there any way to switch these off? I don't know if it's significant (I'm not a DBA by trade) but the audit_sys_operations parameter is set to True.
My client is currently running Oracle Database 10.2.0.5.0 standard edition.
If anyone has any suggestions I'd be grateful.
Thanks in advance,
SteveHi,
Thanks for the input so far ...
@Eduardo and KarK ...
show parameter audit
audit_file_dest string D:\ORACLE\PRODUCT\10.2.0\ADMIN\USSUPM2\ADUMP
audit_sys_operations boolean TRUE
audit_trail string DB, EXTENDED
If we set audit_sys_operations to FALSE, won't that stop auditing of all actions carried out by, for example, someone who connects as SYSDBA? That is something that's still needed to be captured. Unfortunately they go to the WIndows Event Log but at least they're captured somewhere.
@Hemant
This auditing was in place before my client took me on, so I can't say what was used to initiate it unfortunately. What I can say though is that they absolutely don't want to turn off auditing by SYS- type users, just SELECT against SYS-owned objects.
Thinking simplistically, could I just write a script which trawls dba_objects for sys-owned tables, views and sequences and explicitly issues a noaudit select against what's found, and get one of the sysdba-type people we have access to to run it?
Thanks in advance (again)
Steve -
SELECT statement INTO TABLE - what determines order of entries in in.table?
Hello everyone.
I habe a question: A select statement selects multiple entries from a data base table that are put into an internal table.
The question : What determines the order of the entries in the internal table?
And what might change the order all of a suddden in that internal table?
Could reorg. activities/archiving (even ongoing) cause any different result in the order as before ?
I do not mean different entries but I rather refer to the sorting of the internal table, if it is not explicitly stated in the select or in parts of the coding.
Any explaination is appreciated!
Thanks!
CN.Hi,
Its not the order in which you specify the fields in the where clause that affects the sequence of the selection.
What I said is that by default the entries are sorted by the primary key of the table.
I did a bit of a test out of curiosity and after seeing so many different replies on the thread. I was surprised to see the results of the different scenarios.
REPORT Z_TEST_SELECTION .
tables vbap.
data it_vbap type table of vbap.
data it_vbak type table of vbak.
select-options s_vbeln for vbap-vbeln.
select-options s_posnr for vbap-posnr.
"======================================================================
"s_vbeln has following entries
" 5
" 6
" 1
" 2
"s_posnr has following entries.
" 10
" Sorts in ascending order by VBELN and POSNR by default
select * up to 20 rows from vbap into table it_vbap.
refresh it_vbap.
"Below two cases are absolutely unreliable and I would suggest that a
"sort should be mentioned after these statements. So when we use select
"options specify values with the in clause, the sort is not reliable.
"Strangely , neither the sequence is not determined by the order in
"which the data was entered in the select option nor in the sequence of
"the primary key. And this is still a mystery to me about the order in which
"the entries are selected.
" Any answeres anyone ?
"1.
select * from vbap into table it_vbap
where vbeln in ('0000000002','0000000006','0000000005','0000000001')
and posnr in s_posnr.
* Resulted in
*900 |0000000001|000010|
*900 |0000000005|000010|
*900 |0000000006|000010|
*900 |0000000002|000010|
"=========================================================
"2.
select * from vbap into table it_vbap
where posnr in s_posnr
and vbeln in s_vbeln.
* Resulted in
*900 |0000000002|000010|
*900 |0000000001|000010|
*900 |0000000005|000010|
*900 |0000000006|000010|
refresh it_vbap.
"Here the orders were selected in Decending order of Sales order, however
"the posnr is not mentioned in the order by clause, hence posnr was
"still in ascending order.
select * from vbap into table it_vbap
where posnr in s_posnr and vbeln in s_vbeln
order by vbeln descending.
write : 'done!'.
refresh it_vbap.
"Here the orders were selected in Descending order of Sales order.
select * from vbak into table it_vbak where vbeln in s_vbeln
order by vbeln descending.
" The entries were selected in the ascending order of the key VBELN and
" POSNR, so it seems that for all entries does not affect the selection of records.
select * from vbap into table it_vbap
for all entries in it_vbak
where vbeln = it_vbak-vbeln
and posnr in s_posnr.
Of course if you change the order of the primary key (in the transparent table, not in the where clause), the entries will be sorted as per the changed key.
But we seldom change the the sequence of the primary key. In most cases we normally add a new field and make it a key field in addition to the existing key fields.
I hope this helps you.
There might be many more cases and examples than given above, which you can try and reply on this post. Lets see what we come up with.
regards,
Advait -
Select statement from tables which have now been split
I used to select from 3 tables:
user, login, location
I would do:
select distinct user.id, login.computer_id, location.id as location_id
from user, login, location
where user.id = login.user_id
and login.location_id = location.id
and user.id = "manny"
but user has now been split into user1, and user2
I want to pull data where it exists from user1 or user2.
Much of the data in user1 is duplicated in user2 and vice versa, but I want to pull only one instance where it appears so that I can still get single row results of:
ID COMPUTER_ID LOCATION_ID
mannyd redstar_1 Bronx, NY
Any ideas on the query?Why would you split a single table into multiple tables with the same structure and much of the same data? That seems rather counterproductive.
I suppose you could do something like
select user.id, login.computer_id, location.id as location_id
from user1 user, login, location
where user.id = login.user_id
and login.location_id = location.id
and user.id = 'manny'
UNION
select user.id, login.computer_id, location.id as location_id
from user2 user, login, location
where user.id = login.user_id
and login.location_id = location.id
and user.id = 'manny'but that's obviously going to be much more expensive than the single-table approach...
Justin -
Getting a dumb after writing a SELECT statement at TABLE level of SMART
hi all,
i have created a RATE COMPARISON REPORT.In that Report i have to display Rate Price against RFQ No.For this purpose i have write a code at SMART FORMS in TABLE.Following are the code:
SELECT SINGLE netpr
INTO it_detail
FROM ekpo
INNER JOIN ekko ON
ekko~ebeln = ekpo~ebeln
WHERE ekko~BSTYP EQ 'F'
AND ekko~spras eq 'E'
AND ekpo~ebeln eq IT_DETAIL-EBELN
This code is assign with TEXT FILED at TABLE level.when i execute it i get the following dump.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CXSY_OPEN_SQL_DB', was not caught in procedure "%CO2" "(FORM)"_,
nor was it propagated by a RAISING clause.Since the caller of the procedure could not have anticipated that the exception would occur, the current program is terminated.
The reason for the exception is:
In a SELECT access, the read file could not be placed in the target field provided. Either the conversion is not supported for the type of the target field, the target field is too small to include the value, or the data does not have the format required for the target field.
could any body tell me what is problem in my SELECT query statement after executing giving me a dump.
Thanks,
sappk25Hi
The select query is wrong, as you should not move the single field into a table (it_detail)....
Change the query as follows...
data: v_netwr type netwr.
SELECT SINGLE netpr
INTO v_netwr
FROM ekpo
INNER JOIN ekko ON
ekkoebeln = ekpoebeln
WHERE ekko~BSTYP EQ 'F'
AND ekko~spras eq 'E'
AND ekpo~ebeln eq IT_DETAIL-EBEL
if sy-subrc eq 0.
move v_netwr to it_detail.
endif.
Hope this helps.... -
I have 2 tables
Table Parent_child_table:
ID | Parent_id | Name
1 | NULL | Kitchen
2 | 1 | Freezer
3 | NULL | Garden
4 | 3 | Grass
Table Products:
ID | parent_child_table_ID | Price | Comment
1 | 2 | 111 | aaaa
2 | 4 | 12 | vv
I want to select Name from parent table where selected child ID are in PRODUCT table.....
The result would like:
|NAME|
|Kitchen
|Garden
Can someone help with this SQL SELECT ?Raivis wrote:
I have 2 tables
Table Parent_child_table:
ID | Parent_id | Name
1 | NULL | Kitchen
2 | 1 | Freezer
3 | NULL | Garden
4 | 3 | Grass
Table Products:
ID | parent_child_table_ID | Price | Comment
1 | 2 | 111 | aaaa
2 | 4 | 12 | vv
I want to select Name from parent table where selected child ID are in PRODUCT table.....
The result would like:
|NAME|
|Kitchen
|Garden
Can someone help with this SQL SELECT ?A guess
select
p.name
from Parent_child_table p
where p.parent_id is null
and exists
select
null
from Parent_child_table p1, products p2
where p1.id = p2. parent_child_table_id
and p1.parent_id = p.id
)The reason it's a guess is because you've really done nothing to outline WHY you should get the results you say you would like. The more time you spend creating a clear question, the less time you'll have to spend weeding through useless answers.
Cheers, -
Select statement in a BADI method
Hello All,
I want to put a select statement on table CRMD_ORDERADM_I in the PREPARE method of ORDER_SAVEbadi implementation where in I get a syntax error of the table not defined. How do i get over this..
helpfull answers will be rewarded..
Thanks in advance,
SmitaHi,
I dont think you should face any problem in acessing these database tables inside your BADI.
Even if you are facing some problem declare these tables before your code as below.
TABLES : CRMD_ORDERADM_I.
But it should work even without declaring.
Hope this helps
Regards
Sourabh -
How display number of row in select statement
How can I display number of row in select statement?
Table
data1 data2
xxx ccd
wss qwe
qws uij
I need get from SELECT statement:
1 xxx ccd
2 wss qwe
3 qws uijuser13734495 wrote:
Thank you from answer.
Statement
select rownum rn, data1, data2 from table
is good.
And what have I do went I use
select rownum rn, data1, data2 from table order by data1
and I get
3 qws uij
2 wss qwe
1 xxx ccd
I need
1 qws uij
2 wss qwe
3 xxx ccdhence the importance of describing the complete problem.
select
rownum,
data1,
data2
from(
select
data1,
data2
from
table
order by
data1) -
Does the column selected in the select statement will effect the table access. I have a query selecting 10 columns from different tables using joins and inline views. One table is going for a Full table Scan.
When I searched for the cause, I couldn't find anything. Everything looks correct. When I comment 2 two particular columns from the select statement the table is not scanned fully.
Those two columns are not the part of the index. Why does a selection of columns affect the Explain plan?
Thanks,
GMHi Gints,
Thank you for your reply. This is my query and
nvl(TICKET_JOIN.TDQRLV,0) ACC_SHIPPED_QTY,
TICKET_JOIN.TDSOQS QUANTITY_TICKETED are the columns tha's creating issue. If I comment those columns Index is accessed properly.
select
'TKT' SOURCE,
TICKET_JOIN.TKDO01 HIRE_ID,
TICKET_JOIN.TKQ101 TRUCK_ID,
TICKET_JOIN.TKVEHT TRUCK_TYPE,
1 TRUCK_COMM,
nvl(TKCMP1,0) TICKET_NUM,
nvl(TKADTM,0) TICKET_TIME,
--TICKET_JOIN.TDSOQS QUANTITY_TICKETED,
0 CHECKIN_TIME,
--nvl(TICKET_JOIN.TDQRLV,0) ACC_SHIPPED_QTY,
nvl(DDADTM,0) START_TIME
from
(select
TICKET.TKCMP1,
TICKET.TKDO01,
TICKET.TKQ101,
TICKET.TKADTM ,
TICKET.TKVEHT,
TICKET_DETAILS.TDAITM ,
TICKET_DETAILS.TDQRLV ,
TICKET_DETAILS.TDSOQS ,
TICKET.TKCNTF,
TICKET.TKTRDJ,
TICKET.TK58GA8
from
CRPDTA.F5800091 TICKET_DETAILS ,
CRPDTA.F5800090 TICKET
where TICKET.TKCMP1 = TICKET_DETAILS.TDCMP1
and TICKET.TKTRDJ = TICKET_DETAILS.TDTRDJ
and TICKET.TKTRDJ = 107085
and TICKET.TKEV12 <> 'Y'
and TICKET.TK58GA8='ECSEO'
and TICKET.TKCNTF = '11') TICKET_JOIN ,
(select
DDDOCO,
DDCNTF,
DDQTFN,
DDAITM,
DDADTM,
DD58GA8,
DDTRDJ
from
CRPDTA.F5800051 ORDER_DETAILS,
CRPDTA.F5800050 ORDER_HEADER
where
ORDER_HEADER.DHDOCO = ORDER_DETAILS.DDDOCO
and ORDER_HEADER.DHTRDJ = ORDER_DETAILS.DDTRDJ
and ORDER_HEADER.DH58GA8 = ORDER_DETAILS.DD58GA8
and ORDER_HEADER.DHDCTO = ORDER_DETAILS.DDDCTO
/*and
(ORDER_HEADER.DHTRDJ = 107085
OR (ORDER_HEADER.DHTRDJ = 107084 and ORDER_HEADER.DHEV04='Y')
and TRIM(ORDER_HEADER.DH58GA8) = 'ECSEO'
and TRIM(ORDER_DETAILS.DDCNTF) = '11' ) ORDER_VIEW
where TICKET_JOIN.TKTRDJ = ORDER_VIEW.DDTRDJ
and TICKET_JOIN.TDAITM = ORDER_VIEW.DDAITM
and TICKET_JOIN.TKCNTF = ORDER_VIEW.DDCNTF
and TICKET_JOIN.TK58GA8 = ORDER_VIEW.DD58GA8
and NOT EXISTS ( select 1 from CRPDTA.F5800120 TRUCK_ASSIGNMENT
where TATRDJ = 107085
and TACNTF = '11'
and TA58GA8 = 'ECSEO'
and TICKET_JOIN.TKQ101||TICKET_JOIN.TKVEHT = TAQ101||TAVEHT )
Thanks
GM -
How to speed a select statement with the NOT EXISTS where condition ?
Hi all,
I created a view : create or replace view view_name as select * from table_1,table_2 where join_condition and some conditions.
Now I have added in the view "where" clause two NOT EXISTS conditions based on one another different table respectively.
Before I added these two conditions the response time was fast ; but after I added these two conditions then the response time deteriorated.
So how to optimize the select statement ? Hints and so on ...
Thank you very much indeed
Message was edited by:
andrianiainaJust run the script :
SQL> explain plan for select * from dual;
Explained.
SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | | | |
| 1 | TABLE ACCESS FULL | DUAL | | | |
Note: rule based optimization
9 rows selected.
SQL>Nicolas. -
Create object type from multiple tables for select statement
Hi there,
I have 3 tables as given below and I wish to create an object type to group selected columns as 'attribute' from multiple tables.
I need to create 2 input parameters to pass in - 'attribute' and 'attribute value' in PL/SQL and these 2 parameters will be
passing in with 'column name' and 'column value'. e.g. 'configuration' - the column name, 'eval' - the column value.
Then, the PL/SQL will execute the select statement with the column and column value provided to output the record.
Pls advise and thank you.
table ccitemnumber
name null type
ccitemnumber not null varchar2(20)
configuration varchar2(20)
item_type varchar2(30)
table productmodel
productmodelnumber not null varchar2(6)
description varchar2(60)
accesstimems number
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
table topmodel
stmodelnumber not null varchar2(30)
productfamily varchar2(60
formfactor varchar2(10)
modelheight varchar2(10)
formattedcapacity number
formattedcapacity_uom varchar2(20)
object type in database
configuration varchar2(20)
item_type varchar2(30)
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
modelheight varchar2(10)
formattedcapacity number
formattedcapacuser12043838 wrote:
Reason to do this as these fields are required to be grouped together as they are created in different tables. They are treated as 'attribute' (consists of many columns) of the part number. So, the PL/SQL is requested to design in a way able for user to pass in the column name and column value or part number, then the select statement should be able to query for the records. Another reason is a new column can be added easily without keep modifying those effected programs. Reuseable too.This basically equates to ... hard to code, hard to maintain, and poor performance.
Are you really sure you want to do this? This isn't going to be easy-street as you seem to think it is, but it's a one way street to a poorly performing system with security vulnerabilities (google SQL Injection).
I would highly recommend you reconsider your design decision here. -
How to use Oracle Table Type values in Select Statement.
Hi,
I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
For example, try something like the following:
TYPE t_record IS RECORD (
ID TABLEA.ID%type,
NO TABLEA.NO%type,
v_record t_record;
TYPE t_table IS TABLE OF v_record%TYPE;
v_table t_table;
-- Code to populate the values in v_table here.
SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
WHERE ID IN v_table(i).ID;
I want to know how to use the values from Oracle Table Type in the Select Statement.Something like this:
create or replace type t_record as object (
id number,
no number
CREATE or replace type t_table AS TABLE OF t_record;
set serveroutput on
declare
v_table t_table := t_table();
v_t1 t_table := t_table();
begin
v_table.extend(1);
v_table(1).ID := 1;
v_table(1).No := 10;
v_table.extend(1);
v_table(2).ID := 2;
v_table(2).ID := 20;
SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
from TableA
FROM TABLEA
WHERE ID IN (select t.ID from table(v_Table) t);
for i in 1..v_t1.count loop
dbms_output.put_line(v_t1(i).ID);
dbms_output.put_line(v_t1(i).No);
end loop;
end;
/Untested!
P;
Edited by: bluefrog on Mar 5, 2010 5:08 PM -
Field symbols as Table name and in where condition in a select statement
Hello All,
I have a scenario where I need to get user input on table name and old field value and new field value. Then based on user input, I need to select the record from the database. The column name for all the tables in question is different in the database, however there data type is the same and have same values.
I am not able to use a field symbol for comparing the old field value to fetch the relevant record in my where clause.
I cannnot loop through the entire table as it has 10 millilon records, please advice on how to add the where clause as field symbol as the table name is also dynamically assigned.
Here is my code:
DATA: TAB LIKE SY-TNAME,
TAB_COMP1 LIKE X031L-FIELDNAME,
TAB_COMP2 LIKE X031L-FIELDNAME,
NO_OF_FLD TYPE N.
DATA: BEGIN OF BUFFER,
ALIGNMENT TYPE F,
C(8000) TYPE C,
END OF BUFFER.
FIELD-SYMBOLS: <WA> TYPE ANY,
<COMP1> TYPE ANY,
<COMP2> TYPE ANY.
GET TABLE NAME GIVEN BY USER IN LOCAL VARIABLE
TAB = TAB_NAME.
CREATE FIELD NAME BASED ON THE TABLE NAME ENTERED.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
KEY FIELD
TAB_COMP1 = 'GL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OPSL'.
KEY FIELD
TAB_COMP1 = 'OPSL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'OTAX_GL_SYS_NO'.
TAB_COMP2 = 'OTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN 'OIUH_RV_GTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'GTAX_GL_SYS_NO'.
TAB_COMP2 = 'GTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN OTHERS.
EXIT.
ENDCASE.
SET FIELD SYMBOL WITH APPROPRIATE TYPE TO BUFFER AREA.
ASSIGN BUFFER TO <WA> CASTING TYPE (TAB).
How to add where clause and remove the if condition in the select -- endselect
SELECT * FROM (TAB) INTO <WA>.
ASSIGN COMPONENT TAB_COMP1 OF STRUCTURE <WA> TO <COMP1>.
IF NO_OF_FLD = 2.
ASSIGN COMPONENT TAB_COMP2 OF STRUCTURE <WA> TO <COMP2>.
ENDIF.
IF <COMP1> = OLD_SYS_NO.
code for updating table would come here
WRITE: 'MATCH FOUND'.
EXIT.
ENDIF.
ENDSELECT.
Please advice. Thanks much.
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:33 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:34 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:35 PM1. Create single column table for holding field name depending on the table entered.
2. Take input from user: for e.g. table_name
3. Using case load single column table with required fields
for e.g.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
Append 'GL_GL_SYS_NO' to KEY_FIELD --> KEY_FIELD is the single line internal table as mentioned in step 1.
WHEN 'OIUH_RV_OPSL'.
Append 'OPSL_GL_SYS_NO'.
WHEN 'OIUH_RV_OTAX'.
Append 'OTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN 'OIUH_RV_GTAX'.
Append 'GTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN OTHERS.
EXIT.
ENDCASE.
Now depending on the table name you have required column ready
4. Create dynamic internal table using following sudo code
Fill the fieldcatlog using the single column field table and DD03L table, See what all columns from DD03L you want to fill in field catlog table
loop at internal table with all the fields.
move it to field catalog.
append field catalog.
endloop.
5. Pass this field catalog table to static method create_dynamic_table method
DATA table TYPE REF TO DATA. --> data object for holding handle to dynamic internal table.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = fieldcatalog_tab
importing
ep_table = table.
6. Now assign table reference to field symbol of type table.
ASSIGN table->* to <field-tab>.
7. Also create work area <field-wa> using refrence of table.
create data object wa LIKE LINE OF <field-tab>.
ASSIGN wa->* to <field-wa>.
8. Also define field symbol for field name.
for e.g. <field_name>
4. Dynamic internal table is ready
5. Now execute the select statement as follows:
SELECT (KEY_FIELD)
INTO <ITAB> --> created dynamically above
FROM (TABLE_NAME)
WHERE (WHERE). --> WHERE is single line internal table having line type of CHAR72. So for every old value there will be one line
Where condition is same as like we give in static way only difference in this case it will stored in internal table line wise.
In this case you need to append all your where condition line by line in to WHERE.
5. To fill this dynamic internal table using ASSIGN COMPONENT <Comp_number> OF STRUCTURE <field-wa> TO <field-name>
So in this case if first field of structure STRUCT1 is user_id then sudo-code will be
loop at internal table containing list of fields into field_wa --> single column field table
ASSIGN COMPONENT field_wa OF STRUCTURE <field-wa> TO <field>. "Here field_wa is wa area for single column internal table holding all the fieldnames.
Now <field-name> points to user_id field. Move some value into it as nornally we do with variables.
Move <your_new_value> to <field-name>. --> Assign new value
or
<field-name> = <your_new_value>.
Endloop.
6. After completing all the fields one row will be ready in <field_wa>.
APPEND <field_wa> to <field_tab>.
Hope this helps you.
Thanks,
Augustin. -
Please explain on what does these select statements get from these tables..
Hello Experts,
What does these select statements get?and what are these tables CDHDR and CDPOS used for?
The program that I am currently modifying lets users post documents and the ones that are not posted
are saved in a custom table. Now, we had a scenario in PROD server wherein certain items are not being
fetched as bypassed but we saved it in the bypassed table. Anyway, below is the select statements:
get all change document header within the selected dates
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_cdhdr
FROM cdhdr
WHERE udate IN s_udate
AND objectclas EQ 'CHARGE'
AND tcode IN (lc_tcode_msc1,
lc_tcode_msc2,
lc_tcode_msc1n,
lc_tcode_msc2n,
lv_tcode_vl33n,
'SE38',
'ZGENE').
IF NOT it_cdhdr[] IS INITIAL.
SELECT objectid changenr value_new
FROM cdpos
INTO TABLE it_cdpos
FOR ALL ENTRIES IN it_cdhdr
WHERE objectclas EQ it_cdhdr-objectclas
AND objectid = it_cdhdr-objectid
AND changenr = it_cdhdr-changenr
AND tabname = lc_tabname_mcha
AND fname IN (lc_fname_zustd,'LWEDT').
DELETE it_cdpos WHERE value_new+00(01) = 'X'.
LOOP AT it_cdpos ASSIGNING <fs_cdpos>.
l_matnr = <fs_cdpos>-objectid+00(18).
l_charg = <fs_cdpos>-objectid+22(10).
l_zustd = <fs_cdpos>-value_new+00(01).
READ TABLE it_batch INTO wa_batch
WITH KEY matnr = l_matnr
charg = l_charg.
IF sy-subrc EQ 0.
l_tabix = sy-tabix.
wa_batch-zustd = l_zustd.
MODIFY it_batch FROM wa_batch INDEX l_tabix
TRANSPORTING zustd.
ELSE.
wa_batch-matnr = l_matnr.
wa_batch-charg = l_charg.
wa_batch-zustd = l_zustd.
wa_batch-code = 'A'. "selected within period
APPEND wa_batch TO it_batch.
ENDIF.
ENDLOOP.
ENDIF.Hi,
The first select statement is for Change document header.CDHDR table contains this object class in your case if you change any batch number for any material number from the transaction for example (MB01) you can trace this .
From CDPOS you can trace which tables affected (EX : MCHA) and the new value(l_zustd ).
Regds,
Vinsa.R
Maybe you are looking for
-
I saved my iTunes Media Library to an external HD prior to reformatting my laptop. I have since reinstalled everything including iTunes. I pointed iTunes to the new Library location, signed into my account on iTunes and everything looks fine. All of
-
Trying to install iTunes on my Dell laptop with Windows 7 - 64 bit. Get these two error messages when I run the iTunes exe file: Error 2 and Error 2 (Windows error 2). Both say Apple Application Support was not found. Can anyone tell me why this
-
Sharepoint services 3.0 on 2008 R2
Looking at the docs I don't see anywhere where it says I need MSSQL installed to do a stand alone install, but after finishing the setup I get this error: I found this blog post which states: "By Default Network Service account is the Startup servic
-
Agent determination for SRM WF
Hi All, I have developed a custom WF i.e. copy of 2 step Invoice approval WF. For agent determination, I have put in logic for Adhoc agent, which is working fine. My query is that I can have multiple agents for a particular step, which I am able to s
-
Why can't I download photos from my journal when it's hosted on my own server?
When I publish my albums to iCloud, I have an icon that appears on the very left when the image is full-screen that allows me to download the image. When I publich the very same album to my own server by just dropping all the files into a directory,