Skip to Content
0
Dec 09, 2015 at 05:39 PM

Capturing Error in Fox so that I can use in VBA Analysis Office

63 Views

Hello Team -

I am working on AO 2.1 and Embedded Planning.

I have an technical issue to capture Error in the FOX. The idea is if I have an error in FOX Calculation, hence, I will not continue to the next process e.g. Save Plan data.

FOX Code - at this time, this FOX only show error & no calculation.

DATA L_BPE TYPE STRING.

DATA L_EVENT TYPE STRING.

DATA O_USERNAME TYPE STRING.

DATA O_SUBRC TYPE I.

L_BPE = VARV(YXPM00001).

L_EVENT = VARV(YXVEVN001).

MESSAGE E001(UPF) WITH 'ERROR !!'.

In Analysis Office 2.2, I create 1 button, and then insert VBA

Private Sub CommandButton21_Click()

Dim lResult As Long

lResult = Application.Run("SAPExecutePlanningFunction", "PF_1")

lResult = Application.Run("SAPExecutePlanningSequence", "PS_1")

End Sub

PS_1 - Planning Sequence. PS_1 is to execute PF_1 as well.

At the VBA, I tried to run for both function; and I cannot get the lResult = 0. It always give lResult = 1 (means it is success), but the error message shows error.

Have you ever encountered the same problem like this? If yes, how did you solve it?

Or, do you have any idea how to resolve the issue?

Or, Is this the bugs of Analysis Office 2.1?

Many thanks,

Daniel