cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member193355
Contributor
0 Kudos
553

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

former_member193355
Contributor
0 Kudos

Any helps from experts, please ? I am asking because this problem is not available in the SDK samples. If it is available, I will not ask for help in this community.

SAP should concern and should improve SDK samples.

Rgds,

Steve

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi steve.andre2,

Are you able to create such document manually using SAP Business One Client?

If yes, please share few screenshots about the process to create the document so that I can have a look.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Accepted Solutions (0)

Answers (0)