Skip to Content
avatar image
Former Member

Need Help in stored procedure

Hi experts,

                        I want one stored procedure (sp) for GRPO .In that GRPO i created two user defined fields "Add"  and "Sub" .when i raised GRPO i will

give some value in that U_Add or U_Sub according to depending on vendors . And these two fields must should be reflect to linetotal value and that

value not depending on Quantity.

                          For that one i  written two sp query in sp_transaction notification that is executing and not working in GRPO.

        

1)    IF @Object_type = '20' and @transaction_type in (  'A' , 'u')

       BEGIN

       update PDN1 set PDN1.LineTotal = PDN1.Quantity * PDN1.Price + PDN1.U_add - PDN1.U_sub

        From PDN1

        Where PDN1.ItemCode = @list_of_cols_val_tab_del



2)   IF @Object_type = '20' and @transaction_type in (  'A' , 'u')

       BEGIN

       update PDN1 set PDN1.LineTotal = PDN1.Quantity*PDN1.Price + PDN1.U_add - PDN1.U_sub

       From OPDN

       Where PDN1.ItemCode = @list_of_cols_val_tab_del

Thanks & regards

--ram

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jul 08, 2015 at 11:37 AM

    Dear Ram,

    Please try below sptn

    ===============

    IF (@object_type = '18' AND @transaction_type IN ('A','U'))

    BEGIN

        

      Declare @minline3030 int

      Declare @maxline3030 int

      set @minline3030 = (select min(T0.Line_ID) from PDN1  T0 where   T0.TransId=@list_of_cols_val_tab_del)

      set @maxline3030 = (select max(T0.Line_ID) from PDN1  T0 where   T0.TransId=@list_of_cols_val_tab_del)

    while @minline3030 <= @maxline3030

      BEGIN

      update PDN1 set PDN1.LineTotal = PDN1.Quantity * PDN1.Price + PDN1.U_add - PDN1.U_sub

            From PDN1

            Where PDN1.Line_ID =@minline3030 and PDN1.DocEntry=@list_of_cols_val_tab_del

      Set @minline3030 = @minline3030 + 1

      END

    END

    ================

    Regd,

    Chetan Vora

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 08, 2015 at 11:41 AM

    Hi Ram,

    Please don't update any SAP standard fields through TN which may leads to big Problem and SAP also will never support you.

    If you plan for any update in standard field, take help of service partner and do it through Add-on.

    Thanks

    Unnikrishnan

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 08, 2015 at 12:06 PM

    Hi,

    Update/Insert/Delete functions are not allowed by SAP. If any DB corruptions due to update, SAP will not support.

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 09, 2015 at 05:27 AM

    hello ram teja

    try fms , create 2 header level udf and apply following query as fms on linetotal ..this will give u the result  (( quantity * price) + add value1 - value 2)

    SELECT  ($[$38.14.number] * $[$38.11.number]) + ($[OPDN.U_QQQ])  - ($[OPDN.U_WWW])

    (www/qqq are my header level udf . dont apply auto update)

    Add comment
    10|10000 characters needed characters exceeded