Top 2 records per employee ID
I am trying to retrieve the top two salary records per employee ID to show their current salary and one previous. The salary table is a transaction type table showing all salary changes per employee.
For example:
Employee_ID
Salary_Effective_Date
Salary_Amount
We are using Oracle 10G, SQLPlus. We normally select the max(salary_effective_date) to get their current salary_amt. Is there anyway to pull the top two per employee to get current and previous?
Hi,
This question doesn't concern SQL*Plus or iSQL*Plus in any way, does it? It's a SQL question, so, in the future, you might have better luck posting questions like this in the SQL forum:
PL/SQL
The analytic RANK (or, depending on how you want to handle ties, ROW_NUMBER) function is more versatile than aggregate functions for this kind of thing
Since I don't have a version of your table, I'll use the scott.emp table to illustrate.
Here's one way to get some information about the two latest rows (in order by hiredate) for each job:
WITH got_r_num AS
SELECT job, hiredate, ename, sal
, RANK () OVER ( PARTITION BY job
ORDER BY hiredate DESC
) AS r_num
FROM scott.emp
SELECT *
FROM got_r_num
WHERE r_num <= 2
ORDER BY job
, hiredate DESC
;Output:
JOB HIREDATE ENAME SAL R_NUM
ANALYST 19-APR-87 SCOTT 3000 1
ANALYST 03-DEC-81 FORD 3000 2
CLERK 23-MAY-87 ADAMS 1100 1
CLERK 23-JAN-82 MILLER 1300 2
MANAGER 09-JUN-81 CLARK 2450 1
MANAGER 01-MAY-81 BLAKE 2850 2
PRESIDENT 17-NOV-81 KING 5000 1
SALESMAN 28-SEP-81 MARTIN 1250 1
SALESMAN 08-SEP-81 TURNER 1500 2
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Similar Messages
-
Report to list all infotype record per employee
Hi All
is there a report that list all infotypes record per employee ?
thanks for helping
CorinneHi,
It will not be feasible as all the IT has different fields.
There is no standard report as Mr, Raghu mentioned.
Ketul -
Filter Simple List to show only 1 record per employee
All,
I'm looking for a very simple OOTB way to filer a list.
I've used InfoPath form to create a simple test form which is published to form library on submission.
My list columns are:
Employee Name, Pass/Fail,Test Score, Test Attempt (Count).
The list is grouped by Pass/Fail
I need to show all passed tests and only failed tests where a user hasn't subsequently taken the test again(s) and passed it.
I was hoping I could do this with a filter web part as with OOTB filter column options, I can't seem to do it. Or just show the highest count number per employee.
Any help would be greatly appreciated.
Thanks
WThanks, yet that doesn't work for me.
Maybe it's my test attempt count.
Each form is a new form, and each form will have a test attempt (TA=) number against it.
i.e.
Form1 TA=1 Fail
Form2 TA=2 Pass
With the above, both seem to appear with the above filter.
No form as TA=0
I can't guarantee that users will only fail once.
Forms ending in 130 and 310 are completed by the same Employee Name
Thanks
W -
Change Vendor records per Employee Master
Using RPRAPA000 pgm we should be able to update following fields:
Names
Address
Email address- User exit
Tax No
Bank Details
Payment Method
Search Term is updated with last name
Company Code
Fields from Reference vendor u2013 Non HR data
Reconciliation Account: 213000
Payment terms: ZA01
Question: I get message "Missing master data on key selection date" and under Bank Det column, it says the data is "missing". on employee master.
I checked info type 9 and yes it is missing.
So are bank details mandatory for changing vendor master data?Check in transaction OB24 and OB23 for the activity Change Vendor (Accounting). Here in change mode the Bank details may be made mandatory for FI reasons. Check first and confirm with business before you change.
-
Calculation of revenue per employee
hi gurus
I am facing a Porbrm in designing a report int hat report I have to calculate REVENUE PER EMPLOYEE.
the scenario is like this
I have a Project XFPB_BW revenue for this project is known say 5000.00 INR
we have EMPLoyee they book TIme using timesheet and the cost rete is maintained in the time sheet.
say
emp no qty cost
1010 10 100
1010 8 200
1010 7 300
total 25 600
now I have to calculate rev per employee like this
rev/cost = (revenue/cost)*individual cost = 8.33
rev / qty= (revenue/qty)*individual qty = 200
<b> project employee cost qty rev rev/cost rev/qty</b></b>
XFPB_BW 0 0 5000 0 0
1010 100 10 0 833 2000
1010 200 8 0 1666 1600
1010 300 7 0 2499 1400
total 600 25 5000 4998 5000I am writing this start routine for this
PROGRAM trans_routine.
CLASS routine DEFINITION
CLASS lcl_transform DEFINITION.
PUBLIC SECTION.
Attributs
DATA:
p_check_master_data_exist
TYPE RSODSOCHECKONLY READ-ONLY,
*- Instance for getting request runtime attributs;
Available information: Refer to methods of
interface 'if_rsbk_request_admintab_view'
p_r_request
TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.
PRIVATE SECTION.
TYPE-POOLS: rsd, rstr.
Rule specific types
TYPES:
BEGIN OF tys_SC_1,
InfoObject: 0PROJECT Project Definition.
PROJECT TYPE /BI0/OIPROJECT,
InfoObject: 0EMPLOYEE Employee.
EMPLOYEE TYPE /BI0/OIEMPLOYEE,
InfoObject: 0FISCPER Fiscal year / period.
FISCPER TYPE /BI0/OIFISCPER,
InfoObject: 0FISCVARNT Fiscal year variant.
FISCVARNT TYPE /BI0/OIFISCVARNT,
InfoObject: 0CALDAY Calendar Day.
CALDAY TYPE /BI0/OICALDAY,
InfoObject: 0VTYPE Value Type for Reporting.
VTYPE TYPE /BI0/OIVTYPE,
InfoObject: 0CURTYPE Currency Type.
CURTYPE TYPE /BI0/OICURTYPE,
InfoObject: 0AMOUNT Amount.
AMOUNT TYPE /BI0/OIAMOUNT,
InfoObject: 0RECORDMODE BW Delta Process: Update Mode.
RECORDMODE TYPE RODMUPDMOD,
InfoObject: 0CURRENCY Currency Key.
CURRENCY TYPE /BI0/OICURRENCY,
InfoObject: ZMATERIAL Material (Role).
/BIC/ZMATERIAL TYPE /BIC/OIZMATERIAL,
InfoObject: 0PRIORITY Priority.
PRIORITY TYPE /BI0/OIPRIORITY,
InfoObject: 0CO_AREA Controlling area.
CO_AREA TYPE /BI0/OICO_AREA,
InfoObject: 0WBS_ELEMT Work Breakdown Structure Element (WBS Elem
*ent).
WBS_ELEMT TYPE /BI0/OIWBS_ELEMT,
InfoObject: 0UNIT Unit of Measure.
UNIT TYPE /BI0/OIUNIT,
InfoObject: 0COSTELMNT Cost Element.
COSTELMNT TYPE /BI0/OICOSTELMNT,
InfoObject: 0COMP_CODE Company code.
COMP_CODE TYPE /BI0/OICOMP_CODE,
InfoObject: 0PROFIT_CTR Profit Center.
PROFIT_CTR TYPE /BI0/OIPROFIT_CTR,
InfoObject: ZREV_CE1 revenue from cost element.
/BIC/ZREV_CE1 TYPE /BIC/OIZREV_CE1,
InfoObject: 0QUANTITY Quantity.
QUANTITY TYPE /BI0/OIQUANTITY,
Field: RECORD.
RECORD TYPE RSARECORD,
END OF tys_SC_1.
TYPES:
tyt_SC_1 TYPE STANDARD TABLE OF tys_SC_1
WITH NON-UNIQUE DEFAULT KEY.
$$ begin of global - insert your declaration only below this line -
... "insert your code here
TYPES: BEGIN OF tt_revfac,
projdef TYPE /bic/cs8zods_mpp-project,
FISCPER TYPE /bic/cs8zods_mpp-FISCPER,
amt TYPE /bic/cs8zods_mpp-amount,
revenue TYPE /bic/cs8zods_mpp-/BIC/ZREV_CE1,
"Add by Jatin
END OF tt_revfac.
TYPES: BEGIN OF tt_qtyfac,
projdef TYPE /bic/cs8zods_mpp-project,
FISCPER TYPE /bic/cs8zods_mpp-FISCPER,
qty TYPE /bic/cs8zods_mpp-quantity,
revenue TYPE /bic/cs8zods_mpp-/BIC/ZREV_CE1,
"Add by Jatin
END OF tt_qtyfac.
DATA: ...
*DATA: g_t_revfac TYPE STANDARD TABLE OF tt_revfac.
*DATA: g_t_qtyfac TYPE STANDARD TABLE OF tt_qtyfac.
DATA: g_t_revfac TYPE SORTED TABLE OF tt_revfac WITH UNIQUE KEY projdef
fiscper.
DATA: g_t_qtyfac TYPE SORTED TABLE OF tt_qtyfac WITH UNIQUE KEY projdef
fiscper.
$$ end of global - insert your declaration only before this line -
METHODS
start_routine
IMPORTING
request type rsrequest
datapackid type rsdatapid
EXPORTING
monitor type rstr_ty_t_monitors
CHANGING
SOURCE_PACKAGE type tyt_SC_1
RAISING
cx_rsrout_abort.
METHODS
inverse_start_routine
IMPORTING
i_th_fields_outbound TYPE rstran_t_field_inv
i_r_selset_outbound TYPE REF TO cl_rsmds_set
i_is_main_selection TYPE rs_bool
i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
i_r_universe_inbound TYPE REF TO cl_rsmds_universe
CHANGING
c_th_fields_inbound TYPE rstran_t_field_inv
c_r_selset_inbound TYPE REF TO cl_rsmds_set
c_exact TYPE rs_bool.
ENDCLASS. "routine DEFINITION
$$ begin of 2nd part global - insert your code only below this line *
... "insert your code here
$$ end of 2nd part global - insert your code only before this line *
CLASS routine IMPLEMENTATION
CLASS lcl_transform IMPLEMENTATION.
Method start_routine
Calculation of source package via start routine
<-> source package
METHOD start_routine.
*=== Segments ===
FIELD-SYMBOLS:
<SOURCE_FIELDS> TYPE tys_SC_1.
DATA:
MONITOR_REC TYPE rstmonitor.
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
DATA: lwa_datapackage LIKE LINE OF SOURCE_PACKAGE,
lwa_revfac TYPE tt_revfac,
lwa_qtyfac TYPE tt_qtyfac.
LOOP AT SOURCE_PACKAGE INTO lwa_datapackage.
lwa_revfac-projdef = lwa_datapackage-project.
lwa_revfac-FISCPER = lwa_datapackage-FISCPER. "Add by Jatin
lwa_revfac-amt = lwa_datapackage-amount.
lwa_revfac-revenue = lwa_datapackage-/BIC/ZREV_CE1.
COLLECT lwa_revfac INTO g_t_revfac.
lwa_qtyfac-projdef = lwa_datapackage-project.
lwa_qtyfac-FISCPER = lwa_datapackage-FISCPER. "Add by Jatin
lwa_qtyfac-qty = lwa_datapackage-quantity.
lwa_qtyfac-revenue = lwa_datapackage-/BIC/ZREV_CE1.
COLLECT lwa_qtyfac INTO g_t_qtyfac.
ENDLOOP.
SORT g_t_revfac BY projdef.
SORT g_t_qtyfac BY projdef.
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "start_routine
Method inverse_start_routine
This subroutine needs to be implemented only for direct access
(for better performance) and for the Report/Report Interface
(drill through).
The inverse routine should transform a projection and
a selection for the target to a projection and a selection
for the source, respectively.
If the implementation remains empty all fields are filled and
all values are selected.
METHOD inverse_start_routine.
$$ begin of inverse routine - insert your code only below this line-
... "insert your code here
$$ end of inverse routine - insert your code only before this line -
ENDMETHOD. "inverse_start_routine
ENDCLASS. "routine IMPLEMENTATION
(REV by quantity)
CLASS routine IMPLEMENTATION
CLASS lcl_transform IMPLEMENTATION.
METHOD compute_ZRFEV_QTY.
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS-PROJECT TYPE /BI0/OIPROJECT
SOURCE_FIELDS-EMPLOYEE TYPE /BI0/OIEMPLOYEE
SOURCE_FIELDS-FISCPER TYPE /BI0/OIFISCPER
SOURCE_FIELDS-CURRENCY TYPE /BI0/OICURRENCY
SOURCE_FIELDS-UNIT TYPE /BI0/OIUNIT
SOURCE_FIELDS-QUANTITY TYPE /BI0/OIQUANTITY
EXPORTING
RESULT type tys_TG_1-/BIC/ZRFEV_QTY
CURRENCY type tys_TG_1-CURRENCY
DATA:
MONITOR_REC TYPE rsmonitor.
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
DATA: lwa_qtyfac TYPE tt_qtyfac,
l_avg TYPE tt_qtyfac-qty.
READ TABLE g_t_qtyfac INTO lwa_qtyfac
WITH KEY projdef = SOURCE_FIELDS-PROJECT
FISCPER = SOURCE_FIELDS-FISCPER
BINARY SEARCH.
Collect entries for fical year
IF sy-subrc = 0.
IF lwa_qtyfac-qty <> 0.
l_avg = lwa_qtyfac-revenue / lwa_qtyfac-qty.
ELSE.
l_avg = 0.
ENDIF.
ENDIF.
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
... "to skip a record
raise exception type CX_RSROUT_SKIP_RECORD.
... "to clear target fields
raise exception type CX_RSROUT_SKIP_VAL.
RESULT = l_avg * SOURCE_FIELDS-quantity .
CURRENCY = SOURCE_FIELDS-CURRENCY .
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_ZRFEV_QTY
Method invert_ZRFEV_QTY
This subroutine needs to be implemented only for direct access
(for better performance) and for the Report/Report Interface
(drill through).
The inverse routine should transform a projection and
a selection for the target to a projection and a selection
for the source, respectively.
If the implementation remains empty all fields are filled and
all values are selected.
METHOD invert_ZRFEV_QTY.
$$ begin of inverse routine - insert your code only below this line-
... "insert your code here
$$ end of inverse routine - insert your code only before this line -
ENDMETHOD. "invert_ZRFEV_QTY
ENDCLASS. "routine IMPLEMENTATION
the problem with this is that I can not filter at the Query levele NOw I want to know Can I write it at query level if possible how
Please help its urgent and challenging also. -
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
IN XML PUBLISHER REPORT WHICH SHOWS 5 RECORDS PER PAGE REG:-
{color:#0000ff}Dear All,
Conditionally, i want my XML Report has to be Display only 5 Records per Page..
If there are hundreds of records in XML file.
Please, could u help me out..
Waiting for ur reply..
Regards,
Sarfraz.
{color}For 11i, pl see the XML Publisher User Guide at http://download.oracle.com/docs/cd/B25516_18/current/html/docset.html on how to achieve this
HTH
Srini -
How to generat multiple invoices based on per employee/contractor/services?
Hello Experts / Dina,
I am in situation where customer is in business of body shopping and charges to his final customer based on individual invoice / per employee /contracor & customer services. This was happening in legacy system but after the implementation of Oracle Project costing and Oracle Project billing, customer is not able to generate invoices per employee services. Rather consolidated invoices are getting generated.
How to achieve this functionality in oracle project billing?
Lets take example - On Project P1 for customer ABC, 3 below employees are working on different task for 3 months.
Now after one month employees have been billed as shown below.
Emp 1 - 1000 USD - for 100 Hrs
Emp 2 - 2000 USD - for 200 Hrs
Emp 3 - 1000 USD - for 50 hrs
Now @ end of the month when invoice is getting generated is 1 invoice including 3 lines of amount total 4000 USD. There is problem; customer wants that there should be 3 different invoices per employee shoud generated based on above mentiond 3 diff lines for customer ABC.
I guess with oracle projects billing - You can split the invoice based on Accrue through date ( which is not possible in this case ) and agreement ( which is also not possible in this case ) and different currency ( which is again not possible in this case) - I may be wrong when saying it is not possible. plz correct me if I am wrong.
even I guess billing extension wont work. So is there any way to achive this?
Right now only option i am thinking is let single invoice of 4000 USD with 3 different lines should pass to AR and while priniting the invoice customer can create 3 diff prints which includes individual lines. and while applying receipts on the single invoice in the system, customer can apply the receipts to indivual lines.
but I am not sure about AUDIT issues.. Can some one think about any AUDIT issues comes to this approch or issues with TAX rounding amount issues ?
Infact I would like to solve this issue with the help of Oracle Projects billing and not with custom invoice print program. I guess someone from you experts can figure it out to generate muiltple invoice based on employees / suppliers / contractors / materials etc.
A suggestion on Extension / customization / seeded functionality of Oracle Project billing on thi issue would be gr8 help.
Please help.
Thanks
Edited by: oracle_samba on Jan 7, 2013 1:06 AM
Edited by: oracle_samba on Jan 7, 2013 1:07 AMHi Dina,
First of all thanks for your update :-) Your solution looks much promising.
I thought of using billing extension but rejected on the ground that I would end up in generating events based on employee for their corsponding billig amounts so finally generating a consolidated invoice only in One GDI run. But what i was missing was pre-processing extension and running the extention in loop based on employee count.
I am fully sure business would not have any issues of auto approving and releasing invoice upon generation. But my question is "is it possible to just approve the invoice & not release it using auto approve and release extension?" The reason is I think when GDI runs it only deletes Unapproved invoice & spare Approve invoices. - So please suggest.
Also please validate my understanding about your solution with an existing example -
As with the current example, there are 3 EMP presents so need to run GDI 3 times and develop pre-processing ext in a such a way that at each time it will put on hold on all the billable items except EMP1, and EMP2 and EMP3 on each consecutive run respectivly. And ensure that Auto Approve and release extension should be used in order to avoid overriding previously generated invoice? Am I right ?
Many Many thanks for solution !!!
Regards,
:-) -
HOW TO PRINT ONE RECORD PER ONE PAGE
Hi I have report , with two queries. Each query has one group with the same data. lets say the queries are Q1 and Q2. The Groups are with column DeptNo, and DeptNo1 both pointing to the same column DEPTNO. Now I want to design it in such a manner that it shoudl print each group , one record per page, but same group on the same page. For Example
ON PAGE 1
DpetNo 10
Emp1
Emp2
Emp3
DeptNo1 10
Emp1
EMp2
Emp3
ON PAGE 2
DeptNo 20
Emp4
Emp5
DeptNo1 20
Emp4
Emp5
ON PAGE 3
DeptNo 30
Emp6
Emp7
Emp8
DeptNo1 30
Emp6
Emp7
Emp8
How the lay our will be ? What will be the conditions. I can set the property in each group to print one record per page. But how to make it so that it will print like above.
Thanks
FEROZHi Feroz,
You can create a query Q0 to return DeptNo 10, DeptNo 20..... and make it as the parent of Q1 and Q2. Then you can print one dept per page.
Regards,
George -
Limit records per page in the horizontal looper?
Might sound confusing, but I'm wondering if/how I can use the horizontal looper to show 30 records per page?
For example, I have a photo thumbnail collection. I want to show 5 columns and 10 rows. Is there a way to get the looper to put a link to the 'next 50' so the user can see the next 50 thumbnails (starting at thumbnail 51 of course)?
thanksI guessing here but there must be a bit of php code that you can edit that limits the number of records to be displayed instead of the default value of 10.
-
I want to diaplay my records from the databasewith 10 records per page. i l
i want to diaplay my records from the databasewith 10 records per page. i learned that it can be done through pagination . Please can anyone there help me and give me the code of how to page my records in my jsp pages
I have small code ,but its not working....
below is the code....
public ResultSet codeResult(int i){
if(dataSource!= null){
try {
con=dataSource.getConnection();
stmt=con.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
int maxRows=stmt.getMaxRows();
System.out.println("the maxRows is:"+maxRows);
System.out.println("the I value is:"+i);
if((i < 0) || (i > maxRows)){
i=0;
stmt.setFetchSize(i);
long t = System.currentTimeMillis();
rs=stmt.executeQuery("select asc_code,countrycode,asc_name,asc_address1,asc_address2,asc_city,asc_country,asc_region,asc_contact_person,asc_contact_no,asc_email_id,asc_fax_no,nso_incharge,nso_email,ar_ap_code from asc_master order by asc_code asc");
but,its giving all records...
any one help me on this........
Thank you,
D.Nagireddy.
} catch (SQLException e) {
e.printStackTrace();
return rs;
}hey, here my code for paging. hope it helps...
public void DueRecordInfo(int page,int MAX_PER_PAGE)
con = new DBConnection().getConnection();
try
Statement stmt = con.createStatement();
String sqlcount = "SELECT COUNT(*) FROM INFO WHERE TO_DATE(DATEUPDATED,'Month DD, YYYY') < ADD_MONTHS(SYSDATE,-6) AND OBSOLETE LIKE 'No'";
ResultSet rscount = stmt.executeQuery(sqlcount);
rscount.next();
total_row_count = rscount.getInt(1);
lowerbound = (page * MAX_PER_PAGE - (MAX_PER_PAGE))+1;
upperbound = lowerbound - 1 + MAX_PER_PAGE;
String sql = "Select * from "+
"(SELECT row_number() over(ORDER BY TO_DATE(DATEUPDATED,'Month DD, YYYY') DESC) AS RN,ID,SPECNO,REVISEDNO,DATEREVISED,TITLE,ORIGINATOR,DCBNUMBER,DCBLOCATION,OBSOLETE,DATEOBSOLETE,WORDFILE,PDFFILE,DATEUPDATED FROM INFO WHERE TO_DATE(DATEUPDATED,'Month DD, YYYY') < ADD_MONTHS(SYSDATE,-6) AND OBSOLETE LIKE 'No') " +
"WHERE RN BETWEEN "+ lowerbound + " AND " +upperbound;
ResultSet rs = stmt.executeQuery(sql);
while (rs.next())
id.add(num, rs.getString("ID"));
specno.add(num, rs.getString("SPECNO"));
revisedno.add(num, rs.getString("REVISEDNO"));
daterevised.add(num, rs.getString("DATEREVISED"));
title.add(num, rs.getString("TITLE"));
originator.add(num, rs.getString("ORIGINATOR"));
dcbnumber.add(num, rs.getString("DCBNUMBER"));
dcblocation.add(num, rs.getString("DCBLOCATION"));
obsolete.add(num, rs.getString("OBSOLETE"));
dateobsolete.add(num, rs.getString("DATEOBSOLETE"));
wordfile.add(num, rs.getString("WORDFILE"));
pdffile.add(num, rs.getString("PDFFILE"));
dateupdated.add(num, rs.getString("DATEUPDATED"));
num++;
con.close();
rscount.close();
rs.close();
stmt.close();
} -
Displaying 10 records per page
hi,
somebody please help me.....
i have a list of more than 20 records which i get
from database and then i put it in session.
i have to display 10 records per page only and
on the same page i'd like to have links to page
numbers to view next set of records.
example is how googel displays its search results.
ex. [ 1 2 3 4 5 ]
THANKS A LOT!this can be done using the pagination technique.
[email protected] -
Info Records Per Material Group Standard Report Not Running at All.
Hi Experts,
We had a Small problem Where while Running Info Records Per Material Group(T-code ME1W ) Standard Report the Report is not Showing any output in PRD, where else running Info Records Per Material (T-Code ME1M ) Standard Report the Output is getting Displayed.
Our System is Currently SAP EEC 6.0 & Application Package SAP_APPL is of release 604 & Level 0007, Highest Support Package is SAPKH60407.
is this Issue covered in Some OSS Note?
Thanks & Regards
Priyesh ShahHi,
The info-records for the materials which appears in the standard report ME1M/ME1L is different from the one which appear in ME1W.
If you try with the material groups of the ME1L or ME1M info-records it wont be displayed in ME1W.
ME1W will display only the info-records which are created @ material group level.
i.e. try to create a new info-record using ME11 without entering material, in the general data screen you have to enter the material group & other parameters.
Now once you save this info-record,same will appear in ME1W.
Hope its clear.
Thanks & Regards, -
Sender File Adapter cannot send single record per message ?
Hi,
I have scenario flat file to jdbc. but then why the sender file adapter didn't split the record to become single record per message eventhough i have set it in "Recordsets Per Message" = 1. ?
Document Name MT_APINVOICE
Document Namespace urn:file:jdbc:apivinvoice
Document Offset 8
Recordset Name INPUT
Recordset Namespace
Recordset Structure RECORD,*
Recordset Sequence Ascending
Recordset per Message 1
Key Field Name
Key field Type String
RECORD.fieldFixedLengths 10,5,10,10
RECORD.endSeparator 'nl'
RECORD.fieldNames F1,F2,F3,F4
Please advise
Thank You and Best Regards
Fernand>>but then how to make for example more then 1 records per message.
like 10 records per message. should i set RECORD,10 ?
That is right. Just try it out yourself.
@Shesagiri,
Number of record is decided by the parameter Recordset structure and number of recordset with in a message is decided by Recordset per Message.
Regards
Jaishankar -
How to include a key value, per employee, in payslip print program output?
Employee payslips are printed externally. The output file has to include a 3 char value, per employee, to determine the logo that will be printed on to the payslip.
What is the best way to include this 3 char value in the output file?
I assume the best way is to use program RPCEDTG0 and include the code in this program. We are on ECC6 so PE51 isn't used, HRFORMS is, but I assume this wouldn't matter anyway as we don't need to change the HRFORM but rather the RPCEDTG0 program?
Thanks in advance.Hi Kapil,
Thank you for your help.
Yes, I have suggested as you said, i.e. putting logo into the smartform linked to the HRFORM. However, the external printers want a code in the file which they will interpret their side and then pickup and output the logo from their system. We merely need to pass them the code for this.
Maybe you are looking for
-
Iphone emails to PC, but exchange password and account cancelled.
Dear All, Can anyone explain to me how to transfer emails from my iphone to a PC. The only catch is that the email account exchange password and account has been cancelled. However as some of you may know your emails still remain on the iphone. It me
-
This is a long description of a series of problems with my new Palm Pre. You may wish to search the text to find your specific issue(s). There is no solution in my post. Look for possible answers in the responses to come. I bought my Palm Pre 4 days
-
I want to replace my earbuds but when it comes to writing my credit card number, it always tells me that the number is wrong but there isn't any problems with my credit card so are there any problems with the support site?
-
COPA Report cumulative figures
Hi experts, I want following output from the COPA report 1) Actuals for the month 2) Actuals year to date I am using Account based PA. I have designed a form wherein user entry is required and the user has to mention the period for which the report i
-
How to filter data in defining request
Hi Midhun, Could you please help me in filtering data in defining request in offline mode. Still I am trying to open the store and read the data from store I am getting 0 records read from the store Best Regards Abhinav Dodda