cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help in stored procedure

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member211473
Contributor
0 Kudos

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)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

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

Thanks.

frank_wang6
Active Contributor
0 Kudos

I think the target you try to achieve can be done through FMS.

It is terrible to directly updating SAP tables.

Frank

former_member212181
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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