cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent Add in System Form

Former Member
0 Kudos
152

Hello, I want to prevent that users add a document. Instead, a draft document shall be generated.

How can I prevent that and perform a save of the document?

best regards, Philipp

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Phillip,

When a user adds a document you should override and save as draft: You can do it by UI API in SDK.

1. When a form in add mode and pval.beforeaction = true and you pressed item Add buttion ("1")

2 then block the standard event

3. active the save as draft menuitem

Code for eventhandler

Select Case pVal.FormTypeEx
            Case "139"
                If pVal.FormMode = BoFormMode.fm_ADD_MODE Then
                    If pVal.EventType = BoEventTypes.et_ITEM_PRESSED AndAlso pVal.BeforeAction = True AndAlso pVal.ItemUID = "1" Then
                        ' This stops SAP B1 normal action
                        BubbleEvent = False
                        sbo_application.ActivateMenuItem("5907")
                    End If
                End If
        End Select

Regards,

J