ORDER BY values in array

Hello dear colleagues,
Is it possible to sort values by values in IN clause.
In MySQL there is a function called FIELD (http://stackoverflow.com/questions/866465/sql-order-by-the-in-value-list)
For example:
SELECT * FROM <tab>
WHERE "attribute" IN ('val1', 'val2', 'val3')
ORDER BY FIELD( "attribute", 'val1', 'val2', 'val3');
If it isn't possible how can I do it with SQLScript?

Hi Michael,
I don't think HANA has such sort ordering specification by values as you mentioned. May be, you can try the alternatives as mentioned on the discussion thread itself.
You can try something like mentioned below, but I am not sure if it is a scalable solution.
Regards,
Ravi

Similar Messages

  • Open Sales Order quantity & value

    Hi,
    We have a requirement here of report to show open sales order quantity & value for any month (monthend). There is a datasource 2LIS_11_V_ITM which gives Open order quantity. I have created an ODS with 2LIS_11_VAITM & 2LIS_11_V_ITM which can give me desired qty & value, but only for date of last data upload and not for date in the past.(and to get that, I have to sumup all open orders quantity without using any date filter)
    I am thinking of creating a Infocube over this ODS to update the Open Order qty & value at the monthend (Snapshot scenario). But to update this, I am not able to get the logic for date to be used in time dimension.
    If anyone can think of the solution or any alternate way to develop this kind of report, your help/suggestions are most welcome.
    Thanks,
    Vikram.

    Hi Vikram,
    Find the link, which solves u r requirement
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/bi/arobustdesignofopensalesorderdataflow
    Thanks & Regards
    Ramakrishna Kamurthy

  • Open sales order credit value (S066-OEIKW)

    Hello experts,
    I need to update the table S066 with the Open sales order credit value when an item has no confirmed quantity (VBEP-BMENG). So I have created the new rountine under
    VOFM -> Requirements -> Credit checks -> new include RVKMP901. But I don't know how to update this table.
    From the note 377165, the same is explained. But I am niot able to achieve my requirement.
    So please help me in this regard.
    Waiting for your reply.
    Any Suggestion...
    With regards,
    Vasanth M
    Edited by: Vasanth M on Feb 15, 2010 8:21 PM

    Hello Jack,
    Thanks fo your answer. But I have to update the credit amount to the table S066.
    This credit limit could be viewed in the TC FD33. So please suggest me what to do.
    Thanks in Advance
    Best Regards,
    Vasanth M

  • How to get the Open Order Qty value from Transaction Code RWBE?

    Hello,
    Recently I have a program that needs to extract the value of Open Order Qty value from RWBE.
    My specific steps are as follows:
    - I go to tcode <b>RWBE</b>
    - I select the <b>material and plant</b>
    - I tick the checbox for <b>"Also select special stocks"</b> and <b>"Also select stock commitments"</b>
    - I execute the program double click one of the rows for the <b>Unrestricted Use coulmn</b> and view the <b>Open Order Qty</b>.
    My question is how is this particlar variable attained? I tried Ekbe and the ELIKZ feild from EKPO and I still cant seem to get the right value.
    Hope to hear from you soon.
    Thank you and good day.

    check with FM :
    CALL FUNCTION 'MB_ADD_PURCHASE_ORDER_QUANTITY'
           EXPORTING
              x_matnr = t_matnr-matnr         " TGA/4.6 Erw. Lot
              x_meins = t_matnr-basme         " TGA/4.6 Erw. Lot
                x_matnr = prt_matnr-matnr  " TGA/4.6 Erw. Lot
                x_meins = prt_matnr-basme  " TGA/4.6 Erw. Lot
                x_elikz = space
                x_loekz = space
           TABLES
                xtab    = xtab
                xwerks  = r_werks.
    above fm will get open order qty for given material in po

  • How to summarize Open sales order credit value

    Hi, friends.
    I am designing Add-on report about credit exposure.
    I found the relevant tables of Credit Limit in FD32
    KNKK
    S066
    S067
    Then, I would like to show the document details of open sales order credit value in the report.
    I tried to summarize the open sales order amount from VBAK, VAUK, VBAP, VBUP.
    However, it doest match to the amount in S066 table.
    Can anyone tell us how to summarize Open sales order credit value from SD documents?
    Regards,
    Yu

    Sudheer,
    You need to check the update rule given in the definition of the Credit control Area which you are using for credit management. If you want only the open deliveries then you need to have update rule 15 in the credit control area.
    In the credit controal settings, you need to have settings for the credit check at the delivery level.
    Hope this will solve your issue.
    Regards,
    Chetan
    Edited by: Chetan Gupte on Jul 15, 2010 8:56 PM

  • Assigning values to array in soa 10.1.3

    Dear team,
    I am working on soa10.1.3 server. we have a complex element of string array.we created a varaible of that element. In while loop we need to pass values to array elements.How can we do that..we tried with indexvaraible..but getting error.
    Regards,
    Radha

    schema is
    <schema attributeFormDefault="unqualified"
         elementFormDefault="qualified"
         targetNamespace="http://xmlns.oracle.com/BPELProcess4"
         xmlns="http://www.w3.org/2001/XMLSchema">
         <element name="BPELProcess4ProcessRequest">
              <complexType>
                   <sequence>
                        <element name="input" type="string"/>
                   </sequence>
              </complexType>
         </element>
         <element name="BPELProcess4ProcessResponse">
              <complexType>
                   <sequence>
                        <element name="result" type="string"/>
                   </sequence>
              </complexType>
         </element>
    <element name="element5">
    <complexType>
    <sequence>
    <element name="result" minOccurs="0" maxOccurs="unbounded"
    type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    wdsl is
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions name="BPELProcess4"
    targetNamespace="http://xmlns.oracle.com/BPELProcess4"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:client="http://xmlns.oracle.com/BPELProcess4"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         TYPE DEFINITION - List of services participating in this BPEL process
         The default output of the BPEL designer uses strings as input and
         output to the BPEL Process. But you can define or import any XML
         Schema type and use them as part of the message types.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <types>
              <schema xmlns="http://www.w3.org/2001/XMLSchema">
                   <import namespace="http://xmlns.oracle.com/BPELProcess4" schemaLocation="BPELProcess4.xsd" />
              </schema>
         </types>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         MESSAGE TYPE DEFINITION - Definition of the message types used as
         part of the port type defintions
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <message name="BPELProcess4RequestMessage">
              <part name="payload" element="client:BPELProcess4ProcessRequest"/>
         </message>
         <message name="BPELProcess4ResponseMessage">
              <part name="payload" element="client:BPELProcess4ProcessResponse"/>
         </message>
    <message name="BPELProcessMessage">
              <part name="payload" element="client:element5"/>
         </message>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         PORT TYPE DEFINITION - A port type groups a set of operations into
         a logical service unit.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <!-- portType implemented by the BPELProcess4 BPEL process -->
         <portType name="BPELProcess4">
              <operation name="initiate">
                   <input message="client:BPELProcess4RequestMessage"/>
              </operation>
         </portType>
         <!-- portType implemented by the requester of BPELProcess4 BPEL process
         for asynchronous callback purposes
         -->
         <portType name="BPELProcess4Callback">
              <operation name="onResult">
                   <input message="client:BPELProcess4ResponseMessage"/>
              </operation>
         </portType>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         PARTNER LINK TYPE DEFINITION
         the BPELProcess4 partnerLinkType binds the provider and
         requester portType into an asynchronous conversation.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <plnk:partnerLinkType name="BPELProcess4">
              <plnk:role name="BPELProcess4Provider">
                   <plnk:portType name="client:BPELProcess4"/>
              </plnk:role>
              <plnk:role name="BPELProcess4Requester">
                   <plnk:portType name="client:BPELProcess4Callback"/>
              </plnk:role>
         </plnk:partnerLinkType>
    </definitions>
    bpel file is
    <?xml version = "1.0" encoding = "UTF-8" ?>
    <!--
    Oracle JDeveloper BPEL Designer
    Created: Fri Aug 27 10:01:38 IST 2010
    Author: ruck
    Purpose: Asynchronous BPEL Process
    -->
    <process name="BPELProcess4"
    targetNamespace="http://xmlns.oracle.com/BPELProcess4"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:ns4="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:ns1="http://xmlns.oracle.com/bpel/workflow/xpath"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ns3="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
    xmlns:ns2="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:client="http://xmlns.oracle.com/BPELProcess4"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
    <!--
    PARTNERLINKS
    List of services participating in this BPEL process
    -->
    <partnerLinks>
    <!--
    The 'client' role represents the requester of this service. It is
    used for callback. The location and correlation information associated
    with the client role are automatically set using WS-Addressing.
    -->
    <partnerLink name="client" partnerLinkType="client:BPELProcess4"
    myRole="BPELProcess4Provider"
    partnerRole="BPELProcess4Requester"/>
    </partnerLinks>
    <!--
    VARIABLES
    List of messages and XML documents used within this BPEL process
    -->
    <variables>
    <!-- Reference to the message passed as input during initiation -->
    <variable name="inputVariable"
    messageType="client:BPELProcess4RequestMessage"/>
    <!-- Reference to the message that will be sent back to the requester during callback -->
    <variable name="outputVariable"
    messageType="client:BPELProcess4ResponseMessage"/>
    <variable name="elementMessage"
    messageType="client:BPELProcessMessage"/>
    <variable name="count" type="xsd:int"/>
    </variables>
    <!--
    ORCHESTRATION LOGIC
    Set of activities coordinating the flow of messages across the
    services integrated within this business process
    -->
    <sequence name="main">
    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess4.wsdl) -->
    <receive name="receiveInput" partnerLink="client"
    portType="client:BPELProcess4" operation="initiate"
    variable="inputVariable" createInstance="yes"/>
    <!--
    Asynchronous callback to the requester. (Note: the callback location and correlation id is transparently handled using WS-addressing.)
    -->
    <assign name="Assign_1">
    <copy>
    <from expression="number(1)"/>
    <to variable="count"/>
    </copy>
    </assign>
    <while name="While_1"
    condition="bpws:getVariableData('count') &lt;= number(5)">
    <assign name="Assign_2">
    <copy>
    <from expression="'value'"/>
    <to variable="elementMessage" part="payload"
    query="/client:element5/client:result[bpws:getVariableData('count')]"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('count')+number(1)"/>
    <to variable="count"/>
    </copy>
    </assign>
    </while>
    <invoke name="callbackClient" partnerLink="client"
    portType="client:BPELProcess4Callback" operation="onResult"
    inputVariable="outputVariable"/>
    </sequence>
    </process>
    For the count 1 code is working fine.. for count=2 thrwoing exception
    <while>
    Assign_2
    [2010/08/27 10:23:20] Updated variable "elementMessage" less
    -<elementMessage>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    -<element5 xmlns="http://xmlns.oracle.com/BPELProcess4">
    <result>value
    </result>
    </element5>
    </part>
    </elementMessage>
    [2010/08/27 10:23:20] Updated variable "count" More...
    <count>2
    </count>
    Assign_2
    [2010/08/27 10:23:20] Error in <assign> expression: <to> value is empty at line "86". The XPath expression : "" returns zero node, when applied to document shown below: More...
    [2010/08/27 10:23:20] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown. More...
    </while>
    </sequence>
    [2010/08/27 10:23:20] "BPELFault" has not been caught by a catch block.
    [2010/08/27 10:23:20] There is a system exception while performing the BPEL instance, the reason is "faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {} parts: {{summary=XPath query string returns zero node. According to BPEL4WS spec 1.1 section 14.3, The assign activity &lt;to&gt; part query should not return zero node. Please check the BPEL source at line number "86" and verify the &lt;to&gt; part xpath query. Possible reasons behind this problems are: some xml elements/attributes are optional or the xml data is invalid according to XML Schema. To verify whether XML data received by a process is valid, user can turn on validateXML switch at the domain administration page. }} ". Please check the error log file for more infromation. Please try to use bpel fault handlers to catch the faults in your bpel process. If this is a system exception, please report this to your system administrator. Administrator could perform manual recovery of the instance from last non-idempotent activity or dehydration point. More...
    [2010/08/27 10:23:20] BPEL process instance #"60002" cancelled

  • BOM not exploding in Sales order & Net Value error

    Hello Dear all,
    I have created a product "A" with BOM items 10, 20 & 30.
    Item cat. Gr for "A" is ERLA & for 10, 20 & 30 is LUMF.
    I have also created BOM with these 3 matls. (ie 10, 20 & 30).
    When processing Sales Order Item cat. appeared in SO for "A" is TAP & for other 3 is TAN. "A" shows the price maintained for it, but not showing Net Value at Header level data in SO.
    Also document is incomplete because of Net value for Items 10, 20 & 30.
    I don?t want price of 10, 20 & 30 should display in SO at Item level
    Can anyone suggest the required setting?
    Thanks
    Shan

    hi,
    For BOM mainly two material groups are used.
    LUMF and ERLA.
    If you used ERLA in the main material which consists of different materials then the pricing would be carried out only for the main item, while the other sub items pricing would not be displayed.
    while if you use LUMF then the main material would not be priced but only the sub items would be relevant for pricing the the total of all the sub items forms the basis of the sales order net value.
    regarding the net value error you can just check the pricing configuration for the steps and sub total.
    regards,
    Siddharth.
    Edited by: SD on Mar 11, 2008 7:51 AM

  • Unable to change the order quantity value during save of sales order

    Hi Experts,
    There is a need to change the order quantity value, based on some conditions, when pressed 'ENTER' or during 'SAVE' of the sales order (VA01, VA02).
    We are trying to change the order quantity value (KWMENG) in table XVBAP in the subroutines userexit_field_modification, userexit_save_document and userexit_save_document_prepare of the user exit 'MV45AFZZ'. But the change is not replicated to field on GUI.
    The order quantity value can be changed in subroutine 'userexit_move_field_to_vbap', but the subroutine is not getting triggered when user changes only the order quantity on screen.
    Please help us in resolving this issue.
    Regards,
    Santosh

    Thanks for your time guys. The issue is resolved.
    SAP is not triggering the vbap user exit as the order quantity on screen is in structure RV45A.
    There are two ways of resolving the issue.
    1. Implement the SAP note #513342 - Quantity change and USEREXIT_MOVE_FIELD_TO_VBAP. But, it is SAP modification note.
    2. Write the code in VBEP exit of MV45AFZZ. This user exit is called whenever the order quantity is changed. But, it is called multiple times in some cases. Hence, need to write code to limit our code execution only once e.g. maintain a global table with our quantity & uom. Check when the quantity and uom in our table is same as quantity on screen. If not, exit from user-exit.
    Edited by: Santosh Kacham on Nov 11, 2011 6:37 AM

  • How to pass value in array to another procedure?

    Hello.
    I have created application by Developer form9i.
    And I have some problem about passing value in array to another procedure.
    My code is :
    PROCEDURE p_add_array (col_no in number,
    col_val in varchar2) IS     
    type xrecord is record(col number,vcol varchar2(1000));
    xrec xrecord;
    type varraytype is varying array(42) of xrecord;     
    xvartab varraytype := varraytype();
    alert number;
    BEGIN
    set_application_property(cursor_style,'busy');
    xrec.col := col_no;
    xrec.vcol := col_val;
    xvartab.extend(1);
    xvartab(col) := xrec;
    EXCEPTION
    when others then
    set_application_property(cursor_style,'default');
    alert := f_show_alert('!Error ORA-'||
    to_char(DBMS_ERROR_CODE)||' '||
    substr(DBMS_ERROR_TEXT,1,240),
    'al_stop');          
    END;
    And I want to have
    PROCEDURE p_print_arrey is
    BEGIN
    END;
    So how to bring value of xvartab( ) in p_add_array to use in p_print_array?
    Anybody please help me solve this ploblem.

    Hi,
    Instead of declaring the array locally within the procedure (i.e. p_add_array), define it in the package specification (i.e. Under Program Units).
    -- Shailender Mehta --

  • How to Retrieve Purchase order TAX value price

    Hi,
    I want to retrieve Purchase order TAX value price from the purchase order is there any function module to retrieve this value.  Or from which table we can retrieve this value using purchase order no.
    Thanks in advance

    Hi Pradeep,
    Have you looked BAPI <b>BAPI_PRICES_CONDITIONS</b>?
    Hope this will help.
    Regards,
    Ferry Lianto

  • Sales order net value and invoice net value differ

    Hi Gurus,
    i placed  sale order 03/08/2009 the net value of the order is 30000 USD, the same day i have done some price modification (manually i entered the header condition with value of 50 USD) after entering the header condition sales order net values is showing 50 USD. then delivered and invoiced. in the invoice net value is showing 30000 USD. my requirement is the invoice also has to show the 50 USD only. why it is not showing the sales order net value? is there any setting need to be done  regarding this problem?
    Thanks in advance

    i changed the pricing type as D
    From your comments, I presume in copy control, a different alpha value would have been maintained and with that settings, sale order, delivery and billing were generated.
    What I would suggest you is that you create a sale order once again for the same customer and 5 materials, make same changes in pricing, do PGI and billing.  See how it works.
    thanks
    G. Lakshmipathi

  • Restrict Purchase Order Minimum Value

    Hi,
    We want that the SAP System should not allow the user to create a Purchase Order of Value less than Rs. 5000.
    Is there any SAP Standard Functionality available for the same or we need to use the User Exit?
    Regards,
    PK

    Thanks Shital for the reply.
    We are not using Release Strategy, hence we want to out the check at the PO Creation level only.
    Pls. advise.
    Regards,
    PK

  • Sales order net value

    How and where the sales order net value will be communicate with credit management as a open order value?

    Hi Gopalal.,
                          The subtotal field A is related with credit managemnt in Pricing,In pricing if we want to caliculate the credit limit on only PR00 you can set subtotal A immediatly after A,If you want to caliculate Credit limit after dicounts then Subtotal A should be placed after discounts,
    So Subtotal A is nothing but the values of the pricing are stored in A field which compares the credit limit in sales order
    IMPORTANT thing is credit limit gets updated with the help Of INfo structure SO66 in OMO1
    REWARD if helpfull
    Thanks & Regards
    Narayana

  • Reduce Remaining Order Planned value for services with PO

    Hi guys,
    I'am looking for a way to reduce the remaining or residual order plan value for a network activity with services where the amount on the PO is below the planned value. If for example the planned value amounts up to 1000 and the PO has been reduced due to negotiations to 900, a remainder order plan of 100 remains on the network activity till the activity is technically closed.
    Is there a way to reduce the ROP when a PO exists for the network activity?
    Thanks, Geert

    We are combining an early visibility of all costs and a strict budget availability control with a formal procedure for project managers to request additional budget.
    We have more and more projects where a part of the budget remains blocked in ROP for service activities because the planned value was more pessimistic than the real PO amount. Since these service activities are typically executed at the end of the project that part remains blocked. Of course the project managers want to use that marging elsewhere without having to pass a request for additional budget.
    We have no issue with the network activity planned costs remaining visible, we just want the ROP to be 0 when a the purchase requisition for the service activity has been transformed into a purchase order. In the above example 100 of the budget would be freed for other use.

  • Shifting positions of values in arrays

    I need to replicate some functionality in existing IDL (Interactive Data Language) code. This language has some very high level constructs for moving values in arrays. This statement:
    shifted_array = shift(my_array, xshift, yshift)shift all the values in my_array in the x direction by xshift and all the values in the y direction by yshift (and wraps the values around) and puts them in shifted_array.
    How would I best implement this in Java? That is, do it row-by-row / column-by-column / element-element? If so, does anybody have such code already? If not, is there some 'higher-level' way to do this? or use some other data structure?
    Message was edited by:
    allelopath

    Most of the functionality you describe is in
    arraycopy(Object, int, Object, int, int) - Static method in class java.lang.System
    Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
    You need to handle the wraparound.

Maybe you are looking for