Order of the output

I have a query
Eg: select id,name from user
where user.id in ('a7','a6','a3',....); --- ID's are in different order not, in ascending or descending
the output of the above query is something like
id name
a3 a3_name
a7 a7_name
a6 a6_name
But I would like the output to be in the order input was given inside
a7 a7_name
a6 a6_name
a3 a3_name
How do we do this?

user651347 wrote:
I had a list given with 300 users and neither in ASC or DESC order
so we need to order this the way it was given or in the select ... in (); statementOk. Did you mathematical "set" theory at school? Familiar with Venn diagrams?
If you are, let's look at two sets of values.... (1,2,3,4) and (4,3,2,1)....
As a Venn diagram you'd end up drawing those two sets as:-
Set A                                             Set B
#                    #   2  #                     #
#                    #  1     #                     #
#                    #   4    #                     #
#                    #   3  #                     #
            #######               #######They are identical sets and there is no order to them.
You can even do this in SQL, to see if there is a difference in the two sets...
SQL> create or replace type myset as table of number;
  2  /
Type created.
SQL> select myset(1,2,3,4) multiset except myset(4,3,2,1) as diff from dual;
DIFF
MYSET()As you can see, it doesn't matter what order the elements of the set are specified in. As a SET, they are considered identical. The order of the elements when specifying the sets makes no difference.
So, in your query, you can pass your elements to you IN operator in any order you like... but those elements are a SET of data... they have no order, except in the way you read them. Oracle see's no order to them, and cannot consider there to be an order to them.
Therefore, if you need an order to the elements, using a SET of data is not the right approach as it doesn't contain an order. You would need to specify a set of data that contains information about the order, and you'd usually do that by inserting the elements into a table (Global Temporary Table perhaps?) with some additional column containing details of the order, and then in your query, you would use the ORDER BY clause to order on that additional ordering information.
The only way to guarantee the order of output from an SQL statement is to specify an ORDER BY clause. ^1^
^1 There are a few exceptions such as hierarchical queries or data generating queries such as those with recursive subquery factoring or model clauses if used in certain ways^

