Order by...like order of a IN condition

Hi,
it's possible order the result of this statment
SELECT CODI_AVVI,NUME_AVVI FROM
V_Asp_repoanagbollavvi
WHERE CODI_BOLL_AVVI=1097
and CODI_AVVI in (10, 2, 4, 7, 3, 22, 55, 5)
by the order that is in "IN" condition?
I would that NUME_AVVI is order by
10
2
4
7
5
I must create a view, before run this statment?
If it's the solution, how can I do this?
I build parametrical the string of IN condition. The statment is above.
Thank's a lot
Paolo
ps. this is the statment that generate the string for the "IN" condition
SELECT X.CODI_AVVI,X.NUME_AVVI, X.impo_avvi,X.desc_prov,x.ordi_unio
FROM
(SELECT '1' ordi_unio,A.CODI_AVVI,a.NUME_AVVI, a.impo_avvi,b.desc_prov,a.nume_ordi
FROM V_Asp_repoanagbollavvi a,
v_asp_relaavviprov b,
v_asp_relaavvidettcate c,
v_asp_gestazieinte d
WHERE a.CODI_BOLL_AVVI= 1097
AND a.codi_avvi=b.codi_avvi
AND a.codi_avvi=c.codi_avvi
AND (c.codi_dett_cate=d.codi_dett_cate AND b.codi_prov=d.codi_prov
     AND ((a.impo_avvi >= d.impo_mini and a.impo_avvi <= d.impo_maxx
               and 1 =(SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi))
               OR 1 < (SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi)))
AND b.codi_prov in (select codice_provincia from v_asp_anagindiazie f where f.codi_azie=16250)
AND d.codi_azie= 16250
UNION
SELECT '2' ordi_unio,A.CODI_AVVI,a.NUME_AVVI, a.impo_avvi,b.desc_prov,a.nume_ordi
FROM V_Asp_repoanagbollavvi a,
v_asp_relaavviprov b,
v_asp_relaavvidettcate c,
v_asp_gestazieinte d
WHERE a.CODI_BOLL_AVVI= 1097
AND a.codi_avvi=b.codi_avvi
AND a.codi_avvi=c.codi_avvi
AND (c.codi_dett_cate=d.codi_dett_cate AND b.codi_prov=d.codi_prov
     AND ((a.impo_avvi >= d.impo_mini and a.impo_avvi <= d.impo_maxx
               and 1 =(SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi))
               OR 1 < (SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi)))
and b.codi_prov in (select g.codi_prov
               from paraprov g
               where g.codi_regi = (select codi_regi from
                              v_asp_anagindiazie f where f.codi_azie=16250))
and b.codi_prov not in (select codice_provincia from v_asp_anagindiazie f where f.codi_azie=16250)
AND d.codi_azie= 16250
UNION
SELECT '3' ordi_unio,A.CODI_AVVI,a.NUME_AVVI, a.impo_avvi,b.desc_prov,a.nume_ordi
FROM V_Asp_repoanagbollavvi a,
v_asp_relaavviprov b,
v_asp_relaavvidettcate c,
v_asp_gestazieinte d
WHERE a.CODI_BOLL_AVVI= 1097
AND a.codi_avvi=b.codi_avvi
AND a.codi_avvi=c.codi_avvi
AND (c.codi_dett_cate=d.codi_dett_cate AND b.codi_prov=d.codi_prov
     AND ((a.impo_avvi >= d.impo_mini and a.impo_avvi <= d.impo_maxx
               and 1 =(SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi))
               OR 1 < (SELECT COUNT(*) from
                    relaavvidettcate e where e.codi_avvi=a.codi_avvi)))
and b.codi_prov not in (select g.codi_prov
               from paraprov g
               where g.codi_regi = (select codi_regi from
                              v_asp_anagindiazie f where f.codi_azie=16250))
AND d.codi_azie= 16250) X
order by x.ordi_unio
Message was edited by:
mosquito70

One method
sql>with t as(select 10 num from dual
union select 2 from dual
union select 4 from dual
union select 7 from dual
union select 3 from dual
union select 22 from dual
union select 5 from dual)
select * from t
order by decode(num,10,1,2,2,4,3,7,5,3,6,22,7,5,8,9);
NUM 
10 




