Block encoding of transactions to diff whse & w/ same items in one document

Hi,
i need to block all transactions encoded in inventory transactions if their warehouse is different and also if same items are in the same documents. Could you help me with the script? I want to have this in SP_transaction notification but i dont have the script .
I found a script in this forum related to having same items in the sam document but does not apply to inventory transfer, could someone help me how this can be attached in inventory transfer document. The original script is referring to PO, i just change the objecttype and the table name to work for invty transfer but it still accepting same items in invty transfer.
Here's the script:
--Invty transfer
if @object_type = N'67' and @transaction_type in (N'A', N'U')
begin
declare @line1 int
declare @lin1 int
declare @out1 int
Set @out1 = 0
SET @lin1 = 0
Declare @Vend as varchar(200)
Declare @ItemCode as varchar(200)
Select @Vend = CardCode From OWTR Where DocEntry = @list_of_cols_val_tab_del
Select @line1 = Max (LineNum)FROM WTR1 WHERE WTR1.DocEntry = @list_of_cols_val_tab_del
While @lin1 < @line1
Begin
     Select @ItemCode=ItemCode From WTR1 Where DocEntry=@list_of_cols_val_tab_del and LineNum = @lin1
      if (SELECT COUNT(T0.DocEntry) FROM WTR1 T0 inner join OWTR T1 on T0.DocEntry = T1.DocEntry
      WHERE T0.ItemCode = @ItemCode and T1.CardCode = @Vend and T1.[DocStatus] = 'O')> 1
      Begin
           Set @Out1 = 1
           Break;
      END
           Else
           Begin
           Set @lin1 = @lin1+1
           Continue
      END
END
Set @lin1 = @lin1 + 1
if @out1 = 1
begin
      Set @error = 1
      Set @error_message = 'Item Code in line ' + CONVERT(nvarchar(4), @lin1) + N'already Exists For This Vendor!'
End
END
Thanks.

Hi,
Welcome you post on the forum.
You may try,
IF @object_type = N'67' and @transaction_type in (N'A', N'U')
BEGIN
IF Exists (Select T0.ItemCode, count(T0.ItemCode) From WTR1 T0 inner join OWTR T1 on T0.DocEntry = T1.DocEntry
Where DocEntry=@list_of_cols_val_tab_del
Group BY T0.ItemCode Having count(T0.ItemCode)> 1)
Begin
Set @error = 1
Set @error_message = 'Item Code more than once!'
End
END
Thanks,
Gordon

