Skip to Content
0
Jul 17, 2020 at 04:12 PM

how to manipulate the Withholding Tax liable property in a service document line

115 Views Last edit Jul 18, 2020 at 03:49 AM 3 rev

Hi Experts,

Does anyone knows how to manipulate the Withholding Tax liable property in a document line of a/r invoice service document ? In my ar invoice, there are several lines of service item but only one line is subjected to wittholding tax. So, the wt liable for other line should be No.

The property "WTLiable" in the Document_Lines object is not a read property because I am using the customer that has been subjected to withholding tax. The wt code is XX50.

So i want set a value to this field via DI API.

I am using this following code but failed:

For Each HeaderDetail As DataRow in DtHeader.Rows

Dim invoice = TryCast(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices), SAPbobsCOM.Documents)
invoice.CardCode = "C20000"
invoice.DocDate = DateTime.Now
invoice.NumAtCard = HeaderDetail.Item("Reference")
invoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service
invoice.WithholdingTaxData.WTCode = "JS01"

'foreach detail row

sSQL = "select ""ENTRYID"", ""ROW"", ""GROUP"", ""TYPE"",""DOC1"", ""DOC2""," & _
"""DOC3"", ""DETAIL"", ""AMOUNT"", 
""UNIT"" FROM ""SCHEMA"".""TABLE_SOURCE"" where ""ENTRYID"" = '" & HEADERDETAIL.ITEM(""ENTRYID"") & "' " & _
"Order By ""ENTRYID"", ""ROW"" asc"
 dtDetail1 = GetHANA(sHANA, sConn)
 If dtDetail1.Rows.Count <= 0 Then
 DOCStart = False
 DETErrMsg = "$$$Inf$$$"
End If
For Each RowDetail1 As DataRow In dtDetail1.Rows
invoice.Lines.AccountCode = "550000"
invoice.Lines.UserFields.Fields.Item("U_UDF1").Value = RowDetail1.Item("TYPE")
invoice.Lines.UserFields.Fields.Item("U_UDF2").Value = RowDetail1.Item("DOC1")
invoice.UserFields.Fields.Item("U_UDF3").Value = RowDetail1.Item("DOC3")
invoice.NumAtCard = RowDetail1.Item("DOC2")
invoice.Lines.ItemDescription = RowDetail.Item("GROUP")

'For non applicable wt item
invoice.Lines.WTLiable = SAPbobsCOM.BoYesNoEnum.tNO
'For applicable wt item 
invoice.Lines.WTLiable = SAPbobsCOM.BoYesNoEnum.tYES
invoice.Lines.Add()
Next

invoice.WithholdingTaxData.Add()
lRetCode = oAP.Add()

I am not sure if this following syntax is correct :

'For non applicable wt item
invoice.Lines.WTLiable = SAPbobsCOM.BoYesNoEnum.tNO
'For applicable wt item 
invoice.Lines.WTLiable = SAPbobsCOM.BoYesNoEnum.tYES

Pls advice. I appreciated your answer so much. Thank you

Rgds,

Steve