Need to put flag in one of the column of internal table
TYPES : BEGIN OF ty_bseg.
INCLUDE STRUCTURE bseg.
TYPES : flag(1) TYPE c.
TYPES : END OF ty_bseg.
DATA : gt_bseg TYPE TABLE OF ty_bseg.
SELECT * FROM bseg
INTO TABLE <b>gt_bseg</b>
FOR ALL ENTRIES IN gt_bsak
WHERE bukrs = gt_bsak-bukrs
AND belnr = gt_bsak-belnr
AND gjahr = gt_bsak-gjahr.
Now I have to fill 'X' in the internal table gt_bseg.
how can I fill all the records of itab gt_bseg with flag 'X'.
For better performance... is there any command like modify or...?
Hi Sam,
Use the following code.
*Code start
loop at gt_bseg.
gt_bseg-flag = 'X'.
modify table gt_bseg transporting flag.
endloop.
*Code ends
Cheers,
Vikram
Pls reward for helpful replies!!
Similar Messages
-
How to store data file name in one of the columns of staging table
My requirement is to load data from .dat file to oracle staging table. I have done following steps:
1. Created control file and stored in bin directory.
2. Created data file and stored in bin directory.
3. Registered a concurrent program with execution method as SQL*Loader.
4. Added the concurrent program to request group.
I am passing the file name as a parameter to concurrent program. When I am running the program, the data is getting loaded to the staging table correctly.
Now I want to store the filename (which is passed as a parameter) in one of the columns of staging table. I tried different ways found through Google, but none of them worked. I am using the below control file:
OPTIONS (SKIP = 1)
LOAD DATA
INFILE '&1'
APPEND INTO TABLE XXCISCO_SO_INTF_STG_TB
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
COUNTRY_NAME
,COUNTRY_CODE
,ORDER_CATEGORY
,ORDER_NUMBER
,RECORD_ID "XXCISCO_SO_INTF_STG_TB_S.NEXTVAL"
,FILE_NAME CONSTANT "&1"
,REQUEST_ID "fnd_global.conc_request_id"
,LAST_UPDATED_BY "FND_GLOBAL.USER_ID"
,LAST_UPDATE_DATE SYSDATE
,CREATED_BY "FND_GLOBAL.USER_ID"
,CREATION_DATE SYSDATE
,INTERFACE_STATUS CONSTANT "N"
,RECORD_STATUS CONSTANT "N"
I want to store file name in the column FILE_NAME stated above. I tried with and without constant using "$1", "&1", ":$1", ":&1", &1, $1..... but none of them worked. Please suggest me the solution for this.
Thanks,
AbhayPl post details of OS, database and EBS versions. There is no easy way to achieve this.
Pl see previous threads on this topic
SQL*Loader to insert data file name during load
Sql Loader with new column
HTH
Srini -
Function module to find the columns in Internal table
Hi Group,
Is there any function module which displays the columns of the internal table. I guess there is one cos when we debug any program and select the "Tables" button while debugging and enter an internal table and then do a "Find" the pop up which comes up shows the internal table columns. As this functionality is in the debugger which I cannot debug hence was wondering if some one has come across any such function module. Thanks in advance.
Regards,
Ankur Bhandari
[email protected]Hi again,
1. In the above FM
Pass Program as SY-REPID (U cann pass other prg name also)
in FieldName Pass the name of the internal table
eg. 'ITAB'
2. This FM will give u the details of the
internal table.
The u can display the COMPONENTS table
using ALV or anyother method u like.
Regards,
Amit M. -
OAF :I need to show totals for columns that breaks on one of the column in Advance Table
I am using advance table (AT),
I have a requirement to calculate totals for few columns in the AT, based on the account number ( totals should break on the account # , as shown below )
Please help.
Account
Desc
Paid Amt
AP Credit
acc1
desc1
200
100
acc1
desc1
300
100
acc1
desc1
400
100
Total 900
Total 300
acc2
desc2
150
50
acc2
desc2
250
50
acc2
desc2
100
150
Total 500
Total 200
Message was edited by: 85de445e-a75a-4f2f-b086-8cb6abb09c5d
CAN ANY ONE PLEASE PROVIDE ANY INPUTS.. , AS ITS URGENT ! Thanks in advance.Any updates on this please !!! ?
Please suggest if this can be achieved by any other region type or any specific type to be used ?? -
How to remove spaces present in one of the records in a table
Hi
i have a requirement where i need to delete the spaces present in one of the columns in a table.The table has a column with the data in the form of lastname,firstname.The old data present there has one space between the lastname and the firstname and the new data has no space between the last and the first names.so i need to come out with something that will remove the space between the last and firstname in the old records.
Can you give me some suggestions?Maybe something like this?
SQL> WITH data AS
2 (
3 SELECT 'Oracle,Corporation' lastnamefirstname
4 FROM dual
5 )
6 SELECT REPLACE(lastnamefirstname,',',NULL)
7 FROM data ;
REPLACE(LASTNAMEF
OracleCorporation
1 row selected. -
Retrieve as many duplicate records as a value stored in one of the columns
Hi,
I have a peculiar requirement where I want multiple copies of rows the count of which is determined by one of the column values:
create table test (id number, value number, data varchar2(100));
insert into test values (1,5,'one');
insert into test values (2,2,'two);
insert into test values (3,3,'three');
insert into test values (4,4,'four');
insert into test values (5,5,'five');
select * from test where id=3;
I get:
id,value,data
3,3,three
I want:
id,value,data
3,3,three_1
3,3,three_2
3,3,three_3
i.e. Althought there is ONLY ONE row for the id=3, but as the column value=3, i want 3 rows from this table (all identical) except the last column to which I append a running sequential number.
How to do that?
Thanks.You have still pipelined function :
SQL> create or replace type TypeTest as object (id number, value number, data varchar2(100));
2 /
Type created.
SQL>
SQL> create or replace type ListTest as table of TypeTest;
2 /
Type created.
SQL>
SQL> create or replace function TblTest(p_id number default null)
2 return ListTest
3 pipelined
4 is
5 begin
6 for x in (select id, value, data from test where id = nvl(p_id,id)) loop
7 for i in 1.. x.value loop
8 pipe row (TypeTest(x.id, x.value, x.data||'_'||to_char(i)));
9 end loop;
10 end loop;
11 return;
12 end;
13 /
Function created.
SQL> show err
No errors.
SQL>
SQL> select * from table(TblTest(3));
ID VALUE DATA
3 3 three_1
3 3 three_2
3 3 three_3
SQL> select * from table(TblTest);
ID VALUE DATA
1 5 one_1
1 5 one_2
1 5 one_3
1 5 one_4
1 5 one_5
2 2 two_1
2 2 two_2
3 3 three_1
3 3 three_2
3 3 three_3
4 4 four_1
4 4 four_2
4 4 four_3
4 4 four_4
5 5 five_1
5 5 five_2
5 5 five_3
5 5 five_4
5 5 five_5
19 rows selected.
SQL> Nicolas. -
Does anyone know if you need to put down a deposit for the finance option on a macbook??
does anyone know if you need to put down a deposit for the finance option for a macbook?
that is the USA website. Here's the link to the UK one: http://store.apple.com/uk/browse/campaigns/financeyourmac
-
Do I need to put these .pxml files under the source control?
I use Jdeveloper created portlet consumer. after I run it in Jdeveloper, there are lot of .pxml files generated as metadata.
Do I need to put these .pxml files under the source control? or they will be generated at run time?
ThanksYup. Keep your mds folder under source control as well.
-
Please help me. I just cleaned the disk and, when I clicked to install new OS X mavericks a screen with apple id popped up and said that I need to put apple id that purchased the OS X.
How did youobtain OS X?
-
How to give more relevance to one of the column in multicolumn datastore
Hi Gurus,
While using multicolumn datastore needed to give more importance to one of the column than the other one. How can we achieve the same ?
SQL> create table test_sh4 (text1 clob,text2 clob);
Table created.
SQL> alter table test_sh4 add (text3 clob);
Table altered.
SQL> begin
2 ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
3 ctx_ddl.set_attribute
4 ('nd_mcd',
5 'columns',
6 'replace (text1, '' '', '''') nd, text1 text1,replace (text1, '' '', '''') nd, text1 text1');
7 ctx_ddl.set_attribute ('nd_mcd', 'delimiter', 'newline');
8 ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
9 ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+');
10 end;
11 /
PL/SQL procedure successfully completed.
SQL> create index IX_test_sh4 on test_sh4 (text3)
indextype is ctxsys.context
parameters
('datastore nd_mcd
lexer test_lex1')
/ 2 3 4 5 6
Index created.Here while querying how can I give more relevance to text1 column than text2 column ?Every time that you post code, whatever you are using eliminates all formatting and changes any multiple spaces to single spaces, so it makes it hard to tell what your code really is. Within the function, you need to remove the special characters and double spaces before you use the string for anything else. In the first part of your output string, you were only putting a % in front of the first word and after the last word. I fixed it so that it puts % before and after every word. I also added some code to return a score of 100 when an exact match is found in any column. You can use the function in a select from dual to see what it is returning. Please see the demonstration below. I will provide a copy of the function in a separate post that you can copy and paste. You may want to adjust the values that you multiply by. The values of 10 and 5 and .5 and .1 were just examples.
SCOTT@orcl_11gR2> create table test_sh (text1 clob,text2 clob);
Table created.
SCOTT@orcl_11gR2> alter table test_sh add (text3 clob);
Table altered.
SCOTT@orcl_11gR2> insert all
2 into test_sh (text1, text2, text3)
3 values ('staple card', 'word2', 'word3')
4 into test_sh (text1, text2, text3)
5 values ('word4', 'staple card', 'word5')
6 into test_sh (text1, text2, text3)
7 values ('staplecard', 'word2', 'word3')
8 into test_sh (text1, text2, text3)
9 values ('word4', 'staplecard', 'word5')
10 into test_sh (text1, text2, text3) values
11 ('Weber Genesis S-310 Gas Grill',
12 'Weber Genesis S-310 Gas Grill',
13 'Weber Genesis S-310 Gas Grill')
14 select * from dual
15 /
5 rows created.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
3 ctx_ddl.set_attribute
4 ('nd_mcd',
5 'columns',
6 'replace (text1, '' '', '''') nd1,
7 text1 text1,
8 replace (text2, '' '', '''') nd2,
9 text2 text2');
10 ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
11 ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+');
12 ctx_ddl.create_section_group ('test_sg', 'basic_section_group');
13 ctx_ddl.add_field_section ('test_sg', 'text1', 'text1', true);
14 ctx_ddl.add_field_section ('test_sg', 'nd1', 'nd1', true);
15 ctx_ddl.add_field_section ('test_sg', 'text2', 'text2', true);
16 ctx_ddl.add_field_section ('test_sg', 'nd2', 'nd2', true);
17 end;
18 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create index IX_test_sh on test_sh (text3)
2 indextype is ctxsys.context
3 parameters
4 ('datastore nd_mcd
5 lexer test_lex1
6 section group test_sg')
7 /
Index created.
SCOTT@orcl_11gR2> create or replace function text_format
2 (p_string in varchar2)
3 return varchar2
4 as
5 v_string varchar2 (32767);
6 v_string_out varchar2 (32767);
7 v_string_in1 varchar2 (32767);
8 v_string_in2 varchar2 (32767);
9 V_TOKEN VARCHAR2 (32767);
10 BEGIN
11 -- remove special characters and double spaces before using in anything else:
12 v_string := trim (translate (p_string, '/\|-_+&', ' '));
13 v_string := replace (v_string, '''', '');
14 while instr (v_string, ' ') > 0 loop
15 v_string := replace (v_string, ' ', ' ');
16 end loop;
17 -- fixed 2 lines below:
18 v_string_out := '(%' || replace (v_string, ' ', '% %') || '%) ' || ',';
19 v_string_out := v_string_out || '(' || v_string || ')' || ',';
20 -- first search string with spaces:
21 v_string_in1 := v_string || ' ';
22 -- second search string without spaces:
23 v_string_in2 := replace (v_string_in1, ' ', '') || ' ';
24 if v_string_in2 = v_string_in1 then
25 v_string_in2 := null;
26 end if;
27 -- format search string one token at a time:
28 while v_string_in1 is not null loop
29 v_token := substr (v_string_in1, 1, instr (v_string_in1, ' ') - 1);
30 v_string_out := v_string_out
31 || '('
32 || '?' || v_token || ' or '
33 || '!' || v_token || ' or '
34 || '$' || v_token
35 || '),';
36 v_string_in1 := substr (v_string_in1, instr (v_string_in1, ' ') + 1);
37 end loop;
38 while v_string_in2 is not null loop
39 v_token := substr (v_string_in2, 1, instr (v_string_in2, ' ') - 1);
40 v_string_out := v_string_out
41 || '('
42 || '%' || v_token || '% or '
43 || '?' || v_token || ' or '
44 || '!' || v_token || ' or '
45 || '$' || v_token
46 || '),';
47 v_string_in2 := substr (v_string_in2, instr (v_string_in2, ' ') + 1);
48 end loop;
49 -- return formatted string (added score of 100 for exact match in any column:
50 return
51 '(' || v_string || ') * 10 * 10 or
52 (' || rtrim (v_string_out, ',') || ' within text1) * 10 or
53 (' || rtrim (v_string_out, ',') || ' within nd1) * 5 or
54 (' || rtrim (v_string_out, ',') || ' within text2) * .5 or
55 (' || rtrim (v_string_out, ',') || ' within nd2) * .1';
56 end text_format;
57 /
Function created.
SCOTT@orcl_11gR2> show errors
No errors.
SCOTT@orcl_11gR2> select text_format ('STAPLE CARD') from dual
2 /
TEXT_FORMAT('STAPLECARD')
(STAPLE CARD) * 10 * 10 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin text1) * 10 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin nd1) * 5 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin text2) * .5 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin nd2) * .1
1 row selected.
SCOTT@orcl_11gR2> column text1 format a11
SCOTT@orcl_11gR2> column text2 format a11
SCOTT@orcl_11gR2> column text3 format a11
SCOTT@orcl_11gR2> SELECT SCORE(1), t.* FROM test_sh t
2 WHERE CONTAINS (text3, text_format ('STAPLE CARD'), 1) > 0
3 ORDER BY 1 DESC
4 /
SCORE(1) TEXT1 TEXT2 TEXT3
100 staple card word2 word3
100 word4 staple card word5
100 staplecard word2 word3
10 word4 staplecard word5
4 rows selected. -
Query to get the data of all the columns in a table except any one column
Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
For Example:
Let us consider the EMP table.,
From this table except the column comm all the remaining columns of the table should be listed
For this we can write a query like this..
Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
Is there any other way of writing the query to get the required result..?
Thanks..Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
If you really need to list all the columns for a table because you don't want to type them, just use something like...
SQL> ed
Wrote file afiedt.buf
1 select trim(',' from sys_connect_by_path(column_name,',')) as columns
2 from (select column_name, row_number() over (order by column_id) as column_id
3 from user_tab_cols
4 where column_name not in ('COMM')
5 and table_name = 'EMP'
6 )
7 where connect_by_isleaf = 1
8 connect by column_id = prior column_id + 1
9* start with column_id = 1
SQL> /
COLUMNS
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
SQL> -
How to make one of the columns in my tabular an text item with popup lov
Hello,
I want to manually make one of the columns say for the deptno in my tabular form as on text item popup lov using apex_item package
and whenever user clicks on the text item popup lov, it should open up an dept table report and from which he/she needs to select
the deptno and this deptno should be returned into the text item popup lov column.
like for example: say if i have an emp table tabular form with all the columns and deptno column as an popup lov and when user clicks on this column
it should open up an new sql report(similar to popup lov window), the select statement for this would be
select deptno,dname,loc from dept order by 1;
And from this popup lov report whenever an user selects a particular deptno, the same deptno should be returned to my text item popup column in emp tabular form.
something like this
select
"EMPNO",
"EMPNO" EMPNO_DISPLAY,
"ENAME",
"JOB",
"MGR",
"HIREDATE",
"SAL",
"COMM",
APEX_ITEM.TEXT(3,deptno,20,50,'readonly=true') || '<img height="16" align="middle" width="16" style="vertical-align: middle;" alt="Popup Lov" src="/i/lov_16x16.gif"/>' deptno
from "#OWNER#"."EMP"
like i made my column as an text item lov and now I want to write an onclick event for the text item lov so that an popup window is displayed which is a sql report of the table dept (select deptno,dname,loc from dept order by 1;) and in this report i want to make deptno as an link so that when ever an user clicks on it
-- this value should be returned to my text item popup lov column deptno in the emp tabular form.
can anyone help me out with this issue.
thanks,Hi,
Refer to the link for the detailed information on ALV Grid.
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Hope it helps.
Regards,
Rajesh Kumar
Edited by: Rajesh Kumar on May 25, 2009 9:13 AM -
Push button in one of the columns of Table Control
Hi,
I have a requirement, where i have to display a push button in one of the columns of table control for long text. When user clicks on the control, a pop up has to be appeared in which user should be able to enter some meaning ful description and save it. please suggest me how to do this requirement.
Best Regards,
Phani Kumar. SHai,
You can drag n drop a button to the required column in the table control and give the required parameters like ok_code , name etc.
You can now place a text field as the heading of the column.
Now when the user clicks the the button in a row, read the corresponding line in which he has clicked.For that u can use
get cursor lines wrk_line.
now u'll get the data in that row using
Read table it_tab into wa_tab index wrk_line.
now u can call the text editor (using FM's READ_TEXT ,EDIT_TEXT and CREATE_TEXT in which the user can enter the meaningful description and save it.
When u save the text entered save it with a key part of the row that was read earlier(keep it as the text name).
So now if u need to get the description which was entered earlier u can easily read the text (using READ_TEXT ).
I hope this will be helpful for u .
Thanks
Neeraj -
I am writing a database program and have come across this error -
ADO Error: 0x00000001
Argument error. One of the column names specified is blank.
I have tried everything I can think of and have no idea what to try next.
The VI that the error is occuring in (attached written in LV 2011) allows the user to enter in the details of a new user. It then looks up this user to get the ID (primary key) of the user which will be used in another step of the program. The VI writes to the database fine but then comes back with the above error when using the SELECT query. All columns in the database have data in them. Also when i use a differnt VI that just looks up the user/customer it works fine.
I have tried deleting all the code and copying the code from the simpler (look up only) VI but I still get the same error.
I created an indicator for the concatenated text to make sure the query was right and it appears to be fine. So now I am stumped. Any help would be greatly appreciated.
Thanks
Attachments:
AddNewMeasurer.vi 40 KBtripped wrote:
I am writing a database program and have come across this error -
ADO Error: 0x00000001
Argument error. One of the column names specified is blank.
I have tried everything I can think of and have no idea what to try next.
The VI that the error is occuring in (attached written in LV 2011) allows the user to enter in the details of a new user. It then looks up this user to get the ID (primary key) of the user which will be used in another step of the program. The VI writes to the database fine but then comes back with the above error when using the SELECT query. All columns in the database have data in them. Also when i use a differnt VI that just looks up the user/customer it works fine.
I have tried deleting all the code and copying the code from the simpler (look up only) VI but I still get the same error.
I created an indicator for the concatenated text to make sure the query was right and it appears to be fine. So now I am stumped. Any help would be greatly appreciated.
Thanks
The query "appears" fine. Well, obviously it isnt' fine. The database is telling you that.
What is the SELECT query you are sending? -
How to get the column name and table name with value
Hi All
I have one difficult requirement
I have some column values and they have given some alias column names but i need to find the correct column name and table name from the database.
For example value is "SRI" and i dont know the table and exact column name so is there any possibilities to find the column name and table name for the given value
Thanks & Regards
Srikkanth.MSearching all the database for a word...
Courtesy of michaels...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
11g upwards
SQL> select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('EMP', 'DEPT')),
xmltable (str columns result varchar2(10) path '.')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME es RESEARCH
EMP ENAME es JAMES
EMP JOB es SALESMAN
EMP JOB es SALESMAN
4 rows selected.
Maybe you are looking for
-
hp laserjet 2727 nf driver in osx lion does not work, It crashes the application and sends an error message?
-
TS1424 i bought some music and now it wont play
i bought some music and it wont play
-
Sleep button is stuck won't press down
My power/sleep/screen lock button on the top of my iphone 4 won't work unless I push down REALLY hard on it! It no longer has that springy clicky push to it anymore, it kind of just lays there and looks like it has sunk in a bit I have no idea why it
-
Hi all, Iam getting error like Requested Paremeter does not exist in SLG1 while creating log. Please give me some ideas to solve this issue.. Thanks in advance.......
-
Help - Opening Logic 3.5 song in Logic Pro
Hello I am desperately needing to open a Logic 3.5 song in Logic 9. Does anyone run Logic 5 or earlier who can do me a quick transfer, or even export a midi file? Looking forward to your reply George