Similar Messages

  • Blocking staff from ordering more than 4 of same item per day

    Hi All
    I need a SP to block staff from ordering more than 4 items of the same kind per day, reason for this is the stuff gets the product at a discounted rate and now they are abusing that privilege.
    Hope this is clear,.
    Bongani

    Hi Gordon
    Thanks for your response.
    I want to block the user from placing orders once they have reach a daily limit of 4 units for each item for an example.
    Staff XT places an order for Item DG900 for 4 units on the 23rd of June 2011 then he is not allowed to place another order for the same item on the 23rd of June.
    Hope this is clear.
    Bongani

  • Blocking of J1IEX Transaction for particular company code

    Hi,
    I have two requirment,
    1 :  For our one company code  C011 , J1IEX transaction should not allow ,  we have one user and that user is working on different conpany code  but for particular to this company code C011,  how to block the J1IEX transaction user should not take the cenvat
    2: For the same company code J1IEX transaction is allowed  only of in Purchase order material code is  XYZ ,  otherwise for other materials materials should not come i n J1IEX  to get the cenvat benifit.
    regards,
    zafar

    Hi Zafar.
    I belive this would be an authorization issue in this case (guys on the forum pls correct me if I'm wrong).
    Maybe you should put a request for the Basis/Security management team who supports your company, informing what C.Code restrictions to add in this transaction, and for what users, so that they would find out what authorization objects to restrict.
    Regards,
    Rodrigo.

  • AAP 131 Asset is blocked for acquistion, transaction not allowed

    There is a service PO with Account assignment Category = Asset.
    PO done and released.
    SES done and released.
    Now want to delete the SES. For that it has to be de - released by the HOD.
    While de -releasing the SES it gives
    ERROR" AAP 131 Asset is blocked for acquistion, transaction not allowed "
    Checked Asset, it is already acquired and capitalized long back.
    Need help.
    Regards

    Hi,
    As message AK005 describes in the long-text, the AuC is assigned to an investment measure and therefore it is not allowed to post transactions that affect the acquisition value of the AuC.
    So it is not allowed to post down payments, acquisitions, retirements, etc. directly to the AuC of an investment measure.
    Only the CO/IM settlement transaction can be used for assets which are assigned to an investment measure.
    Such kind of postings, and this is the only possibility, have to be posted to the investment measure directly, which means the posting has to be done to the WBS-element or the internal order.
    Afterwards this down payment can be settled from the WBS-element or the internal order to the AuC.
    regards
    Waman

  • I have to block all SAP transaction from 2014-07-14 using SP

    I have to block all SAP transaction from 2014-07-14 using SP. kindly help...

    Hi,
    You can not block all transaction in single transaction notification. I have created for Sale order and just change object code and table for all other transactions.
    IF (@object_type = '17') and (@transaction_type IN (N'A'))
    BEGIN
    IF EXISTS (
    SELECT A.DOCENTRY FROM ORDR A WHERE A.[DocDate] >='20140710'and a.DOCENTRY = @list_of_cols_val_tab_del)
    BEGIN
    Select @error = 10, @error_message = N'You are not authorize to add this Sales order'
    END
    END
    Thanks & Regards,
    Nagarajan

  • DB Adapters inserting data into 2 diff tables of same database giving issue

    Hello,
    I am using Oracle soa suite 11g BPEL.
    I need to insert data in 4 different tables of same Oracle database with the requirement of rollback all data if error occurs anywhere.
    I have configured the DB adapater as XA enabled on console .
    In code:-
    I am using 2 DBAdapters to insert data one by one in 2 diff tables of same DB (using INSERT ONLY operations). Before each invoke activity i am using a transformation activity to prepare the input variable of the DBAdapter.
    When i run this code i get below error:-
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [DBINS_DIANA.XxontPoiHdrsIface]. Caused by java.sql.BatchUpdateException: ORA-02049: timeout: distributed transaction waiting for lock . ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>
    If i use a wait activity between the 2 invokes i get the data inserted fine , but that means the transactions between inserts would be committed which i want to be rollback fully in case of any errors.
    Can anyone have a clue what is wrong here?
    Thanks
    Shivani

    Hi Anagha,
    Have a look at these links:
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2b/d5653fd1d3b81ae10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/frameset.htm
    Regards,
    Chandra

  • Transaction MB5B takes not into account the archived material documents

    Transaction MB5B takes not into account the archived material documents . Is it possible?

    Hi
         It is not possible to see the archieved materials. Once archieved it will remove from the registry. Cannot be retrieve back.
    Thanks
    Ganesh

  • Is it possible to block a number in iOS 6 but the same iphone number could be viewed as online on whatsapp application in the blocked device?

    Is it possible to block a number in iOS 6 but the same iphone number could be viewed as online on whatsapp application in the blocked device?

    Hi ChrisJ4203,
    I see you didn't comment on editing the numbers in the keypad, I believe you have that problem too but you forgot to click "I have this question too".
    By the way I've sent a couple feedback messages to Apple already and thanks for reminding me, I guess I'll have to be doing that more often.
    Enjoy your day

  • Transaction KSB1 - Display Actual Cost Line Items for Cost Centers

    Hi,
    When I run transaction KSB1 - Display Actual Cost Line Items for Cost Centers, all my offsetting accounts (accumulated depreciation accounts) are shown except for the ones for asset classes:
    - Buildings
    - PC & Small Applications
    On the FI side, I can see transactions being posted to their relative accumulated depreciation accounts but I do not see this on the CO side when transaction KSB1 is executed. I have checked the config and the account assignments look correct. Also, the assets created have cost centers assigned to them.
    Could you please help!
    Thanks,
    - Deki

    Hi Murali,
    I have one depreciation expense account (P/L Account) which is also a cost element.
    During depreciation run, the different asset classes are supposed to hit the depreciation account above and their corresponding accumulated depreciation accounts (These are Balance Sheet Accounts and I have separate accounts for each asset class .. ie: Accumulated Depreciation for Furniture and Fixture for asset class Furniture and Fixture).
    Now when I run transaction KSB1 - Display Actual Cost Line Items for Cost Centers, all my accumulated depreciation accounts are shown except for the ones for these asset classes:
    - Buildings
    - PC & Small Applications
    Any thoughts on why the above aren't showing?
    Thanks!  I really appreciate your help!
    - Deki

  • How to process a transaction where a customer needs an Item on Trial basis?

    How to process a transaction where a customer needs an Item on Trial basis.
    It essentially means that the item should not move to customer's stock. It still has to be the part of inventory valuation.
    Couple of options i tried out but i did not find them satisfactory. Such as:
    1) Create an Internal requisition (eventually an Internal Order) and receive the item in the diifferent Warehouse (Same OU) in locator enabled sub inventory. and Locator would capture the customer address to an extent.
    2) Create Consignment Subinventories for customers and store the items in those Subinventories. Although items have been shipped to customer. This way we can still have the item as a part of valuation.
    If at all you have done similar kind of stuff or if you could think of better and logical solution, can you please guide me on this?
    Thanks in Advance.
    KS
    Edited by: devilisalive on Nov 11, 2008 7:59 AM

    KS
    Lived through that couple of times.But nothing out of the box. But here are some question:
    1. What would you do when you physical or cycle count for this stock? This is physically not here, but you are showing that in your inventory valuation account and showing quantity as well.
    2. What do you do at the end of demo/trial period? What if the customer wants to buy instead of returning? Are these serial controlled items?
    3. Do you use installed base also?
    To overcome the first question what we suggested is to park it in a temporary account (say Demo or Trail account) instead of COGS account when you ship. Can be easily done with account generator and a different order type.
    If your process is to return no matter what (at the end of the trial period), you may want to create an RMA and book it against the original order as soon it is fulfilled (extension). This helps you to see how many products are out there that are yet to be returned. Link these two orders line_id to line_id (as we do in copying).Keep the original order line status in In Demo or Trial and do not close the line. Once you receive the product against the RMA close the original line.
    What about the cost (assuming std cost)? If you are shipping new products on trial basis, they are going out at full cost. When the customer returns them the value is not the same (probably). If yes, do you receive into a different organization where the cost is different or to the original organization? If it is different, the demo account may have some value left out.
    Originally when shipped
    Cr Inventory 100
    Dr Demo A/C 100
    If you return into a different organization where the cost is say 50% (assuming you are using std cost).
    Cr Demo A/C 50
    Dr Inventory A/C 50
    You can see there is a balance of 50 in the account.
    If the customer wants to buy, do you bring the goods back (logically) and ship them again? This is a clean way system wise but pain in neck process wise.
    In order to achieve process efficiency not to involve people, you can do this. You can just create bill only order line and invoice the customer. But what about the relieving value from Demo account recognizing COGS account? You have to perform a logical inventory transaction and account for this to cr Demo A/C and Dr COGS A/C at the original cost.
    Also demo may be shipped to customer X but they may want to you to invoice to parent company.
    I wish there is a clean solution available in Oracle as a standard, but could not find one. Hence a lot of extensions. Still there are lot of more questions, but I limit to these here.
    Yes, this Devil is Still Alive :)
    Thanks
    Nagamohan

  • Table for line items of budget document posted through FMBB transaction.

    HI,
    I am looking for Table of line items of budget document posted through FMBB transaction.
    There is table FMBL but it is breaking the amount into 12 parts.
    Thanks.

    Hi
    check the tables
    FMBDA   
    FMBDP   
    FMBDT   
    FMBH
    BPDK
    Regards
    Anji

  • Why charged me twice for the same item? They have withdrew money from my bank account for the second time about half an hour later after the transaction was completed leaving me overdrawn.

    Why charged me twice for the same item? They have withdrew money from my bank account for the second time about half an hour later after the transaction was completed leaving me overdrawn.

    Hi Benjamins,
    I've checked your account—you have two ExportPDF subscriptions. One placed on October 20 2013, and the other placed on October 11 of this year. So, you were probably charged the auto renewal for the subscription placed in 2013, and then the new charge for this year's order.
    Please Contact Customer Care so that an agent can help get things situated for you. There's no reason to have two subscriptions to the same service, so an agent can help you cancel one, if you'd like.
    Best,
    Sara

  • This update is not available for this Apple ID eiher because it was bought by a diffirent user or the item was refunded or cancelled

    Please help me when i update tune in message come like this, This update is not available for this Apple ID eiher because it was bought by a diffirent user or the item was refunded or cancelled. kindly advise what to do.

    Hi bu7ch,
    Thanks for the question. I understand you are having issues downloading an application update from the App Store. To troubleshoot these issue, let’s follow the steps for iTunes Store connectivity:
    First, try signing out of your account in Settings > iTunes & App Store. Once signed out, go ahead and restart your device. Once your device has restarted, sign back in to the iTunes Store and try to download the update.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    If the above did not resolve your issue, refer to the following:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    Thanks,
    Matt M.

  • This update is not available for this Apple ID eiher because it was bought by a diffirent user or the item was refunded or cancelled. kindly advise what to do

    his update is not available for this Apple ID eiher because it was bought by a diffirent user or the item was refunded or cancelled. kindly advise what to do

    Apple appears to be having trouble on their servers. Try again in a few hours.
    (106365)

  • Delete and insert same Object in one transaction?

    Hi all,
    Can be possible in one transaction delete and then insert same object into the database?
    If I want change PK in some record in DB, then I must delete the Object and then insert new Object (row). And this I want realize in one transaction - Unit of Work.
    Is this possible?
    Thx advance,
    best regards,
    KLD
    P.S. Sry for my English

    Generally not always a good idea, but may be possible. If you are using JPA, you should be able to do a flush() after deleting the object, then re-persist the new one.
    For the UnitOfWork API, writeChanges() is the same as flush, but it only allowed to be called once, so you may need to use the RepeatableWriteUnitOfWork, or performDeletesFirst option.
    Or just use two separate units of work.
    James : http://www.eclipselink.org

Maybe you are looking for