22 
5
Sorry I didnt read the edited message
Message was edited by:
        jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to update cost related condition type amount in sales order without disturbing other condition types.

    Hi ,
    How to updae only one item condition  ZYV0 value in sales order. If I can see we have several options from pricing type to update condition types but here My requirement is to update only one condition amount .If I can see other pticing types they will update all condition types .
    -Exclusive option is checked for all the tables maintained in access sequence,
    Below options were not worked for me.
    -In condition type ----> Condition category has been updated with "D"(Tax) pricing type-"G" to update in sales order
    - This option worked for me but  condition category  "F"(frieght) and pricing type -H but in conditions tab when I update two condition amounts are activated for one condition type like below.
    ZYV0--30 % (old condition record value updated in sales order)
    ZYV0- 50% (updated condition record)
    Regards

    Hi Rita,
    Tried with condition category "u" and updated with pricing type "U" . It works as same I used old logic.
    with condition categories "D" and "F" it will update old and new condition record values in sales order.
    ZYV0--30 % (old condition record value updated in sales order)
    ZYV0- 50% (updated condition record)
    I have updated  here existing condition record value from 30 % to 50 % validity periods are not changed.
    Regards

  • Linking between Sales order data and Biling condition

    Hi Bwers,
    Currently we are geneating a report with Sales order Item level (2lis_11_VAITM) information and Biling conditions(2lis_13_VDKON). We have respective DSO for both datasources (Sales order DSO and Biling Condition DSO). We have to pull both information into a report.
    We have sales order number (0DOC_NUM) in Sales DSO and Biling document number (0BILL_NUMber) in Biling DSO. And we found Sales order Number (0BILL_NUM_0DOC_NUMB) as an navigational attribute for Biling DSO.
    We are trying to extract Billing condition type and Billing condition value from Billing DSO.
    Now the question's are:
    1. Can I use Sales order number as linking field for Both DSO' or not. Though It is an Navigational attribute for Biling document number in Biling DSO.
    2. Is the Sales order number and Billing Document number both are same or not. What is the linking field between sales order info to Biling info.
    2. How to bring Sales order info and Biling info into a report through Infoset. If infoset which link should I use bring both info into a report.
    3. Or Multiprovider is the right one.
    3. Please let me know if any other linking fields are existed between these two datasources other than Sales order.
    All the helpful answers are awareded with full points.
    Regards,
    Venkat

    1. Can I use Sales order number as linking field for Both DSO' or not. Though It is an Navigational attribute for Biling document number in Biling DSO.
    - yes you can link, Navigation attrbute does not matter
    2. Is the Sales order number and Billing Document number both are same or not. What is the linking field between sales order info to Biling info.
    --one sales order number may correspond to different billing number including the one which shares the same number.
    2. How to bring Sales order info and Biling info into a report through Infoset. If infoset which link should I use bring both info into a report.
    -- Multiprovider is the best option while dealing with such cases.
    3. Or Multiprovider is the right one.
    --yes.
    3. Please let me know if any other linking fields are existed between these two datasources other than Sales order.
    there may be possibilty of other fields also like Profit center, Controling area etc depending upon your project requirment

  • Is  order in which the conditions given in the 'WHERE' clause are imortant

    Hi All,
    Is the order in which the conditions are given in the 'WHERE' clause are important for
    performance with regard to oracle query plan.
    Regards

    Short answer: no.
    Longer answer: Well. probably not. If you are using very old versions of the database or the rule-based optimizer, you can probably find some corner cases where it mattered. If you are using a vaguely recent version of the database with the cost based optimizer, it shouldn't matter-- the optimizer is free to evaluate the conditions in whatever order it would like and it chooses to do so in the order that it expects to be most efficient. That said, as the number of objects and conditions increases, the number of possible permutations the CBO tries to consider increase dramatically to the point that an exhaustive analysis of all possible conditions isn't feasible. In that case, the optimizer will have to make a reasonable effort to explore the set of possible plans rather than doing an exhaustive search-- the order of conditions is likely to matter slightly in the optimizer's choice of which branches to explore and which to prune if there are many conditions with similar (or identical) costs. Now, that being said, it is very unlikely that you could do anything useful with this knowledge that would be able to force the optimizer to do something that you'd want. It's possible to do, of course, it's just not a particularly useful way of influencing the optimizer.
    Justin

  • Order specific control over condition type

    Dear Gurus...
    There are two oder (sales docments)types  and two condition types, out of them one condition type has to be applicable for both order types and another condition type has to be applicable only for one order type how to configure....
    This is Project Manager interview question any idea please help to rescue...
    Thanks in advance
    siva

    Hi Siva,
    You do like this
    You define two pricing procedures
    In one procedure you put both condition types(For Ex ZZZ1).
    Iin second pricing pricedure you put onecondition type which is applicable to both the document types(For ex:ZZZ2).
    You define two different document pricing procedures to that order types.
    Document pricing procedure for Both conditions order Z1
    Document pricing procedure for single condition order Z2
    Assign that document pricing procedure to those sales document types.
    Now you do the two pricing procedure determinations differently based on the new document pricing procedures.
    Sales area+Z1-->ZZZ1
    Sales area+Z2-->ZZZ2
    Now you can get one condition type in both order types and another condition type only for one order type.
    I hope it will clear for you,
    Regards,
    Murali.

  • Sale order showing a discount condition type twice in conditions Tab

    Dear Experts,
    Sale order showing a discount condition type twice in conditions Tab.
    Could you resolve my issue?
    Thanks in advance.
    Regards,
    Ravi

    Hi,
        In the Sales order, go to Conditions and in the Pricing 'Analysis' , check for where the system is determining the two values of this discount condition. It may be possible that it is determining from two condition tables.
    Also in the access sequence of this condition type, please make sure that the 'exclusive' indicator is checked for the condition tables.
    Please check if it helps.
    Thanks,
    Saurabh

  • SAP report showing sales orders on which pricing conditions have been chang

    Is there a SAP report that shows a list of sales orders on which pricing conditions have been changed.
    My knowledge is:
    Review pricing condition transaction data table (‘KONV’) helps is some way.

    Hi Ashish,
    I don't know any such a report, but I guess you can play arround with table CDPOS.
    Change doc. object = VERKBELEG
    Table Name = KONVC.
    Actually this will take lot of time.
    Thanks,
    Mandar

  • Can we take standard report for all sales orders based on the condition typ

    Hi all,
    Based on the condition type, we need to take a report for sales orders on the particular date.
    Thanks and Regards.....VM

    Hello again.
    Searching for a solution, I found a Logical Database for sales orders, that have all the information that you need.
    Using like reference the post of Bhagavatula, in the same transaction SQVI you can use, instead of the suggested join, you can select a logical database called VAV in Data source.
    This logical database links the tables, VBAK, VBAP, VBUK and KONV that is the central point of the question.
    You can list the information of logical database using the transaction SLDB.
    In 'Logical Database' inform VAV.
    Press F8 to list all the fields.
    More information about logical database in:
    Link: [SAP Logical Database|http://help.sap.com/saphelp_46C/helpdata/EN/9f/db9b5e35c111d1829f0000e829fbfe/content.htm]

  • INVENTORY & ORDER MANAGEMENT Tables join conditions required

    Hi All,
    I have to create one view, it has to display item_number, item_description,quantity_in_warehouse and pendingquantity_in_salesorder.
    query is based on INVENTORY & ORDER MANAGEMENT Tables. i have written below query, it is not giving expected output. Kindly go through once and rectify me if i did any thing wrong while writing the join conditions.
    SELECT mtlb.segment1 Item_Number,
    mtlb.description Item_Description,
    mtld.transaction_quantity Quantity_in_Wearhouse,
    oel.ordered_quantity PendingQuantity_in_SalesOrder
    FROM mtl_system_items_b mtlb,
    mtl_onhand_quantities_detail mtld,
    oe_order_headers_all oeh,
    oe_order_lines_all oel
    WHERE mtlb.inventory_item_id = mtld.inventory_item_id
    AND mtlb.organization_id ; = mtld.organization_id
    AND mtlb.inventory_item_id ; = oel.inventory_item_id
    AND oeh.header_id ; = oel.header_id
    AND oeh.org_id ; = oel.org_id
    AND oeh.ship_from_org_id ; = mtlb.organization_id
    AND oel.ship_from_org_id ; = mtlb.organization_id
    AND mtld.subinventory_code LIKE 'Warehouse'
    AND oel.flow_status_code LIKE 'AWAITING_SHIPPING'
    ORDER BY mtlb.segment1;
    it is bit urgent. please help me to resolve this issue.
    Thanks.
    Edited by: user627525 on Jul 19, 2010 4:35 AM

    Hi Jonny,
    Thanks for your reply. it is very useful for me. need small clarification.
    i have execute the query that u have given. please find the following output.
    segment1 order_number line_number shipment_number on_hand
    210020004000011 10005 1 1 139150
    210020004000011 10006 1 1 139150
    210020004000013 10005 2 1 27675
    210020004000013 10006 2 1 27675
    i have modified the query and added column ordered_quantity from oe_order_lines_all table.
    SELECT
    mtlb.segment1 ; as Item_Number,
    mtlb.description as Item_Description,
    sum(mtld.primary_transaction_quantity) as Quantity_in_Whouse,
    oel.ordered_quantity as PQuantity_in_SOrder
    FROM oe_order_headers_all oeh,
    oe_order_lines_all oel,
    mtl_system_items_b mtlb,
    mtl_onhand_quantities_detail mtld
    WHERE oel.header_id = oeh.header_id
    AND oel.inventory_item_id = mtlb.inventory_item_id
    AND oel.ship_from_org_id = mtlb.organization_id
    AND oel.inventory_item_id = mtld.inventory_item_id
    AND oel.ship_from_org_id = mtld.organization_id
    AND oel.flow_status_code = 'AWAITING_SHIPPING'
    AND mtld.subinventory_code = 'Warehouse'
    GROUP By mtlb.segment1,mtlb.description,oel.ordered_quantity
    ORDER BY mtlb.segment1;
    i have executed the above query. Quantity_in_Whouse is showing double the actual available quantity.
    item_number item_description Quantity_in_Whouse PQuantity_in_SOrder
    210020004000011 item1 278300 100
    210020004000013 item3 55350 125
    when i executed the below query, Quantity_in_Whouse is showing 139050 and 27550 respectively.
    SELECT mtlb.segment1 Item_Number,
    mtlb.description,
    sum(mtld.primary_transaction_quantity) Quantity_in_Whouse
    FROM mtl_system_items_b mtlb,
    mtl_onhand_quantities_detail mtld
    WHERE mtlb.inventory_item_id = mtld.inventory_item_id
    AND mtlb.organization_id ; = mtld.organization_id
    AND mtld.subinventory_code LIKE 'Warehouse'
    and mtlb.segment1 in ('210020004000011','210020004000013')
    group by mtlb.segment1, mtlb.description
    ORDER BY mtlb.segment1;
    item_number item_description Quantity_in_Whouse
    210020004000011 item1 139050
    210020004000013 item3 27550
    please give some solution so that i can display Quantity_in_Whouse as 139050 and 27550 .
    if i am any thing wrong please rectify me.
    Thanks in advance.
    Edited by: user627525 on Jul 19, 2010 7:54 AM
    Edited by: user627525 on Jul 19, 2010 7:56 AM
    Edited by: user627525 on Jul 19, 2010 9:39 AM

  • Doubt - Sales Order- Pricing - "Retain Manual conditions" in SAPUI

    Hi,
    For sales order, at header pricing level, there is a button, "RETAIN MANUAL CONDITION". What is the purpose of this button?
    what ever the result it gives after clicking on this button, I should get it through programatically.
    Could you please help me out with any FM for this purpose..
    Thanks,
    Sandeep

    Hi Michael,
    Thanks for mentioning the function modules.
    My exact requirement goes like this:
    I have sales order. Now I am creating the follow-up document to this. while creating the follow-up, the follow-up document should get updated with pricing condition, which we get when we click on "Retain Manual of Changes" of preceding document.
    Currently I am using CRM_COPY_BADI, for creating this follow-up. But, I couldn't find any method, which updates the pricing conditions. Is there any other BADI, which can solve my purpose while creating follow-up?
    Currently, I am getting the pricing conditions to my follow-up document: what ever I see on on SAPUI screen of Preceding documnet.
    If I click on "Retain Manual Changes" of Preceding document and save. And then if I create the follow-up document, then it is getting what ever the conditions, the preceding document have.
    But, user wants : Without clicking the button of preceding document also, the follow-up documnet should have the result of "Retain manual Changes".
    I hope I am not confusing you. And I I hope you understood my requirement.
    Can you please help me?
    Thanks.
    Sandeep

  • Block the goods receipt against a purchase order without a record condition

    Dear
    I need to block migo against a po if FRB1 record condition price have price value 0
    I need to block only MIGO not the creation of the purchase order.
    How can I do this ?
    Thanks.

    hi,
    Yeah its placed at the item level of the PO, which states wheather GR is possible for it or not...if we uncheck it GR will not be posted...Check Delivery tab in the PO item details...
    But in your case you have to go on with condition type...
    Regards
    Priyanka.P
    Edited by: Priyanka Paltanwale on Oct 18, 2010 5:10 PM

  • Purchase Order item value breakup condition type wise

    Dear Sir,
    We are developing a custom report and in this report we need to reflect  for Purchase Order item wise the break-up of values  at the condition type level .
    In Me23n , at at Item Level , when we click on tab <Condition> then all values break-up at condition type level gets displayed .
    But to use in custom program , we need to know the table  where this information is available .
    Kindly guide us pl .
    Regards
    B Mittal

    Hi,
    This suggestion is based on my understanding of your issue.  May not be straight forward SAP solution.
    I would suggest you to make following assessment for your custom program: (going through the condition tab will lead you to structures)
    1. Try to figure out how the pricing condition are maintained.  Normally you have your Base price PBXX or gross price per EA defined that can be found in the PIR of the material + Vendor combination or in the pricing condition you would have defined.
    2. In same way figure out all the other absolute condition types.  I mean any thing that is not % percentage based on PBXX value. (assess ;your pricing Schema to understand this.
    3. Once you know how is your pricing schema  breakup then try to pick the net price of PO and then do a backward calcuation based on PIR condition value.    .
    Hope this helps.
    thx
    MJ

  • Purchase order print ID for  condition lines

    How to add / remove  condition types ie. freight rates, handling charges in purchase order print out ?.
    i want the values of these condition types to be /not to be in the purchase order print out.
    even when i m maintaining these values in P.0 conditions.

    hi
    in pricing procedure m/08 u can the condition types as print relevant.
    maintain it and check in print preview
    If this Hint had helped please reward points
    gibi

  • Searching for Sales orders with a particular condition type..

    Hi,
    I'm searching for sales orders and purchase orders which contain a particular condition type, can someone please point me in the right direction?
    Regards,
    Attiq

    Hi,
    Goto SE16 and put KONV
    Put the particular condition type that you are looking for and execute
    Copy the KONV- KNUMV value for all the records found
    Goto SE16 and put VBAK / VBRK
    in the field VBAK-KNUMV or VBRK-KNUMV put the copied data from step three and execute
    Note all the corresponding document number i.e. VBAK-VBELN / VBRK-VBELN
    Pls reward if helpful.
    Regards,
    Pramod.

  • Sales order item details with condition types

    Hi Guys,
    I am uploading the sales order details using DIRECT INPUT method in LSMW, one line item having 5 condition types, but in the item level structure BVBAKPOM, I can able to MAP  only four condition types.
    Is there any way to map more then 4 condition type in the ITEM level structure? Or do we need to loop the item level structure.
    Waiting for your valuable replies
    Thanks,
    Gourisankar.

    Hi Harish,
    INOB table key is CUOBJ, At run time the VBAP-CUOBJ is not generated yet. Its value is now "999999999999990001".
    I guess once the order is created we will get an entry in INOB.
    Do you have any other way with which INOB entry can be selected ?
    Thank You.

Maybe you are looking for

  • Capture Audio and Video to different disks or not?

    I thought that capturing audio and video to separate disks was more efficient, now I see in the FCS 2 documentation it says that this is not recommended for any of the DV formats. But it does not say why, or what the consequences of doing this are...

  • This crossgrade is RIDICULOUS!!

    Apple said that they would make this Intel transition as painless as possible. Well this crossgrade nonsense completely contradicts that! I can order an upgrade from FCP 1,2,3 online or in a store, but I can't purchase an upgrade from 4 or 5 to the U

  • From where can i buy keyboard for 2008

    ?  .. i need complete keyboard  for white macbook because my keyboard damage where can find original one ? serial No w88422qx3vy

  • QM in procurement basic flow

    Hi all, Can anybody explain me about the end to end process of QM in procurement ? means....what is the start point and where it end ? ...master data involved ?....... Appreciate your help... Cheers, Pat

  • Table and columns separation  in string

    Hi, I am having one column data containing combining table and column names like act_hand_table.work_order i want seperate table and column names i want separte . filed Please help me Regards, Kiran