Custom paging and sorting

Hi all,
anybody has any experience with custom paging and sorting with oracle 10i. please help. I really appreciae if someone throw some ideas or sample code for me.
I am working with 10i and asp.net 2.0. I just can not find any sample code for oracle.
thanks

CREATE OR REPLACE procedure getempscur(ecur out sys_refcursor) is
    BEGIN
     OPEN ecur for select * from emp;
   end;
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public class testrefcur
    public static void Main()
        using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;"))
            con.Open();
            using (OracleCommand cmd = new OracleCommand("getempscur", con))
                cmd.CommandType = CommandType.StoredProcedure;
                OracleParameter p2 = new OracleParameter("p2", OracleDbType.RefCursor, ParameterDirection.Output);
                cmd.Parameters.Add(p2);
                cmd.ExecuteNonQuery();
                OracleRefCursor rc = (OracleRefCursor)p2.Value;
                OracleDataAdapter da = new OracleDataAdapter();
                DataSet ds = new DataSet();
                da.Fill(ds, 2, 5 ,"EMP",rc); // contains rows 2-7
                da.Dispose();
                rc.Dispose();
}

Similar Messages

  • Issue with ADF table range paging and sorting

    Hello,
    We have a requirement to support pagination in ADF tables. For this, we have made use of Range paging access mode in the view object level. The paging works perfectly fine with this. But we have another requirement of letting the user do a sort on the table (Yes!! The paginated table). The sort should be applied on all rows in the db and the control should return to the first row.
    Applying sort as it is provided by the fwk, sorts the records in the obtained range only. So we have over ridden the Sort listener in Managed bean for this and are able to acheive the sorting of all rows through a AM method call. We are seeing a problem after this. If the sort action is applied to the key attribute then the previous and next range navigation works fine. If the same action is applied to non-key field, then some times (yea!! This is not consistent) the next set is not fetched.
    Here is the code snippet that is called on Next navigation:
    Map<String,Object> pfScope = AdfFacesContext.getCurrentInstance().getPageFlowScope();
    Object objPageNumber = pfScope.get("pageNumber");
    int pageNumber = 0;
    if(null != objPageNumber)
    pageNumber = new Integer(objPageNumber.toString()).intValue();
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    JUCtrlRangeBinding view = (JUCtrlRangeBinding)bindings.getControlBinding("GeDmRequestVO");
    int iRange = getTable().getAutoHeightRows();
    int currentPage = view.getIteratorBinding().getNavigatableRowIterator().getRangeStart()/(iRange + 1);
    System.out.println("Before " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
    System.out.println("Current : " + currentPage);
    System.out.println("Page Number : " + pageNumber);
    System.out.println("Range : " + iRange);
    System.out.println("Value : " + iRange*(currentPage + pageNumber));
    view.getIteratorBinding().getNavigatableRowIterator().scrollRange(iRange*pageNumber);
    System.out.println("After " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
    Although, the new values are not refreshed in the table, the SOPs for before and after print the proper range sizes. And as I mentioned above, the above code works perfectly fine if there is no sort applied or when key attribute is sorted.
    Would appreciate your help on this regard with navigation after non-key attribute sort.
    Thanks,
    Chitra.

    Hi Chitra,
    Can you specify some links to implement RangePaging.....We need to implement pagination.If possible can you share the code or specify the steps how you achieved it.
    Thanks

  • JSF Custom component for table pagination and sorting

    hi
    i want such a custom component that render a table and table has the features of pagination and column sorting.
    any one know from where i can get such a custom component.
    (if this component is available with source then it would be more help full for me)
    thnks & regards,
    Haroon
    Message was edited by:
    HaroonAnwarPADHYAR

    I know two companies that offer JSF component for table pagination and sorting and AJAX based :
    http://www.teamdev.com/quipukit/demo/datatable/DataTable_filteringAndPaging.jsf
    http://java.samples.infragistics.com/NetAdvantage/JSF/2006.1/
    The problem? They are not open source..
    And I am too looking forward on this subject, because I want to develop my own custom component and add some features. If someone has any tips, references or samples of their own, it would be really appreciated.
    Thank you.
    Paul

  • Apply custom repeat formatting, column deletion, and sorts?

    I download a .csv sales report file weekly.  Is there a way to create and apply a pre-determined/custom formatting, deletion of columns, and "sorts?"
    The .csv data contains the same fields/headers on each week.  Then every week I go through and delete the columns that I don't need and sort the data on the same criteria.  Is there a way to save these steps and apply them with each new report I open?
    It would be the equivant in Photoshop, of "recording" "actions" and "playing" them on opened files.

    There is no way to rtecord actions but if you describe exactly what you need, I may try to write a script doing the trick.
    The most efficient scheme would be to send to my mailbox an exemple of the csv file (ten rows would be sufficient) and the Numbers document which you want to get starting from this source.
    Click my blue name to get my address.
    Yvan KOENIG (VALLAURIS, France) mercredi 24 août 2011 21:29:19
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • OBIEE 11g : Unable to see any images while customizing styles and skins

    Hi,
    I am trying to customize OBIEE 11g style and skin. I followed the steps mentioned at http://www.rittmanmead.com/2010/12/oracle-bi-ee-11g-styles-skins-custom-xml-messages/ and also in oracle white paper http://www.oracle.com/technetwork/middleware/bi/customizing-oracle-biee-11g-176387.pdf.
    I am not able to see any images on any OBIEE screens. After login, I can see the name of skin which i have created as the default skin but login page images, header images (after login) are not coming up. Can you please provide solution?
    P.S. I have not changed any images or any css files in the custom skin and style directory. I just wanted to know first whether the new skin/style works for me. If it works, then i will apply some sort of customization.

    That is correct. Also remember to delete browser cache. Here you have the folders: Re: how to insert the picture in the dashboard of BIEE
    Let me know.
    J.-

  • Adding new value in Pick list and sorted logic on basis of new value.

    Hi All,
    I have a requirement where I have to add a new value in seeded OAMessageBean and sort the page contents on basis of selected value.
    I see in about this page and found out that no VO is attached with this field.
    I assume that it attached somewhere in controller and tried to find out there but cannot able to find it there.Is there any way to find the VO which is attached to this bean?
    Also how to add a new values in this seeded picklist as I can able to get handle to OAMessageBean in custom controller.
    Please Help.
    Regards,
    889254

    Hi Peddi,
    Thanks a lot for your reply,
    I tried to open that page in jdeveloper but I dont see any choice bean on the page.Also tried to open CO attached to this page but no clue.As I am able to the get handle of this choicebean in controller.Is there any way I can find out which VO attached to this choiceBean.
    I tried using below depricated method and it is returning null
    messageField.getListViewObject();
    My another question is Can we add new value to choice bean In CO.
    I tried to add it by below methods but these are not reflecting in the application.
    messageField.addOption("TEMP");
    messageField.addIndexedChild("TEMP");
    Regards,
    889254

  • Bt you need to get your customer service and billi...

    HI all just to let you know I have been with bt ( all 3 packages vision, broadband option 3 and telephone + the £5 each month free calls )
    Until they tried to put all of the bills together all was fine I got all bills and went online to pay instant with card and or part direct debit for 2 of the 3 accounts. ) all no problems.
    UNTIL!!!!!!
    the change over back in July 2010.
    After a 1.5 hours repetitive conversation with customer service ( and yes they where english speaking ) we are astill no where.
    they now say that my bt broadband has a different account and has been sent to my landlord ( as he had to call them 3 yrs ago to get a line put in to my rent place)
    any way the only problem is my broadband bill. I have not received any bill paper or email from July 2010 at ALL!!
    I still get the bills for vision and telephone all in my name and gets paid direct debit I have no problems with those 2 its the broadband bill
    Only to find last night my landlord came round irate that bt had cut him off because my broadband bill was not paid and he said its not his its mine ( this was lets say a slight confrontation with me and landlord) BT muck up again !!!!
    Next I call today to speak to Customer service only for them to keep repeating that there is nothing they can do its in the landlords name.
    I say I'm not bothered I just want to know why I was getting all bills and paying for them ON TIME until July 2010.
    They then say they need to change the account holder to my name and I say but your sending me online email bill and paper billing for my vision and telephone why have you stopped the broad band.
    Any way sorry for long story but I am seriously thinking of enough is enough now what with the first 18 months broad band connection problems ( exchange end had to re port 3 times their end) and 4 engineers. to get it sorted to now when BT change all account into one for this to happen.
    LISTEN BT  ITs now become a personal confrontational matter ( my landlord coming round)
    ITS your problem your end GET it sorted.
    If my only advice to anyone with BT
    1GET account in your name same address if possible.
    2. make sure BT know your mobile, and email addresses. double check each year when you renew contracts
    3. WRITE EVERYTHING DOWN , name, time date who spoke to.
    HERE COMES BIG COMPLAINTS LOOK OUT BT
    also sent email to adam lee yesterday about this whole thing. Adam lee was who my landlord spoke to about the whole thing and so I think he deducted the wrong billing of my broadband to his account.
    his email is  ******* for any one else.
    UPDATE:
    when I check my online statements it shows all 3 accounts yet BT customer service say my broadband account has been disconnected??  DUHHHH im using it now !!
    and funny thing is  how can you pay a bill if the broadband says your bill is uptodate your next bill is due 16th October 2010 ( YES 2010 ..LOL)

    Hi Hamish72
    Thanks for comments
    I totally agree as I run my own facebook custom fanpage design and webhosting so I know how customers what to be treated Key 1 I learnt is always listen and repeat back their question. and 2 solve the problem. 3 revert back to no: 1
    UPDATE: just spoke to another customer service person called KAREN. Now this is not a name and shame in fact I have include her name as she sorted this all out in 30 mins totally understood and has 75% solved problem while on the phone. The other 25% is down to waiting to activation of a move over of the error of bt putting my broadband account under my landlords account ( different address ). Why the other CS couldn't do this I don't know.
    any way will let you all know how it goes.

  • I want to order files (e.g., photos) in a particular order (not necessarily an order that is an option in MacOS. Ie, my own custom order, and I want them STAY in that order until I change the order. Is this possible?

    I want to order files (e.g., photos) in a particular order (not necessarily an order that is an option in MacOS. Ie, my own custom order, and I want them STAY in that order until I change the order. Is this possible?

    Custom sort order is not a typical option in the list view of any desktop computing systems I know of. The way you're seeing it work is also how it works in Windows and other systems.
    There is no "None" sort order. What you're seeing is a "None" option under "Arrange By." Arranging is not the same as sorting; arranging is how the files are grouped in the window. For example, you can arrange (group) files by Kind while sorting by Name. You'll notice that if you are in List view and you choose Arrange By "None," in the window there is still a sort triangle next to the column name that it's sorting by.
    If Arrange is set to None, the files appear in one big group (the traditional view) that is controlled by the Sort order (where there is no None option).
    I didn't even know the difference between Sort and Arrange until I saw your question and did a little research! This Macworld article helped:
    How to arrange and sort files in Lion Finder (also applies to later OSs like Mavericks)
    As for your main question, how to do a custom sort order in the Finder, you can only rearrange files manually in Icon view. As with other operating systems, if you want to create a custom sort order for photos there are other ways:
    Use a photo organizer application like iPhoto or Lightroom. Some let you have custom sort orders in folders, but others only let you have a custom sort inside a different container like an "album" or "collection". Having those additional container types is part of why photos are often best managed in an organizer application and not on the desktop.
    Rename the files. You can use a renaming utility program to rename the photos with numbers that will enforce your sort order when sorted by name on the desktop, like
    01 Photo.jpg
    01 Photo.jpg
    01 Photo.jpg
    or
    Photo 01.jpg
    Photo 02.jpg
    Photo 03.jpg

  • How to view long file names and sort files within folders/projects?

    Hello, like so many people here, I am a new mac user, but certainly not computer illiterate. I have been a professional photographer for 10 years and recently change to mac and have been slowly trying to adapt my work flow accordingly.
    However I have become increasingly frustrated with Aperture 3 and after reading posts here it looks like I am certainly not the only person. While in my case I am sure it is because of my inexperience with mac systems so any guidance or assistance is much appreciated.
    Hopefully my questions are simple. I have been importing my images and re-naming images as I do so. A very simple combination of date, custom name, and counter. However, when I look at the images once the import has completed, they are not in any logical order within the 'project'. I have tried to sort them by file name, orientation, file size, etc, both ascending and descending, but they will not list in the correct order. eg the file '2010-03-09 Lyon France 001', continually falls between '2010-03-09 Lyon France 022' and '....021'.
    This has also lead me to a further question. While my file names can generally be read when the image is a landscape format, on the portrait images the file name it too long for me to read the whole name, and I can not find anyway to read the file name, eg browser, split screen, viewer, or full screen.
    Im sorry for all the details, and I am sure it is just my lack of experience, so appreciate your help.
    PS. On a separate note, I notice on another thread from the frustrated user 'ultratechy' that he got a reply from Tony who stated 'Also after installing any application you should always run disk utility and repair permissions....' Now as I am completely new to mac, I had no idea about this. Any other tips that I should always be aware of? Thanks again.

    Thanks for your reply Calx. If it makes you feel better, I am actually a New South Welshman - just living in the sunshine state!
    You are correct, I am trying to get my head around a new way of working and thinking, but I suppose it will all become clearer as time goes by. I have re-visited the manual many times, and been doing loads of research online, but just trying to put it all into practice now, so any tips or advice is always appreciated.
    At the moment, I am just working with a small part of my library until I do get my head around things before moving onto the bulk of my images. I have my images stored and backed up on multiple external hard drives. I am trying to import my images into aperture from an external drive as I have been slack over the years with keywording, metadata, organising, etc etc, so I figure from what I have read that aperture may assist me with making these time consuming tasks a bit quicker and easier.
    I have put a bit of thought into my filing structure, but I am sure that with further use and understanding, this may change in the future, but I hope not. To give you an example of how I am thinking and working - I have used folders for my regular clients, eg, Ray White, and then made another level of folders within 'Ray White' for the date, and then in each 'date folder' I place my projects and name them with the address of the property I have photographed. I select and edit images from each project and place them in albums under each project. Not sure if this is the most perfect structure, but any advice is welcome.
    Keywords is always an issue with me. Over the years I have compiled a number of list for each client and each 'type' of photography. For example, real estate images have there own list, I just simply manually add keywords for specific jobs, eg the address and any specific location or features.
    Again, advice and guidance always welcome and I would appreciate how you go about these topics? And maybe you can help explain something that I have pre-emted may be a problem, and it may happen when I move onto my larger library, and I am not sure how to explain this as it may show my lack of management previously. When I worked on my PC, I used PS4, Adobe Bridge and Camera RAW pretty much exclusively. For my landscape images for example, I might have 2 or 3 variations of the one images, eg, black and white, sepia, and color for instance. But the file name remained the same, I just stored them in different folders indicating what version of the image was stored there. Now I am thinking that when I import images in Aperture, I will come across difficulties because Aperture will think the I am importing duplicate images because I will in fact have 3 images with the same file name, even though the adjustments I have made to them are different. Is this the case? Will I have to make adjustments again? Will I have to change the name of the files prior to importing? If so, any advice or tips?
    Well, I should stop there. Im sorry to bombard you with some much text, but as mentioned, I am new, and finding my feet, so thanks for your time.

  • Customer Groups and Customer Credit Groups

    Hello
      I was going through the documentation for Credit Management, but I was confused on what the difference was between customer groups and customer CREDIT Groups.. both of them sort of have the same definition, then what is the difference ?
    Please help me out.
    Regards,

    Hi Raj,
    For your info :
    The <b>credit group</b> groups together different business transactions which should be dealt with in the same manner with regard to the credit check.
    You enter the credit groups when you configure the sales document types for credit management and define the automatic credit check.
    Default settings
    The following credit groups are contained in the standard SAP R/3 System:
    01 = credit group for sales order
    02 = credit group for delivery
    03 = credit group for goods issue
    Actions
    1. Check whether you can use the credit groups in the standard system.
    2. If you need to create new credit groups, enter an alphanumeric key with two characters and a descripion for the credit group.
    A <b>customer group</b> tells to which a customer can belongs to.
    You specify the customer group for sales data in the customer master record for each sales area.
    The SAP System copies this specification automatically into the sales documents at header and item level. Here, you will find the customer group on the detail screen for general business data.
    Actions
    1. Specify an alphanumeric key which can have up to 2 characters and a description for the customer groups.
    2. Make sure that the customer groups are entered in the customer master records.
    Hope it helps. Pl reward if useful.
    Thanks & Regards
    Sadhu Kishore

  • Extracting and Sorting a Number in a Text field

    Hi everybody,
    I have a column in LOAN_DTL Table as LOAN_DESC which contains data like this:
       CUSTOMER LOAN A/C : CAR  10.00%
       CUSTOMER LOAN A/C : CAR 11
       CUSTOMER LOAN A/C - HOUSE 15.5%
       CUSTOMER LOAN ACCOUNT - CAR 5.50%
       CUSTOMER LOAN A/C - CAR 9%
       CUSTOMER LOAN ACCOUNT : HOUSE 10%
       CUSTOMER LOAN A/C : PERSONAL LOAN 8.50
       CUSTOMER LOAN ACCOUNT : HOUSE 7.75
       CUSTOMER LOAN A/C : HOUSE 6.00
    From the above data, I need to extract the Group i.e. CAR, HOUSE etc. and sort the Group on Rate of Interest order as below :
              CUSTOMER LOAN ACCOUNT - CAR 5.50%
              CUSTOMER LOAN A/C - CAR 9%
              CUSTOMER LOAN A/C : CAR  10.00%
              CUSTOMER LOAN A/C : CAR 11
              CUSTOMER LOAN A/C : HOUSE 6.00
              CUSTOMER LOAN ACCOUNT : HOUSE 7.75
              CUSTOMER LOAN ACCOUNT : HOUSE 10%
              CUSTOMER LOAN A/C - HOUSE 15.5%
              CUSTOMER LOAN A/C : PERSONAL LOAN 8.50
    How to go about the above ?

    Like this?
    SELECT loan_desc,REGEXP_SUBSTR(loan_desc,'[[:digit:],.]+%?') extract_string
    FROM loan_dtl
    ORDER BY 1,
             DECODE(loan_desc,
                    loan_desc,
                    TO_NUMBER(REGEXP_SUBSTR(loan_desc,'[[:digit:],.]+')));
    Message was edited by: 000000

  • Read and sort a semicolon seperated csv file

    Hi all,
    I need to sort the given csv file columnwise (alphabatically)... which means the corresponding row/rows also have to be sorted. need help.
    the csv file looks like:
    Wear;9;;;
    ;;;Image;1
    ;;;Area;2
    ;;;ner;3
    ;;;Content;1
    ;;;BContainer;1
    ;;;View;1
    VIEW;10;;;
    ;;;get;8
    ;;;ner;1
    ;;;View;1
    ACTIVE;21;;;
    ;;;Image;1
    ;;;get;7
    ;;;Area;4
    ;;;ner;1
    ;;;de.vw.mqbkombi.widgets.TransitionContainer;3
    ;;;Aget2;2
    ;;;ner2;1
    ;;;Sget;1
    ;;;iView;1
    The idea is to first sort Wear,VIEW, ACTIVE alphabatically (columnwise), making sure all the rows that they have are also moved.
    after that, alphabatically sort all the in-between rows.
    would appreciate the help from any expert on csv, excel table.

    doremifasollatido wrote:
    If you know that your columns never have embedded semicolons, you could call String.split to split each row at semicolons. Although you could leave the results in the arrays that String.split gives, you should probably create a Java class to represent each row. It will make your code easier to understand, and you could also more easily represent numeric values as numbers such as primitive int values (so that they sort correctly as numbers instead of as Strings). Then create a List of instances of that Java class, and sort the list using Collections.sort and a custom java.util.Comparator.Or indeed make it Comparable; but I'd agree this is definitely the way to go.
    Also, assuming that all your "secondary" rows, such as:
    ;;;Image;1
    ;;;Area;2
    refer to the preceding "primary" (Wear;9;;;), I'd suggest you fill in the unsupplied values for them. That will allow you to sort them all in one go. It might also be worth including a type in your "Row" class (maybe as an enum); alternatively you could have two different subclasses of a common Row class.
    Winston

  • Is it advisable to use the charcter "&" in customer numbers and in business

    Is it advisable to use the charcter "&" in customer numbers and in business partner naming?
    Are there any restrictions in using wild characters for customer numbers. KNA1-KUNNR field.

    Dear Chandramouli,
    In the name you can use but in the no. not advisable I believe. When you are defining the no range, it is as following:
    Intervals can only contain either letters or numbers, as sorting can differ between platforms (Code page):
    Allowed:  000001 to 999999
      AAAAAA to ZZZZZZ
    Not allowed:  AAAAAA to 999999
    Please find the SAP help on this.
    Thanks,
    Atin

  • STANDARD SMARTFORM FOR CUSTOMER INVOICE AND CREDIT MEMO

    GUD MORNING ,
    I WANT THE STANDARD SMART FORM FOR THE CUSTOMER INVOICE AND CREDIT MEMO RELATED TO FI FOR SALES.
    ARUN REDDY I

    Hi,
    Search For Standard or Customise Smartform
    *&  Report       : ZTEST_SEARCH_FORMNAME
    *&  This program will help you to search the SMARTFORM either Standard
      Or Customer created in your compatiable language.
    REPORT  ZTEST_SEARCH_FORMNAME  .
    TYPE-POOLS: SLIS.
      TABLES: STXFADM, STXFADMT.
      DATA:  BEGIN OF ITAB OCCURS 0,
           FORMNAME     LIKE STXFADM-FORMNAME,
           MASTERLANG   LIKE STXFADM-MASTERLANG,
           DEVCLASS     LIKE STXFADM-DEVCLASS,
           VERSION      LIKE STXFADM-VERSION,
           FIRSTUSER    LIKE STXFADM-FIRSTUSER,
           FIRSTDATE    LIKE STXFADM-FIRSTDATE,
           FIRSTTIME    LIKE STXFADM-FIRSTTIME,
           LASTUSER     LIKE STXFADM-LASTUSER,
           LASTDATE     LIKE STXFADM-LASTDATE,
           FORMTYPE     LIKE STXFADM-FORMTYPE,
           CAPTION      LIKE STXFADMT-CAPTION,
           END OF ITAB.
      DATA: IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV,
              WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
              WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_DEV  FOR STXFADM-DEVCLASS NO INTERVALS.
    SELECT-OPTIONS: S_FORM FOR STXFADM-FORMNAME NO INTERVALS.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: P_LANG LIKE T002-SPRAS DEFAULT 'EN'.
    SELECTION-SCREEN END OF BLOCK B1.
    PERFORM F_SELECT_DATA.
    PERFORM F_LAYOUT.
    PERFORM F_FIELDCAT.
    PERFORM DISPLAY.
    *&      Form  f_select_data
          text
    -->  p1        text
    <--  p2        text
    FORM F_SELECT_DATA .
      SELECT
             A~FORMNAME
             A~MASTERLANG
             A~DEVCLASS
             A~VERSION
             A~FIRSTUSER
             A~FIRSTDATE
             A~FIRSTTIME
             A~LASTUSER
             A~LASTDATE
             A~FORMTYPE
             B~CAPTION
             FROM STXFADM AS A INNER JOIN  STXFADMT AS B ON
             AFORMNAME = BFORMNAME INTO  TABLE ITAB  WHERE
             A~DEVCLASS IN S_DEV AND
             A~FORMNAME IN S_FORM AND
             B~LANGU = P_LANG.
        IF SY-SUBRC  = 0.
        SORT ITAB BY FORMNAME.
      ELSE.
        MESSAGE I398(00) WITH 'No Form Exits for this selection criteria'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " f_select_data
    *&      Form  display
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY .
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SYST-CPROG
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT
        TABLES
          T_OUTTAB           = ITAB.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " display
    *&      Form  f_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM F_FIELDCAT .
      DATA: WA_COL TYPE I VALUE 1.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-003.  " Form Name
      WA_FIELDCAT-FIELDNAME =  'FORMNAME'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-004.  " Smart form Text
      WA_FIELDCAT-FIELDNAME =  'CAPTION'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-005.  "Package
      WA_FIELDCAT-FIELDNAME =  'DEVCLASS'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-006.  "First User
      WA_FIELDCAT-FIELDNAME =  'FIRSTUSER'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-007.  "First Date
      WA_FIELDCAT-FIELDNAME =  'FIRSTDATE'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-008.  "Version
      WA_FIELDCAT-FIELDNAME =  'VERSION'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-009.  "Master Language
      WA_FIELDCAT-FIELDNAME =  'MASTERLANG'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS   =  WA_COL + 1.
      WA_FIELDCAT-SELTEXT_L =  TEXT-010.  "Last User
      WA_FIELDCAT-FIELDNAME =  'LASTUSER'.
      WA_FIELDCAT-TABNAME   =  'ITAB'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ENDFORM.                    " f_fieldcat
    *&      Form  f_layout
          text
    -->  p1        text
    <--  p2        text
    FORM F_LAYOUT .
        WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM.                    " f_layout
    Regards,
    Jagadish

  • Query and sort content from two lists using search API

    Hi,
    I have a custom web part which I would like to query two different lists and sort the results by Created Date. One is a list of news articles and the other contains blogs. So basically the result set will be an intermix of news and blog items sorted by date.
    I would also like to do this by query through the search API. Does anybody have any sample code to do this?
    thanks,
    Sherazad.
    Sherazad

    Hi Sherazad:
    To use the JOIN operator in CAML, your lists must have a
    defined relation(Lookup column). You can refer to sample code that I list as follow.
    Create your query from one of your lists.
    SPList Projects= SPContext.Current.Site.RootWeb.Lists["Projects"];
    SPQuery query = new SPQuery();
    To do the join, setquery.Joins
     <Join Type="INNER" ListAlias="Contacts">
        <Eq>
            <FieldRef Name="ProjectManager" RefType="ID" /> ///
    ProjectManager is a Lookup Column.
            <FieldRef List="Contacts" Name="ID" />
        </Eq>
     </Join>
    And query.ProjectedFields (To tell SharePoint how to project the lookup columns into the result)
    <Field Name="Project Name" Type="Lookup" List="Projects" ShowField="Title">
    /// My Project Name is a Display Name in Memory so you can give a name by yourself But ShowField must be Internal Name of the Column(Project Name)
    You can add a lot of columns that you want to display.
    Everything comes from memory.
    To choose the fields to display set query.ViewFields
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name">
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name">
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name"> 
    Then
    SPListItemCollection result = ListA.GetItems(query);

Maybe you are looking for