Read single record in a table
Hi all,
I hava a table and when I create a new record I have to read the previous one for some check.
Which is the script to read a particular record in a table?
THANKS
ENZO
This is one of the many ways :
var dataline = xfa.form.data.PAGE.SUBFORM.TABLENAME.resolveNodes("DataRow[*]");
This puts all the nodes of a table into the dataline variable.
You can then use this code to loop through the table and access the field TEXTFIELD in that row :
for ( i = 0; i < dataline.length; i++ )
dataline.item(i).resolveNode("TEXTFIELD").rawValue;
You can use the resolveNode function to capture specific fields in a structure as well, using dots :
dataline.item(i).resolveNode("SUBTABLE.ROW2.TEXTFIELD").rawValue;
If you want to catch the last line, use :
dataline.item(dataline.length).resolveNode("TEXTFIELD").rawValue;
If you want to catch the second to last line, which I presume is what you want use :
dataline.item(dataline.length - 1).resolveNode("TEXTFIELD").rawValue;
Similar Messages
-
Time out while reading single record from CRMD_ORDERADM_H table on OBJECTID
Hi,
This is the problem i am facing in CRMD_ORDERADM_H.
if i search for a single record in CRMD_ORDERADM_H Table using SE11 on OBJECT_ID field, it is giving me Time out error.
CRMD_ORDERADM_H db size would be > 1 Billion records.
It is having a Secondary Standard index on OBJECT_ID.
If i search for single record with OBJECT_ID and PROCESS_TYPE i am able to get the result within seconds.
But if i take some range in OBJECT_ID and single value in PROCESS_TYPE then i am getting Time out erro.
we have index (custom) on OBJECT_ID and PROCESS_TYPE combination.
What would be the cause?
Thanks in Advance,
-KishoreHello,
there is a special table for reading records from orders: CRMD_ORDER_INDEX.
Regards, R -
How to make few columns of single record inactive in Table conrol?
Hi all,
Scenario is like this : i have one table control , it is displaying 10 records , in that first four columns are editable. Now my requirement is, whenever record having intial values( suppose one record having initial values among ten) except key field , we need to deactive that particular record , now table control should contain ten records , but nine records are in editable state and one record in non editable state .
How to make few columns of single record inactive in Table conrol?
Thanks in advance.hi there...
select the column that u want to convert to non editable mode in the screen layout. then double click on it. go to the attributes tab and uncheck the input chk box. the check box will become disabled for input. u can do this for any number of columns.
if u want to do it dyanamically, loop at screen. check for the screen element's name. when itmatches the column u want to disable, simply set the input value as 0.
dont forget to modify sscreen after setting the attribute values.
i hope this helps.
do reward if helpful. -
MDM API to read the Record Key Mapping table
Hi,
Does anybody know what class/method I can use to read the Record Key Mapping table?
For the Business Partner table the Key Mapping table has this columns:
<u>Default / MDM Partner ID / Remote System / Key</u>
I have everything but the Key. How can I read it?
Thanks in advance,
Diego.GetKey Mapping is one of the available Web Services as of SP4.
Else you could use the Java API to get the Key Mapping.
<b>CatalogData class</b> has the following method
<b>GetKeyMapping</b>
public java.lang.String[][] GetKeyMapping(java.lang.String agency,
java.lang.String table,
int[] recordIDs,
boolean isDefaultKeyOnly)
throws StringExceptionRetrieves the key mapping for each record.
Parameters:
agency - the agency name.
table - the table name.
recordIDs - the list of records.
isDefaultKeyOnly - True to retrieve only the default value, False to all key values.
Returns: the key values for each record. -
JDBC sender: after read insert records into another table
Hi all,
I send records from a SQL view (not a table) to RFC via proxy method.
After reading a record from the view I would like to move this record to a database table called CHECKED. Can anyone provide me a solution for this or is this impossible. (there are 6 fields that have to be inserted in DB CHECKED after reading: admin, bukrs, dagbknr, bkstnr, datum, regel)
Can I use an INSERT statement in my Update SQL Statement with variables or do I have to create an SP?
Hope someone can help me out of here...
Thanks in advance!
Wouter.ur strucutre would of:
<root>
<Satement1>
<TableName action=INSERT>
<table>checked</table>
<access>
<admin>val</admin>
<bukrs>val</bukrs>
<dagbknr>val</dagbknr>
<bkstnr>val</bkstnr>
<datum>val</datum>
<regel>val</regel>
</access>
</dbTableName>
</StatementName1>
</root>
or u can use a SQL DML which wud pose a strucutre similar to
<root>
<stmt>
<Customers action="SQL_DML">
<access> INSERT CHECKED SET admin=$admin$, bukrs=$bukrs$', dagbknr=$dagbknr$, bkstnr=$bkstnr$', datum=$datum$, regel.=$regel.$'
</access>
</Customers>
</stmt>
</root>
for more inputs refer to <a href="/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 link on jdbc</a> -
Trigger to keep a single record form a table to a certain status
Hi all.
I have a table which has a "Status" field. I'm trying to accomplish, with a trigger, that the table can only have one record with an "Active" status, so whenever and Insert or Update occurs, if the new value for the "Status" field is "Active", I should update all other records in the table to "Inactive". I've tried several approaches, and managed to make it work on Inserts, but any Updates wll give an error that says that the table is mutating. I've tried to do it on before and after trigger types, without success.
Is there a way to do what I want with a trigger, or do necessarily I have to create an SP that needs to be called before the Insert or Update operation?Alternatively you can try with as follows:
SQL> create table t as select rownum id, 'Inactive' status from dual connect by level <= 4
2 union all select 5, 'Active' from dual
3 /
Table created.
SQL>
SQL> select * from t
2 /
ID STATUS
1 Inactive
2 Inactive
3 Inactive
4 Inactive
5 Active
SQL> create or replace trigger t_trg
2 before insert or update
3 on t
4 for each row
5 begin
6 if (sys_context (
7 'userenv',
8 'client_info'
9 ) != 'start transaction'
10 or sys_context (
11 'userenv',
12 'client_info'
13 ) is null)
14 then
15 dbms_application_info.set_client_info ('start transaction');
16
17 execute immediate 'update t@loopback set status = ''Inactive'' where status = ''Act
ive'' and id != :id'
18 using :new.id;
19
20 dbms_application_info.set_client_info ('end transaction');
21 end if;
22 end t_trg;
23 /
Trigger created.
SQL>
SQL> update t
2 set status = 'Active'
3 where id = 2
4 /
1 row updated.
SQL>
SQL> select * from t
2 /
ID STATUS
1 Inactive
2 Active
3 Inactive
4 Inactive
5 Inactive
SQL>
SQL> update t
2 set status = 'Active'
3 where id = 4
4 /
1 row updated.
SQL>
SQL> select * from t
2 /
ID STATUS
1 Inactive
2 Inactive
3 Inactive
4 Active
5 Inactive
SQL>
SQL> insert into t values (6, 'Active')
2 /
1 row created.
SQL>
SQL> select * from t
2 /
ID STATUS
1 Inactive
2 Inactive
3 Inactive
4 Inactive
5 Inactive
6 Active
6 rows selected.
SQL>All you need is the loopback trigger wich I defined as
CREATE DATABASE LINK LOOPBACK
USING '(description=(address=(protocol=beq)(program=/path_to_your_oracle_binary/oracle)))'; -
SQL Query to Read each record in a table
Can you please share any T-SQL block of statement, that reads reach record row by row
for example
Table1
Row_1 a b c
Row_2 d e f
I need to call an stored proc which takes record values as parameters(row by row)
Equalent logic in c#
foreach row in Table1
Sp(row)Try
--Create table
CREATE TABLE Test1 (
id INT identity(1, 1)
,Val INT
,flag CHAR(1) DEFAULT 'F'
--Feed value
INSERT INTO Test1
VALUES (
1
,'F'
2
,'F'
3
,'F'
SELECT *
FROM Test1
--Create SP
CREATE PROCEDURE yourSp @param INT
AS
BEGIN
SELECT 'Yes'
,@param
END
DECLARE @i INT = 1
,@count INT = 0
,@val INT = 0
SELECT @count = count(1)
FROM Test1
WHILE (@i <= @count)
BEGIN
SELECT @val = Val
FROM Test1
WHERE id = @i
EXEC YourSP @val
SET @i = @i + 1
END
Thanks
Manish
Please click Mark as Answer if my post solved your problem and click
Vote as Helpful if this post was useful. -
Reading Locked records from HR table using LDB PNP
Hi,
I am trying to read the table pa0168 using LDB PNP.
But the problem is that get pernr staement does not retrieve locked records i.e where PA0168-sprps eq "X'.
Can anybody help me with this.
I have to use LDB so i don't want a solution of writing a select * for the pa0168 table.
hence i have to use get pernr statement but it should also retrieve locked records.
how can i achieve that.? please help
Thanks
GT
Message was edited by: GTHi GT,
In the START-OF-SELECTION event, set the parameter value
pnp-sw-ignorelockedrecords = 'N'.
Good Luck,
Suresh Datti
( Pl award points if the answer helps you ) -
How to update Records of SAP table from .CSV file
Hi,
I have written a code which takes a data from (,) delimited CSV file and adds it into the Internal table.
Now I want to update the all fields in SAP table with the Internal table.
I want to use Update statement.
Update <table Name> SET <field needs to update> WHERE connditon.
I don't want to iterate through thousand on record in sap table to check the where condition.
Could you please tell me how to do it.Hi. I thing you will not workaround the iterating of the internal table.
You can pre-load all the records into another internal table
check lt_csv[] is not initial. " important, otherwise next select would read all records of the table
select .... into lt_dbitab for all entries in lt_csv where key-fieds = lt_csv-key_fields...
check sy-subrc eq 0 and lt_dbitab[] is not initial.
then do in-memory update of the it_dbitab
loop at it_dbitab assign <fs>.
read table lt_csv assign <fs_csv> with key ... " lt_csv should be sorted table with key, or you should try to use binary search
if sy-subrc eq 0.
...change required lt_dbitab fields: <fs>-comp = <fs_csv>-comp...
endif.
endloop.
ant then you can do mass-update
update dbtab from table lt_dbitab.
From performance view, this solution should be much faster than iterating lt_csv directly and updating every single database record
Br
Bohuslav -
Copy records of one table into another using Update statement
Supposing I have 2 tables test and test1.
Test has columns col1 and col2. and test1 has only one table col1.
select * from test returns:
COL1 COL2
a
b
c
d
e
select * from test1 returns
COL1
p
q
r
s
t
Suppose i want to copy values of test1.col1 to test.col2 so tht final result of
select * from test should be
COL1 COL2
a p
b q
c r
d s
e t
I found a query in the OCP introduction book:
update test set col2=(select col1 from test11)
this works fine only when we have a single record in test1 table but fails otherwise.
how can this be achieved using the update statement ?SQL> desc test
Name Null? Type
COL1 VARCHAR2(10)
COL2 VARCHAR2(30)
SQL> desc test1
Name Null? Type
COL1 VARCHAR2(10)
SQL> insert into test values ('a','');
1 row created.
SQL> insert into test values ('b','');
1 row created.
SQL> insert into test values ('c','');
1 row created.
SQL> insert into test values ('d','');
1 row created.
SQL> insert into test1 values ('e');
1 row created.
SQL> insert into test1 values ('f');
1 row created.
SQL> insert into test1 values ('g');
1 row created.
SQL> insert into test1 values ('h');
1 row created.
SQL> commit;
Commit complete.
SQL> ed
Wrote file afiedt.buf
1 select a.col1, b.col1, a.rn from
2 (select row_number() over (order by col1) rn, col1 from test) a,
3 (select row_number() over (order by col1) rn, col1 from test1) b
4* where a.rn = b.rn
SQL> /
COL1 COL1 RN
a e 1
b f 2
c g 3
d h 4
SQL> ed
Wrote file afiedt.buf
1 update test set col1 =
2 (
3 select forupd from (
4 select a.col1, b.col1 test1col, a.col1||' '||b.col1 forupd, a.rn from
5 (select row_number() over (order by col1) rn, col1 from test) a,
6 (select row_number() over (order by col1) rn, col1 from test1) b
7 where a.rn = b.rn
8* ) z where z.col1 = test.col1)
SQL> /
4 rows updated.
SQL> commit;
Commit complete.
SQL> select * from test;
COL1 COL2
a e
b f
c g
d h
SQL>
This will work only if you have the same number of lines in COL1 in both tables. If you have different number of lines, then you need to code more at join (outer, inner).
But for complicated cases, please post sample data.
Michael
PS: And supossing that the values are distinct in TEST table. Else update will fail, because more rows will be retrived.
If more values in TEST table in COL1, then you need to assign a row number on TEST also, and in WHERE of query you need to place one more join condition:
something like:
8* ) z where z.col1 = test.col1
and z.rn = test.rn)
SQL> /
But as i said, get more specifications.
Message was edited by:
kjt
Added the PS. -
Regarding reading multiple records into a single internal table..
hi experts,
Need your help, i have a requirement like this.
i will have a input file like this
D 123 Suresh 12/01/2008
E ven sha 5432
E ven sha 5432
D 153 Sachin 11/01/2008
E ven sha 5432
Now all i need to consider from D to E (i.e., before next D) as a single record and i need to preare a separate excel,
So that E records can be max 9. So we cant expect this will be always 2 or 3 or 4.
So how can i do this upload and process..
give some idea.
Thanks,
SureshHi,
Once you transfer the values from input file to internal table.
loop through all records of internal table .
check the first letter using offset
e.g if Itab-field+0(1) = 'D'
elseif Itab-field+0(1) = 'E'.
endif.
Populate the work area of internal table until you find the next 'D' once you find 'D' again ...append the work area to internal table......clear work area.
Regards,
Rahul -
Insert multiple records into a table(Oracle 9i) from a single PHP statement
How can I insert multiple records into a table(Oracle 9i) from a single PHP statement?
From what all I've found, the statement below would work if I were using MySQL:
insert into scen
(indx,share,expire,pitch,curve,surface,call)
values
(81202, 28, 171, .27, 0, 0, 'C' ),
(81204, 28, 501, .25, 0, 0, 'C' ),
(81203, 17, 35, .222, 0, 0, 'C' ),
(81202, 28, 171, .27, 2, 0, 'C' ),
(81204, 28, 501, .20, 0, 1, 'C' ),
(81203, 28, 135, .22, 1, 0, 'C' )
The amount of records varies into the multiple-dozens. My aim is to utilize the power of Oracle while avoiding the i/o of dozens of single-record inserts.
Thank you,
WillYou could look at the INSERT ALL statement found in the documentation here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_913a.htm#2133161
My personal opinion is that you probably won't see any benefit because under the hood I think Oracle will still be doing single row inserts. I could be wrong though.
The only way to confirm was if you did a test of multiple inserts vs an INSERT ALL, that is if the INSERT ALL met your requirements.
HTH. -
How to Enable a Selected single record from Table control...
Hi,
I have 5 records in my table control and in screen Painter in Made all the fields in Table control as Output field.
and successfully all my Table control fields are disabled...
Now Now i want to enable the record which i selected n rest all the 4 records should be in Disable.
what i did is:
in PBO.
loop at itab into wa with contol TBC1 .
Module XYZ.
endloop.
Module XYZ.
loop at screen.
if screen-group = 'x'.
screen-input = 1.
modify screen.
endif.
End Module.
Please help me....
Thanks,hi
in the layout of the screen u might have dragged and dropped the table control
double click on it u will get attributes screen in that u select MULTIPLE or SINGLE under Line-Selection
under attributes tab based on ur requirement.
table control declaration:
controls : control type tableview using screen 8000.
the internal table in table control must be like
data : begin of itab occurs 0,
empno type .......,
empname......,
empcity.....,
check(1), " for tab selection"
end of itab.
data : itab1 like itab occurs 0 with header line.
data : flag.
data : wk_init type i.
data : lines type i.
in the attributes screen of the table control
pass the value ITAB-CHECK to the field W/SELECTION
in SE51
PBO
Module_status_0800
loop with control table_control_name.
module_fill_tcontrol.
endloop.
PAI
Module_user_command_0800
loop with control table_control_name.
module_read_tcontrol.
endloop.
in se38
Module_status_0800.
describe table itab1 lines lines.
control-lines = lines.
endmodule.
Module_fill_tcontrol.
describe table itab1 lines wk_init.
if wk_init is not initial.
read table itab1 into itab index control-current_line.
endif.
for enabling a row in the table control:
if sy-ucomm = 'EDIT'.
loop at screen.
if flag is initial.
screen-input = 0.
elseif ( flag eq 'Y' ).
if ( ( screen-name = 'ITAB-EMPNO' or
screen-name = 'ITAB-EMPNAME' or
screen-name = 'ITAB-EMPCITY' )
and control-line_selector eq itab-check
and control-current_line le lines ).
screen-input = 1.
else.
endif.
endif.
modify screen.
endloop.
endif.
endmodule.
Module_read_tcontrol.
READ TABLE itab1 INDEX control-current_line.
IF sy-subrc EQ 0.
MODIFY itab1 FROM itab INDEX control-current_line.
ELSE.
MOVE-CORRESPONDING itab TO itab1.
APPEND itab1.
CLEAR itab1.
ENDIF.
endmodule.
module_user_command.
case sy-ucomm.
when 'EDIT'. -
> Function Code assigned to the pushbutton to enable the field
flag = 'Y'.
endcase.
endmodule.
Regards
Murali.M -
Insert multiple rows into a same table from a single record
Hi All,
I need to insert multiple rows into a same table from a single record. Here is what I am trying to do and I need your expertise. I am using Oracle 11g
DataFile
1,"1001,2001,3001,4001"
2,"1002,2002,3002,4002"
The data needs to be loaded as
Field1 Field2
1 1001
1 2001
1 3001
1 4001
2 1002
2 2002
2 3002
2 4002
ThanksYou could use SQL*Loader to load the data into a staging table with a varray column, then use a SQL insert statement to distribute it to the destination table, as demonstrated below.
SCOTT@orcl> host type test.dat
1,"1001,2001,3001,4001"
2,"1002,2002,3002,4002"
SCOTT@orcl> host type test.ctl
load data
infile test.dat
into table staging
fields terminated by ','
( field1
, numbers varray enclosed by '"' and '"' (x))
SCOTT@orcl> create table staging
2 (field1 number,
3 numbers sys.odcinumberlist)
4 /
Table created.
SCOTT@orcl> host sqlldr scott/tiger control=test.ctl log=test.log
SQL*Loader: Release 11.2.0.1.0 - Production on Wed Dec 18 21:48:09 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SCOTT@orcl> column numbers format a60
SCOTT@orcl> select * from staging
2 /
FIELD1 NUMBERS
1 ODCINUMBERLIST(1001, 2001, 3001, 4001)
2 ODCINUMBERLIST(1002, 2002, 3002, 4002)
2 rows selected.
SCOTT@orcl> create table destination
2 (field1 number,
3 field2 number)
4 /
Table created.
SCOTT@orcl> insert into destination
2 select s.field1, t.column_value
3 from staging s, table (s.numbers) t
4 /
8 rows created.
SCOTT@orcl> select * from destination
2 /
FIELD1 FIELD2
1 1001
1 2001
1 3001
1 4001
2 1002
2 2002
2 3002
2 4002
8 rows selected. -
Reading First record of table in smartform
Hi friends doing a smartform for COO certifcate of origin
in which selection criteria is Customer invoice throug that i get
list invoice and through which i get commercial invoice .
For each Sales order no and line item no there can be mulitple commercial invoice.
I got the data upto this in my main window the ouptut is correct but at the footer level which is another window out of mainwindow
i want to print text of country of final destination of the first comm. invoice from header .
suppose .
so no so line comm inv
1a 10 123
124
125
1a 20 01
02
i want to print the first invoice text 123 . rest to be igoner for so number.
i tried by describe and select,
by index too but i need to check it with other so itab.
in that iam getting the last record of this table to check as iam comparing with work area immdiatly after the main window .
which is wa_main.
READ TABLE i_cinvoice into wa_cinvoice
WITH KEY vbelv = wa_main-vbelv
posnv = wa_main-posnv.
IF sy-subrc = 0.
w_vbeln1 = wa_cinvoice-vbeln.
ENDIF.
w_cntofd = w_vbeln1.
*END OF FQ01
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ZEXC'
language = sy-langu
name = w_cntofd
object = 'VBBK'
TABLES
lines = i_cntofd
EXCEPTIONSloop at i_main into wa_main.
READ TABLE i_cinvoice into wa_cinvoice
WITH KEY vbelv = wa_main-vbelv
posnv = wa_main-posnv.
IF sy-subrc = 0.
w_cntofd = wa_cinvoice-vbeln.
ENDIF.
endloop.
here may be the read condition checks for the valid record in wa_main.
Maybe you are looking for
-
i using sqldeveloper to connect sybase ase 12.5 server and stored Chinese. but when i query out the data , it can not dislplay Chinese correctly, even i using sybase jdbc driver or jtds jdbc driver both error. so how to setup sqldeveloper to support
-
Volume issues with MacBook Pro
Hi, I just placed a new SSD into my Late 2011 MacBook Pro and re-installed Mavericks and for some reason the volume on my machine is a lot quieter compared to before... I have gone into System Preferences and both my input and output volumes are full
-
How can I select the existing worksheet while using OLE2 to open the template workboo
Source: application:=ole2.create_obj('Excel.Application'); workbooks:=ole2.get_obj_property(application,'Workbooks'); args := ole2.create_arglist; ole2.add_arg(args, 'c:\RptTemplate.xlt'); workbook:=ole2.invoke_obj(workbooks,'Open',args); ole2.destro
-
Audit who did or tried to run reports on certain criterias and when?
Hi, Where can I find more information on Security in BPC? I´d like to know more about on how to audit users, is there any standard reports that can show me who ran reports, which critera, which time etc.? Thanks!
-
Upgrade to Indesign CS4 from Pagemaker
I have a Windows PC with Pagemaker 6.5 installed, which is listed as an eligible product to upgrade to Indesign CS4. However, on installation the only options presented for upgrade are CS, CS2, and CS3. What steps do I need to take to complete the in