Different order of subgroups groups per configuration in order by clause

Hello,
I have a question regarding Order by and group by of SQL. I have three tables, Groupconfig and ItemConfig and Items.
Group has a extra field which will specify the sorting order of the items when read out from the database.
I have the choice of Sorting by alpa description of the item or a sorting order defined on the item table.
But when I write some SQL to retrieve all the items in the items table and join to the item config table, to get the description of the item and the sorting number,
then join again to the groupconfig table to get the sorting of each group.
Problem is that when I run the query the data is not quite returned in the correct order in each group as defined in the group config for each group.
I know there are differences with the NLS_SORT variable in Oracle but I have a feeling that this is more to do with my SQL can someone help?
I require the overall groups to be retuned by group ID, and within each group a different ordering.
SELECT * FROM
SELECT
GC.GROUPID GP_GROUPID,
GC.DESCRIP GP_DESCRIP,
GC.SORTING_ORDER GP_SORTINGORDER,
IC.SORTING_ORDER IC_SORDER,
IC.DESCR IC_DESCRIPTION,
IC.ITEMID IC_ITEMID,
RID.UNIT I_UNIT,
IC.SORTING_ORDER
FROM
RF_ITEMDETAILS RID,
RF_ITEMCONFIG IC,
RF_GROUPCONFIG GC
WHERE
IC.ITEMID = RID.ITEMID
AND GC.GROUPID = IC.GROUPID
ORDER BY
CASE WHEN GC.SORTING_TYPE = 'N' THEN IC.SORTING_ORDER END,
CASE WHEN GC.SORTING_TYPE = 'A' THEN IC.DESCR END
) GP
ORDER BY GP.GP_SORTINGORDER
But when I run this second group is correct and ordered by Numeric sorting but the first group by the sorting number field is never correct.
Doe this SQL look correct or does anyone know if a good performat way to do this?

maaher cant beleive I actually asked that question. thanks for your reply.
I have changed my SQL to build up the Orber by clause using the case statements like so....( and added Product Group table in also!)
SELECT
PC.PRODUCTID PC_ID,
PC.DESCR PC_DESC,
PC.SORTING_ORDER PC_SORT,
GC.GROUPID GC_GROUPID,
GC.DESCRIP GC_DESCRIP,
GC.SORTING_ORDER GC_SORTINGORDER,
IC.ITEMID IC_ITEMID,
IC.DESCR IC_DESCRIPTION,
IC.SORTING_ORDER IC_SORDER,
RID.UNIT ID_UNIT
FROM
RF_ITEMDETAILS RID,
RF_ITEMCONFIG IC,
RF_GROUPCONFIG GC,
RF_PRODUCTCONFIG PC
WHERE
-- Item Configuration
IC.ITEMID = RID.ITEMID
AND IC.VISIBLE = 'Y'
-- Group Configuration
AND GC.GROUPID = IC.GROUPID
AND GC.VISIBLE = 'Y'
-- Product Configuration
AND PC.PRODUCTID = GC.PRODUCTID
AND PC.VISIBLE = 'Y'
-- Order by
ORDER BY
PC.SORTING_ORDER,
CASE WHEN PC.SORTING_TYPE = 'N' THEN GC.SORTING_ORDER END,
CASE WHEN PC.SORTING_TYPE = 'A' THEN GC.DESCRIP END,
CASE WHEN GC.SORTING_TYPE = 'N' THEN IC.SORTING_ORDER END,
CASE WHEN GC.SORTING_TYPE = 'A' THEN IC.DESCR END

