Skip to Content
Oct 08, 2020 at 06:14 AM

Update PAN no.


I am using SAP B1 9.2 PL:08. I am using this code for updating the pan no. of business partner.

objSAPBP = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
                    objSAPBP.CardCode = txtCode.Text
                    If objSAPBP.GetByKey(txtCode.Text) = True Then
                        For intM = 0 To objSAPBP.FiscalTaxID.Count - 1
                            If objSAPBP.FiscalTaxID.AddrType = SAPbobsCOM.BoAddressType.bo_ShipTo Then
                                objSAPBP.FiscalTaxID.TaxId0 = Trim(txtPanNo.Text)
                                objSAPBP.FiscalTaxID.TaxId12 = Trim(txtCode.Text)
                            End If
                        lngStatus = objSAPBP.Update
                        If lngStatus = 0 Then                           
                            lblStatus.Visible = True
                            lblStatus.CssClass = "MsgStatusBlk"
                            lblStatus.Text = "PAN No. updated successfully"
                            btnSave.Text = "OK"                           
                        End If
                        If objCompany.GetLastErrorDescription.Length > 0 Then
                            lblStatus.Visible = True
                            lblStatus.CssClass = "MsgStatusRed"
                            lblStatus.Text = objCompany.GetLastErrorDescription
                        End If                   
                    End If

I can update the pan no. using the above code.But it creates problem for some business partners. Some pan no.'s are not getting updated using the above code. So I update the pan no. manually through SAP client. For such business partners new entry is added in CRD7 table which is not linked to shipping address i.e. Address field is blank. For some business partners , I can find different pan no's in the CRD7 table.

Is this correct code for updating pan no. ?