‎2008 Nov 16 12:22 PM
Hi,
i heard that i can write method in 2 ways.
1. CALL METHOD
lp_ukm_easy->add
EXPORTING
it_key_mapping = lt_mappings
IMPORTING
es_messages = ls_messages.
2. ls_messages = lp_ukm_easy->add (exporting = lt_mappings) .but when i write like 2 i have error what i doing wrong ?
Regards
‎2008 Nov 16 4:01 PM
Lots of things wrong.
1. If the method has only one IMPORTING parameter (or one is marked as preferred), you can leave out EXPORTING in the call to the method.
2. If es_messages was a returning parameter you could use
ls_messages = lp_ukm_easy>add( lt_mappings ) .3. No space between add and (
4. Always have a space inside the brackets.
5. Short form of what you wrote is:
lp_ukm_easy->add( EXPORTING it_key_mapping = lt_mappings
IMPORTING es_messages = ls_messages ). matt
‎2008 Nov 16 4:01 PM
Lots of things wrong.
1. If the method has only one IMPORTING parameter (or one is marked as preferred), you can leave out EXPORTING in the call to the method.
2. If es_messages was a returning parameter you could use
ls_messages = lp_ukm_easy>add( lt_mappings ) .3. No space between add and (
4. Always have a space inside the brackets.
5. Short form of what you wrote is:
lp_ukm_easy->add( EXPORTING it_key_mapping = lt_mappings
IMPORTING es_messages = ls_messages ). matt
‎2008 Nov 16 8:29 PM
Hello Vijay
The second variant you describe
DATA: lo_msglist TYPE REF TO if_reca_message_list.
CALL METHOD cf_reca_message_list=>create
RETURNING
ro_instance = lo_msglist. " or functional method call:
lo_msglist = cf_reca_message_list=>create( ).
is the so-called functional method call. It works - as Matt explained - only if the method has a RETURNING parameter. If a method has a RETURNING parameter it is the only returned parameter. You cannot have additional EXPORTING or CHANGING parameters besides a RETURNING parameter.
Regards
Uwe