cancel
Showing results for 
Search instead for 
Did you mean: 

create a button for draft documents

Former Member
0 Kudos

Hi all!

I know the only way to generate a draft document is to go to File -> Save as draft document. But is not very user friendly...

So I want to create a button in sales documents for drafts.

When the user clicks the button the document is added as draft.

Is it possible?

Or is there a better solution?

Thanks in advance for every help!

Kindest regards,

Veronica Vezzali

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Veronica,

If you add the button, and capture the click event, the only thing you need to do is to "simulate" a click event on that menu with this code

App.ActivateMenuItem(MenuUID)

Where App is the Application object and the MenuUID, the menu UID for the "Save as draft document" menu item (5907).

Regards,

Ibai Peña

PS: A couple of minutes late...

Former Member
0 Kudos

Hi.

It works, but I have a message

Menu - Can not activate a disabled menu item

Besides an other question.

When I create the button for draft document in quotation, the button is always in the same position when I resize the form. And this is OK!

But, for example, in delivery, the button positions changes when I resize the delivery form. And this is not correct.

This my code to create draft delivery button:

            'delivery
            If pVal.FormTypeEx = "140" Then
                Set oForm = SBOApplication.Forms.GetForm("140", i)
                rifL = oForm.Items("68").Left + oForm.Items("68").Width + 5
                rifT = oForm.Items("68").Top
            End If
            Dim oItem As SAPbouiCOM.Item
            Set oItem = oForm.Items.Add("BParch", it_BUTTON)
            oItem.Top = rifT
            oItem.Height = 19
            oItem.Left = rifL
            oItem.Width = 65

            oItem.Visible = True

            Dim oButton As SAPbouiCOM.Button
            Set oButton = oItem.Specific
            oButton.Caption = "PARCH."

Can you help me?

Thanks in advance for your help.

Kindest regards,

Veronica Vezzali

Former Member
0 Kudos

re: Menu - Can not activate a disabled menu item

Before activating a menuitem you may want to

a) check that the menuitem is enabled, and/or

b) make sure that you have focus on a form/transaction (in a mode) that has the menuitem enabled

re: button position / resizing

HTH

Juha

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks to all,

very useful information.

Kind Regards,

Fabio Salucci

Former Member
0 Kudos

Hi,

This is possible with the DI but in your case, like you explain it, it will be the most easy to invoke the menuitem click by code.

The menuUID for save as draft is 5907 (SAP BO 2004A).

SboApplication.ActivateMenuItem("5907")

Hope it helps

Eddy