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
Similar Messages
-
Can anyone assist witth the following query
What determins order photos are transferred, my photos have been numbered and appear in the correct order on the laptop but transfer in a random order in some albums irrespective of title or date taken.
Can i alter any setting to ensure photos will transfer in a logical order to track the history of the events in any particular album folder.Thanks for this, I have checked the dates in case the camera settings had been lost unfortunatly in this instance all pics are dated in correct order but not transferred in date order, or date modified order, or is the date config based on US date atyle?
-
How to convert simple SQL Select statements into Stored Procedures?
Hi,
How can I convert following SELECT statement into a Stored Procedure?
SELECT a.empno, b.deptno
FROM emp a, dept b
WHERE a.deptno=b.deptno;
Thanking in advance.
Wajidstored procedure is nothing but a named PL/SQL block
so you can do it like this see below example
SQL> create or replace procedure emp_details is
2 cursor c1 is SELECT a.empno, b.deptno
3 FROM scott.emp a, scott.dept b
4 WHERE a.deptno=b.deptno;
5 begin for c2 in c1
6 LOOP
7 dbms_output.put_line('name is '||c2.empno);
8 dbms_output.put_line('deptno is ' ||c2.deptno);
9 END LOOP;
10 END;
11 /
Procedure created.and to call it use like below
SQL> begin
2 emp_details;
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> set serveroutput on;
SQL> /
empno is 7839
deptno is 10
empno is 7698
deptno is 30
empno is 7782
deptno is 10
empno is 7566
deptno is 20
empno is 7654
deptno is 30
empno is 7499
deptno is 30
empno is 7844
deptno is 30
empno is 7900
deptno is 30
empno is 7521
deptno is 30
empno is 7902
deptno is 20
empno is 7369
deptno is 20
empno is 7788
deptno is 20
empno is 7876
deptno is 20
empno is 7934
deptno is 10Edited by: Qwerty on Sep 17, 2009 8:37 PM -
How to write select statement into SCRIPT editor
hello,
i build a sap script for purchase order printing for exporting.
now after all po order print fine then our client want some more should be print into layout regarding po header.
At the soul my q is can i write select query into script editor itself.
thanks and regards
amit.You cannot write your select statement inside your SAPscript, to overcome this SAP has provided us an option of calling sub-routines.. go through the below example
Go through this example
Ex. SAPSCRIPT
/: PERFORM <Subroutine name> IN PROGRAM <subroutine prog name>
/:USING &<field name>&
/:CHANGING &<field name1& "It will be returned back from sub-routine
/:ENDPERFORM
Then create subroutine pool program(of your own name) and you have to write the code.
FORM ><subroutine name> tables int_cond structure itcsy
outt_cond structure itcsy.
data : value(20), value1(20). "do your own declarations
Read int_cond table index 1.
value = int_cond-value.
value1 = value1 + value.
*****Write your select statement
Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.
ENDFORM.
Just rough idea given above.
Regards,
SaiRam -
Getting result of dynamic select statement into variable
I have a function that builds a dynamic sql statement. I then want to take the result of that statement and insert it into a variable. I have tried this
execute immediate strSQL USING OUT intCounter;but that is giving me an error on that line of code. The SQL is a select count(*) and works fine. It is just how to get it into the variable that is tripping me up.
Thanks,
EvaSure. Version 11g. The complete procedure reads as follows:
CREATE OR REPLACE FUNCTION VALIDATIONQUESTIONRESULT
p_ShortName VARCHAR2,
p_SiteID VARCHAR2
RETURN NUMBER IS
strSQL VARCHAR2(5000);
strTableName VARCHAR2(200);
strPatIDFieldName VARCHAR2(200);
intCounter NUMBER;
BEGIN
select VALIDATIONSQL into strSQL from vwvalidationquestions where upper(shortname) = upper(p_ShortName);
select
case UPPER(DBTABLENAME)
when 'CPTICODES' then 'CPTIPATID'
when 'CPTIICODES' then 'CPTIIPATID'
when 'DEMOGRAPHICS' then 'PATID'
when 'FAMILYHISTORY' then 'FHPATID'
when 'GCODES' then 'GCODEPATID'
when 'HOSPITALIZATION' then 'HPATID'
when 'MEDICALHISTORY' then 'MHPATID'
when 'MEDICATIONS' then 'MPATID'
when 'PROCEDURES' then 'PPATID'
when 'VISITS' then 'VPATID' end into strPatIDFieldName
from DATASPECIFICATIONS where UPPER(SHORTNAME) = UPPER(p_ShortName);
strSQL := strSQL||' and '||strPatIDFieldName||' in (select PATID from DEMOGRAPHICS where PARTICID = '||p_SiteID||');';
execute immediate strSQL into intCounter;
return intCounter;
END VALIDATIONQUESTIONRESULT; strSQL when checked builds perfectly. I get 100% what I expect from it. An example of what I am getting from strSQL is:
select count(*) from Procedures where TO_CHAR(ProcdDt, 'MM') = TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'MM') and TO_CHAR(ProcdDt, 'YYYY') = TO_CHAR(ADD_MONTHS(SYSDATE, -12), 'YYYY') and PPATID in (select PATID from DEMOGRAPHICS where PARTICID = 12);I am getting the number I would expect from this. I just need to put that number into intCounter. I tried altering strSQL so it looked like this:
select count(*) into intCounter from Procedures where TO_CHAR(ProcdDt, 'MM') = TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'MM') and TO_CHAR(ProcdDt, 'YYYY') = TO_CHAR(ADD_MONTHS(SYSDATE, -12), 'YYYY') and PPATID in (select PATID from DEMOGRAPHICS where PARTICID = 12);but that gave me an error on the execute immediate line as well.
Sorry, I thought it would be simple so that was why I only put that bit of info. I guess it is more complicated than it at first appeared!
Eva -
How to convert this select statement into update
Hai All
I have two table Namely Daily_attend , Train_mast
Daily_attend Consist Of fields are Train_mast consist Of fields are
Name varchar Train no var
Empcode Num T_date date
Intime Date Train_name var
Outtime date Late_hrs var
IND_IN Number
IDE_OUT Number
Attend_date date
I need to update IDE_IN In Daily_attend table Depend upon late_hrs in the Train_mast table
I have got Through in select statement This is my select statement
select to_number(TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')+late_hrs/(24*60)-intime
) * 24*60 from dail_Att,train_mast;
How can i convert it to update
Any help is highly appricateable
Thanks In Advance
Regards
Srikkanth.MSrikkanth,
Try this code. And 1 more thing, i can't see any WHERE condition to join between the 2 tables DAIL_ATT, TRAIN_MAST.
UPDATE DAIL_ATT A SET A.IDE_IN = (SELECT TO_NUMBER(TO_DATE(TO_CHAR(INTIME, 'DD-MON-YYYY')|| ' ' || TO_CHAR(0815, '0000'), 'DD-MON-YYYY HH24:MI') + LATE_HRS / (24 * 60) - INTIME) * 24 * 60 FROM TRAIN_MAST B WHERE <condition>);Regards,
Manu.
If my response or the response of another was helpful or Correct, please mark it accordingly -
To Determine latest 3 entries in a table
Hello All,
I have a table with the stucture
Table A
PK_ID NUMBER,
Name_ID_FK Number,
Entry_Date Date // Where Entry date is date the row is inserted
This might have data like
1,1,12/12/2001
2,1,12/13/2001
3,2,12/14/2001
4,2,12/15/2001
5,4,12/16/2001
6,5,12/17/2001
and so on...
I want to determine the last (latest) 3 unique entries
i.e in the above case that should return
Name_ID_FK 2,4 and 5
Any help is appreciated.
Thanks in advance,
Sudhindrasql>select * from a;
PK_ID NAME_ID_FK ENTRY_DATE
1 1 12/12/2001
2 1 12/13/2001
3 2 12/14/2001
4 2 12/15/2001
5 4 12/16/2001
6 5 12/17/2001
6 rows selected.
sql>select distinct name_id_fk
2 from (select name_id_fk
3 from a
4 order by entry_date desc)
5 where rownum <= 3;
NAME_ID_FK
2
4
5
3 rows selected.
-- What if name_id_fk = 2 has the two most recent dates?
sql>update a set entry_date = entry_date + 10 where name_id_fk = 2;
2 rows updated.
sql>select distinct name_id_fk
2 from (select name_id_fk
3 from a
4 order by entry_date desc)
5 where rownum <= 3;
NAME_ID_FK
2
5
-- Should this now return just 2 rows? What is the rule?
2 rows selected. -
Converting SELECT Statement into UPDATE
Hi All,
Running SQL Server 2008 R2. I have the following SELECT query, which is returning the desired results.
SELECT DISTINCT
[x].[AccountNo],
[x].[AvgAccountLen],
CASE
WHEN LEN([AccountNo]) > 6 THEN LEFT([AccountNo], 6)
ELSE [AccountNo] + REPLICATE('0', [AvgAccountLen] - LEN([AccountNo]))
END AS [NewAccountNo]
FROM
SELECT DISTINCT
[AccountNo],
SELECT TOP 1
LEN([AccountNo])
FROM
[dbo].[Table]
WHERE
[AccountNo] > 0
GROUP BY
[AccountNo]
ORDER BY
COUNT(*) DESC
) AS [AvgAccountLen]
FROM
[dbo].[Table]
) AS [x]
WHERE
LEN([AccountNo]) <> [AvgAccountLen]
Below are results, which again are what I'm looking for.
AccountNo AvgAccountLen NewAccountNo
4200 6 420000
4250 6 425000
42000 6 420000
4030 6 403000
4460 6 446000
4250000 6 425000
4520000 6 452000
Long story short is that I've been left to clean up a partially-completed task. I need to conduct an update on Table that pads (or trims) the account numbers accordingly. Further, this process affects multiple entities which is why I can't simply
use a static pad/trim value of 6 (this particular entity returns 6, there could be other entities with 4, 8, etc.). AvgAccountLen may not be the most appropriate column name either - it's a representation of the most frequently-occurring value length
(I have already confirmed that the result returned for this value is correct in each entity). How would I go about writing a UPDATE statement to accomplish this?
Any help is greatly appreciated!
Best Regards
BradCan you provide your example data as a table to compliment your expected result?
I'm thinking something like this may help:
DECLARE @accounts TABLE (accountNo INT, avgAccountLen INT, newAccountNumber INT)
INSERT INTO @accounts (accountNo, avgAccountLen) VALUES
(4200 , 6),
(4250 , 6),
(42000 , 6),
(4030 , 6),
(4460 , 6),
(4250000, 6),
(4520000, 6)
UPDATE @accounts
SET newAccountNumber = LEFT(CAST(accountNo AS VARCHAR)+REPLICATE('0',avgAccountLen),avgAccountLen)
FROM @accounts
SELECT *
FROM @accounts
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question. -
Select data into LOV as Multi Column form a Single Column Table
Table: CALL_DETAILS
FLT_NO CALL_NO LOCATION DATE_ARRIVAL PRV_FLT_NO
FLT01 1 DXB 01/07/07 FLT00
FLT01 2 TIL 02/07/07 FLT00
FLT01 3 HKG 03/07/07 FLT00
FLT01 4 SIN 04/07/07 FLT00
FLT01 5 DXB 05/07/07 FLT00
FLT02 1 DXB 05/07/07 FLT01
FLT02 2 TIL 06/07/07 FLT01
FLT02 3 HKG 07/07/07 FLT01
FLT02 4 SIN 08/07/07 FLT01
FLT02 5 DXB 09/07/07 FLT01
FLT03 1 DXB 09/07/07 FLT02
FLT03 2 TIL 10/07/07 FLT02
FLT03 3 HKG 11/07/07 FLT02
FLT03 4 SIN 12/07/07 FLT02
FLT03 5 DXB 13/07/07 FLT02Above is my Table & Data
I want a query to populate like blow after selecting 2 LOCATIONS.
LOC 1 = DXB
LOC 2 = HKG
LOV Data........
FLT01 DXB 01/07/07 HKG 03/07/07
FLT02 DXB 05/07/07 HKG 07/07/07
FLT03 DXB 09/07/07 HKG 11/07/07On the form the user will type LOC_1 and LOC_2. Then on the next field the user have to select the
available Flight Details between LOC_1 and LOC_2. May through a LOV the Flight_Details to be populated.
Also there will be a possibility to have the Locations like below
LOC 1 = SIN
LOC 2 = TIL
LOV Data........
FLT01 SIN 04/07/07 TIL 06/07/07
FLT02 SIN 08/07/07 TIL 10/07/07Another go, including an extra flight which is not connected to the first. Original query would break with this data. It would be better if you could structure your data so that flights were grouped into logical services instead of using the previous flights column.
WITH data AS(
SELECT 'FLT01' FLT_NO, 1 CALL_NO, 'DXB' LOCATION, To_Date('01/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 1.5 CALL_NO, 'DXB' LOCATION, To_Date('01/07/07 12','DD/MM/YY HH') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 2 CALL_NO, 'TIL' LOCATION, To_Date('02/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 2.5 CALL_NO, 'HKG' LOCATION, To_Date('02/07/07 12','DD/MM/YY HH') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 3 CALL_NO, 'HKG' LOCATION, To_Date('03/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 4 CALL_NO, 'SIN' LOCATION, To_Date('04/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT01' FLT_NO, 5 CALL_NO, 'DXB' LOCATION, To_Date('05/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT00' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT02' FLT_NO, 1 CALL_NO, 'DXB' LOCATION, To_Date('05/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT01' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT02' FLT_NO, 2 CALL_NO, 'TIL' LOCATION, To_Date('06/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT01' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT02' FLT_NO, 3 CALL_NO, 'HKG' LOCATION, To_Date('07/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT01' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT02' FLT_NO, 4 CALL_NO, 'SIN' LOCATION, To_Date('08/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT01' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT02' FLT_NO, 5 CALL_NO, 'DXB' LOCATION, To_Date('09/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT01' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT03' FLT_NO, 1 CALL_NO, 'DXB' LOCATION, To_Date('09/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT02' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT03' FLT_NO, 2 CALL_NO, 'TIL' LOCATION, To_Date('10/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT02' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT03' FLT_NO, 3 CALL_NO, 'HKG' LOCATION, To_Date('11/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT02' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT03' FLT_NO, 4 CALL_NO, 'SIN' LOCATION, To_Date('12/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLT02' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLT03' FLT_NO, 5 CALL_NO, 'DXB' LOCATION, To_Date('13/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLTXX' FLT_NO, 1 CALL_NO, 'DXB' LOCATION, To_Date('14/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLTXX' FLT_NO, 2 CALL_NO, 'TIL' LOCATION, To_Date('15/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLTXX' FLT_NO, 3 CALL_NO, 'HKG' LOCATION, To_Date('16/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLTXX' FLT_NO, 4 CALL_NO, 'SIN' LOCATION, To_Date('17/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual UNION ALL
SELECT 'FLTXX' FLT_NO, 5 CALL_NO, 'DXB' LOCATION, To_Date('18/07/07','DD/MM/YY') DATE_ARRIVAL, 'FLTAA' PRV_FLT_NO FROM dual
SELECT flt_no, f_location, f_date, t_location, t_date
--,rn_from, rn_to
FROM(
SELECT
tfrom.flt_no,
tfrom.location f_location,
tfrom.date_arrival f_date,
tto.location t_location,
tto.date_arrival t_date,
Row_Number() over(PARTITION BY tto.date_arrival ORDER BY tfrom.date_arrival DESC) rn_from,
Row_Number() over(PARTITION BY tfrom.date_arrival ORDER BY tto.date_arrival ASC) rn_to
FROM
(SELECT DISTINCT sys_connect_by_path(flt_no,'/') flts FROM data CONNECT BY PRIOR prv_flt_no = flt_no) service,
(SELECT * FROM data d1 WHERE call_no != (SELECT Max(call_no) FROM data WHERE flt_no = d1.flt_no)) tfrom,
(SELECT * FROM data d1 WHERE call_no != (SELECT Max(call_no) FROM data WHERE flt_no = d1.flt_no)) tto
WHERE tfrom.location = 'SIN'--'DXB'
AND tto.location = 'TIL'--'HKG'
AND tto.date_arrival > tfrom.date_arrival
AND InStr(service.flts,tfrom.flt_no) > 0
AND InStr(service.flts,tto.flt_no) > 0
WHERE rn_from = 1
AND rn_to = 1
ORDER BY 1,3; -
Is possible to connect the 2 SELECTS statements into 1 for my stored procdr
ELSE IF(@number = 2)
BEGIN
SELECT COUNT([outlet #])
FROM OM
WHERE [address] LIKE '%' + @address + '%';
SELECT [outlet #], [name], address, [city/town], [postal code], telephone
FROM OM
WHERE address LIKE '%' + @address + '%'
END
Would it be possible to obtain the # of records and records in one shot
Thank u for your timeI suppose it depends on what you are really talking about, and what database and driver you are using.
A statement can return more than one result set - see Statement.getMoreResults(). -
Is it possible to convert only select statement into procedure in Oracle
Hi, Just i wanted to convert the below query in to procedure.Procedure input is 'P.Column1'
SELECT
P.Column1 AS PRODUCT,
D.Column2 AS Column2N,
D.Column3 AS LongColumn2iption,
P.Column4 AS PRODUCICE,
D.Column5 AS BilliuctID,
E.Column6 As Impaenue,
C.Column7 AS EffecDATE,
FROM Table1 P, Table2 D,Table3 E,Table4 C
WHERE
P.Column1=D.Column1 and
P.Column1=C.PROD_COMPONENT_ID and
P.SETID=D.SETID and
D.Setid =E.Setid and
P.Setid =E.Setid and
P.Setid =C.Setid and
D.Column1=E.Column1 and
P.Column1=E.Column1 and
C.Column1<>'CONSUMER TARIFFS' and
P.Column1 in('')Something like:
SQL> var my_Data refcursor
-- Anonymous block
SQL> begin
2 open :my_data for select 1,2 from dual;
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> print :my_Data
1 2
1 2You can then convert the above anonymous block in to a procedure. -
Table Maintenance: Manual Transport for Entries in Customizing Table
Dear forum,
i'm facing a tricky problem at the moment. My customer wants the maintain a customizing table, but he does not want to transport the entries automatically (don't ask me for the reason), but manually.
The online help tells me, that this can be done.
In the SE11 i chose untilities -> table maintenance generator and for the subscreen "dialog data transport details" i chose "no or user, recording routine".
Continuing wiht the SE11 i chose untilities -> table maintenance generator -> environment -> maintenance objects -> transport "manual transport".
In the SE54 i created the events 10, 11 and 12 with the recommended coding from the online help.
But when i start the Maintenance via SM30 the points in the menue table view -> transport or edit -> transport are not active.
The function group does not include any generated statuses to activate the menue-points. What is missing toi get the popup, that asks me for the transport number?
Can somebody help me out or tried this before?
With kindly Regards,
Robertwrong!
the online documentation says:
Manual transport
The object maintenance transaction offers a manual link to transports. You can branch to it by selecting the Transport menu option. In the transport session, you can then select objects to place them in a Change request. A special transport program may be available instead of the menu option Transport, to place the object in a change request. The setting Manual transport means that changes to the object are not automatically recorded. If the maintenance transaction offers an automatic transport link, in addition to the manual one, you should select the setting Automatic transport.
What has to be done to realise it except creating the events? -
Doubt about Select statement.
Hi folks!!
I have a few doubts about the select statements, it may be a silly things but its useful for me.
what is difference between below statment.
1)SELECT * FROM TABLE.
2)SELECT SINGLE * FROM TABLE
3)SELECT SINGLE FROM TABLE.
Hope i will get answer,thanks in advance.
Regards
Richie..Hi,
try this and if possible use sap help.i mean place the cursor on select and press F1.
Types of select statements:
1. select * from ztxlfa1 into table it.
This is simple select statement to fetch all the data of db table into internal table it.
2. select * from ztxlfa1 into table it where lifnr between 'V2' and 'V5'.
Thisis using where condition between v2 and v5.
4. select * from ztxlfa1 where land1 = 'DE'. "row goes into default table work Area
5. select lifnr land1 from ztxlfa1
into corresponding fields of it "notice 'table' is omitted
where land1 = 'DE'.
append it.
endselect.
Now data will go into work area. and then u will add it to internal table by
append statement.
6. Table 13.2 contains a list of the various forms of select as it is used with internal tables and their relative efficiency. They are in descending order of most-to-least efficient.
Table 13.2 Various Forms of SELECT when Filling an Internal Table
Statement(s) Writes To
select into table it Body
select into corresponding fields of table it Body
select into it Header line
select into corresponding fields of it Header line
7. SELECT VBRK~VBELN
VBRK~VKORG
VBRK~FKDAT
VBRK~NETWR
VBRK~WAERK
TVKOT~VTEXT
T001~BUKRS
T001~BUTXT
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM VBRK
INNER JOIN TVKOT ON VBRKVKORG = TVKOTVKORG
INNER JOIN T001 ON VBRKBUKRS = T001BUKRS
WHERE VBELN IN DOCNUM AND VBRK~FKSTO = ''
AND VBRK~FKDAT in date.
Select statement using inner joins for vbrk and t001 and tvkot table for this case based on the conditions
8. SELECT T001W~NAME1 INTO TABLE IT1_T001W
FROM T001W INNER JOIN EKPO ON T001WWERKS = EKPOWERKS
WHERE EKPO~EBELN = PURORD.
here selecting a single field into table it1_t001winner join on ekpo.
9. SELECT BUKRS LIFNR EBELN FROM EKKO INTO CORRESPONDING FIELDS OF IT_EKKO WHERE EBELN IN P_O_NO.
ENDSELECT.
SELECT BUTXT FROM T001 INTO IT_T001 FOR ALL ENTRIES IN IT_EKKO WHERE BUKRS = IT_EKKO-BUKRS.
ENDSELECT.
APPEND IT_T001.
here I am using for all entries statement with select statement. Both joins and for all entries used to fetch the data on condition but for all entries is the best one.
10. SELECT AVBELN BVTEXT AFKDAT CBUTXT ANETWR AWAERK INTO TABLE ITAB
FROM VBRK AS A
INNER JOIN TVKOT AS B ON
AVKORG EQ BVKORG
INNER JOIN T001 AS C ON
ABUKRS EQ CBUKRS
WHERE AVBELN IN BDOCU AND AFKSTO EQ ' ' AND B~SPRAS EQ
SY-LANGU
AND AFKDAT IN BDATE AND AVBELN EQ ANY ( SELECT VBELN FROM
VBRP WHERE VBRP~MATNR EQ ITEMS ).
Here we are using sub query in inner join specified in brackets.
Thanks,
chandu. -
How to add a dummy row in the result set of a SELECT statement.
Hello Everyone -
I have requirment to add a dummy row in the result set of a SELECT statement.
For e.g. lets say there is a table Payment having following colums:
Payment_id number
status varchar2(10)
amount number
payment_date date
so here is the data :-
Payment_id Status Amount payment_date
1 Applied 100 12/07/2008
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
Here is my SQL
Select * form payment where payment_date >= 01/01/2009
Output will be
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
My desired output is below
2 Reversed 200 01/ 06/2009
3 Applied 300 01/ 07/2009
2 Reversed -200 01/ 06/2009 ------(Dummy Row)
Thrid row here is the dummy row which I want to add when status is "Reversed"
I would be very thankful for any kind of help in this regard ...
Thanks,
GauravCartesion joining against a dummy table is a useful method of creating a dummy row:
with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
--- end of mimicking your table
dummy as (select 'Reversed' col1, 1 rn from dual union all
select 'Reversed' col1, 2 rn from dual)
select mt.cust_id,
mt.payment_id,
mt.status,
decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
mt.payment_date
from my_tab mt,
dummy
where mt.status = dummy.col1 (+)
order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
CUST_ID PAYMENT_ID STATUS AMOUNT PAYMENT_DATE
1 1 Applied 100 07/12/2008
1 2 Reversed 200 06/01/2009
1 2 Reversed -200 06/01/2009
1 3 Applied 300 06/01/2009
2 1 Applied 100 07/12/2008
2 2 Reversed 200 05/01/2009
2 2 Reversed -200 05/01/2009
2 3 Applied 300 06/01/2009
2 4 Reversed -400 06/01/2009
2 4 Reversed 400 06/01/2009
2 5 Applied 500 07/01/2009Edited by: Boneist on 07-Jan-2009 23:10
NB. You may have to mess around with the ordering if that's not come back in the order you wanted. You didn't mention what the rules were for any expected ordering though, so I've made up my own *{;-)
Also, I added an identifier (cust_id) to differentiate between different sets of payments, since that's usually the case. Remove that if it's not applicable for your case. -
Database hints in select statement
Hi all,
i need to apply the databaser hints for my select statement where i am using for all entries clause .But the issue is that i am getting the dump when i am tring with the same .
If i use the hint without all entries clause ,it runs fine.
The query where i need to apply the hint is :
SELECT * FROM bsim "n443935
INTO CORRESPONDING FIELDS OF TABLE g_t_bsim_lean "n443935
FOR ALL ENTRIES IN t_bwkey WHERE bwkey = t_bwkey-bwkey
AND matnr IN matnr
AND bwtar IN bwtar
AND budat >= datum-low.
and the DB hint is:
Addition of database hints for DB6 as per OSS message 649621
%_HINTS
DB6 'USE_OPTLEVEL 7' " Insert CR-1000000473 Tr-D11K934315
DB6 '&SUBSTITUTE VALUES&'.
Let me know whats the issue for the dump in for all entries in clause.Did you check if [https://service.sap.com/sap/support/notes/1520152|https://service.sap.com/sap/support/notes/1520152] applies?
Maybe you are looking for
-
Oracle stored Procedure and Packages in CR4E
Hi, I want to use Stored Procedure in CR4E. I don't know how to use Stored Procedures and packages in Crystal Reports for Eclipse. In the data source explorer I can only see the Tables, Views and Stored Procedures but not packages from my Schema and
-
MX7 multiple instance jdbc data sources
The data sources on my single instance install of MX7 (Solaris9, Oracle9i), using jdbc, worked just fine. In a single instance install, the environment variables needed for jdbc (ORACLE_HOME, TNS_ADMIN, etc.) go in the start script $CF_DIR/bin/coldfu
-
Variable usage in TestStand expression statements
I am trying to implement the following: Locals.tot_power= (Locals.tot_power+ 10E Locals.reading) as an expression in TestStand, it doesnt accept the variable locals.reading for the exp power. Is it possible to do this somehow? Solved! Go to Solution.
-
International Keyboard issues in IChat Sharing
Hi, I'm absolutely loving the new screen sharing built into Leopard, however we have encountered a bit of an issue. My colleague is in the UK and has a British keyboard, whilst I'm in Belgium with a Belgian keyboard. When I take control of his screen
-
OS 9 - How to Install this Pesty Thing
Hello All, I have been extremely annoyed the past few weeks trying to find out how to install Classic OS 9 on my iBook G4 (PowerPC processor). Currently, I have Tiger 10.4.8 installed - which I had to buy separately, as this laptop was refurbished an