Similar Messages

  • Different Order Types within a Collective Order

    Dear PP Gurus,
    I have a requirement for having different order types with in a collective order. For example, in a BOM of 3 levels, the order type for each assembly should be different say ZPP1, ZPP2 and ZPP3.
    For this, I have maintained separate production scheduling profiles in each of these assemblies with the respective order types. Also, I have maintained MRP groups separately for each of these materials. Further, in Plant Parameters, no default order type is assigned.
    However, when I create the order, the system creates all orders with order type ZPP1 which is for the header material.
    As per SAP help, this is possible but I am not able to create collective order with different order types.
    Please suggest any SAP Note or configuration changes which I have missed out.
    Thanks!
    With Regards,
    Nitin

    Dear Sabine,
    Thanks for your reply.
    However, as per SAP help, this is possible. Please refer to the link http://help.sap.com/saphelp_470/helpdata/en/ee/b6532cae8011d19e97080009b0db33/content.htm
    In this link, under Pre-reuisites section, in Point 2 it is mentioned
    "This indicator is transferred into the order header (master data) of the orders. If there are differing order types within the collective order, the setting of the indicator of the order type of the leading order takes precedence. This indicator is transferred to all lower-level orders and overrides their original indicators."
    The above line implies that different order types are possible with in a collective order.
    Please suggest some way out.
    Thanks!
    With Regards,
    Nitin

  • Number range for different order types

    hi
    pl tell me how to create the number ranges for production order s and how to assign this number ranges to different order types in production server.
    thanks and regards

    Dear ,
    Goto CO82 ,
    1.Frist you should review in the Overview Screen (Hit the Orview in CO82) wether you have option to create the group as per required number ranges for two order type
    2.Hit the Pencil Button of the Group : It will take you "Maintain Number Ranges Group" and Select Group on the top -
    Insert.It will pop up with Inser Group Window .Enter the Text , Enter Number Ranges (From no /To No) and then hot the insert button (+ sign) .You have to create two number ranges group as per your requirement
    3.Now select you order type and hit the Select Eelement (Nip symbol) , select the resepctive group , then Hit Element/Group Tab .Once you follow this steps , you will find your Oredr type assigned to respective number ranges group.
    4.To cross check , you select the number ranges group and hit the Spec button to see the correct number ranges .
    5.MAKE SURE THAT YOU HAVE ORDER TYPE CREATED BEFORE YOU CREATE THEIR NUMBER RANGES -OPJH
    Revery back if u need any help
    Regards
    JH

  • Group Account Configuration - OBIA 11.1.1.7.1

    Hello,
    I am setting up Financial Analytics OBIA 11.1.1.7.1, have following questions regarding group account code setup
    1. Should we always use Natural Account Segment for mapping to Group Account Codes? I could see a customer is using different segment (Sub Account) to classify their accounts to various categories. Should we use combination of Natural Account and Sub Account to classify them in to various Oracle supplied group account numbers?
    2.If i have to go with multiple segments for group account configuration, i could n't see a technical note from oracle support for OBIA 11.1.1.7.1 where ETL tool is ODI. Can we customize ODI using the technote available for Informatica based OBIA 7964 tech note? Are there any changes to apply on top of it?
    Thanks
    Venkat G

    Hi,
    Thanks for reply. We've multiple COAs(Three Companies with seperate COA) Also with in one COA natural Account is dependend on Sub GL Segment and Cost Center. In "file_group_acct_codes_ora" file we only map Natural Accounts.Now if we map only Natural Accounts to Group Account Number it will pull all data. e.g. Natural Account 123,Cost Center A and Sub GL Account 1 should be mapped to Cash. if we map 123 to Cash it will pull all data for all Sub GL Accounts and Cost Centers. Please let me know if you need more clarification.
    Regards
    mzai

  • Aperture performs adjustments in a different order depending on file type

    Aperture performs Adjustments in a different order depending on file type.
    Here's an example:
    Starting with two copies of an image, one in RAW format (Canon CRW from a D60), the other in TIFF (opened the .crw file in Preview and exported an 8bit tiff file).
    {The test image is a photo of my copy of Aperture on the floor of my studio (which, for reference, is a few points of Cyan off of a neutral grey).}
    The original Image.
    http://members.arstechnica.com/x/adrien/testRAW_originalImage.jpg
    Adjustments
    http://members.arstechnica.com/x/adrien/adjustments.jpg
    The RAW file adjusted
    http://members.arstechnica.com/x/adrien/testRAW_adjusted.jpg
    The TIFF files adjusted
    http://members.arstechnica.com/x/adrien/testTIFF_adjusted.jpg
    Import both of these files (testRAW.crw & testTIFF.tiff) into Aperture.
    Make adjustments to the RAW and TIFF images:
    - Exposure: Saturation -> 0 (lowest possible value).
    - White Balance: Temp -> 3500K (from 5000K).
    It doesn't matter what order you perform these operations in.
    The RAW file is now a neutral greyscale image. With the Saturation set to 0, the White Balance makes no major difference in the image, it stays grey.
    The TIFF file, however, is now a blue tinted greyscale image - much like a sepia-tone effect. Moving the White Balance slider changes the color of the image.
    It appears that Aperture is performing the Saturation and WB operations in a different order: for the RAW file it first performs the WB, then the saturation; while in the TIFF file it performs the saturation first, then the WB.
    The result is the same for a JPEG image.
    The RAW behavior is the 'expected' behavior in photography - White Balance should happen 'before' the Saturation setting.
    I've filed the bug with Apple (number 4394125 at bugreport.apple.com). hopefully they'll fix this.
    Cross posted from this discussion at the MacAch on ArsTechnica forums:
    http://episteme.arstechnica.com/groupee/forums/a/tpc/f/8300945231/m/893007866731 /r/832001796731#832001796731

    Well, there are different ways of achieving this.
    Solution 1:
    You can create a new output type which will be triggered and call a same driver program and the new smart form. I am sure you can customize as to what Purchasing document type will trigger which output type. Get in touch with someone in the function team to get this configured.
    Solution 2:
    No Customizing, let the configuration be the same, but in the driver program change the value of  "TNAPR-FONAM" immediately after the form entry_neu to the new form name based on the Purchasing document type.

  • Different Purch Org & Purch Group is shown when PR is transferred to SRM

    Experts,
    We are facing a strange problem,
    A user is creating a PR in R3 under specific Purch org. We have configured to transfer the PR to SRM to carry out the sourcing activity. So that PR reaches in the sourcing cockpit but with different Purch org & Purch group. Even that user is not assiged under that purch group & purch org in SRM.
    No BADI's is implemented.  The user Specific Purch org exist in the SRM and user is assigned to it at ppoma_bbp.
    Any solution for this.. Please
    Thanks

    Hello Anand,
    I assume you are using SRM 70 or above here. PR transfer from ERP to SRM Sourcing Cockpit is handled by Badi in ERP ME_REQ_SOURCING_CUST , where based on the logic written for the purchasing pr will be transferred to SOCO else PR will be available in the CPPR application.
    Also the transfer will happen by PI where a technical user called as Integration user will be used, which will also be assigned to the PPOMA in SRM under the purchasing unit.
    With the successful PR transfer to SRM , a shopping cart will be created in the SRM system automatically with the Integration user and the same grp will be carried forward to the Draft RFx creation in SOCO. But the user will have the option to change the purchasing group based on his needs.
    It will not be depend on the logged in user purchasing grp and org.
    Hope this answer your query here.
    Best Regards,
    Rahul

  • Group by and order by clause

    Hi,
    I have wriiten the below query and i am using group by and order by clause....but i am not getting the required result
    SELECT b.ACCOUNT_REGION,CASE WHEN b.product_reference_status='Reference' THEN 'Recruited' WHEN b.product_reference_status in ('Inactive','Declined') THEN 'Inactive' WHEN b.product_reference_status ='Nominate' THEN 'Inprogress' ELSE 'Other' END product_reference_status, COUNT(decode(b.product_quarter,'Q1FY09',b.REFERENCE_ID)) Q1FY09, COUNT(decode(b.product_quarter,'Q2FY09',b.REFERENCE_ID)) Q2FY09, COUNT(decode(b.product_quarter,'Q3FY09',b.REFERENCE_ID)) Q3FY09, COUNT(decode(b.product_quarter,'Q4FY09',b.REFERENCE_ID)) Q4FY09, COUNT(decode(b.product_quarter,'Q1FY10',b.REFERENCE_ID)) Q1FY10, COUNT(decode(b.product_quarter,'Q2FY10',b.REFERENCE_ID)) Q2FY10, COUNT(decode(b.product_quarter,'Q3FY10',b.REFERENCE_ID)) Q3FY10, COUNT(decode(b.product_quarter,'Q4FY10',b.REFERENCE_ID)) Q4FY10, COUNT(b.product_quarter) Total
    FROM refdump a, ref_dh_pr b
    WHERE A.REFERENCE_ID=b.REFERENCE_ID AND (b.CREATED_ON - NVL(a.REFERENCE_DATE,a.CREATED))>15 group by b.account_region,product_reference_status order by 2
    output is as given below
    Region Status Count
    LAD     Inactive     0
    EMEA     Inactive     21
    *APAC     Inactive     2
    *APAC     Inactive     1
    EMEA     Inactive     2
    EMEA     Inprogress     220
    LAD     Inprogress     19
    LAD     Other     2
    LAD     Other     0
    LAD     Other     5
    LAD     Recruited     182
    APAC     Recruited     191
    My question is
    1) Why i am geeting two APAC regions and 3 LAD (marked *) regions when i have grouped by region and status
    2) How can i make the status in the following order
    a) Recruited
    b)Inprogress
    c)Inactive
    d)Other
    Thanks,

    <i>group by b.account_region,product_reference_status</i>
    Just take all the columns in the group by clause in your select segment and run the SQL, you'll come to know abt the different values in columns which group together.
    *009*

  • Cant use more than one authorization group per report with SBO CR Basic

    Cant use more than one authorization group per report with SBO CR Basic.
    I have installed on SAP Business One SBO 2007 SP00 PL49 the Crystal Reports Basic 2.0.0.7.
    i have defined two users, manager and supervisor.
    I have defined two groups, M and S.
    Manager belongs in managers (M), and supervisor is assigned to the supervisors (S).
    i enter to one report, disable the public option to enable group authorization, and then check M group.
    Manager can see the report, but Supervisor is not allowed. So far good.
    Then i uncheck M, then check S in the report properties, and Manager cant get in, supervisor opens the report, So far good.
    But when we check both Groups or more, only the M group authorization appears to work, and S group users cant acess, even the report is allowed for that group, also happens with all the groups appart the first (2nd, 3rd, 4th, etc.).
    It seems that a report can manage a single group, but i have to be shure to tell this to the customer.
    So far we have included all Manager users to the S group in order that only S group is used and authorized users can use, but this is duplicating user participation in groups, and it would be much easier to check the desired groups for a single report.

    Cant use more than one authorization group per report with SBO CR Basic.
    I have installed on SAP Business One SBO 2007 SP00 PL49 the Crystal Reports Basic 2.0.0.7.
    i have defined two users, manager and supervisor.
    I have defined two groups, M and S.
    Manager belongs in managers (M), and supervisor is assigned to the supervisors (S).
    i enter to one report, disable the public option to enable group authorization, and then check M group.
    Manager can see the report, but Supervisor is not allowed. So far good.
    Then i uncheck M, then check S in the report properties, and Manager cant get in, supervisor opens the report, So far good.
    But when we check both Groups or more, only the M group authorization appears to work, and S group users cant acess, even the report is allowed for that group, also happens with all the groups appart the first (2nd, 3rd, 4th, etc.).
    It seems that a report can manage a single group, but i have to be shure to tell this to the customer.
    So far we have included all Manager users to the S group in order that only S group is used and authorized users can use, but this is duplicating user participation in groups, and it would be much easier to check the desired groups for a single report.

  • Different order units in info records

    Hi, I need to have different order units for different Plants in Info Records. I find this field only at general level. How can I solve this problem? Can anyone help me? Thanks. Marí

    When you create the info you are creating for plant so you can enter different order unit in diff info as per the plant you select but suppose if you want to maintain more thna one order unit in the same info then you have to activate the variable order unit funcitonlity
    to do that go to material masater purchiasing view and enter the 1 0r 2 based on you reqs
    1- active
    2- active with own price (means in the info record for all the order unit you can maintain the price
    then maintain the diff order unit in mateirl master
    within mateirl master Additionl data-unit of measure here you can enter
    now when you go to info record you will see the variable orderunit filed is populate on general data screen if not populate and then populate.
    if 2 is entered then when you click conditio it will popup for pricing

  • Previously reserved stock can still be issued to a different order

    why is it that stock that is reserved for a particular order, can be issued (261) through MIGO for a different order? shouldnt be there reservations for that?

    Hi,
    Only standard availbale option is control of Material availability check during Production  / Process Order creation or release.
    You have to tick INCLUDE RESERVATION in T.code OPJJ.
    Select your checking Group which you have assgin to your Order type in OPJK .
    This will restrict the Order release or creation in case of Material shortage.
    Regards,
    Dhaval

  • Multiple log groups per thread to improve performance with high redo writes

    I am reading Pro Oracle 10g RAC on Linux (good book). On p.35 the authors state that they recommend 3-5 redo log groups per thread if there is a "large" amount of redo.
    Who does having more redo log groups improve performance? Does oracle paralelize the writes?

    redo logs are configured per instance, from experience you need atleast 3 redo log groups per thread to help switch over and sufficient time for archives to complete before reuse of the first redo log group. When you have a large redo log activity there is a potential that redo log groups will switch more often and it is important that archive has completed before an exisiting redo log group can be reused, else the database /instance may hang.
    I think that is what the author is referencing here, have sufficient redo log groups (based on the acitivty of your environment) to allow switching and allowing sufficient time for archives to complete.

  • [solved] [gnome] Switching between windows: now grouped per program?

    I have a question how I can change the behavior in Gnome regarding open windows for programs & switching between those windows.
    OpenBox & LXDE - every instance of a program has its own icon.
    If I have Chromium running in two windows, and LXTerminal in an other window I have 3 icons.
    With ALT + TAB I can switch between all windows.
    Gnome: every program has its own icon, no matter how many instances / windows are open
    If I have Chromium running in two windows, and LXTerminal in an other window I have 2 icons: one for Chromium and one for LXTerminal.
    With ALT + TAB I can switch only between the two programs.
    The icon for Chromium has a downwards-arrow, and if you wait some time, you can choose between the two Chromium screens.
    How can I configure Gnome to have icons for every open window instance, and not grouped per program?
    I prefer to use ALT + TAB to switch between all open windows (an not only between the open programs).
    Last edited by pe7er (2012-08-01 11:52:44)

    Thanks for your fast response!
    I haven't worked with Gnome Extensions before (I used to have Gnome 2 on my Debian machine), so I had to find my way regarding how to install:
    After registration at https://extensions.gnome.org/ I logged in & browsed to the extension that you recommend and just used the switch to switch it on.
    It works great! Thanks!

  • BAPI_ALM_ORDERHEAD_GET_LIST to select two different order at a time (urgent

    hello all ,
    Using BAPI_ALM_ORDERHEAD_GET_LIST i want to select two different orders at a time . As we do in IW38 using select single vaules(1) .
    i want to know how to pass the selection .
    Up to know i have tried like this :
    FIELD_NAME                     S OP LOW_VALUE
    OPTIONS_FOR_ORDERID            I EQ 500460
    OPTIONS_FOR_ORDERID            I EQ 500400
    But i am getting only the first order . But i want both order numbers .
    So please help me on this .
    Thanks are regards ,
    Prem

    Just for information. The following IT_RANGES fields map to the IW38 checkboxes at the top of the selection-screen:
    SHOW_DOCUMENTS_IN_PROCESS      IW38 - Outstanding (CRTD)
    SHOW_OPEN_DOCUMENTS                  IW38 - In process (REL)
    SHOW_COMPLETED_DOCUMENTS       IW38 - Completed (TECO and CLSD)
    SHOW_HISTORICAL_DOCUMENTS       IW38 - Historical
    If you want to select TECO/CLSD orders, then you would use the following in IT_RANGES:
    SHOW_DOCUMENTS_IN_PROCESS      I EQ
    SHOW_OPEN_DOCUMENTS                  I EQ
    SHOW_COMPLETED_DOCUMENTS       I EQ X
    SHOW_HISTORICAL_DOCUMENTS       I EQ
    As you then said, you need to filter out the CLSD statuses using:
    OPTIONS_FOR_STATUS_INCLUSIVE I EQ TECO
    I suspect this would be a more efficient way of selecting the data, but you'd need to check.
    PeteA

  • Different movement types for Goods Issue for different Order Types

    Hello Experts,
    Can we maintain different movement types for Goods Issue for different Order Types at the time of automatic creation of reservations?
    Thanks and regards,
    Satyajit

    Satyajit,
    Folow the link given,
    Re: How to add new movement types when creating reservation?
    Hope this helps you.
    SmanS

  • Nas on airport extreme not recognized by time machine. same nas was previously used as time machine backup on different airport extreme. are there any configuration files that i can delete to fix this problem ?

    nas on airport extreme not recognized by time machine. same nas was previously used as time machine backup on different airport extreme. are there any configuration files that i can delete to fix this problem ?

    Time Machine has been working just fine, but in the last week or two it has given up the ghost. I reset the connections to the drive, and it will basically save a few bytes of data and then hang.
    Although Apple originally announced, prior to the release of the first 802.11n AirPort Extreme Base Stations (AEBSn), that it would support Time Machine backups to AirPort Disks, they removed that option before they did finally release the base station for sale.
    Since then, Apple has posted (as you have noted) that they DO NOT support Time Machine backups to AirPort Disks. As far as I know, they have not changed from that position and those who do these backups find that they become corrupted over time. Sorry, but it sounds like you just confirmed that for yourself.
    1) Has one of the recent updates either on the AE (firmware) or OSX disabled this function?
    No. Again, this feature has never been supported by Apple for every generation of AEBSn released.
    2) Are there any changes I can make to get this working again?
    If your data backups are critical to you, then you will want to use a different solution for your Time Machine backup destination drive strategy. I would suggest that you connect your WD My Book directly to your Mac in the mean time.
    Your other options would be to either use a Time Capsule (which interestingly does support TM backups to AirPort Disks) or a non-Apple solution like the Drobo FS or HP MediaSmart server.

Maybe you are looking for

  • Flat file Ftp Adapter

    How can a I produce a flat file with ftp adapter for a receiving application? Source XML > Destination Flat File

  • How to check My linux is Redhat linux  or OEL linux

    HI How to check My linux is Redhat linux or OEL linux THANKS SIMHA

  • New bookmarks lost whenever Firefox restarts

    I've been having bookmark problems ever since I started using Firefox 4. What happens is that I add or update my bookmarks, but after a reboot or a Firefox restart, my new bookmarks are not saved. I've tried xmarks, but something always changed the b

  • OSB http Header Problem

    Hello all, (I hope I'm right here with my Oracle Service Bus problem) I have a Oracle Service Bus Proxy Service, that calls a Business Service (not in my control). That business service is somehow crap, cause it doesn't respond correctly (in sense of

  • Using an unchecked exception to alter flow control inside a class

    Best-practice question: Is it wrong to use an unchecked exception in an if-like manner? For example, instead of using: if (condition) { -----------a lot of code----------------- } else { ----------some more code-------------- Is it wrong to do it lik