How to get particular record in last
Hi,
I want query for if existing particular record whenever come as a last record.
Ex,
name
s
t
h
but t always comes last record. how to i get?
Thanks,
Dhamu.
816776 wrote:
Hi,
I want query for if existing particular record whenever come as a last record.
Ex,
name
s
t
h
but t always comes last record. how to i get?
Thanks,
Dhamu.Your question makes no sense (and yes we can excuse the fact that English is not your first language).
What determines if a record is "existing"? All the records exist, so there must be something else.
For example if a record is determined as "existing" because it exists on another table you could left outer join to that table which then gives all the records from your first set of data and puts any that exist in the second set of data at the end in terms of ordering...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 's' as name from dual union all
2 select 't' as name from dual union all
3 select 'h' as name from dual)
4 -- Records to compare against.
5 ,t2 as (select 't' as name from dual)
6 --
7 -- END OF TEST DATA, JUST USE QUERY BELOW AGAINST YOUR OWN TABLE
8 --
9 select t.name
10 from t left outer join t2 on (t.name = t2.name)
11* order by t2.name nulls first, t.name
SQL> /
N
h
s
t
SQL>
Similar Messages
-
How to get footer only in last page of report
anybody tell me
1).how to get footer only in last page while we are displaying reports
and header only in first page .
2) how to create search help and how to use it .
3) how to create lock objects and how can we use itHi
This posting has an example of using a splitter container:
Changing width of a custom container dynamically
This posting has a discussion about using TOP-OF-PAGE:
Display Page numbers in ALV
This posting has an example of using picture control:
Insert picture in selection screen.
This posting has an example of putting a picture on top of an ALV grid:
Logo in OO ALV Grid
The page footer is defined using the statement END-OF-PAGE.
The processing block following END-OF-PAGE is processed only if you reserve lines for the footer in the LINE-COUNT option of the REPORT statement.
<u><b>CREATION:</b></u>
Go to SE11 Tcode
select search help
give the 'z' search help name and create
select the selection method ur table name eg : 'mara'
dialog module 'display value immediately'.
add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
where left position when displaying and spos = search position
and then save and activate ..
<b>Creating Search Help:</b>
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_basic.htm
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_imp.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee2b446011d189700000e8322d00/frameset.htm
A lock object is a virtual link of several SAP tables which is used to synchronize simultaneous access by two users to the same set of data ( SAP lock concept).
Locks are requested and released in the programming of online transactions by calling certain function modules which are automatically generated from the definition of the lock objects. These lock objects must be explicitly created in the ABAP Dictionary.
<b>To set locks, you must perform the following steps:</b>
1. You must define a lock object in the ABAP Dictionary. The name of the lock object should begin with E.
2. The function modules for requesting and releasing locks which are created automatically when the lock object is activated must be linked to the programming of the relevant online transactions.
<u><b>Reasons for Setting Locks</b></u>
Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.
<u><b>Lock Mechanisms in the Database System</b></u>
The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
<u><b>SAP Locks</b></u>
To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.
<u><b>Lock Types</b></u>
There are two types of lock in the R/3 System:
<u><b>
Shared lock</b></u>
Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.
<u><b>Exclusive lock</b></u>
Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.
example uses the lock object ESFLIGHT and its function modules ENQUEUE_ESFLIGHT and DEQUEUE_ESFLIGHT to lock and unlock the object.
For more information about creating lock objects and the corresponding function modules, refer to the Lock objects section of the ABAP Dictionary documentation.
The PAI processing for screen 100 in this transaction processes the user input and prepares for the requested action (Change or Display). If the user chooses Change, the program locks the relevant database object by calling the corresponding ENQUEUE function.
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'SHOW'....
WHEN 'CHNG'.
* <...Authority-check and other code...>
CALL FUNCTION 'ENQUEUE_ESFLIGHT'
EXPORTING
MANDT = SY-MANDT
CARRID = SPFLI-CARRID
CONNID = SPFLI-CONNID
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID
TYPE 'E'
NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
The ENQUEUE function module can trigger the following exceptions:
FOREIGN_LOCK determines whether a conflicting lock already exists. The system variable SY-MSGV1 contains the name of the user that owns the lock.
The SYSTEM_FAILURE exception is triggered if the enqueue server is unable to set the lock for technical reasons.
At the end of a transaction, the locks are released automatically. However, there are exceptions if you have called update routines within the transaction. You can release a lock explicitly by calling the corresponding DEQUEUE module. As the programmer, you must decide for yourself the point at which it makes most sense to release the locks (for example, to make the data available to other transactions).
If you need to use the DEQUEUE function module call several times in a program, it makes good sense to write it in a subroutine, which you then call as required.
The subroutine UNLOCK_FLIGHT calls the DEQUEUE function module for the lock object ESFLIGHT:
FORM UNLOCK_FLIGHT.
CALL FUNCTION 'DEQUEUE_ESFLIGHT'
EXPORTING
MANDT = SY-MANDT
CARRID = SPFLI-CARRID
CONNID = SPFLI-CONNID
EXCEPTIONS
OTHERS = 1.
SET SCREEN 100.
ENDFORM.
You might use this for the BACK and EXIT functions in a PAI module for screen 200 in this example transaction. In the program, the system checks whether the user leaves the screen without having saved his or her changes. If so, the PROMPT_AND_SAVE routine sends a reminder, and gives the user the opportunity to save the changes. The flight can be unlocked by calling the UNLOCK_FLIGHT subroutine.
MODULE USER_COMMAND_0200 INPUT.
CASE OK_CODE.
WHEN 'SAVE'....
WHEN 'EXIT'.
CLEAR OK_CODE.
IF OLD_SPFLI NE SPFLI.
PERFORM PROMPT_AND_SAVE.
ENDIF.
PERFORM UNLOCK_FLIGHT.
LEAVE TO SCREEN 0.
WHEN 'BACK'....
<b>
Another Example</b> :
please see this link with Screen shot .....
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
Reward all helpfull answers
Regards
Pavan -
How to get latest record on top of the result list
Hi Gurus,
How to get latest record on top of the result list when you open the record.
saved data method in BT120H_CPL of OverView page and result list in ICCMP_INBOX.
Regards,
RaviHi
Try sort descending by on fileld "changed at ".
manipulate the sort depends on your requirement
Regards
Logu -
How to get multiple records using fn-bea:execute-sql()
Hi,
I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
Regards,
Nagaraju
Edited by: user10373980 on Sep 29, 2008 6:11 AMHi,
Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
For example:
fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
Id Name
01 XXX
02 YYY
03 ZZZ
I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
<student>
<Name>XXX</Name>
</student>
I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
Please suggest.
regards,
Venkat -
How to get current month and last month dynamically??
how to get current month and last month dynamically
like
month = getCurrentMonth();
lastmonth = getcurrentMonth() -1;
please help
thankshi :-)
/* depracated but can be still useful */
java.util.Date dtCurrent = new java.util.Date();
int month = dtCurrent.getMonth();
int lastmonth = dtCurrent.getMonth() - 1;
System.out.println("* " + month);
System.out.println("* " + lastmonth);
/* better to use this one */
Calendar cal = new GregorianCalendar();
int imonth = cal.get(Calendar.MONTH);
int ilastmonth = cal.get(Calendar.MONTH) - 1;
System.out.println("*** " + imonth);
System.out.println("*** " + ilastmonth);
regards, -
i accidently lost my ipad's photos when i got the new OS. How to get them back? (last backup contained my photos)
I just restaured backup and bingo!! all my photos came back
-
How to get the records of the particluar day when delta laod failed (Urgent
Hello BW Gurus,
We are facing one serious issue. Here is the scenario.
1st time the Delta was init and for next consective two loads delta ran sucessfully... then next time delta got failed and the status is in red..... even though system started next delta loading and it has fetched the records and status is in green but not activated ,,,,,its happening still past one month so almost there are 20 requests which are to be get activatetd.
How to resolve this issue.
<b>And how to get the records of the partilcular day when the delta got failed.
</b>
Anyone have come across with this strange issue then help me out and i will rewarrd the points.
Urs,
Raki.Hi
Can you provide more details about your extractor and data targets.
Are you loading delta to an ODS ??
If you are loading to an ODS, The only solution i can see is to get the missing delta records via FULL UPDATE. Because if you delete the error request from ODS it will also delete the 20 successful requests above it.
Cheers
Praveen
null -
How to get the records which has a specified x/y coordinates
Hi,
How to get the records which has a specified x/y coordinates. I have a table which has street data. And another table has a point data. Now I just want to get the records from street data which includes the points in the point data table. Can any one give your suggestions
Thanks and Regards
AravindanAravinda,
If you want to find the line segments which intersect the given
set of points, you can do that with SDO_RELATE.
siva -
How to get selected record details when single selection is used in a table
Hi All,
Inside a query region I have created a table using region wizard,for this table I have added a singleSelection Item. What I want is , on selection of a particular record i want to update or view that record in a new page , for this I have added update and view icons in each row.
But I am unable to get the particular selected record
OATableBean tableBean = (OATableBean)webBean.findChildRecursive("ResultTableRN");
OASingleSelectionBean singleSelection = (OASingleSelectionBean)tableBean.getTableSelection();
For this singleSelection object I was unable to find any method which will give the value of the view attribute associated with it.
Anybody any suggestions regarding it ?
Thanks in advance,
Anant NImbalkar.Hi Anant,
here is how you have to do it
1) you need to enable PPR on that Singl selection , by changining the Action type =fireAction.
2) define the envent , EVENT
3) define paramters for that event. This is place that gives you handle to the Attribute of VO.
So you can define paremters such
Name = PARAM1
value =${oa.EqxContactPrivEOVO1.ContactPrivilegeId}
You can define as many paramters as you can for the vo field that u wanted to have.
Now in the procesformRequest() , all you do it handle the event EVENT and get the parameters
if ("EVENT".equals(pageContext.getParameter(EVENT_PARAM)))
String accountid= pageContext.getParameter("PARAM1");
You can refer developer guide for further details. -
How to get the only the last raw of the table
Hello All,
While fetching a table into internal table, how to get only the last record of the table.?
Thanks and Regards, PradeepI hope following code will solve your problem.
DATA : it_bseg TYPE TABLE OF bseg,
x_bseg TYPE bseg,
v_index TYPE i.
SELECT COUNT(*)
FROM bseg
INTO v_index.
SELECT *
FROM bseg
INTO TABLE it_bseg.
READ TABLE it_bseg INTO x_bseg INDEX V_INDEX.
First SELECT will give you the number of rows in a table in v_index. Second SELECT will fetch all table data and then READ will give you the last record of the table in a structure x_bseg.
Reward points if the answer is helpful. -
Data merging: how to get multiple records in single text frame?
Hi
I'm experimenting with data merging in InDesign CS3. The biggest stumbling block I've come across is trying to get my records to flow as continuous text in a single text frame (which would, ideally, autoflow onto new pages in the document). The records vary considerably in length, and so I can't just create a standard text frame to repeat on the page.
Perhaps data merging isn't the best way of doing this and I should be learning to script instead. I feel like I'm just one step away, though.
Any suggestions would be appreciated.OK, new scenario now:
Is it possible to set a text box to auto-resize to fit the content that comes in during the data merge?
I have placed one of my data fields in a text box with a stroke and fill, and placed this as an anchored object in the main text box with the other fields. The problem is that the length of text in this field varies considerably, and I'd like the text to fit snugly within its box. Ideally this text box would not appear at all if the field is blank for a particular record.
I hope I've explained all of that clearly enough. Any ideas? -
How to get the record set into array?
Hi,
I want to get the record set into array in the procedure and do the processing of the array later in procedure.
below is the stored procedure i am working on:
procedure bulk_delete_group(p_group_id in Array_GroupListID) as
begin
for i in p_group_id.first..p_group_id.last loop
--Here I have to get the list of user id before deleting group
SELECT user_id into *<SOME ARRAY>* FROM group_members WHERE group_id = p_group_id(i);
DELETE group WHERE group_id = p_group_id(i);
--Process the user id array after group deletion..
end loop;
end bulk_delete_group;
Thanks in advance
AdityaSomething like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:02.37
satyaki>
satyaki>create type np is table of number;
2 /
Type created.
Elapsed: 00:00:03.32
satyaki>
satyaki>Create or Replace Procedure myProc(myArray np)
2 is
3 i number(10);
4 rec emp%rowtype;
5 Begin
6 for i in 1..myArray.count
7 loop
8 select *
9 into rec
10 from emp
11 where empno = myArray(i);
12
13 dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename);
14 end loop;
15 End myProc;
16 /
Procedure created.
Elapsed: 00:00:00.88
satyaki>
satyaki>
satyaki>declare
2 v np:=np(9999,7777);
3 begin
4 myProc(v);
5 end;
6 /
Employee No:9999 Name:SATYAKI
Employee No:7777 Name:SOURAV
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.30
satyaki>Regards.
Satyaki De. -
HOW TO GET "N" RECORDS, URGENT
Hi,
Can any one please tell me what will be the SQL statement to get 10 records for each department . I dont want top 10 , i just want to get 10 records for each department from the employee table. or lets say 10 orders for each day for last 30 days from the order table. This is very URGENT. Please help.
Thanks in AdvanceHi,
Thanks for your reply . But you didnt get my question I guess. I said I dont want the top "N" records. I want a query to pull N records for each department . Here is a sample, which shows 3 records for each department. Though there can be many records in the table for each department, the select staement pulls only three records for each department. I want that select statement.
Thanks
Feroz
deptno------------empno----------ename
10 -------------------100------------feroz
10--------------------110------------anwar
10--------------------120-------------liakat
20-------------------200--------------zahir
20------------------210---------------inzam
20------------------220---------------shakil
30------------------300---------------rameh
30------------------310--------------rajesh
30-------------------320-------------ritesh -
How to get changed records in a table
I have a table t1 as
create table t1( num number, name varchar2(35),code char(2));
my data looks like
num name code
1 xy c1
2 zx c2
3 qq c5
after 2 hr i have changed my value to:
1 zx c3
2 za c2
3 qq c5
i need to get a select statement which gives the changed rows:
my output looks like:
1 zx c3
2 za c2
how to get these changed rows
Thanks in advance"It's not working" - fabulous feedback.
Really any reply to that should be just left at "because you're doing it wrong" however....
The flashback query syntax doesn't work like that.
Has to be more like this:
select t1.column,t2.column
from t1 ,t2
where t1.column=t2.column
MINUS
select t1.column,t2.column
from t1 AS OF TIMESTAMP TO_TIMESTAMP('27.04.2011 10:00:00', 'DD-MM-YYYY HH24:MI:SS')
, t2 AS OF TIMESTAMP TO_TIMESTAMP('27.04.2011 10:00:00', 'DD-MM-YYYY HH24:MI:SS')
where t1.column=t2.column;The documentation is great for seeing how things should work, syntax etc.... you should try it. -
How to disable particular record?
Hi,
I am working with ALV List Display. After displaying the output, there is an Check Box option in the report output.
If I check for a particular record and delete that particular record, that record only should be disabled remaining records should be enabled, So that I can check another record and delete that record.
Please given solution for the above ASAP.
Thanks,
Vinay.Hi Vinay,
Try the following sample code :
REPORT y131_alv_test.
TYPE-POOLS : slis.
DATA : BEGIN OF str_test,
check,
name,
END OF str_test.
DATA : it_test LIKE TABLE OF str_test WITH HEADER LINE,
wa_fldcat TYPE slis_fieldcat_alv,
it_fldcat TYPE slis_t_fieldcat_alv.
it_test-name = 'NAME1'.
APPEND it_test.
it_test-name = 'NAME2'.
APPEND it_test.
wa_fldcat-fieldname = 'CHECK'.
wa_fldcat-seltext_l = 'CHECKBOX'.
wa_fldcat-checkbox = 'check'.
wa_fldcat-input = 'X'.
APPEND wa_fldcat TO it_fldcat.
CLEAR wa_fldcat.
wa_fldcat-fieldname = 'NAME'.
wa_fldcat-seltext_l = 'DISPLAY NAME'.
APPEND wa_fldcat TO it_fldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'Y131_ALV_TEST'
i_callback_user_command = 'RETURN'
it_fieldcat = it_fldcat
TABLES
t_outtab = it_test.
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
*& Form RETURN
* text
***The subroutine should be of the following interface
FORM return USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'CHECK'.
IF rs_selfield-value = 'X'.
DELETE it_test WHERE check = 'X'.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. "RETURN
This would help you, reward if convinced with the code.
Regards
Maybe you are looking for
-
No sign of time capsule on mac pro yet i can get into my setting
hi , i came back from travels for a week only to find i could not back up my time capsule, even more my time capsule could not be found as a disk in airport, yet i could open time machine preferences from the top menu then slide the bar to on, the ne
-
PO pricing to be copied in Intercompany Billing
Hi, In STO process the requirement is that in intercompany billing documnet the the pricing should be copied from the PO. I tried in VTFL - Item - then Price Source ans select' A' -PO. But it did't work. Can anyone suggest how to solve the issue? Reg
-
What's the best way to add a new iphone to family itunes?
We just bought a second iphone for my wife. It was set up with her own apple id. It looks like the family sharing for itunes requires a common apple id. What's the best way to share the family music library with her new device? Thanks
-
Displaying fixed message when deploying package
Hi! I'm using SCCM 2012 and it works fine and all but I wonder if there is a possibility to play with some messages for the user? For example, when I'm deploying a Java package I would like to display a fixed message to the user like: "The system is
-
SAP Documentation BPC 10 - /CPMB/COPY
Hi, I am looking for similar documentation as detailed below which is for 7.5 but for version 10? http://help.sap.com/saphelp_bpc75/helpdata/en/cf/1988ba92144fad92abb87df37bcd97/frameset.htm I have checked the EPM guide but cant find it in there? Any