Skip to Content
0

How can I get value of Document Total of system form in SDK?

Oct 25, 2017 at 01:33 PM

56

avatar image

Hi all,

How can I get value of textbox (Document Total) of system form (AR/Invoice) in SAP B1 SDK

Actually in VB I can do something like

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim total As Double
        total = TextBox1.Text
    End Sub

How can I do something like that in SAP B1?

Please anyone can help me

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
ANKIT CHAUHAN
Oct 25, 2017 at 02:02 PM
0

Hi,

It should be done something like this:

SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.GetForm("139", 1);
SAPbouiCOM.EditText oEditTotal = (SAPbouiCOM.EditText)oForm.Items.Item("29").Specific;
Double Total = Convert.ToDouble(oEditTotal.Value);

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Ankit,

I have a problem of to convert Total to double

I tried to do something like this and it works fine

            Dim oForm As SAPbouiCOM.Form
            Dim oEditTotal As SAPbouiCOM.EditText
            oForm = SBO_Application.Forms.GetForm("133", 1)
            oEditTotal = SBO_Application.Forms.ActiveForm.Items.Item("29").Specific
            Dim Total As String = Convert.ToString(oEditTotal.Value)
            SBO_Application.MessageBox(Total)

The problem is if I convert to double like this Dim Total As [Double] = Convert.ToDouble(oEditTotal.Value) it brings error message Add-on 9000040 failed with exception; Event Type: 1

How can I convert the Total to double? because string bring string result like GBP 234.30

Please anyone can help me

0

Hi,

Currency will always be 3 characters long and after that you have an space. So in total there are 4 characters.

Try to read the value always after 4 characters. You can use any simple .NET method like (SubString) to get the money value only.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

0

Thank you so much Ankit,

It works fine

0