2007 Jul 18 12:13 AM
Hi All,
how to get the value from a returning pararmeter when we call a method from the main program.
call method obj1->withdraw exporting amount = 100
regards
Siddhartha
2007 Jul 18 12:25 AM
There are a few ways, but the way that I prefer is like so. Here, SOME_VALUE is the returning parameter.
data: some_value type i.
some_value = obj1->get_some_value( ).Regards,
RIch Heilman
2007 Jul 18 12:24 AM
Hi Siddhartha,
If that method has the return parameter then only you can get it.Check if this method has return parameters.
Regards,
Atish
2007 Jul 18 12:25 AM
2007 Jul 18 12:43 AM
Hi RIch,
NEW_BALANCE = obj1->deposit.
New balance is my returning parameter of the method, but at the same time i have to export some values too to that method.
its not working for me.
regards
Siddhartha
2007 Jul 18 1:06 AM
2007 Jul 18 10:25 AM
HI,
In addition to the code
new_balance = obj1->deposit( 'some value' ).You can use the following syntax also.
CALL METHOD obj1->deposit
EXPORTING
iv_value = 'some value'
RECEIVING
iv_balance = new_balance.Regards
Geogy
2007 Jul 19 1:13 AM
Hi Geogy,
thanks for the reply, but you know none of the things are working for me, i dont know why.
CALL METHOD obj1->deposit
EXPORTING
iv_value = 'some value'
RECEIVING
iv_balance (main program parameter) = new_balance(returning parameter).
when i am using this one, its saying the reverse is accepted, its throwing a syntax error.
e.g.
CALL METHOD obj1->deposit
EXPORTING
iv_value = 'some value'
RECEIVING
new_balance(returning parameter) = iv_balance (main program parameter).
and the output is coming as zero. as the program parameter value is Zero.
Please help.
Regards
Siddhartha
2007 Jul 19 2:19 AM
If the returning parameter is defined as NEW_BALANCE within the method, then the following should work fine. But you must be move some result to this parameter inside the method itself.
CALL METHOD obj1->deposit
EXPORTING
iv_value = 'some value'
RECEIVING
new_balance = iv_balance .So for example, inside this method, you should be filling it.
method deposit.
new_balance = 100. "or whatever your logic is
endmethod.Regards,
RIch Heilman
2007 Jul 19 8:31 PM
Hi RIch,
Thanks a lot for the help, actually i was missing on that part where some operation has to be carried out for the parameter which i am returning, now the problem is solved. Once again Thanks a lot.
regards
Siddhartha Sengupta
2007 Jul 18 6:30 PM
Hi,
You can use the other form also.
<data> = obj1->withdraw ( exporting amount = 100 ).
or.
call method obj1->withdraw
exporting amount = 100
receiving <parameter> = <data>.
Regards.
Marcelo Ramos
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |