Skip to Content

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.