cancel
Showing results for 
Search instead for 
Did you mean: 

Creating comboboxes which should affect in all marketing docs

Former Member
0 Kudos

Hi,

I want to create two combo boxes one with location fields and one with type of agreement.

this two combo boxes should be appeared in all the marketing documents.

How to do this.

Send me Code.

Regards,

Muni

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

U can create a UDF with valid values, in any marketing documnent table lika OINV and it would effect all the tables.

Private Sub AddUserField()

'//****************************************************************************
'// The UserFieldsMD represents a meta-data object that allows you
'// to add\remove fields from tables or change the fields' characteristics
'//****************************************************************************

    Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD

'//****************************************************************************
'// In any meta-data operation there should be no other object "alive"
'// but the meta-data object, otherwise the operation will fail.
'// This restriction is intended to prevent a collisions.
'//****************************************************************************

    '// The meta-data object needs to be initialized with a
    '// regular UserFields object
    Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)

    '//**************************************************
    '// When adding user tables or fields to the SAP Business One database
    '// use a prefix identifying your partner name space
    '// this will prevent collisions between the various partners add-ons
    '//
    '// SAP's name space prefix is "BE_"
    '//**************************************************

    '// Set the Fields' mandatory properties

    oUserFieldsMD.TableName = "OCRD" '// BP table
    oUserFieldsMD.Name = "BE_UserField1"
    oUserFieldsMD.Description = "A user field"
    oUserFieldsMD.Type = db_Alpha '// am alphanumeric type
    oUserFieldsMD.EditSize = 20

        'Adding the valid values
        oUserFieldsMD.ValidValues.SetCurrentLine(0)
        oUserFieldsMD.ValidValues.Value() = "1"
        oUserFieldsMD.ValidValues.Description() = "Selected"
        oUserFieldsMD.ValidValues.Add()

    '// Add the field to the table
    oUserFieldsMD.Add

End Sub

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Hi vasu,

I dont want to add values to the tables.

My requirement is

I have to add two Comboboxes to all the marketing document forms.

That is, when any document like sales order, sales quotation or delivery is opened.

This two comboboxes should be visible there to the user.

So please provide solution for this.

Former Member
0 Kudos

Hi,

For that u need to add the Fields in the DB table, so that when u open the document and click on the View --> User-Defined-Fields u will see the added fields in the UDF form. And if u need to have then as a combo box then u need to add the valid values.

If u just want to add the Combo box in the UI directly on the form then ui can check the sample provided to modify the system form. The sample can be found in the path specified.

C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\11.SystemFormManipulation

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Hi Muni,

I think Vasu's solution is the best one here. Once you have added a UDF with Valid Values to all marketing documents, you will have a combo box visible when you go to View -> User Defined Fields.

To do it through the UI would be possible but not as straightforward as the method Vasu suggested. You would have to catch each form loading every time it loads and add the comboxes through code. I think it would be much faster to implement this using UDFs but through the UI is also possible if using the UDFs as decribed doesn't meet your requirements.

Regards,

Niall

Answers (0)