2006 Jan 26 11:07 PM
Hi,
I have a problem. I have a function which's signature is;
bool isPossible(); //in .NET environment
And the corresponding code of this signature in ABAP/4;
DATA: RESULT TYPE I VALUE 8.
DATA: APP TYPE OLE2_OBJECT.
...
CREATE OBJECT APP 'X.APPLICATION'.
CALL METHOD OF APP 'isPossible' = RESULT.
But, I see that RESULT is 8, not changed. How can I get the result of isPossible method. Normally, it returns boolean value. But in ABAP, what is the corresponding type of boolean?
Thanks.
2006 Jan 28 9:24 AM
You should use type C, beacuse OLE methods with return type boolean return '0' or '1' in ABAP instead of 'X' and ' '.
You should note that ABAP buffers OLE statements to first non-OLE statement.
So when you write this code and check value of lv_b in debugger it will be empty:
REPORT ZOLE .
INCLUDE ole2incl .
DATA: lr_o TYPE ole2_object,
lv_b type c.
CREATE OBJECT lr_o 'BT.BTester'.
CALL METHOD OF lr_o 'retT' = lv_b .
CALL METHOD OF lr_o 'retF' = lv_b .
but when you write
REPORT ZOLE .
INCLUDE ole2incl .
DATA: lr_o TYPE ole2_object,
lv_b type c.
CREATE OBJECT lr_o 'BT.BTester'.
CALL METHOD OF lr_o 'retT' = lv_b .
check sy-subrc = 0.
CALL METHOD OF lr_o 'retF' = lv_b .
check sy-subrc = 0.
you should see that after call of 'retT' lv_b hasa value '1' and after call of 'retF' lv_b is '0'.
Thats beacuse 'check sy-subrc = 0.' is non-OLE statement and it causes ABAP to execute previous buffered OLE statements.
PS. BT.BTester was my test object with two methods:
retT - simply returns true
retF - returns false
Message was edited by: Tomasz Mackowski
Hi,
I have a problem. I have a function which's signature is;
bool isPossible(); //in .NET environment
And the corresponding code of this signature in ABAP/4;
DATA: RESULT TYPE I VALUE 8.
DATA: APP TYPE OLE2_OBJECT.
...
CREATE OBJECT APP 'X.APPLICATION'.
CALL METHOD OF APP 'isPossible' = RESULT.
But, I see that RESULT is 8, not changed. How can I get the result of isPossible method. Normally, it returns boolean value. But in ABAP, what is the corresponding type of boolean?
Thanks.
2006 Jan 26 11:16 PM
The boolean equivalen in SAP is: <b>SAP_BOOL</b> (X=True, Space=False)
2006 Jan 27 10:07 PM
Hi Sam,
Is there any include to use SAP_POOL? I can not define like;
DATA RESULT TYPE SAP_BOOL.
Compiler gives error as: "SAP_BOOL IS UNKNOWN"
Thanks.
2006 Jan 27 10:14 PM
2006 Jan 27 10:17 PM
No you dont! Maybe it is your vesion.
Goto SE11 and see if you have the data type SAP_BOOL
2006 Jan 27 10:37 PM
Hi, I have just checked SAP_BOOL from SE11. There is no type as SAP_BOOL. But there is another type BOOLEAN. I have used this type for my purpose;
DATA RESULT type BOOLEAN.
DATA: APP TYPE OLE2_OBJECT.
...
CREATE OBJECT APP 'X.APPLICATION'.
CALL METHOD OF APP 'isPossible' = RESULT.
isPossible method returns true. But, RESULT is ''. Also, I changed the condition that isPossible return false, but again RESULT is ''. I mean that I can not get the result of this method in OLE. What should I do?
2006 Jan 28 1:50 AM
hi, try this way;
CALL METHOD OF APP 'isPossible' = RESULT <b>NO FLUSH</b>.
Hope it will be helpful
2006 Jan 28 4:37 AM
Hi Huseyin,
1. Try with C(10)
ie. some character having some length
regards,
amit m.
2006 Jan 28 9:24 AM
You should use type C, beacuse OLE methods with return type boolean return '0' or '1' in ABAP instead of 'X' and ' '.
You should note that ABAP buffers OLE statements to first non-OLE statement.
So when you write this code and check value of lv_b in debugger it will be empty:
REPORT ZOLE .
INCLUDE ole2incl .
DATA: lr_o TYPE ole2_object,
lv_b type c.
CREATE OBJECT lr_o 'BT.BTester'.
CALL METHOD OF lr_o 'retT' = lv_b .
CALL METHOD OF lr_o 'retF' = lv_b .
but when you write
REPORT ZOLE .
INCLUDE ole2incl .
DATA: lr_o TYPE ole2_object,
lv_b type c.
CREATE OBJECT lr_o 'BT.BTester'.
CALL METHOD OF lr_o 'retT' = lv_b .
check sy-subrc = 0.
CALL METHOD OF lr_o 'retF' = lv_b .
check sy-subrc = 0.
you should see that after call of 'retT' lv_b hasa value '1' and after call of 'retF' lv_b is '0'.
Thats beacuse 'check sy-subrc = 0.' is non-OLE statement and it causes ABAP to execute previous buffered OLE statements.
PS. BT.BTester was my test object with two methods:
retT - simply returns true
retF - returns false
Message was edited by: Tomasz Mackowski
2006 Jan 29 2:46 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |