Disable 'Delete' from VA02

Logistics : SD and its sub-modules (Inquires, Quotes, Order Entry, SIS, Sales Contacts, Dist. & Billing)

Moderators: Snowy, thx4allthefish, mike_ac, Lost Identity

Bennycat
Posts: 13
Joined: Wed Jul 09, 2008 3:51 pm

Disable 'Delete' from VA02

Post by Bennycat » Wed Jul 09, 2008 4:11 pm

Hello SAP Gurus,

Can anyone talk me through the best way to either disable or grey out the 'delete' option from VA02 change sales order? My other option would be to restrict authorisation (preferably) at sales area level? All help gratefully received!

Bennycat

PJA
Posts: 11383
Joined: Sun Jul 20, 2003 3:11 pm
Location: Deepest darkest Aberdeenshire
Contact:

Re: Disable 'Delete' from VA02

Post by PJA » Thu Jul 10, 2008 3:39 am

Bennycat,

Maybe user-exit USEREXIT_DOCUMENT_DELETE:

See here for more details

PeteA

Bennycat
Posts: 13
Joined: Wed Jul 09, 2008 3:51 pm

Re: Disable 'Delete' from VA02

Post by Bennycat » Thu Jul 10, 2008 4:33 am

Hi PeteA,

Thanks for your reply. I'm more curious about how to stop Users from deleting the document in the first place, rather than retrieving or deleting data after they've done it. Functionally they should mark the line for rejection. I looked through this forum and two people talk about amending the screen and another about authorisations, but no more detail than that.

Any more thoughts?

Bennycat

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Thu Jul 10, 2008 4:46 am

Afraid only a modification is possible for that. I had to modify the Menu bar for Status U in Program SAPMV45B using SE41. De-activated the Function Code LOES which left the Sales Document > Delete menu item greyed out and inoperative.
SAPMV45B

5 Modified sub-objects

5 Status

5 U

5 Different active functions

Original LOES Activated
Modification LOES Inactive
Regards.
ib
___________________________________
SAPFans help those who help themselves !

PJA
Posts: 11383
Joined: Sun Jul 20, 2003 3:11 pm
Location: Deepest darkest Aberdeenshire
Contact:

Re: Disable 'Delete' from VA02

Post by PJA » Thu Jul 10, 2008 8:10 am

Bennycat,

This is worth a try before modifying the system...

Get your ABAP team to go into debug mode after you select the DELETE function. Get them to put a break-point on AUTHORITY-CHECK to see if there are any authorisations related to the deleting of sales orders.

Updated 11 June 2009: It is possible via authorisations using object V_VBAK_VKO where DA_ACTVT = 06.

PeteA
Last edited by PJA on Thu Jun 11, 2009 8:45 am, edited 2 times in total.

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Thu Jul 10, 2008 8:18 am

It's a good thought, Pete ........ the authorisation which you might be able to use is V_VBAK_AAT activity 06.

If you try removing that access fom everyone, that might do it ..... it's so long since I went with the mod option that I can't remember if we actually tried that ............
Regards.
ib
___________________________________
SAPFans help those who help themselves !

shantanu.kunte
Posts: 36
Joined: Mon Apr 02, 2007 6:21 am
Location: India

Re: Disable 'Delete' from VA02

Post by shantanu.kunte » Thu Jul 10, 2008 8:49 am

Transaction Variant will very easily achieve this.... user exit is not required i guess....
Create a variant with code SHD0. Then create a new transaction code and assign this variant to the newly created code.

It should work fine.....

Correct me if i am wrong.

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Thu Jul 10, 2008 9:04 am

I've never found it possible to manipulate menu items in variants on SHD0. I suppose there might be something that could be done in GUIxt ?

For a 'cleaner' option try Pete's authorisation suggestion, or even the 'mod' - screen variants are not as reliable as they're supposed to be, and GUIxt always seemed like an unnecessary extra to me?
Regards.
ib
___________________________________
SAPFans help those who help themselves !

