cancel
Showing results for 
Search instead for 
Did you mean: 

Writing additional charges in Order

Former Member
0 Kudos

Hi,

I have to write additional charges in the Dialog Order (139) in relation to weight.

Some facts affecting the proceeding:

1)

The weight have to be sumed up iterative. So it is not possible to work with Formatted Search and I have to work over the UI.

Steps I finished already:

1)

Activating the devilery-costs in the settings of Order. The Form "dumps" is available over a linked button.

The column 3 is the column that takes the amount and sends his value to the textbox additional charges.

2)

A program that reads all the values I need to determine the value of costs out of a UDT

the following steps I tried:

1)writing in the matrix of dumps

this.form = null;

this.form = this.sboConnection.getSBOApplication().Forms.GetFormByTypeAndCount(3007,1); //formType = 3007

this.matrix = (Matrix)this.form.Items.Item("3").Specific;

this.editText = (EditText)this.matrix.Columns.Item("3").Cells.Item("1").Specific;

this.editText.Value = amount;

problem: the program drops out when I try to initialize the form

2)writing to the textbox additional charges in form Order

this.form = this.sboConnection.getSBOApplication().Forms.GetFormByTypeAndCount(139,1);

this.editText = (EditText)this.form.Items.Item("89").Specific;

this.editText.String = amount;

problem: I cannot set the value, I because the item disabled. When I try to enable it the program drops out.

The table for the charges is OEXD. But the only value that affects the corresponding cell or textbox is fixed amount.

The Order- Dialog gets it, when it is loading.

Maybe somebody has a hint for me.

I will appreciate it.

Marc

Accepted Solutions (1)

Accepted Solutions (1)

former_member185703
Active Contributor
0 Kudos

Re 2) In Florian's post: right, enabling disabled items on SAP Business One UI system forms is not possible via UI API.

Re 1) If something "drops out" you should capture this exception and display the message it comes with to find out why!

PLease check-out alternative options to access the form (see UI API help). E.g. use the FormUID to access it...

Regards,

Frank

Answers (1)

Answers (1)

Former Member
0 Kudos

From my point of view, i would suggest to use the DI-API,

access the Document-Object (and the Document-Objects

child, the DocumentsAdditionalExpenses-Object) after

the order is saved.

But I suppose you would like to add the Additional Expenses before the order is saved,

so the user who wants to save the order can see the additional costs

and decide whether to save or not?

According to the Manual, Additional Expenses must be defined.

(Administration-> System Initialization-> Document Settings, General Tab->

Define Expenses button)

By DI-API, use the AdditionalExpenses-Object, in VB6 something like


Dim objAddExp As AdditionalExpenses
Set objAddExp = vCmp.GetBusinessObject(oAdditionalExpenses)
'// set needed properties here
objAddExp.Add

1)

"UI-API-Clicking" Item 91 will open the Expenses Window

with type 3007 (I think thats what you do at the moment).

Hm, you get the handle to the window GetFormByTypeAndCount..

> problem: the program drops out when I try to initialize the form

What do you mean with: the program drops? When you call GetFormByTypeAndCount?

Maybe you are to early with GetFormByTypeAndCount and should Sleep() and DoEvents or

something until the form is loaded?

Personally I would try to store the "new" Expenses value somewhere,

react on the FORM_OPEN, fill the remembered value to the matrix

and UI-press Item 1.

This way you don't need to have a reference from the order form to the expenses form

or the other way arround, the expenses form is modal, anyway.

2)

According to the UI-API manual, you can't enable system items.

Message was edited by: Frank Moebius