Create GUID() based on Business key combination

Hi All,
We have a requirement to create GUID for a Business Key, Please check the below example.
SELECT ID ,AB, (CASE WHEN RANK() OVER(PARTITION BY ID ORDER BY AB ) = 1 THEN NEWID() ELSE NULL END ) AS GID 
INTO #FIN 
FROM (
SELECT 1 AS ID,'A' AS AB UNION ALL 
SELECT 1,'B' AS AB UNION ALL 
SELECT 2,'A' AS AB UNION ALL 
SELECT 2 ,'B' AS AB UNION ALL 
SELECT 3 ,'A' AS AB ) A 
SELECT ID,AB,(SELECT GID FROM #FIN B WHERE B.ID = A.ID AND GID IS NOT NULL) AS GID  FROM #FIN A
I get same GUIDs for row 1 & 2, another Guid for 3 & 4. Can this be done without using a temp table?
Rajkumar

try below
select ID,AB,max(convert(varchar(50),GID)) over(partition by id)
from
(SELECT ID ,AB, (CASE WHEN RANK() OVER(PARTITION BY ID ORDER BY AB ) = 1 THEN NEWID() ELSE NULL END ) AS GID
--INTO #FIN
FROM (
SELECT 1 AS ID,'A' AS AB UNION ALL
SELECT 1,'B' AS AB UNION ALL
SELECT 2,'A' AS AB UNION ALL
SELECT 2 ,'B' AS AB UNION ALL
SELECT 3 ,'A' AS AB ) A
) a1
Thanks
Saravana Kumar C

Similar Messages

  • How to create sequence based (SERIAL) primary key?

    Does anybody know any workaround to modify dictionary table outside Web Dynpro?
    I specify default column value in SQL Studio:
    ALTER TABLE PB_ORGANIZATION COLUMN ORG_ID ADD DEFAULT SERIAL(1)
    Everything is OK, but when I try to insert values in modified table from Web Dinpro EJB application I get the error:
    com.sap.engine.services.ejb.exceptions.
    BaseReliableNoSuchEntityException: The entity does not
    exist in the database. Its value in the cache has to be
    refreshed.
    It seems WebAS keeps some metadata, generated by Web Dynpro, and manual changes in a database table put it out of sync with this metadata.
    I need serial primary keys in my project. Is it possible to solve the above problem?

    I'll better send You entire application. It has Web Service frontend (PhoneBook) which can be used for testing. Method createOrganization() throws the exception.
    No, this error appears in EJB application only.
    BTW, I have even made attempt to replace <default-value>0</default-value> by <default-value>SERIAL(1)</default-value> but it didn't help.

  • Is there a way to create a custom shortcut key to paste my email address?  I would like to be able to press a key combination that will paste whatever I set it to, i.e. my email address.

    Is there a way to create a custom shortcut key to paste my email address?  I would like to be able to press a key combination that will paste whatever I set it to, i.e. my email address.

    There are multiple ways to do similar things. One, built into the system, is to use text replacement. See:
    http://www.tuaw.com/2009/12/31/mac-101-making-text-replacement-work/
    There are other programs you can buy that can do the job in different ways, such as TextExpander. You could also just create a clipping file by dragging your e-mail address to somewhere like the desktop, and then you can simply drag that file to wherever you like to insert your e-mail address there.

  • How to Create an activity based on business partner

    hi guys,
    Can any body help regarding the below scenario.
    1) Creation an business partner.
    2) create an acitvity based on business partner.
    3) Create an lead and opputunity based on business parter.
    What are the function modules should we used to create the above three steps consequently.
    I need the function module for creation of BP , ACTIVITY,
    LEAD,OPPURTUNITY.
    Regards
    Viswa Guntha

    Hi,
    For creating a business partner, use the FM
    BAPI_BUPA_CREATE_FROM_DATA.
    For creating lead, opportunities and activities, use the FM CRM_ORDER_MAINTAIN. You need to handle the tables of this FM accordingly to create different kinds of orders.
    You can do it so by handling the PROCESS_TYPE of CT_ORDERADM_H in the changing tables.
    Regards,
    Karthik.

  • How to create a new "key combination"

    Hi, gurus,
           I need I now key combination like "sales organiztion/distribution  channel/sales office" in a conditon type. How can I set in IMG? Thanks advance.

    hi
    Use t-code V/03
    In addtition to above reply, first check which is the last table no used. You should use table no from 501 to 999
    before creating new table you can check the avilable tables.
    Regards

  • How i can Find primary key combination?

    Hi,
    I have small doubt how i can find primary key combination for a record in siebel application.( For example Opportunity list applet or Account list applet or etc.. what is the primary key combination and how i can find that combination for a particular record)
    Thanks & Regards

    Hi
    From the applet Identify the Business Component (BC)
    From the BC idnetify the table, and the property user key sesuence will give you the proper combination. Column conflic_id is used for handling remote synchronization.
    For BC based on S_PARTY, such as COntact, the table mentionned in User PRop will give your the main table used in this case.
    Best Regards
    EvtLogLvl

  • How to load composite business key into Dimension

    Hi,
    Maybe what I'm asking is very basic but, well, here I go:
    I have a dimension, CollectingAgent, and several tables to populate from:
    Bank (bank_code, bank_name ) [PK: bank_code]
    Agency (bank_code, agency_code, agency_name, address, etc) [PK: bank_code, agency_code]
    Now, for my purposes, collecting agent is the bank+agency descriptions concatenated. I don't know hoy to load, or map, the combinated key (bank_code, agency_code) into the business field of the dimension. OWB won't let me define more than one attribute as business key.
    I'm using OWB 10g Rel2.
    Thanks in advance for your help,
    --oswaldo.
    [osantos]

    Ok, let me try to give an example made up with completely bogus information. I'm going to make a dimension called clothing that has two hierarchies that look like this:
    "Item" hierarchy:
    All Clothing --> Item Type --> Color / Item
    "Color" hierarchy:
    All Clothing --> Color --> Color / Item
    Item type would be values such as pants, shirts, dresses, etc. The low level "color / item" is just a combination of those two (i.e. "Blue Shirt") - and note in this example that it will have 2 composite natural keys. It will roll up over the item type hierarchy under shirts, and under the color hierarchy in blue. Here's a sample of what I'm talking about:
    (Item hier)
    All Products
    ...Pants
    ......Blue Pants
    ......Red Pants
    ......Green Pants
    ...Shirts
    ......Blue Shirts
    ......Red Shirts
    etc.
    (Color Hier)
    All Products
    ...Blue
    ......Blue Pants
    ......Blue Shirts
    ...Red
    ......Red Pants
    ......Red Shirts
    like I said, completely bogus, but this will let me illustrate how to set up the dimension. I'd create the following attributes (hard to format, sorry):
    Key....................Surrogate Key
    ID.......................Natural Key
    Item_Type_ID......Natural Key
    Color_ID..............Natural Key
    Short_Desc.........short description
    Long_Desc..........long description
    Having created these attributes, I'd then create the following levels and assign the attributes as follows:
    All_Products_Level:
    ...Key
    ...ID
    ...Short_Desc
    ...Long_Desc
    Item_Type_Level:
    ...Key
    ...Item_Type_ID
    ...Short_Desc
    ...Long_Desc
    Color_Level:
    ...Key
    ...Color_ID
    ...Short_Desc
    ...Long_Desc
    Color_Item_Level:
    ...Key
    ...Color_ID
    ...Item_Type_ID
    ...Short_Desc
    ...Long_Desc
    Should be pretty easy from there. The whole trick is to have a SERIES of different natural keys - a "generic" one (ID) for dimension levels you don't really care about, and "named" ones (color_id, item_type_id) you can use for given levels. And note that you CAN have more than one natural key at any level, and you can have some natural keys that are not used at all levels.
    For your simple dimension, you can probably do the following (note that I'm assuming the lowest level has your composite two business keys, while the top level is completely separate):
    TOP_LEVEL:
    ...Key (for the surrogate key)
    ...ID (for the business natural key)
    ...Short_Desc
    ...Long_Desc
    BOTTOM_LEVEL:
    ...Key (for the surrogate key)
    ...Business_natural_key_1 (rename to be match your first business key)
    ...Business_natural_key_2 (rename to match your second business key)
    ...Short_Desc
    ...Long_Desc
    Hope this helps! If you need to see something a little more concrete, feel free to email me at SPowell at columbus.rr.com, send me some details on exactly what your keys are, etc. and I'll whip up a quick example for you.
    Thanks,
    Scott

  • Assign key combination to service

    I got a couple of questions:
    1. In keyboard preferences you can assign a shortcut to Services you made with Automator. When I assign a combination that includes the '\' key, it simply disappears, so I can't assign command+\ to my service. It worked previously, though. Why is that?
    2. My Automator script is as follows:
    tell application "GrowlHelperApp"
              set the allNotificationsList to ¬
                        {"Audio Output Source"}
              set the enabledNotificationsList to ¬
                        {"Audio Output Source"}
              register as application ¬
                        "Audio Output Source" all notifications allNotificationsList ¬
                        default notifications enabledNotificationsList ¬
                        icon of application "Script Editor"
              do shell script "SwitchAudioSource -n"
              do shell script "SwitchAudioSource -t system -n"
              set CURRENT to do shell script "SwitchAudioSource -c"
              if CURRENT is "iMic USB audio system" then
                        set DEVICE to "Speakers enabled"
              else
                        set DEVICE to "Headphones enabled"
              end if
              --          Send a Notification...
              notify with name ¬
                        "Audio Output Source" title ¬
                        "Audio Output Source" description ¬
                        DEVICE application name "Audio Output Source"
    end tell
    It doesn't really matter what the script does, but when I press the Play button in the Automator interface, it runs instantly. When I assign a shortcut and press it (I assigned opt-command-,), it takes a few secs until the script is run for the first time. Subsiquent callings to the script are fast as expected. How can I make it run fast the first time?
    3. I want to assign the Caps Lock key or Eject key to execute the script. What is the simplest way possible?
    If you know the answer to either question, I would be very happy to read your answer.

    HI,
    Key combination is your field combinatios which you select or maintain during pricing procedure, its a first step of Pricing procedure determination.
    Lets say for PR00 (Price) you want to determine price with two factors.
    First you will create two condition table with the Tcode V/03
    Here you can have the combination as per your business need.like i said
    1. You want to maintain price for customer & material this is one key field combination. Table 005
    2. You also want to maintain price for customer & material & plant combination this is another key field combination.Table 006
    Now the next is you will create the access sequence for Condition Type PR00 for exp. u maintain access sequence PR02
    First go to V/07 & create access seq. PR02
    now select PR02 & click on access here new entries & and select the condition table here which u have created in the manner system should the condition record for a condition type PR00.(Basically it checks from specific to general).Means first you will put here Table no. 006 & then 005
    After this step you will select that condition table line & select field then enter it will go green means its activate now also select the Exclusive check in front of all the condition table & save it.
    Now you can assign that access seq. to your contition type PR00 & accordingly you can make the condition record for your customer.
    I hope it will clear your point.
    revert me if face any issue.
    Regards
    Deepak

  • Service Tax - Key Combination to Maintain Condition Record

    Dear Experts,
    Can anybody please explain which Key Combination is to be selected while maintaining Condition record for Service Tax ( 0% service tax and Service tax 12.5 + ECS).
    I have created two tax codes - S1 and S0. please explain the procedure to maintain condition record for Service Tax.
    Thanks in Advance.

    HI,
    TAXINN is condition based. The functionality does not work with tax codes, tax codes are for informative purpose..
    JMX1 can be maintained in FV11 with the help of a key combination.
    When you create this condition with respect to vendor/material combination then when a PO is made with these 2 combination the system gets the percentage / value from the condition record and calculates the price.
    Thanks & Regards,
    Kiran

  • MWST Key Combination

    Hi,
    There are 3 available key combinations for MWST condition type, I just want to know the difference of key combinations 'Departure Country / Destination Country' and 'Export Taxes'.  What are their differences and usage.
    Thanks.

    Dear Yeng,
    'Departure Country / Destination Country' and 'Export Taxes'.
    'Departure Country From which country the goods are getting deliver i.e shipping poing country.
    Destination Country' To which country the good need to deliver i.e Country of the ship to party.
    Export taxes This may be indicates different taxes in the export sales.
    Use Through above combination you can able to maintain the Tax condition record diferently based on the different combination data.
    Based on the condition record system will consider the taxes automatically based on the combination while creating sales order.
    I hope this will help you,
    Regards,
    Murali.

  • Key combination Ctrl-Home Ctrl-End not working.

    vim has a default binding for <Ctrl-Home> goes to the beginning of the file and <Ctrl-End> for the end.
    However, I couldn't get these key combinations to work for me. And I've consulted the #vim channel on freenode.
    They said it maybe a problem that the terminal I'm using caught the key and didn't send it to vim, but I find this conjecture hard to believe, because I've since been testing several terminals including xfce's default, roxterm, tilda, lxterminal, lilyterm ... and none of them working.
    Later when I reboot I found that, even under the pure console (tty), the combination still doesn't work !
    So this must be a problem from the original key mapping itself, and not latter stuffs like xfce, terminals and editors etc...
    can anyone help me fix this ? I've also seen the wiki articles but unfortunately they aren't very helpful.

    The <C-{Home,End,Left,Right}> key combinations work in Xterm, but not in urxvt. All of the terminals that I recognize mentioned above are all VTE based terminals. This thread here:
    https://bugs.launchpad.net/ubuntu/+sour … +bug/89660
    is showing a lot of people with gnome-terminal, also VTE based, as not working either. It's definitely a terminal issue.
    The following page explains how to get Vim to recognize key combos that are usually trapped or unmapped by the terminal:
    http://vim.wikia.com/wiki/Mapping_fast_ … rminal_Vim

  • Error while creating https based web clipping portlet

    Please help me if any one has created https based web clipping portlet. I'm getting the following error when https url is used during clipping :
    An exception has occurred : oracle.portal.wcs.transport.http.HttpTransportException WCS-510 -- HTTP connection failed to URL https://google.com by method get
    Please click "Cancel" or "Back" in the above panel (if present) to retry. Otherwise, please try to click "Back" (from the browser) to go back to the Oracle Portal page to restart.
    both are not working
    Steps performed :
    1) Added proxy settings in provider.xml
    2) Imported certificates from https site into WLS_Portlet key store
    Thanks
    Bikash

    Hi,
    Are you using proxy server? if yes you have to configure it, or it is problem with your provider.xml file. Can you past the code from provider.xml related to proxy setting?
    I have resolved this issue by follow following technique, Look this code from provider.xml
    <proxyInfo class="oracle.portal.provider.v2.ProxyInformation">
    <!-- <httpProxyHost></httpProxyHost>
    <httpProxyPort></httpProxyPort>
    <dontProxyFor>*.mycompany.com</dontProxyFor> -->
    <proxyUseAuth></proxyUseAuth>
    <proxyType></proxyType>
    <proxyRealm></proxyRealm>
    <proxyUseGlobal></proxyUseGlobal>
    <proxyUser></proxyUser>
    </proxyInfo>
    commented first three tags and removed value from remaining tags.
    Just try with that, Hope this will solve your problem
    Muhammad Nasir

  • I have error while testing the system created from a sap business objects template in SAP portal

    I have error while testing the system created from a sap business objects template in SAP portal. Error text:
    com.sapportals.connector.connection.ConnectionFailedException: Connection Failed: A nested exception occurred. Could not initialize physical connection. Connection Failed: A nested exception occurred. Could not initialize physical connection. Connection Failed: A nested exception occurred. Could not create JCO connection. 'mshost' missing
    I configure integration SAP portal and SAP BW system. All system requirements are complied.
    Environment
    SAP Business Objects 4.0
    SAP BW 7.31
    1.     I configure SSSO between SAP BW and SAP Business Objects Enterprise 4.0
    2.     Next I setting integration SAP PORTAL with SAP BW system
    3.     I download certificate from portal. Select Certificates and key (http://sapserver:port/nwa) – See scren_
    4.     In next window selected Ticketkeystore and Saplogonticketpair-cert( near part window form)
    5. Select Export entry button and binary format file certificate for download. Press download.
    6.     Save certificate file in local PC folder
    In next step need export certificate file to SAP system. Sequence of step:
    1.       Run STRUSTSS02 transaction .
    2.       Chose certificate ->import.
    3.       Select downloaded certificate file
    4.       Select Add to certificate list button and Add to ACL button
    5.       Inter System ID and Client(000)
    6.       In next I download iview sap business objects template into sap portal: System administration->transport->Import. And select and download sap business Objects iview template in .epa format into sap portal.
    7.       Result – downloaded iview.
    8.       In next step I create system from template. System administration->system landscape.
    9. In next step I input parameters for my system in Connector category, Sap business objects and user management categories: See screen _2
    10.   When I created the system and test the connection error occurred: See screen_3
    This issue is important enough. I would be grateful for opinions and ideas. Thanks in advance.

    Did you find a solution?

  • Calculation of due date based on Business Days for FICA documents

    Hi All,
    I am working on project where SD - FICA integration is in picture. We post some charges through SD and FICA document gets posted on relevant Contract Account.
    Normally we create Sales Order using transaction VA01 and then we do Billing for this Sales Order through VF01. After billng is done, FICA document automatically gets generated.
    We have following requirement to be fulfilled.
    For the SD bills posted as above, I want to calculate due date of these bills based on Business Days for FICA document generated (SAP Standard calculate due date based on Calander days). We can use factory calander for calculating business days in relevant function module.
    I have checked in the system and it seems that event 1330 ( FM - ISU_DUE_DATE_DETERMINE) is not working in this scenario. Is there any other FM which I can use?
    Can anyone help me on this?
    Regards,
    Pradeep

    Hello Praeva ,
    The event 1330 has a sample FM FKK_SAMPLE_1330. It doesnt even have a Standard Function Module.
    You need to create a Installation-Specific FM and put your code to determine the Due Date based on the logic.
    Rgds
    Ram Kumar.

  • Importing Key Combinations of a Lookup table.

    Hi, I have created a lookup table which is equivalent to a check table in R3. For example table named, SPT (Special Procurement Type), Which has a key combination (Composite Keys) in R3 itself and the keys are Plant + Procurement Type and so in MDM Look table both keys are defined as display fields. The problem comes in automating the import. In IM source, both key fields are separate fields, I tried combining the field using Partion, but Automap is not working and so the import automation process. Any thoughts/advices on tackling this issue is appreciated.
    Thanks
    Job.

    Hi Job,
    IF u  combine the fields in partition and then if try to do value mapping automatically,then it is not possible .There u have to map manualy .Automap in value mapping can be done only when values are not combination but single.
    Like
    Source----
    Destination
    abc----
    <null>
    def----
    abc
    xyz----
    def
    xyz
    But if it is like:
    Source----
    Destination
    abc,12----
    <null>
    def,23 -
    abc,12
    def,23
    in above case it is a combination so not possible.
    I hope u im able to make u understand.
    If this has helped u then do Reward points.
    Regards,
    Neethu Joy
    Edited by: Neethu joy on Dec 31, 2007 3:17 PM
    Edited by: Neethu joy on Dec 31, 2007 3:19 PM
    Edited by: Neethu joy on Dec 31, 2007 3:24 PM

Maybe you are looking for

  • Print button on WAD template

    Hi, Presently we are in BW 3.5 version with support pack 22. We enhanced the html code based on ' How to ... Web printing with MS Excel' document. We imported the transport file which contains package and ABAP Classes. After click on the print button

  • MIGO - Goods Receipt against Outbound Delivery  - Default Storage location

    Hi All, We have a Plant A001 and 2  Storage locations B001 and C001. Recently we added a new Storage location D001. Moving forward we would like to have all goods receipts to be posted to the new Storage location D001. What are the steps involved so

  • Scanner driver non-availability

    I have an old scanner (Microtek ScanMaker 4800). It is not recongnized by my Mac (Mac OS X Lion 10.7.5). Scanner has no problem and is working correctly with Windows OS PCs. Scanner manual says that scanner is compatible for Mac. Driver software for

  • Using Split Clips in Premiere Elements 7.0

    Is there any way, after having split a clip and renamed the portions, to place them in the Organizer or in the Editor Project List as separate "new" media items which I can copy, insert elsewhere in the Sceneline or even another movie altogether? Man

  • Sconadm registration problem

    Hi there, I'm having problems using sconadm to register. My registration properties file contains: userName=XXXXXXX password=XXXXXXX hostName= subscriptionKey=XXXXXXXXXX portalEnabled=false proxyHostName=ourcachehost proxyPort=NNNN proxyUserName=XXXX