Skip to Content

Read package status from VBA

Sep 20, 2017 at 10:25 AM


avatar image

Hi guys,

Is there anyway to read the statuts package of an input form from VBA?



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Vadim Kalinin Sep 20, 2017 at 11:56 AM

You can read message only from write back badi:

Option Explicit

Public api As New FPMXLClient.EPMAddInAutomation
Public submres() As FPMXLClient_OlapUtilities.SubmitResult 'Array!!!

Public Sub SubmitData()
Dim lngTemp As Long

api.SetSilentMode True

submres = api.SubmitWorkSheet(ThisWorkbook.Worksheets("Sheet1"))
For lngTemp = 0 To UBound(submres)
    MsgBox CStr(submres(lngTemp).ErrorMessage)
Next lngTemp

api.SetSilentMode False
End Sub
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Sep 20, 2017 at 10:32 AM

There is no simple way to read package status from VBA! I have already answered this question and provided solution.

In short:

Create write back badi that will read package status if data is send to some special (dummy) combination of members.

The badi will return error message containing status.

VBA can read error message after data save.

10 |10000 characters needed characters left characters exceeded
amine lamkaissi Sep 20, 2017 at 11:43 AM

Hi Vadim,

Thanks for your answer, how can i read this message error returned by the BADI from VBA?

Let's say the message erros is : refresh failed



Show 5 Share
10 |10000 characters needed characters left characters exceeded

there is a long way to do it. You can write your package log to DM folder before the BADI finish and later on you can read this DM file from VBA and show to the user.


Sorry, but how?


you can populate your log message into an internal table (+ you can retrieve also from CL_UJK_LOGGER class), write as a text format to DM folder to the same model where your BADI is triggered. Later on on the EPM template, you can read that DM folder by using DOWNLOAD method and display the content. Only critical point is "how to distinguish your package log". Here you can send a guid from DM package and read back based on this guid. At the same time it is possible you can trigger many package but you want to read the latest one that you triggered from template.

But EPM API doesn't give you an option to list the content of DM folder. Lets say you have 10 files but you won't be able to get their names via API. In this case we are writing the file list of our DM folder content to another txt file which the name is predefined.
More advanced of this logic i am using to populate an offline EXCEL report and download it from an EPM report.

User selects Contexts and clicks generate report button->BADI creates and offline complicated Excel->Save offline excel to DM folder via ABAP->Update DM folder content list to the predefiend txt file-> Display Content of DM folder in the EPM report via download method->User selects what report to be downloaded->Again trigger Download method for the generated offline excel from DM folder (binary format)->Convert to Excel format-> Save to Desktop->Open it.

I am using this method for complicated report scenarios which cannot be achieved via EPM report or very slow reports. User generates reports, later on select report to download from list in an EPM report and offline report is auto-downloaded.


First - user is asking about the status of any DM package.

Sequence of events:

1. User launch some DM package (using VBA) and it's running in background.

2. To perform status request user has to perform save from EPM to some specific member combination. The value saved can be used to identify the particular DM package (some reference table or simply comments to some member combination). "Save" has to be performed in VBA using SubmitWorkSheet method (some hidden sheet with simple input form can be used for this purpose).

3. Write back badi (or validation badi) will be triggered and the code to check status of DM package will run:

UserID - visible in write back badi (select package for the same user ID).

EnvironmentID and ModelID also from write back local variables.

Package name and package group - from some reference table.

Then the code will select the latest line based on TIMESTAMP of table UJD_STATUS (we need field STATUS) where USER_ID, APPSET_ID, APPLICATION_ID, PACKAGE_ID,GROUP_ID are set.

The STATUS will be assigned to error message of write back badi.

4. In VBA the error message will be analyzed as a result of SubmitWorkSheet method.

Repeat 2-4 after some delay using timer.


Thanks Bilen.

amine lamkaissi Sep 20, 2017 at 11:59 AM

Thanks Vadim.

10 |10000 characters needed characters left characters exceeded