cancel
Showing results for 
Search instead for 
Did you mean: 

SP TN to block/restrict user from edit/change price field in PO

Former Member
0 Kudos

Hi,

How to restrict or block user from edit/change price field in PO.

I found the similar post, but there is no answer on the TN, can anyone please help ?

http://scn.sap.com/thread/3231899

The approval procedure will not meet the requirement as the user is still allow to edit on others field other than POR1.Price

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

daroy_alvin
Active Participant
0 Kudos

Hi Olga,

Please try:

If @object_type='22' and @transaction_type='U'

BEGIN

If Exists (select T0.DocEntry

from OPOR T0

inner join POR1 T1 on T1.DocEntry = T0.DocEntry

where T0.DocEntry = @list_of_cols_val_tab_del

and T1.Quantity <> (select a.Quantity from POR1 a where a.DocEntry = T1.DocEntry

  and a.LineNum = T1.LineNum)

)

BEGIN

Select @error = 22, @error_message = 'Update not possible for POR1.Quantity'

End

End

Thanks & Regards,

Alvin

Former Member
0 Kudos

Hi Alvin,

I had try on the SP, it will still allow to update the qty in PO.

Is it working on your side ?

Thanks

daroy_alvin
Active Participant
0 Kudos

Hi Olga,

Try below query, working on my side.

If @object_type='22' and @transaction_type='U'

BEGIN

If Exists (select T0.DocEntry

from OPOR T0

inner join POR1 T1 on T1.DocEntry = T0.DocEntry

where T0.DocEntry = @list_of_cols_val_tab_del

and T1.LineTotal <> (select top 1 a.LineTotal from ADO1 a where a.DocEntry = T1.DocEntry

  and a.LineNum = T1.LineNum

  and a.ObjType = T1.ObjType

  order by a.DocDate desc)

)

BEGIN

Select @error = 22,

@error_message = 'Update not possible for POR1.Price'

End

End

Thanks

Alvin

daroy_alvin
Active Participant
0 Kudos

Hi Olga,

Did you tried above query?

Alvin

Former Member
0 Kudos

Hi Alvin,

Yes, it worked for me ! Thank you !

Anyway, I changed the LineTotal to price as user may change the quantity.

Thank you for your time and effort.

Thanks

0 Kudos

Sorry asking a noob question, may I know how to use the code ? Is it compatible to SAP B1. I am new to SAP B1

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Olga,

have you tried on using the form settings?

you just need to uncheck the active column so that the user will not be able to edit the field.

regards,

Former Member
0 Kudos

Hi Mark,

This will not work because user is still allow to manually key in the price when creating. Only not allow to update once it is created.

Thanks

Former Member
0 Kudos

do you mean that they are not allowed to update the price once the PO is posted?

regards,

Former Member
0 Kudos

Hi Mark,

yes, this is what i mean.

is there any alternative other than SP ?

Thanks

Former Member
0 Kudos

If I'm not mistaken, there is an alternative. It's under the Authorizations.

You just have to set "Max. Discount - Purchase" to 0. This will work even if the PO is not yet posted

But I think SP is still better.

Regards,

Former Member
0 Kudos

Hi Mark,

ok, will try on that.

Thank you

frank_wang6
Active Contributor
0 Kudos

You will need to use ADOC and ADO1 to find the history price on the same document and then compare.

Frank

Former Member
0 Kudos

Hi Frank,

ADOC = Invoice - History

ADO1 = A/R Invoice (Rows) - History

I want to block on PO, the above table seem not related.

Thanks

frank_wang6
Active Contributor
0 Kudos

ADOC, ADO1 is the history table for all transactions.

you will need to compare the current POR1 with ADO1.

I believe the one posted below by Alvin will not work.

SP_TN is actually triggered after table update, but before commit. So Alvin's query is actually comparing record itself.

You will need to compare the POR1 with ADO1 to achieve desired result.

Frank

Former Member
0 Kudos

Hi Frank,

Thank you for the info, appreciated.

Thanks