on 12-13-2004 3:19 PM
when calling to method in abap objects we can write
CALL METHOD method_name
EXPORTING
param =: value1 , value2 , .... ,valuen .
but how can i call method if it get 2 parameters ?
means like
CALL METHOD method_name
EXPORTING
param1 =: ???????
param2 =: ??????? .
Your Sample uses the repetion logic. This can only be used if the tail of the statement can be replaced in a unique manner. This case is not given for a method with several parameters due one must specify each argument by name.
cref->method(
arg1 = act1
arg2 = act2).
you may of course use macros:
define mac_call_m1.
cref->Method( arg1 = &1 arg2 = &2 ).
end-of-definition.
mac_call_m1:
1 2,
4 9.
But thats nothing special for OO.
Kind Regards
Klaus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry,
I misunderstood the original question. I saw the colons but assumed they were just part of Herzel's notation.
Regards,
James Gaddis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you are entering a CALL METHOD within the ABAP editor, you should consider using the "Pattern" button (Ctrl+F6 in 4.6C). The Insert Statement popup has an option for "ABAP Objects patterns" (in 4.6C). Enter the Instance, Class, and Method in the Call Method section of the OO statement popup.
Just as with function modules, it is advisable to always use the Pattern button when possible. This will help avoid typing errors and ensure that you use the correct interface and syntax. It also makes our lives much easier...
Best Regards,
James Gaddis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Herzel
Klaus' solution is the best way I believe. Statement chaining is a good feature of ABAP syntax, however it is restricted to some extent.
Hence, try defining a macro as Klaus suggested or writing a subroutine.
*--Serdar
P.S.: Fuat, Herzel's question is not about the method calling statement, but about chaining it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Example
CALL METHOD object=>method
EXPORTING
param1 = 'PARAM1'
param2 = 'PARAM2'.
Another example:
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = filetable
rc = rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Please give points if it helps.
Message was edited by: Fuat Ulugay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.