Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

EXECUTE_MACRO of I_OI_DOCUMENT_PROXY - giving Dump

Former Member
0 Kudos

Hi All,

I was trying to execute a simple excel macro from SAP.

My idea is to open excel file using "In Pace" method and execute a macro when a button is selected on screen. I was able to create a container and open excel document in side the container successfully.

When button on screen is pressed, i'm calling EXECUTE_MACRO method of I_OI_DOCUMENT_PROXY. I tried to call method as below

Declared g_document as  I_OI_DOCUMENT_PROXY.

CALL METHOD g_document->execute_macro

         EXPORTING

           macro_string = 'Module4.Macro3'   " Module and Macro.

           no_flush     = 'X' 

         IMPORTING

           error        = it_errors

           retcode      = g_retcode .

or

CALL METHOD g_document->execute_macro

         EXPORTING

           macro_string = 'Macro3'    "Macro Name only

           no_flush     = 'X' 

         IMPORTING

           error        = it_errors

           retcode      = g_retcode .

I don't have to pass any parameters to this macro, it is just a test macro to fill some cells randomly. This macro is working fine when i run it on excel file. I tried several others ways of calling this method, like passing script names as OKADIS, passing changing parameters, with and without no_flush, none of them worked. The error I'm getting is short dump as shown in attached screen shot.

If anybody had ever faced such issue and was able to resolve it, please guide me on how to do this.

Any help is highly appreciated.

Thanks in Advance.

1 REPLY 1

ŁukaszPęgiel
Contributor
0 Kudos

Hi,

try this:

CALL METHOD g_document->execute_macro

         EXPORTING

           macro_string = 'Module4.Macro3'   " Module and Macro.

           no_flush     = ' '

          param_count  = 1 "even if you don't have params.

         IMPORTING

           error        = it_errors

           retcode      = g_retcode .


Regards

Lukasz