Randomly be able to sort and give top n on any of the field

hi abapers
i mean to say that when the final output comes i can randomly be able to sort and give top n on any of the field and then get the output on the same screen. as we do in mc.5
i m trying to find the solution for this for last 2 months
can u provide me the code how to do this as i m not able to understand mc.5 code for top n function.
itab having mat rate qty
then when the output comes i want to get n top items on any of the field ( material,rate,qty) and number n can be any no of records.

Hi deepika,
well, it depends. let's say you want a popup to ask for the field of an internal table with a known struture, ie, it's structure is defined in the data dictionary. You can do something like this to select the sort field:
  DATA: it_t000 TYPE TABLE OF t000 WITH HEADER LINE.
  DATA: it_fields TYPE TABLE OF dd03l-fieldname WITH HEADER LINE.
  DATA: it_spopli TYPE TABLE OF spopli WITH HEADER LINE.
  DATA: l_answer LIKE sy-tabix.
  SELECT * FROM t000 INTO TABLE it_t000.
  SELECT fieldname INTO TABLE it_fields FROM dd03l WHERE tabname = 'T000'.
  LOOP AT it_fields.
*maybe it would be more useful the description instead of the fieldname,
* this is just an example
    it_spopli-varoption = it_fields.
    APPEND it_spopli.
  ENDLOOP.
  CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
    EXPORTING
      textline1          = ''
      titel              = 'Get field order'
    IMPORTING
      answer             = l_answer
    TABLES
      t_spopli           = it_spopli
    EXCEPTIONS
      not_enough_answers = 1
      too_much_answers   = 2
      too_much_marks     = 3
      OTHERS             = 4.
  READ TABLE it_spopli INDEX l_answer.
  DATA: otab  TYPE abap_sortorder_tab,
        oline TYPE abap_sortorder.
  oline-name = it_spopli-varoption.
  APPEND oline TO otab.
  SORT it_t000 BY (otab).
  LOOP AT it_t000.
    WRITE: / it_t000.
  ENDLOOP.
whereas you can use this to query and select the top n lines:
  DATA: it_t000 TYPE TABLE OF t000 WITH HEADER LINE.
  DATA: it_t000_1 TYPE TABLE OF t000 WITH HEADER LINE.
  DATA: it_fields TYPE TABLE OF dd03l-fieldname WITH HEADER LINE.
  DATA: it_spopli TYPE TABLE OF spopli WITH HEADER LINE.
  DATA: l_answer LIKE sy-tabix.
  SELECT * FROM t000 INTO TABLE it_t000.
  SELECT fieldname INTO TABLE it_fields FROM dd03l WHERE tabname = 'T000'.
  LOOP AT it_fields.
    it_spopli-varoption = it_fields.
    APPEND it_spopli.
  ENDLOOP.
  CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
    EXPORTING
      textline1          = ''
      titel              = 'Get field order'
    IMPORTING
      answer             = l_answer
    TABLES
      t_spopli           = it_spopli
    EXCEPTIONS
      not_enough_answers = 1
      too_much_answers   = 2
      too_much_marks     = 3
      OTHERS             = 4.
  READ TABLE it_spopli INDEX l_answer.
  DATA: otab  TYPE abap_sortorder_tab,
        oline TYPE abap_sortorder.
  oline-name = it_spopli-varoption.
  APPEND oline TO otab.
  DATA: l_value TYPE spop-varvalue1,
        l_top TYPE sy-tabix.
  CALL FUNCTION 'POPUP_TO_GET_ONE_VALUE'
    EXPORTING
      textline1      = 'Number of top lines'
      titel          = 'top lines'
      valuelength    = 2
    IMPORTING
      value1         = l_value
    EXCEPTIONS
      titel_too_long = 1
      OTHERS         = 2.
  l_top = l_value.
  SORT it_t000 BY (otab).
  DO l_top TIMES.
    READ TABLE it_t000 INDEX sy-index.
    APPEND it_t000 TO it_t000_1.
  ENDDO.
  LOOP AT it_t000_1.
    WRITE: / it_t000_1.
  ENDLOOP.
there is a significant number of ways to achieve this, it depends on what type of list you have (ALV, table control, write list), the type of table line (data dictionary, internal table type) and the type of interaction you want with the user.
The code above might be the most simple example.
regards,
Edgar

