Order by and minus in char fields

I have a test query that i have ordered by the expected result order.
select t from (
select cast('1' as nvarchar(20)) as t
union all select '1---qa'
union all select '1q'
union all select '1q1'
union all select '1qz'
union all select 'a'
union all select 'A'
union all select 'č'
union all select 'Č'
union all select 'g'
union all select 'G'
union all select 'ž'
union all select 'Ž'
) q
order by t --collate latin1_general_bin
and the question is... why is minus character (at 3rd line in '1---qa' string) ignored by "order by" clause? That row is put after '1q1' and not after '1'.
When you replace '-' with '+' or any other special char it works as expected but not with '-'. It is just ignored no matter if there is one or more of them.
Don't mind local chars like čž, they are for testing purposes with collate (thus commented) and with bin collation that is not doing proper sorting but minus order is ok in that case.
Tested on SQL 2008 R2 and SQL express 2012, database collation is 'Croatian_CI_AS'.
Is it a bug?

Interestingly this puts it right after 1 in sequence
select t from (
select cast('1' as varchar(20)) as t
union all select '1---qa'
union all select '1q'
union all select '1q1'
union all select '1qz'
union all select 'a'
union all select 'A'
union all select 'č'
union all select 'Č'
union all select 'g'
union all select 'G'
union all select 'ž'
union all select 'Ž'
) q
order by t
in my SQL 2014 instance
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Decrypt and Encrypt a CHAR Field

    Hello everybody,
    my issue is that I want to encrypt a Char field with length 12, which is written in a table. It should be possible if necessary to decrypt the char field after encryption. Do you have any suggestions?
    Thank you already
    Best Regards
    Martin

    Hi Martin..
    try this code
    Data enpwd(32) type c.
    parameter pwd like enpwd .
    ******** Encrypting *******************
    CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'
    EXPORTING
    IM_DECRYPTED_PASSWORD = pwd
    IMPORTING
    EX_ENCRYPTED_PASSWORD = enpwd
    ******** Decrypting *******************
    CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'
    EXPORTING
    IM_ENCRYPTED_PASSWORD = enpwd
    IMPORTING
    EX_DECRYPTED_PASSWORD = pwd
    ********* Output **********************
    write:/ 'Encrypt data=', enpwd,
    / 'Decrypt data=', pwd.
    also try this forum links
    http://forums.sdn.sap.com/thread.jspa?messageID=5077062#5077062
    https://forums.sdn.sap.com/thread.jspa?threadID=1196646&tstart=0
    Regards .
    Shiva

  • Create additional field in sales order item and copy to purchase order item

    Dear SAP Gurus,
    I am hoping that someone could help me by providing me with how to implement the following 2 requirements in the SD order and in the purchase order.
    1. I am wanting to add a custom field to the SD sales order item copying a value from the vendor customer master.
    2. I then want to add a custom field to the purchase order item and copy the value from my custom field in 1. to this new custom field..
    Can you please advise how I would go about implementing the above requirements?  I am assuming that there are exits to allow me to implement these 2 requirements.
    Many thanks
    Henry

    Hi,
    For the first requirement you can use the USEREXIT_MOVE_FIELD_TO_VBAP in report MV45AFZZ.
    For the second, as I think that you will create a RFQ you can try to use the enhancement MEREQ001.
    Regards,
    Eduardo

  • Adding new field to sale order BDOC and replicate to R3

    Hi all,
    I'm trying to map the new customize field in CRM to field VBKD-VSART in R3.
    The reason behind this  was because my customer would like to have field shipping type appear in CRM order, but since this field is not provided by SAP, I've to create it. 
    What I did was:
    1) Create new field VSART via EEWB in CRM. This is done and working fine, the field appeared in 'customer fields' tab.
    2) Put this new field to BDOC in CRM.  I believe this is done when I created via EEWB. I think it use BADI CRM_BTX_EXTENSIONS , implementation CRM_GEN_OBJECTS for this part.
    3) Put BDOC into BAPI in CRM.  This is the part that I'm having a problem with.
    I found that I need to use BADI CRM_DATAEXCHG_BADI for that and I've checked example from implementation CRM_BTX_EEW_DATAEXCH. However, it only contain example to input field in VBAK, VBAP and VBEP.  Can anyone guide me on this part?
    4) Map BAPI to R3. I think that I need to use userexit MV45AFZZ form USEREXIT_MOVE_FIELD_TO_VBKD for that. But what is the incoming structure that I could use to map with VBKD.
    Any help would be appreciate, Thank you in advance.
    Gilbert

    Hello Gilbert,
    Please find if this helps,
    BDOC's to update the custom fields in R/3 from the CRM sales order
    Replication of new customer fields in order to R/3
    regards,
    Muralidhar Prasad Chatna.

  • Sales order doc and item fields in customer line item report(FBL5N)

    Hi All,
    We have some billing documents and the accounting docs are created as well. However, in the FBL5N report, we are not able to display the sales order doc and item info even though the columns are avaliable in the layout.
    Anyone can help?
    Thanks,
    Teo

    Hiya,
    You said you had the Order/Sales Doc field on the layout already.
    Have you ever been able to view the Order? All I can view is the Billing Doc, and I would think that is logical, since the Order is not the immediately prceeding document for the Accounting Doc. The Accounting Doc is created off the Billing Doc and that is what is updated in BSEG. The Sales Order is not updated in BSEG (I haven't seen that happen).
    In the event of a GR into stock posting, the Product Cost Collector or PO is the immediately preceeding document and hence updated in BSEG.
    Cheers.

  • Orders, deliv. and conRel fields in MD04 transaction code

    Hi All,
    I want to know the database tables and fields for Orders, deliveries and conrel fields in MD04 transaction code.
    In MD04 if you give material and plant as input details and say continue, we are getting the Stock requirement list. In that MRP elements : Orders, deliveries and conrel  and the quantity fields against to these elements ,, from where we are getting the data. Is there any function modules for the same?
    Kindly advice me.
    Thanks in advance.
    Regards
    Ramesh.

    Hi Ram Kumar,
    I'm not sure about the screen enhancements can be done for the transaction FBCJ as we don't have any screen exits.
    But we have only BAdI for FBCJ transaction called CJ_DOCUMENT - Change to External Document before Cash Journal Doc. Check.
    Workaround on the method CHANGE with the changing parameter C_ITCJ_SPLIT_POSTINGS.
    Enhance the structure ISCJ_POSTINGS to add your new fields and write the logic in the BAdI method to populate the values to these fields.
    Please give a try and let us know.
    Regards
    Gangadhar
    Message was edited by: Gangadhar Ragula

  • Change description of value fields and segment level chars in prod system

    Hi
    1 . We would like to change the description of some value fields.... We would like to know whether the change has to be carried out directly in the production client by opening the client using SCC4 or we should change the description in development client and transport it to production...
    We are afraid that if we transport the operating concern again from dev to production system using KE3I, it may affect the transaction data which is already lying in the production system
    2. We would also like to create and include some new fields as Segment level characteristics in COPA... What is the proces for the same and whether the same has to be done directly in production or transported from dev client
    3. Some value fields which were copied in our operating concern from a template of Air line Industry, are not suitable to oour business. So we are trying to change their description.. But SAP does not allow to change the description of thes value fields..
    Only those value fields which were created by us starting from VV***, can be changed.. Description of those delivered from the template, cant be changed. What is the process of doing the same
    Regards
    Ajay Maheshwari

    Hi
    When the Operating concern was copied from Airline Industry, many standard chars which are not applicable to Airline Industry were not copied.... For eg: Material group 1 to 5... These are std fields of Mat master which normally exist in Operating concern when I used to create it manually.... Many other chars reqd by the business are not available
    Someone else copied it using Airline template and many reqd chars are not available at all... I have the option of creating User defined chars for it and write a derivation rule to populate it... 
    Though COPA is active, my client does not use it as of now in ECC 5.0.. They would like to use it post ECC 6.0.. So, I thought its better to start afresh than carrying forward the mistakes done by someone else.. They are OK with this model, but I wanted to be sure what all issues can be faced due to this
    Regards
    Ajay Maheshwari

  • Outline Agreements - min order qty and regular vendor flag

    As a part of E Source Integration with ECC we are planning to leverageusing Outline Agreement(Contract Type MK) to store
    Price and other Business Terms for Material / Vendor combinations. Currently we are
    using Purchase Information Record with minimum order quantity and
    regular vendor flag functionalities, and these are maintained manually.
    We intend to use Minimum Order qty and Regular Vendor Flag
    indicator in Outline Agreement as well, however noticed that these fields are
    not available in the screens. Does anyone know if these fields can be enabled in an outline agreement?

    Guys
    thanks for reply..
    But I thnik my question was not fully clear as the aswers didn't make sense to me...
    As a logistics consultant .I know that I can maintain Min Order qty for a material + vendor at PIR level..
    My question ..if I buy 10 items in a PO from a sinle vendor..is there any option to restrict Min qrder qty for these combination of materials..
    or in other words vendor says he dont care about number of items ,but the lot lot should be min..10 cartons only..
    appropriate points will be rewarded.
    thanks in advance.

  • Purchase orders : Open and Completed,Open Only,and Completed Only

    Hi Friends,
    I have got a new requirement in Existing report I have to add few fields Like :
    Slectio screen will be :
    Purchase orders :
    Open and Completed     only
    Open Only
    Completed Only
    When I select open and Completed only, it display only those purchase orders.
    if i select Open only, it should display only open purchase orders, Like wise for Completed .
    Could you please from which table i can find out the purchase is open and completed, or open only, completed only?
    Could provide me the fileds for
    Open and Completed     only ?
    Open Only ?
    Completed Only?
    Regards,
    Xavier.P

    Hi Xavier ,
    Purchase orders :
    Open and Completed only -- All PO in EKKO Table
    Open Only -- Table EKPO for which Final Invoice Indicator(EREKZ) is not set
    Completed Only -- Table EKPO for which Final Invoice Indicator(EREKZ) is set
    Regards
    Ramesh Ch

  • Sale order delivery and billing blocked

    Hi sap sd gurus
    I have a problem after creating a sale order , the one line item in sale order showing status of delivery blocked and billing blocked , now i am unable to post delivery and billing when i see in schedule line item order qty and confirmed qty .
    Now i want to find why this is blocked and remedy for removing this block .
    Could anyone suggest me in this issue asap
    thanks in advance
    Kanna

    Dear Kanna,
    Go to XD02 at the toppage you will find Extras
    In that Extra Topage  you will find a field   Blocking Data.
    Check whether Order block and Delivery Block has been ticked.
    If ticked is there remove the tick and try Delivery and Billing.
    If you have any concerns revert back the same to me
    With Regards,
    Amjath

  • Order Quantity and Target Quantity, both as editable in Sales Order

    Hi All,
    We have a requirement in which order quantity and target quantity, both should be allowed as editable fields in overview screen while creating a sales order or contract. Currently, only one quantity field is editable (order quantity in sales order and target quantity in contract).
    First question, is this possible?
    Second, If possible, then please tell the configurations need to maintain?
    Note: The material is relevant for delivery (so schedule lines allowed).
    Thanks & Regards,
    Vishal

    Hi Lakshmi,
    Thanks for the reply. I think I did not clarify the actual requirements. Let me explain it again:
    I understand that generally, Target qty is in contract and Order Qty is in sales order. But actually, here query is,
    When I create Sales Order (VA01), then while entering Material, user should see both quantity columns (Order Qty and Target Qty) in editable mode.
    So is this possible? If yes, then please guide.
    Please revert back if any further clarifications is required.
    Thanks & Regards,
    Vishal

  • Sold to Party and Ship to party field are in grey out mode in VA01.

    Hi Friends,
    I am facing a very critical situation, Please help me on this.
    While creating the sales order by VA01, the Sold to Party and Ship to Party field are in grey out, so we cannot enter sold to party and ship to party. This is happening for all Order types.
    And while checking the existing sales order by VA02, so I found that at Header level and Item level the Partner tab are disable
    ( mena partner tab are in grey mode,).
    But when we click on sold to party field in VA02 it directly moves to partner but all Partner shown in Sales tab.
    I have check all the partner function and partner determination configuration.
    So can any one help me out in this, how in VA01 sold to party and ship to party field are in grey out mode.
    How in VA02 the partner tab are disable.?
    Thanks
    Irfan Ullah
    09370236510

    Hai Irfan Ullah,
    In Sales - customer
    1. Partners are listed (SP,BP,PY, SH)for account group and Partner Determination procedure(TA) is assigned to it
    Now for sales order type you need to assign the partner determination process
    SPRO
    Sales and Distribution
    Basic Functions
    Partner Determination
    Set Up Partner Determination
    Execute
    Set Up Partner Determination for Sales Document Header
    Select TA - standard order from the right side list
    and select Partner Determination Procedure Assignment (from left)
    Now assign your sales type to Partner determination TA.
    Create a SALES order you can find the sold to and ship to are editable.
    Regards,
    Mani

  • Net Value in Sales order item and header URGENT

    Hi experts
    In some sales orders the net value is not shown but it is available in PR00 condition.
    Where should i check pricing proceedure or copy control,
    In the same sales order type i.e ZRP other sales orders are having net value,
    this sales order is created with reference to sales order type RE.
    Pls guide where to check and what correction needs to be done.
    Thank u in advance.
    regards
    SM

    Hi,
    Pricing procedure in tcode V/08, check the field 'SubTo'.
    Copy control in tcodes VTFA (between SO and invoices).Check the field 'pricing type' for conditions.
    I hope this help you,
    Regards,
    Eduardo

  • Sales order no and line item no in account assignment tab of line item no.

    Hi All,
    When we display a sales order and go to line item --> Account assignment tab --> we can see sales order no and line item no in that screen. We want to know from where this existing no. in that field is populating from.
    We want to know this as we want to check feasibility of changing sales order and item no to maintenance contract no and line item no. ( Maintenance contract we have to pick from notification)
    If anybody has any idea about this do let me know as this is urgent requirment.
    Effort will be rewarded.
    Thanks in advance.
    Edited by: Satish Bharambe on Jul 4, 2008 10:38 AM

    Hi Satish,
    You mean Accounting assignment tab-->In Settlement rule details
    If yes the order number which is coming in that field Sales order and for which sale order you are looking that details both are the same numbers(i.e Nothing but sales order number).
    When you create sales order system will give number of the sales order the number will come in this place.
    I hope it will help you,
    Regards,
    Murali.

  • COPA structure cross 50  char-How to add more char fields in the sturcture

    Hi SAP CO Guru's,
    I am facing one problem in COPA characteristics, I have created the characteristics however in the KEA0 structure where we have already exhaused max limit of 50 char, hence system is not allowing to add these new fields in the structure.
    I need help for getting addition 2 fields into structure.
    I have one more option where few Char fields are not usable, can be remove from the structure if we can not increase the limit of 50 Char in the structure but system is not allowing me th remove the already selected Char fields.
    Thanks in Advance.
    Uday Suryawanshi
    SAP FICO consultant, Pune

    Hi Uday
    There is a way you can increase the limit.. refer the note given above
    However, SAP wont take the responsibility of any thing that happens later on.. It is completely your headache....
    So, better rename the Chars and use them....
    If you are still in DEV Client, delete COPA docs posted till now.. refer Note 21207... This helps you to delete a char if posted data exists
    I personally would prefer to rename and reuse.. After all, recycling is encouraged these days
    Br, Ajay M

Maybe you are looking for

  • WiFI problem: Driver is not bound succesfully...any comments how to solve?

    After a system check my Wifi stopped suddenly working. I have - noticed that the WiFI-network object is not anymore visible in the Network Connections - run WLAN diagnostics with Deveice Manager ==> Tells hw OK - I have updated and reloaded the drive

  • Variable Scope at package or interface level

    Hi, Can we set the ODI Project variable scope to package or interface level because in my project im using a last rundate refresh variable this variable value will be changed at the time of execution of each package. Thanxs Madhavi

  • ADF 11g - and National characters...

    We have difficulties with our danish national characters - in several ADF forms. The database is setup correct - with NLS and all. Our browsers too. Is there some kind of ADF setting to handle NLS characters? Rgds, Henrik

  • Package won't work - how to make one myself?

    After installing and upgrading Arch on my laptop, I wanted to add a battery monitoring application, kpoowersave (since I installed kdebase). Noticed that it is not in pacman's repository. Installed yaourt and found it in AUR. Unfortunately for me, bo

  • Problem with opening Final Cut Pro X

    I had just moved the 'Final Cut Pro' folder with the events and projects from movies into my own folder. I also had just added another desktop (Dunno if that is part of the problem). Since then, when I open FCP, it has a message saying 'The selected