Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Defaulting taxcode on ship to address on BP via UI

Hi,

I would like to default the tax code field in the matrix on the right side of the BP addresses tab when the user clicks the "define new" option on the left matrix for a ship to address. The user wants the value to default to the entry they enter most commonly.

Select Case pVal.EventType
    Case Is = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED

       Select Case pVal.ItemUID

             Case Is = "69"

       'Detect user pressed "Define new" - shipping address
       If pVal.ColUID = "20" And pVal.Row = 5 And Not pVal.BeforeAction And _
             pVal.ActionSuccess Then

        Dim oitem As SAPbouiCOM.Item

        'g_SBOFORM is class that encapsulates SBO system form
        oitem = g_SBOForm.Items.Item("178")
        Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
        Dim oEdit As SAPbouiCOM.EditText
        oEdit = oMatrix.Columns.Item("12").Cells.Item.(1).Specific
        oEdit.String = "0" 'tax code (exempt)

Problem 1: I the "define new" constant that B1 provides

will not always be column 20, since many addresses may appear above it. How do I determine if the column they press is "Define New" for ship-to's?

Problem 2: the update of oEdit.String fails with a message that says the item is not editable. Am I hitting the wrong field, or am I really not able to default ANY of the address information when a new ship-to is about to be added?

I'm very grateful for any help you can offer!

Former Member
replied

Hi Jhon,

For problem 1, column is allways the same, but you can´t determine which row is the "define new" one. I think you should use the String value to compare it with "Define New". Something like:

If pVal.ColUID = "20" And And Not pVal.BeforeAction And _
             pVal.ActionSuccess Then
   'Supposing oItem is item 69.
   Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific 
   Dim oEdit As SAPbouiCOM.EditText
   oEdit = oMatrix.Columns.Item("20").Cells.Item.(pVal.Row).Specific
   If oEdit.String = "Define New"
      'Do what you need.
   Endif
Endif

For problem 2, I don´t know what field you are talking about. We haven´t got any tax field in the BP addresses right side (2004A). Isn´t it a user defined field??

Regards,

Ibai Peñ

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question