Stored procedure at Purchase order..

hi.
i need a stored procedure at purchase order..
what i need is purchase quotation , posting date should be equal to purchase order posting date other wise..
error will show...
the below one i tried but it's not working..
--IF (@object_type = '22' )and (@transaction_type IN ('A','U'))
--BEGIN
--If exists(SELECT T3.[Docentry]  FROM POR1 T0 left join OPQT T1 on  T0.[BaseDocNum]  =  T1.[DocNum]
-- INNER JOIN PQT1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OPOR T3 ON T0.DocEntry = T3.DocEntry WHERE DATEDIFF(DD,T3.DocDate,T1.DocDate ) <> 0   and T3.DocEntry =
--@list_of_cols_val_tab_del )
--  Begin
--  set @error =105
--  set @error_message = 'Please Check the Date'
--  End
--  end

Try:
IF (@object_type = '22' )and (@transaction_type IN ('A','U'))
BEGIN
If exists(SELECT T3.[Docentry]  FROM POR1 T0 left join OPQT T1 on  T0.[BaseEntry]  =  T1.[DocEntry]
INNER JOIN PQT1 T2 ON T1.DocEntry = T2.DocEntry
INNER JOIN OPOR T3 ON T0.DocEntry = T3.DocEntry
WHERE T3.DocEntry = @list_of_cols_val_tab_del and DateDiff(dd,T3.DocDate,T1.DocDate) != 0)
  Begin
  set @error =22
  set @error_message = 'PO date must be the same as Quote date'
End
END
Thanks,
Gordon