Similar Messages

  • Sorting and filtering by select-multi person or group field in the list in SharePoint 2013

    Hi everybody,
    In SharePoint 2013, I have defined a column as "Person or Group" field, which you allow for multiple selections. when I try to sort/filter it by this field in the list. The field doesn't show up in the dropdown. If I changed "Allow multiple
    selections" option to "No" by clicking the column name to edit it in "List Settings", the field can show up sort in the dropdown.
    How about support sorting and filter by select-multiple "Person or Group" field in sharepoint 2013?
    BTW, in SharePoint 2010, it can support this issue no matter what the "Allow multiple selections" option the request is.
    Any help would be great!
    Thanks,
    Jodie

    Hi Jodie,
    Can you please give this as a try.
    To fix the Filter Issue on Assigned To Column. We need to run the following scripts.
    The field which allows more than one values or which allows multiple selections. The multi-valued fileds are non-sortable,
    non-filterable. Multi-valued fields cannot be indexed
    $web=Get-SPWeb
    $list=$web.Lists[] $field=$list.Fields[ColumnName] $strSchema=$field.SchemaXml $str=Schema$strSchema.Replace("Sortable=`"FALSE`"","Sortable=`"true`"")
    $field.SchemaXml = $strSchema
    Krishana Kumar http://www.mosstechnet-kk.com
    Thanks for your reply, I have tried to run the scripts, but it still cannot work. The following is my scripts:
    $web=Get-SPWeb 'http://cst-server-01'
    $list=$.web.Lists["Product Request"]
    $field=$list.Fields["Applicant"]
    $strSchema=$field.SchemaXml
    $str=Schema$strSchema.Replace("Sortable='"FALSE'"", "Sortable='"True'"")
    $field.SchemaXml = $strSchema

  • How do you create a link to a pdf in Muse? Thought it was going to show that with Katie's menu and can"t find in any of the tutorials.

    How do you create a link to a pdf in Muse? Thought it was going to show that with Katie's menu and can't find in any of the tutorials.

    The steps would be :
    - Add files from file menu > select pdf > add to site
    - Select the content (rectangle,text etc) and click on hyperlink dropdown > it should show you the added files list
    - Select the file you want to link
    Thanks,
    Sanjit

  • I have created numerous forms in Designer and for some reason, "Edit in Designer" from PDF, I cannot edit any of the fields in Design View.

    I have created numerous forms in Designer and for some reason, "Edit in Designer" from PDF, I cannot edit any of the fields in Design View.

    Is it possible you accidentally put the fields on the master page?

  • When i launch Bridge CC and make first click on any button, the program freezes.

    When i launch Bridge CC and make first click on any button, the program freezes. How to solve this problem?

    This error can be caused by the My Web Tattoo extension (application?) that shows as FBSMTWB in your user agent.<br />
    See http://help.fastbrowsersearch.com/
    You may need to reset the user agent after you have removed that program.
    See [[Web sites or add-ons incorrectly report incompatible browser]]

  • HT201342 I have just opened an icloud email address and am unable to open ANY of the messages in my INBOX. I keep getting the message, "Cannot open this item. This operation is not supported until the entire message is downloaded. Download the message and

    I have just opened a new icloud email address and am unable to open ANY of the messages in my INBOX. For each item I get the message "Cannot open this item. This operation is NOT supported until the entire message is downloaded. Download the message and try again". I now have no clue what I need to do to open these items. Help please.

    What version of iPhoto do you have installed?  Is if one of the versions shown as not compatible in this screenshot?
    If it is then go to the App Store and download iPhoto 9.5.  It will be free if you have an iPhoto 9 or later verson currently.
    OT

  • Why am I suddenly getting the following error message: "The specified location is reserved by the operating system and is not permitted. Please choose a different location." I've been recording all night and I haven't changed any of the parameters.

    Why am I suddenly getting the following error message: "The specified location is reserved by the operating system and is not permitted. Please choose a different location." I've been recording all night and I haven't changed any of the parameters.

    Hi Tom,
    Looks like we have problem here as we see another blank post from you here. It's probably something to do with your email. Let me send you a PM with my email address and we can communicate that way.
    Thanks,
    Kevin

  • My system recovered from a serious error recently. During the error, Firefox crashed. Since I have restarted my syetme and Firefox, I cannot use any of the toolbar options such as:close, minimise and maximise. Also, when I right click, an outline of a box

    My system recovered from a serious error recently. During the error, Firefox crashed. Since I have restarted my system and Firefox, I cannot use any of the toolbar options such as:close, minimise and maximise. Also, when I right click, an outline of a box appears without the visible options although on some occasions they appear after 10 seconds or so. Can you advise me of what to do to cure this problem please or is it a case of using a Windows tool such as System Restore?
    == This happened ==
    Every time Firefox opened
    == 22nd May 2010

    I HAVE NOW SOLVED THE PROBLEM BY RUNNING WINDOWS REGISTRY REPAIR TOOL WHICH HAS OBVIOUSLY REPAIRED CORRUPT REGISTRY FILES.

  • Image Capture, Dropbox, and iPhoto are not displaying any of the photos I've taken on my iPod Touch.

    I'm using the most recent iPod Touch with iOS6.  I've been able to share photos and videos via email without any problem, but I'd rather find a more efficient way of doing it.  Everything I've read online has instructed me to use Image Capture or iPhoto.  However, when I open either of these applications, they are able to recognize my iPod, but behave as though there are no photos or videos on the device when there are, in fact, 20 photos/videos in the Camera Roll.  I turned off Photo Stream, since I'm not running Lion on my computer (it's incompatible with my version of ProTools). 
    Help!

    If you backed up the iPod before restoring it then restore from that backup. See the restore topic of:
    iOS: How to back up
    Also, if yoo have that backup you can extract the photos by:
    Recover iPhone, iPad or iPod photos from backups with Picturescue
    If you used PhotoStream then try getting them from your PhotoStream. See that topic of:
    iOS: Importing personal photos and videos from iOS devices to your computer

  • I am having some serious issues with firefox, i can't print anything because it is stuck on fax and I can't use any of the drop down menus on any site

    I am having some serious issues with firefox to the point of choosing another search engine. I can't print anything because it is stuck on fax and won't let me change it to my printer when i do try to select my printer it jumps right back to fax. The drop down menus do not work on any of the sites I go to. For example when purchasing clothes and you have to choose a size from a drop down menu I can't do it when I click on the drop down menu it doesn't work at all. I don't have a virus I ran my virus protector and no viruses are present. I don't have any suspicious issues going on with my computer so there has to be something in Firefox that is causing my issues. I tried internet explorer and I don't have any issues there. I hope you can help me because I love Firefox and would really like to continue to use it.

    Lots of issues there, main one getting fcpx going again, try deleting the preferences using the utility deveoped by these guys.
    http://www.digitalrebellion.com
    Try deleting your render files and re-rendering the project.
    Start with these and let us know how you go.
    Tony

  • HT3258 I was on Snow Leopard and it allowed me to get into my hospital computer system and applications. I went to Mountain Lion on my Macbook and now I cannot access any of the applications. I need Java which is installed. It is called I 3 system and is

    I was on Snow Leopard with no issues accessing my Windows and Java based hospital computer system . I swithced to Mountain Lion and now I have NO access to any of the hospital applications remotely. Is there a way I can get back to Snow Leopard or manipulate Mountain Lion to allow me to access my hospital system?

    davidmarr wrote:
    Is there a way I can get back to Snow Leopard or manipulate Mountain Lion to allow me to access my hospital system?
    Restore the Snow Leopard bootable backup/clone or the Time Machine backup. As for making ML work, I've not a clue since I don't do windoze or access things remotely. You'll have to wait for one of those gurus to pop in or just post what's happening when you try at the ML forums.

  • I have just  installed prem elements 9 onto a new PC and it will not open any of the old projects

    When I try to open any of the previous projects or any video file it comes up with the error message that the file format is not  supported or the codex missing,. the same file will open OK on the old PC. This probems occurs for all video formats.

    Without more information I can't say for sure, but:
    1) You'll need to ensure you have the latest version of Quicktime installed in order to work with the MTS files from your Canon. Then start a new project and set it up for Full AVCHD video. When you do this the program will automatically install the necessary codecs.
    2) As for the AVI, it could be an MJPEG AVI, which is an iffy file to edit in Premiere Elements. Sometimes it works and sometimes it doesn't. Installing the software that came with the camera can help.

  • My school (Washington State University - Angel website) is showing up as "Untrusted" and I can't access any of the content, how do I bypass this?!!?

    I am getting a "This Connection is Untrusted" Error when I log into my school's classroom website, and therefore cannot access any of the content I need for my class. This is a new problem, I just had to reinstall Mozilla when I upgraded my hard drive, it worked two days ago, but not today. Does anyone know why this would happen, or how I can circumvent this? The only option allowed to me is to "Get me out of here!" which is the exact opposite of what I need it to do.

    Check the date and time in the clock on your computer: (double) click the clock icon on the Windows Taskbar.
    Check out why the site is untrusted and click "Technical Details to expand this section.<br>If the certificate is not trusted because no issuer chain was provided (sec_error_unknown_issuer) then see if you can install this intermediate certificate from another source.
    You can retrieve the certificate and check details like who issued certificates and expiration dates of certificates.
    *Click the link at the bottom of the error page: "I Understand the Risks"
    Let Firefox retrieve the certificate: "Add Exception" -> "Get Certificate".
    *Click the "View..." button and inspect the certificate and check who is the issuer of the certificate.
    You can see more Details like intermediate certificates that are used in the Details pane.
    If "I Understand the Risks" is missing then this page may be opened in an (i)frame and in that case try the right-click context menu and use "This Frame: Open Frame in New Tab".
    Note that some firewalls monitor (secure) connections and that programs like Sendori or FiddlerRoot can intercept connections and send their own certificate instead of the website's certificate.

  • My iTunes has been trying to autofill my iPhone with the songs but then it stopped and now i cannot get any of the songs onto the phone

    I dont know whar to do from here! it wont let me download any of the songs onto my phone and on my phone it has all these blank files where these songs are supposed to be. The system failure on my phone has also returned due to this im assuming.

    Can't connect to the iTunes Store
    iTunes Store error (-3212)??: Apple Support Communities

  • I am trying to restore my iPhone 5 and my screen is no longer able to use and there is a lock code on the phone, how do i restore the phone without having to use the phonne?

    how do i restore my iPhone with a lock code on the phone and the screen is completely unable to use?

    Forgotten Passcode or device disabled after entering wrong passcode
    If you have Find My iPhone enabled, you can use Remote Wipe to erase the contents of your device. If you have been using iCloud to back up, you may be able to restore the most recent backup to reset the passcode after the device has been erased.
    Alternatively, place the device in recovery mode and restore it to erase the device:
    Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to shut down.
    While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    Continue holding the Home button until you see the Connect to iTunes screen.
    iTunes will alert you that it has detected a device in recovery mode. Click OK, and then restore the device.

