05-11-2007 12:53 AM
i record a macro in excel and the name is Macro1, and in sap i using this method to call the macro
CALL METHOD document->execute_macro
EXPORTING
macro_string = 'Macro1'.
but the system can't find the macro,how to define the macro string?
thanks!
05-11-2007 1:18 AM
05-11-2007 1:22 AM
I changed the macro string to captial letters,but it not work
and the error string is: can't find macro ThisWorkbook.MACRO1
05-11-2007 1:28 AM
Can you tell us what class are you using?
In other words,
how was the object document created(With referance to whichh class?)
Regards,
Ravi
05-11-2007 1:34 AM
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
OBJID = 'ZSRM_TMX_PRINT'
LIFETIME = 'T'
IMPORTING
URL = URL.
CALL METHOD C_OI_CONTAINER_CONTROL_CREATOR=>GET_CONTAINER_CONTROL
IMPORTING
CONTROL = CONTROL.
CREATE OBJECT CONTAINER
EXPORTING
CONTAINER_NAME = 'VIEW'.
CALL METHOD CONTAINER->SET_VISIBLE
EXPORTING VISIBLE = 'X'.
CALL METHOD CONTROL->INIT_CONTROL
EXPORTING
R3_APPLICATION_NAME = 'SRM'
INPLACE_ENABLED = INPLACE
PARENT = CONTAINER.
CALL METHOD CONTROL->GET_DOCUMENT_PROXY
EXPORTING
DOCUMENT_TYPE = 'Excel.Sheet'
IMPORTING
DOCUMENT_PROXY = DOCUMENT.
CALL METHOD DOCUMENT->OPEN_DOCUMENT
EXPORTING
OPEN_INPLACE = INPLACE
DOCUMENT_URL = URL.
CALL METHOD DOCUMENT->GET_SPREADSHEET_INTERFACE
IMPORTING
SHEET_INTERFACE = SPREADSHEET.
*append value to excel
data:ERROR_STRING(255).
CALL METHOD document->execute_macro
EXPORTING
macro_string = 'MACRO1'
NO_FLUSH = ' '
changing
ERROR_STRING = ERROR_STRING.
05-11-2007 3:58 AM
12-13-2007 11:24 AM
02-10-2009 2:54 PM
Try this:
macro_string = 'module1.Macro1'
It works !
Look at demos:
SAPRDEMOEXCELINTEGRATION
SAPRDEMOEXCELINTEGRATION2
SAPRDEMOOFFICEINTEGRATION
best regards,
Robert