Similar Messages

  • Stored procedure in purchase order for duplicate item for a vendor

    Hi all
    I have written a stored procedure for duplicate item for vendor the output i need from this SP is whenever for a vendor we will raise purchase order the system should check that their shouldn't be any po in the system for the same item by the selected vendor. Its working fine when only one item is selected but it is behaving wrongly when more than one item is selected.
    If (@object_type='22' and @transaction_type='A')
    BEGIN
    Declare @Vend as varchar(200)
    Declare @ItemCode as varchar(200)
    Select @Vend =CardCode From OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del
    IF 1 !=(Select Count(T0.DocEntry) From OPOR T0  Inner Join POR1 T1 On T0.DocEntry=T1.DocEntry  Where T0.CardCode=@Vend and T1.ItemCode=@ItemCode)
    Begin
    select @error =1
    select @error_message = 'Item Code Already Exists For This Vendor'
    end
    end
    Thanks
    Rashid.

    Hi Rashid,
    Try this,
    if @object_type = N'22' 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 OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @line1 = Max (LineNum)FROM POR1 WHERE POR1.DocEntry = @list_of_cols_val_tab_del
    While @lin1 < @line1
    Begin
         Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del and LineNum = @lin1
          if (SELECT COUNT(T0.DocEntry) FROM POR1 T0 inner join OPOR T1 on T0.DocEntry = T1.DocEntry
          WHERE T0.ItemCode = @ItemCode and T1.CardCode = @Vend)> 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
    Regards,
    Bala

  • Define Release Procedure for Purchase Orders

    Hi Friends,
    We are changing Release procedure for purchase orders for one department from > $ 5000 to > $ 10000.
    We defined three characteristics for the class namely Purchasing Order Document, Purchasing Order Type and Ner Order Value which is Currency data type. I Defined Release Procedure for Purchase Orders in configuration master. It's working fine, I mean the Net order Value field is updated in Configuration Client.
    After transporting the above change to the Testing Client, the Net Order Value field did not update in testing Client even though I created Characteristics in Testing Client (as characters are not transportable, I created them seperately in Testing Client). I can't update the Net Order Value manually in Testing Client as it says "Client 010 (test) has status 'not modifiable' "
    Please tell me how to update that field, as the net order value didn't change even after transport. I can't change manually in testing Client as the status is "not modifiable"

    Hi,
    Yes I have already done that.
    In SPRO,
    After hitting the following:-
    MM --> Purchasing --> Purchase Order --> Release Procedure for Purchase Orders --> Define Release procedre for Purchase Orders
    I have to process the objects in the following sequence,
    Release Group, Release Code, Release Indicator, Release Strategy & Workflow.
    Upto Release Indicator it is fine. After hitting Release Strategy, I should select the release strategy (which I just created) and display. Then 4 buttons will be displayed namely,
    Release Prerequisites, Release statuses, Classification, Release simulation.
    Upto Release statuses it's fine. Afeter hitting Classification,
    the values of Purchase document & Order type are populated, but the Total Net Order Value is Blank. It is supposed to populate the amount & 10,000. But it is not.
    Actually that amount will be stored in the field GNETW of table CEKKO. But CEKKO is a Structure not a table. So I can't update the field.
    Please advice me...
    Thank You,
    Nag

  • Release procedure for Purchase orders

    Hello SAP Gurus,
    Can anyone explain in steps the release procedure for purchase orders and also can any one explain how it differs from Puchase requisition release procedure.
    Thanks
    NDS

    Hi
    Release procedure for Purchase orders here is process flow.
    Go to spro>img>materials management>purchassing>Release procedure for Purchase orders
    1. Create characterstics  -Intially you will create characterstics based on which you would like to release a purchase order.
    Charactrestics are like plant, purchase order value,purchase group etc.. Assign characterstics to release class 032.
    2. Create Release group say 01 and create release codes like pm(project manager), gm(general manager) etcc..
    3.  Create a Release starategy say s1 and assign release group to it 01 and release class 032 and department to whom this release stategy applies say MM. define the order of release say first pm followed by gm etc..
    4.  under classfication define value limits for release of purchase order.
    5. define release indicators
    6. simulate the release
    7. assign if there is any workflow.
    hope it helps.

  • Relese Procedure for Purchase Order....

    Hi experts,
    we have 4 types  of purchase order CLASE with ZT01,ZT02,ZT03,ZT04  .    one is  STANDARD  (NB Standard PO)
    also we r working with RELESE PROCEDURE .
    my client wants RELESE PROCEDURE only for  ZT01,ZT02,ZT03,ZT04   ..
    not for  (NB Standard PO)   .
    where can i set for this RELESE PROCEDURE BY Purchase ORDER CLASS TYPE.
    ThanksinAdvance,
    Anthyodaya.

    Hi,
    Its very simple. Create a new characteristic using CT04 Tcode for the document types.
    For tabel name CEKKO & Filed name BSART (For doc type) enter all the doc type ZT01 to ZT04.
    For the existing class that you already created for PO, assign this newly created class and the remaining process remains the same.
    The Release triggers for only these doc types.
    Hope you are answered.
    Any quereis let me know.
    Regards,
    Smitha

  • T.Code for Release Procedure for Purchase Order Type

    Hi Frd
    im working in ECC 6.0.
    OMGS is t.code for Release Procedure for Purchase Order Type in SAP 4.6.
    Can anyone tell me what is the t.code for Release Procedure for Purchase Order Type in ECC 6.0 .the OMGS t.code is not working in ECC.
    Thanks
    By
    Pari

    Hi Rajasekharan,
        Go to tcode ME22 and enter the Purchase order number.
    inside the Display screen,u can see a GREEN flag button on the Application Toolbar.
        Click on a item and press the Green Button.
    U will see the release code,provided the Purchase order is set to release strategy,after that Go to tocde ME28 enter the release code ,along with Document number and then release the Purchase order.
    Actually the tcode for releasing purchase order is ME28
    Reward points if useful.
    Cheers,
    Swamy Kunche

  • Store Procedure for Purchase Order

    Hi Experts,
                     I want Stored Procedure in which if user tries to edit User Defined Fields already added in Purchase Order Item & Service.

    hi
    YOU CAN DO THIS THROUGH FORM SETTINGS BY UNTICKING THE FIELD "ACTIVE" FOR THAT PARTICULAR USER.

  • About the pricing procedure of purchasing order

    Hello friends,
    can anyone tell me about the pricing procedure,conditions & texation of Purchase order?
    and hoew to maintain all those term in Customisation?

    The Basic thing is Condition Technique. In which there are 
    1. Access Sequence 2. Condition Record 3. Condition Type 4. Condition Table. 
    A Access Sequence access a Condition Record of a Condition Type in a Condition Table is a  Condition Technique.This is a simple logic 
    Here the Condition Type is very important like PB00, PBXX,RA01 etc. 
    In the background every Condition Type has its own defition means the purpose of the Condition Type  like, is it for Pricing or Percentage, Quntity base, Accrual Feilds etc is to be defined to work this functions.  Normally we use the existing ones without any risk. But some cases, we have to Create a New Condition Types as per the organisation requirement. 
    The Pricing Schema is useful to minimise condition types while mention prices for Vendor on the basis of Pricing Schema which we defined according to organisation requirement. 
    The Pricing Schema means the calculations procedure of Condition Type. 
    Ex.  RA01 - Discoount % is caclulated on PB00 - Gross Price  means 
    RA01 is based on PB00  like that we have to define in the Pricing Schema 
    which makes easy to use in real time. 
    Here PB00 has the Access Sequence - 0002. 
    But RA01 does not have the Access Sequence.Why because it is a dependent on PB00. But both are Condition Types. 
    In the system, by default some standard  Scheme will be there at Vendor Schema Group in the Vendor Master Screen means the standard one is assigned which is very lengthy which may fullfil our requirement. But some cases which may not fullfil our requirement, in such we have to define. 
    For the configuration, I may not able to explain properly through here but will give some idea. 
    Configuration: SPRO - IMG - Material Management - Purchasing - Conditions - Define Price Deternmination Process:
    1. Define Access Sequence 
    2. Define Condition Type 
    3. Defince Calculation Schema:- Here you have to define the Schema - Define Schema group 
    1. Define Schema Group vendor 
    2. Define Pricing Schema group 
    3.  Schema group for Purchase Organisation 
    4. Assign Schema group to Purchase Organisation - Define Schema determination 
    1.define calculation schema for Standard purchase organisation 
    After completion of the Schema Group, we have to assign it to Vendors. 
    Then whenever we use any transaction with this Vendor, the concerned  Schema will work as configured by us. 
    The Pricing in MM is vast because each Condition have its own importance and each Access Sequence have its own importance. So you need not bother about this. First you learn how to define the Calculation Schema through the above.

  • Pricing Procedure for Purchase Order

    I have to pick item level conditions for value : bed , hr edu cess, edu cess, cst,lst.
    I am trying to the pick up fields kbetr and kwert for following conditions from konv table but there are only header level conditons.
    so How can i Proceed for this?
    For Purchase order script i have used standard Program SAPFM06P.But this a subroutine Pool Program.

    hi
    Write a Sub-routine in the form, where u can call all the pricing procedures.
    write this in the form
    /:           PERFORM TAX_AMT IN PROGRAM ZMM_REP_POTAX
    /:           USING &EKPO-NETWR& .
    /:           CHANGING *xxx-xxx&
    write a sub-routine  in abap editor , calling the program name and calculating pricing procedures
    regards
    sailendra kolakaluri

  • Display Taxes procedure in Purchase order

    Dear BADA guru's!!
    while creating Purchase Order  in Invoice tab, after clicking the taxes ,the procedur in display mode.In the same screen left side we have some buttons for forward and backward.The tabs itself in display mode.But my requirement is that tabs should be in change mode.Is it possible to change in change mode.
    pls suggest.
    regards
    UNREDDY

    It is not the stadard practice.
    condition should come through condition record only.
    Thats why TAXINN is called condition based tax procedure.

  • Reg: Release Procedure of Purchase Order

    Hi,
    I have a requirement for release procedure of a purchase order. I have two approvers for the approval of the purchase order. The first approver should have the option whether he wants to send the po to the higher approver by selecting 'yes' or releasing the purchase order by selecting 'no'.
    can anyone give me information on how to do this? as i am new to workflow.
    Thanks in advance.
    Regards,
    Ramesh Babu S

    http://help.sap.com/saphelp_erp2005vp/helpdata/en/04/9277a346f311d189470000e829fbbd/frameset.htm
    Check this link for reference.
    Create a new work flow(SWDD Transaction). In that create a new task for which specify triggering event as PurchaseOrder.released of Business object BUS2012.
    And then create other tasks and link as per your requirement.
    For more reference on workflow: http://****************/Tutorials/Workflow/Workflow.htm

  • Tax value stored table in purchase order

    Hi ,
    i want to extract tax values of tax code from the Purchase order . 
    So plz tell me the tables where i can extract the tax values for a particular Purchase order at item level.
    Regards
    Kishore

    hi
    TAX TABLES
    for excise check table J_1IEXCHDR for header
    J_1IEXCDTL for item excise
    The Table name used to find the Tax Values are
    KOMV: Pricing Communications-Condition Record
    KONV: Conditions (Transaction Data)
    From the above tables you can refer the fields below.
    KAWRT
    KBETR
    Fetch the corresponding records based on the field
    KNTYP
    regards
    kunal

  • Release procedure for Purchase Order

    Hi All,
    I need function module/class method/program name which determines which release statergy is to be adopted in order to release the purchase order based upon release conditions.
    Regards,
    Amit

    Hi
    If you are assigning more  than one relase class in the Config then this error comes , please use only one relase class .
    Thanks & Regards
    kishore

  • Sp Transaction Procedure For Purchase Order Item Checking

    Hello All,
    I need to create a sp_Transaction notification for Purchase Order where system will check that the document to be added
    with Vendor 'A' and ItemCode 'ERT' should not be be previously added for the same vendor 'A.
    Example:-
    Doc No.  Vendor   Item Code
    1                A            ERT
    Is added
    Next if the Purchase Order is added with same vendor and same Item then system should block the entry and throw a message
    'Purchase Order Already Entered for Vendor 'A' with Item Code 'ERT'"
    This checking will be done for each line item of currently entered Purchase Order Document.
    Thanks ,
    Amit

    Hello Amit,
    You don't need post identical thread twice. This SP related discussion is usually posted on main forum.
    Please close this one.
    Thanks,
    Gordon

  • Sp_Transaction Notification For Purchase Order Item Checking

    Hello All,
    I need to create a sp_Transaction notification for Purchase Order where system will check that the document to be added
    with Vendor 'A' and ItemCode 'ERT' should not be be previously added for the same vendor 'A.
    Example:-
    Doc No.  Vendor   Item Code
    1                A            ERT
    Is added
    Next if the Purchase Order is added with same vendor and same Item then system should block the entry and throw a message
    'Purchase Order Already Entered for Vendor 'A' with Item Code 'ERT'"
    This checking will be done for each line item of currently entered Purchase Order Document.
    Thanks ,
    Amit

    Hi Amit,
    i found this on forum. Try this,
    if @object_type = N'22' 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 OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @line1 = Max (LineNum)FROM POR1 WHERE POR1.DocEntry = @list_of_cols_val_tab_del
    While @lin1 < @line1
    Begin
         Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del and LineNum = @lin1
          if (SELECT COUNT(T0.DocEntry) FROM POR1 T0 inner join OPOR T1 on T0.DocEntry = T1.DocEntry
          WHERE T0.ItemCode = @ItemCode and T1.CardCode = @Vend)> 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
    Check this too Stored procedure in purchase order for duplicate item for a vendor
    Thanks,
    Joseph
    Edited by: Joseph Antony on Jan 11, 2011 1:37 PM

Maybe you are looking for