Similar Messages

  • Printing Terms and Conditions for each Purchase order in the RDF output

    Hi All,
    Present i have an RDF report with the registered concurrent program. when i run this concurrent program i am getting the terms and conditions at the end of the purchase orders only once(for example 10 purchase orders). Now the requirement is to get this terms and conditions printed for each purchase order. The output is in PDF format. It's an 11i RDF report. Can any one suggest me the methods how to do this? Please give me reply as soon as possible.
    Thankyou in advance
    Regards,
    Polimera

    Hi, Polimera
    Welcome to OTN
    Present i have an RDF report with the registered concurrent program. when i run this concurrent program i am getting the terms and conditions at the end of the purchase orders only once(for example 10 purchase orders). Now the requirement is to get this terms and conditions printed for each purchase order. The output is in PDF format. It's an 11i RDF report. Can any one suggest me the methods how to do this? Please give me reply as soon as possible.
    Take a fixed frame inside the purchase order master repeating frame and place your terms and condition inside the fixed frame.
    Hope this helps
    If someone response is helpful or correct, please mark is accordingly

  • Block the output in R/3 if order is not compliant

    Hello All
    We are currently implementing SAP GTS  compliance module.  To integrated SAP GTS with the rest of the solution, we want to block the output for purchase orders and sales orders and the creation of the subsequent document.
    For the creation of the subsequent document, there are some SAP notes related to it and it doesn't really create an issue for us
    For the output, we are currently struggling to find a correct solution
    So far, we had found the oss note 900555 to block the printed output for the Purchase order but how can we do it  for the others ?
    In addition, I didn't find any solution for the sales orders output  ( expecially we hae some EDI messages that we want to block)
    Currently we were investigating an  other way to do it:
    - Send back a user status that we will use as condition to determine the output. We have still some concerns about this solution because it means that by default we should put this user status as "non-compliant" for all the orders and only when the status is sent back from GTS we can execute the output
    An issue that raise to me also the developper is that in R/3 the output determination is executed before the first call to GTS.
    I hope that some members of the community have better solution which ideally can cover PO and SO with real time call
    Thank you in advance
    Nicolas

    Hello Bastian,
    We had the same issue and didn't find something useful to block the outputs completely.
    Instead, for EDI Outputs probably you can have an extra text segment added in the idoc structure. And put the document compliant status as Yes/No in that segment. The document status will be available.
    But however as we expect, the Outputs cannot be blocked. But atleast notification about the status can be sent to Third party. You can liaise with third party to have a logic implemented to check the status of this field and pass the information to destination.
    Regards
    Dhilipan

  • Maintaining the Output type in the PO from Sales Order

    Hi experts,
    I have developed one application for Sales Order that..there is one link of Purchase order in the Sales order.if i click on PO in the sales order.it goes to me22n screen.if i will maintain the output type in the PO and Click on SAVE button.it gives some error like (No update of sales order 100001 from purchase
                                     order (error V1 275)).
    cud u help me to solve the above issue.its very urgent.
    is there any way to change to va02 to va03...when i am going  from va02 to me22n
    thanx in advance
    regards,
    hpp

    May be because when saving the PO, it's trying to update some sales order related data too and it's locked by you. Try using the save button in output type maintenance screen, or open the sales order in display mode and call ME22N and try maintaining the output type.
    or try using LEAVE TO TRANSACTION ME22N from VA02.
    Regards
    Sridhar
    Message was edited by:
            Sridhar K

  • Txt output problem,cannot order the output

    Hi,
    I'm working with forms and reports 6i, and I have a problem when generating the .txt output.
    My report consists in some columns (database-scalar) from the main query and in some columns(formula).
    What I'm trying to do is to mix the order of columns (database-scalar) and columns(formula),but
    I can't do it. The columns(formula) are always in the end of the output...
    I've put the right order in the report editor,but It only works to put the order of the columns (database-scalar) .
    Example
    query
    select a,b,c from..where...
    formula colum: desc_a,desc_b
    The desired output
    a desc_a b desc_b c
    The output I get
    a b c desc_a desc_b
    Thanks in advance

    Solved,reading anothers posts found the error.
    Just need to play with the "break order" and separating in groups the formula column and the database-scalar colum.

  • Specifying the output order of elements in XML using Oracle Reports.

    Hi,
    I am developing an Oracle Reports report, using Report
    Builder 6.0.8.17.0 on WinNT. The requirement is that the report
    will only ever be used to generate XML output.
    However, due to a bug in the XML Parser at the other end,
    it's necessary to have certain elements appear in the XML before
    others.
    e.g. This simplistic example shows XML output from Reports
    runtime, which looks something like this:
    <DEPT id="10">
    <NAME>Government</NAME>
    <EMP id="4435">
    <SAL>12000</SAL>
    <ENAME>Harry Boland</ENAME>
    <EMP>
    <EMP id="8643">
    <SAL>21000</SAL>
    <ENAME>Michael Collins</ENAME>
    <EMP>
    <EMP id="9900">
    <SAL>47000</SAL>
    <ENAME>Eamonn de Valera</ENAME>
    <EMP>
    <LOCATION>
    <ADDRESS type="street">Kildare St.</ADDRESS>
    <ADDRESS type="city">Dublin</ADDRESS>
    </LOCATION>
    </DEPT>
    However, the application that is parsing the XML fails due to
    the fact that it expects the LOCATION element to be the first
    within the DEPT element. i.e. before the NAME or any of the EMP
    elements.
    The way I have developed this is by creating a master query
    which creates a master group, G_DEPT, with two column, ID and
    NAME, and two detail queries and corresponding detail groups, EMP
    and LOCATION. These groups are joined to the master using the
    datalink facility in Report Builder.
    Is there any way in Report Builder I can specify that the
    LOCATION element is to be output for each DEPT element before any
    other element belonging to DEPT?
    Thanks,
    Iibhear.

    The order of the elements is determined by the order of the columns in the Data Model. Note that you can also use the "Exclude from XML output" property to completely omit columns form the XML output.
    Message was edited by:
    Brian Hill
    This applies to Reports 10g. I don't know if it also works in 6i.

  • Controlling the output when purhcsae order item is deleted

    HI
    Here is our scenario, we have two outputs automatically determined ( by condition records) when a purhcase order is changed, now when we delete the purchse order item we want only one put type to be triggered and not the other one.
    NEU    - When the PO line item is deleted  we want  trigger this output
    NEU1  - When the PO line item is deleted  we dont want to trigger this output
    Obviously we cannot  use "Fields Relevant to Printouts of Changes"  config to deactivate the EKPO-LOEKZ field as it impacts both the outputs.
    Is there a way to achieve this?
    Thx,
    Krishna.

    Hi Mohan,
    Thanks for the reply, we did try to use that requiremnet option but then how do you know if the purchase order item is being  deleted?  You have this field in the routinue KOMKBEA-DRUVO which gets pouplated with '2' means change.
    Obviously you cannot do a select query on EKPO because the PO is not yet updated at this point of time.
    Thx
    Krishna.

  • ADDRESS_INTO_PRINTFORM - Is it possible to chose the order of line output ?

    Hello,
    I use this FM  - ADDRESS_INTO_PRINTFORM, that provide me am output format for address.
    The output is:
    lineo
    line1
    line2
    line3 etc etc
    Is it possible to chose the order output ? I mean, first line0, after line1, after line4, after line3, etc etc ??
    Tks.

    Hi,
    You can influence the address returned by ADDRESS_INTO_PRINTFORM.  You would need to create and address layout in the customer range (900 to 999) and assign this to the required country in config.  Then use the user exit EXIT_SAPLSADR_001 to apply your own formatting.
    Regards,
    Nick

  • Modify the output medium log for SRM Purchase order

    Hi, I'm using a FM BBP_ECS_PO_OUT_BADI to modify the output medium of the SRM purchase order. Though it is displaying it in the header level output medium ( radio buttons )
    the document output log holds the old value. Is there a way to modify/update the output log to hold the changed output medium?

    Prasanna,
    Is this to block the PO's being sent to vendors temporarily? We had similar requirement and we were able to do it by updating table BBPD_PO_METAOUT. SAP Note 659386 has more information on it.
    Regards,
    Suren

  • Re-peating the output in sales order

    Hi,
    When we create a sales order and save it , the output is issued through output type. We are now facing an issue.
    when we do some changes in the sales order (manually or batch job), the output is not re-triggred.
    how to re-trigger the output. It can be done manually be repaeting the output but we want  system to repeat the output automatically . how this is possible ?
    regards

    Hi Sonu,
    For such repeating the output type for the change also, need to contact the functional consultants. They can configure in NACE tcode.
    FYI, they are supposed to maintain the acess sequence, procedures and conditions records and assign them.
    Regards,
    Aditya

  • Repeating the output in sales order

    Hi,
    When we create a sales order and save it , the output is issued through output type. We are now facing an issue.
    when we do some changes in the sales order (manually or batch job), the output is not re-triggred.
    how to re-trigger the output. It can be done manually be repaeting the output but we want  system to repeat the output automatically . how this is possible ?
    regards

    Hi,
    Check in VV12 for the condition record, there is one button called Repeat Output. Use that it used for the repeat output processing only. I think this will solve your problem
    Hope you get some inputs
    regards,
    Sagar
    Edited by: Sagar Wagh on Dec 18, 2009 7:28 AM

  • Generating the output in Ascending order of Date (Month-YY)

    Hi I have a query as below...
    I want the result to be in Ascending order of date in the form of (Month-YY)
    but i couled get the desired order
    the result is next to the query...
    SELECT TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'MON'), 'MONTH') || ' - ' || TO_CHAR (TO_DATE (poh_date_d), 'YY'), class_code_c, COUNT (coach_no_c)
    FROM mecd_coach_m
    WHERE poh_date_d BETWEEN TO_DATE ('01-JAN-07') AND TO_DATE (SYSDATE)
    AND poh_stn_c = 'MTN'
    GROUP BY TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'MON'), 'MONTH') || ' - ' || TO_CHAR (TO_DATE (poh_date_d), 'YY'), class_code_c
    ORDER BY TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'MON'), 'MONTH') || ' - '
    || TO_CHAR (TO_DATE (poh_date_d), 'YY')
    The Output
    TO_CHAR(TRUNC( CLASS_CODE COUNT(COACH_NO_C)
    APRIL - 07 ACCN 12
    APRIL - 07 ACCW 7
    APRIL - 07 ART 1
    APRIL - 08 ACCN 16
    APRIL - 08 ACCW 8
    APRIL - 08 ART 4
    APRIL - 08 GFSCWAC 1
    AUGUST - 07 ACCN 12
    AUGUST - 07 ACCW 3
    AUGUST - 07 CT 2
    AUGUST - 07 DCBACEN 1
    DECEMBER - 07 ACCN 14
    DECEMBER - 07 ACCW 7
    DECEMBER - 07 ART 3
    DECEMBER - 07 GFSCWAC 2
    FEBRUARY - 07 ACCN 9
    FEBRUARY - 07 ACCW 5
    FEBRUARY - 07 GS 27
    FEBRUARY - 07 GSCN 60
    FEBRUARY - 08 ACCN 13
    FEBRUARY - 08 ACCW 9
    FEBRUARY - 08 FACCW 1
    JANUARY - 07 ACCN 1
    JANUARY - 07 ACCW 4
    JANUARY - 07 ART 3
    JANUARY - 07 GFSCWAC 1
    JANUARY - 08 ACCN 15
    JANUARY - 08 ACCW 13
    JANUARY - 08 ART 4
    JANUARY - 08 GFSCWAC 2
    JULY - 07 ACCN 8
    JULY - 07 ACCW 13
    JULY - 07 ART 2
    JULY - 07 BUO 1
    JUNE - 07 ACCN 15
    JUNE - 07 ACCW 10
    JUNE - 07 ART 2
    JUNE - 07 FCZ 1
    JUNE - 07 FSCN 1
    JUNE - 08 ACCW 1
    JUNE - 08 ART 1
    JUNE - 08 GS 2
    JUNE - 08 GSCN 3
    MARCH - 07 ACCN 18
    MARCH - 07 ACCW 7
    MARCH - 07 GS 30
    MARCH - 08 ACCN 13
    MARCH - 08 ACCW 9
    MARCH - 08 GFSCWAC 1
    MARCH - 08 GS 55
    MARCH - 08 GSCN 79
    MAY - 07 ACCN 10
    MAY - 07 ACCW 8
    MAY - 07 ART 4
    MAY - 07 FSCN 1
    MAY - 08 ACCN 4
    MAY - 08 ACCW 3
    MAY - 08 ART 1
    MAY - 08 FACCW 1
    MAY - 08 GS 11
    NOVEMBER - 07 ACCN 15
    NOVEMBER - 07 ACCW 12
    NOVEMBER - 07 ART 1
    NOVEMBER - 07 GS 32
    NOVEMBER - 07 GSCN 70
    OCTOBER - 07 ACCN 14
    OCTOBER - 07 ACCW 7
    OCTOBER - 07 ART 1
    OCTOBER - 07 FACCW 1
    OCTOBER - 07 GS 38
    SEPTEMBER - 07 ACCN 8
    SEPTEMBER - 07 ACCW 9
    SEPTEMBER - 07 ART 1
    SEPTEMBER - 07 DCTACEN 1
    SEPTEMBER - 07 DCTEN 2
    Please suggest me the Solution
    Thank You....

    U r right. It will give error.I am sorry for it. I am sending the correct code. I think it will work.
    SELECT TO_CHAR(TO_DATE(PD,'MM-YY'),'MONTH')||'--'||TO_CHAR(TO_DATE(PD,'MM-YY'),'YY') DATE,class_code_c,COUNTS
    FROM
    SELECT TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'MM'), 'MM') || ' - ' || TO_CHAR (TO_DATE (poh_date_d), 'YY') pd,
    class_code_c, COUNT (coach_no_c) COUNTS
    FROM mecd_coach_m
    WHERE poh_date_d BETWEEN TO_DATE ('01-JAN-07') AND TO_DATE (SYSDATE)
    AND poh_stn_c = 'MTN'
    GROUP BY TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'MM'), 'MM') || ' - ' || TO_CHAR (TO_DATE (poh_date_d), 'YY'),
    class_code_c
    ORDER BY TO_CHAR (TRUNC (TO_DATE (poh_date_d), 'mm'), 'MM') || ' - '
    || TO_CHAR (TO_DATE (poh_date_d), 'YY'))
    For checking:
    select to_char(to_date(dt,'mm--yyyy'),'month')||'--'||to_char(to_date(dt,'mm--yyyy'),'yyyy'),SUM
    from
    (select to_char(hire_date,'mm')||'--'||to_char(hire_date,'yyyy') dt,sum(salary) SUM from employees
    group by to_char(hire_date,'mm')||'--'||to_char(hire_date,'yyyy')
    order by
    to_char(hire_date,'mm')||'--'||to_char(hire_date,'yyyy'))

  • Set up the output GR slip for RE (customer return) Order Type

    Dear Experts,
    I need to set up the output GR slip for RE (customer return) Order Type
    Kindly let me know how can I do this in SAP
    Regards
    Shetty

    Hi,
    As I understand your question, you need to set up an output type for printing Goods Receipt in Sales Order (RE) - perhaps when the RE order is saved. For this, you can follow the following steps. Also you need to take the help of an ABAPer to develop a form which prints as per your requirement.
    For configuring the output, follow the steps
    a. Go to SPRO>Sales and Distribution > Basic Function > Output Control > Define Output type.
    b. Create a new output type (Eg: ZTRE)
    c. Create a new Access Sequence and put in the required condition tables... The Key combination may be Document Type / Customer or Document Type /  Sales Orgnaization / Distribution Channel. etc.
    d. Assign the access sequence to the new output type.
    e. Create a new ouput procedure and assign new output type to it.
    f. Assign this new output procedure to the document type.
    g. In Tcode: VV11 maintain the condition record for Output type ZTRE.
    When the output type is created, a form and a program needs to be assigned to it so that the requirement of GR slip gets printed. You have to take the ABAper's help for the same. You have to mention the fields which have to be printed on the GR Slip. You can do the same for delivery document as well.
    Else you can go to Tcode: NACE to do the same configuration. You have to select V1 for Sales documents.
    Hope this answeres your question
    Thanks
    Mukund S

  • User exist for controlling the OutPut type in sales order

    Hi
    Is their any exist which controls the output type based on header data of the order? VA01/02.
    Best regards
    Satish Kumar K

    Hi,
    IN the VOFM routine you can use the structure KOMKBV1 which will be populated with the sales org (VKORG), division (SPART) and order type (AUART).
    Example
    SY-SUBRC = 4.
    IF KOMKBV1-VKORG = '0001' AND
        KOMKBV1-SPART = '12' AND
        KOMKBV1-AUART = 'ZXXX'.
    SET THE return code to 0 to propose the output type.
      SY-SUBRC = 0.
    ENDIF.
    Hope this helps..
    Thanks,
    Naren

  • Ordering the output file

    Is there a way to order the output files so the pieces come out in order by pallet so we don't get zero pallets in the middle of our container and address files?
    Thanks.

    Bill,
    You may want to take a look at Mailflow in Presort.  I think the below steps may give you the results you are looking for...
    VIEWS:
    1. Open presort job
    2. Double-click Execution options
    3. Select Sequence by Mailflow
    4. Click OK
    5. Expand Mailflow Setup
    6. Double-click Mailflow
    7. Select Alternate Mailstream Hierarchy Seq
    8. Click OK
    9. Double-click Alternate Mailstream Hierarchy Sequence
    10. Set Presort Scheme to 1
    11. Set Segment (or Entry Point) to 2 as desired
    12. Set Entry Point (or Segment) to 3 as desired
    13. Click OK
    JOBFILE:
    1. Open .pst in an editor
    2. Go to the Execution block
    3. Set the parameter + Sequence Output by Mailflow (Y/N) to Y
    4. Go to the Mailflow block (if block is not available, copy it from master.pst)
    5. Set the parameter Use Alt Mailstream Hierarchy Seq (Y/N) to yes
    6. Go to the Alternate Mailstream Hierarchy Sequence block (if block is not available, copy it from master.pst)
    7. Set Presort Scheme to 1
    8. Set Segment (or Entry Point) to 2 as desired
    9. Set Entry Point (or Segment) to 3 as desired
    Thanks,
    Kendra

Maybe you are looking for