Maybe you are looking for

  • Too many objects match the primary key oracle.jbo.Key

    Hi OAF Gurus, Currently we are implementing R12 Upgrade , for this we have deployed all the custom OAF Application related files on to the the respective JAVA_TOP folder. We have a custom municipal postal application which tracks the Postal Details.

  • Photoshop Elements 6.0 startet nicht mehr

    Hallo ich habe die Vollversion unter Vista laufen. Die lief bisher immer ganz prima. Jetzt bekomme ich beim starten die Fehlermeldung "Adobe Photoshop Elements 6.0 (Organizer) funktioniert nicht mehr Es wird nach eine Lösung des Problems gesucht" KAn

  • Aebs in bridgemode or not

    when i bought my aebs two years or so ago, i got it finally working with the help of this forum. the modem/router/wlan station that came with the dsl (t-com, germany, "speedport w 701 v") has its wlan switched off. the aebs is connected to the t-com

  • How to display word document as a HTML document in portal

    Hi I developed a portal application in that i am displaying word document using IFrames, from my application i am uploading word document and saving those document in KM Requirement is that i need to provide an option to show this word document in ht

  • Ubuntu: no screen display

    I have recently been subjected to a nice friendly hard drive wiping by my eMac, and i have no mac OS X disk, so i thought I'd get ubuntu on it until i can afford OS X again. having downloaded the PPC iso and burned it onto my disk, i booted it , and