‎2017 May 05 6:17 PM
I am trying to call external program from ABAP. I have built and registered COM object.
When Creating Objects it open new process (I can see from Task Manager). But CALL METHOD it gives error SY-SUBRC = 2
PS. This App has Method by name PrintBarcode with 2 params.
What is the problem can be?
INCLUDE OLE2INCL.
DATA: H_LABELPRNCOM TYPE OLE2_OBJECT
,RET_CODE TYPE I
.
CREATE OBJECT H_LABELPRNCOM 'KGSLabelPrn.Application'.
IF SY-SUBRC = 0.
CALL METHOD OF H_LABELPRNCOM 'PrintBarcode'
= RET_CODE
EXPORTING #1 = SY-HOST
#2 = BARCODE.
ENDIF.
IF SY-SUBRC <> 0 OR RET_CODE <> 0.
RAISE ERROR.
ENDIF.
FREE OBJECT H_LABELPRNCOM.
.
ENDFUNCTION.
‎2017 May 05 6:48 PM
‎2017 May 05 6:48 PM
‎2017 May 05 6:58 PM
ABAP documentation says:
"The return value of the external method meth can be stored in a data object rc. This data object expects, in accordance with the called method, a character-like data type of length 8 or a data type of type ole2_object from the type group OLE2 to be able to accept the addressed object. "
‎2017 May 08 2:34 PM
Thank you Sandra,
In my case: I've tried void method and string return method also. But nothing changes same error.
‎2017 May 08 2:35 PM
What about input params, i have only 4 input params in my .NET application
‎2017 May 08 3:59 PM
I was also talking about types of arguments. And about RET_CODE too.
‎2017 May 08 4:02 PM
You should also try rewriting your COM object, with a method without parameter, just to make sure whether you can call it from ABAP, to know whether it's related to parameters.
‎2017 May 10 9:46 AM
Thank you Sandra
I found the problem. This method must return string value "0"
That it was a problem in my case.
Thanks in advance