shantanu.kunte
Posts: 36
Joined: Mon Apr 02, 2007 6:21 am
Location: India

Re: Disable 'Delete' from VA02

Post by shantanu.kunte » Thu Jul 10, 2008 10:46 am

You can perfectly maipulate with menu items in SHD0. When u start creating transaction variant, there in 2nd or 3rd screen there is a push button "Menu Functions" on the bottom,when u go inside u have all the menu options there, u can deactivate which ever option u wish.
Do not forget activating the transaction variant before testing



Thanks

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Thu Jul 10, 2008 11:02 am

Don't remember seeing that opyion in the past, but I see what you're getting at ..... but I don't see the Delete option there, possibly because I've de-activated it elsewhere?

Couild be an answer, then, although, as mentioned, I have reservations about the reliability of these screen variants from SHD0 ....
Regards.
ib
___________________________________
SAPFans help those who help themselves !

PJA
Posts: 11383
Joined: Sun Jul 20, 2003 3:11 pm
Location: Deepest darkest Aberdeenshire
Contact:

Re: Disable 'Delete' from VA02

Post by PJA » Thu Jul 10, 2008 12:25 pm

So do I ib,

Its fine so long as the settings apply to all sales orders... it may also affect quotations, contracts, etc???

PeteA
Last edited by PJA on Sat Aug 02, 2008 3:08 am, edited 1 time in total.

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Fri Jul 11, 2008 3:00 am

My modification also affects ALL sales documents ... Quotes, Contracts etc. In my case there's no harm in this but for others, applying the deletion block to only particular document types may well be preferable.

So ... upshot of all this is that the authorisation solution put forward by Pete is undoubtably the the best way to achieve this as it allows it to be effective only to particular sales order types?

I intend to remove my modification and set up the authorisations instead. No strictly required, [joke] but as I will be parting company from this system soon, I'd rather reduce the number of instances where a successor will be saying "he did what??? Bloody fool!!!" after I'm gone ! [/joke]
Regards.
ib
___________________________________
SAPFans help those who help themselves !

PJA
Posts: 11383
Joined: Sun Jul 20, 2003 3:11 pm
Location: Deepest darkest Aberdeenshire
Contact:

Re: Disable 'Delete' from VA02

Post by PJA » Fri Jul 11, 2008 4:04 am

ib,

Never tried this before, but can you catch the DELETE function in USEREXIT_DOCUMENT_SAVE?

Is there some flag that is set by the system, or maybe the OK_CODE...

If so, then it could be made dynamic.

I don't have system access, so I can't check (enjoying a career break - which means I'm between contracts...)

PeteA

ib
Posts: 3216
Joined: Fri Oct 17, 2003 5:41 am
Location: Oil Patch, Scotland

Re: Disable 'Delete' from VA02

Post by ib » Fri Jul 11, 2008 5:15 am

No ... I don't know if you can ... a real ABAPer might?

BTW I just removed my modification in a test system.

Checked out the SHD0 option, and yes, you can de-activate the Delete option there. This would still never be my preferred method, but for those who want to try it, looks like it would work?

Testing the authorisation option took a bit longer as the user I chose to test with had a number of profiles for sales documents, but after checking in SU56 to ensure that the combination of activity 06 and sales doc type did not exist in the user, I did receive the 'No authorization for deleting document type' message when i tried - looks like an Info message but functions as an error as it will let you anything else, but deleting is out.

So .. I repeat ... I will remove my modification and make the required authorisation changes, as this is cleary the only sensible answer!
Regards.
ib
___________________________________
SAPFans help those who help themselves !

PJA
Posts: 11383
Joined: Sun Jul 20, 2003 3:11 pm
Location: Deepest darkest Aberdeenshire
Contact:

Re: Disable 'Delete' from VA02

Post by PJA » Fri Jul 11, 2008 6:29 am

Guys,

Nothing better to do, so I posted it in the ABAP Forum

Can someone check if the following is set in USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE when deleting a sales order:

xvbkd-updkz = 'D'

PeteA

Post Reply