cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a BAPI collecting dunning levels

Former Member
0 Kudos

Hello all experts,

I am having a problem with BAPI “DebtorCreditAccount” (called from a VB program), collecting dunning levels.

The BAPIs is called like follows (only the essential code is shown):

The first function (GetCustomerCurrentBalance) works fine but the second (GetCustomerHighestDunningLevel) doesn’t work.

-


Public Function GetCustomerCurrentBalance(ByVal strCustomerID As String) As Decimal

Dim objARAccount, objReturn, objActualBalance As Object

Try

objARAccount = Me.p_sapBapi.GetSAPObject("ARAccount", "1000", Me.ConvertCustomerID(strCustomerID))

objARAccount.GetCurrentBalance(Return:=objReturn, ActualBalance:=objActualBalance)

Return CType(objActualBalance.Value("TOTAL_BAL"), Decimal)

Catch ex As Exception

Return 0

Finally

objARAccount = Nothing : objReturn = Nothing : objActualBalance = Nothing

End Try

End Function

Public Function GetCustomerHighestDunningLevel(ByVal strCustomerID As String) As Integer

Dim objDebtorCreditAccount, objReturn, objHighestDunningLevelD As Object

Dim objTEST1 As Object

Try

objDebtorCreditAccount = Me.p_sapBapi.GetSAPObject("DebtorCreditAccount", Me.ConvertCustomerID(strCustomerID), "0001")

objDebtorCreditAccount.GetHighestDunningLevel(Return:=objReturn, HighestDunningLevelD:=objHighestDunningLevelD)

Return CType(objHighestDunningLevelD.Value("DUNN_LEVEL"), Integer)

Catch ex As Exception

Return 0

Finally

objDebtorCreditAccount = Nothing : objReturn = Nothing : objHighestDunningLevelD = Nothing

End Try

End Function

-


The error message I get is:

Message: The runtime object of type DebtorCreditAccount with the persistent key 00000480060001 could not be created in the Business Object Repository.

Message-Nr: 826

Workarea: OL

R/3 error message: Object does not exist

Please give me some input on how to proceed!

Best Regards,

Niklas

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Vijaya for your fast reply. The parameters that I am giving as input are however correct.

I have investigated the problem a bit further and tried some other calls.

If I just chose to create an object of the type “DebtorCreditAccount” (without submitting any parameters) and then use the same method call as before (se code in topic above) I get the following error: “Mandatory parameter HIGHESTDUNNINGLEVELA missing.” This must mean that it knows that something is missing.

objDebtorCreditAccount = Me.p_sapBapi.GetSAPObject("DebtorCreditAccount")

objDebtorCreditAccount.GetHighestDunningLevel(Return:=objReturn, HighestDunningLevelD:=objHighestDunningLevelD)

If if add the mandatory parameter “HIGHESTDUNNINGLEVELA” I get the error message "The persistent key for an business object instance of type DebtorCreditAccount has not been set. Cannot invoke method GETHIGHESTDUNNINGLEVEL”. This I interpret as the object has not been right instantiated. This brings me back to square one.

objDebtorCreditAccount = Me.p_sapBapi.GetSAPObject("DebtorCreditAccount")

objDebtorCreditAccount.GetHighestDunningLevel(HIGHESTDUNNINGLEVELA:="0", Return:=objReturn, HighestDunningLevelD:=objHighestDunningLevelD)

Grateful for a response!

Regards,

Niklas

Former Member
0 Kudos

Hi,

From the error it looks like a data error or type error.

Please can you check if the type that you are giving as input is the same as its expecting?

Regards

Vijaya