‎2012 Feb 20 3:51 PM
Hi Gurus,
I'm trying to use IS SUPPLIED statement inside a METHOD but it seems there is any problem.
I type an example of my source code:
Calling statement:
* 1rst call)
wd_comp_controller->set_context( imp_t_eval_act = lt_eval_act[] ).
* 2nd call)
wd_comp_controller->set_context( imp_t_eval_ant = lt_eval_ant[] ).
* Method definition:
* Import parameter: IMP_T_EVAL_ACT as optional
* Import parameter: IMP_T_EVAL_ANT as optional
* Method source code:
IF imp_t_eval_act IS SUPPLIED.
" code would be executed in 1rst call
" wouldn't be executed in 2nd call
ENDIF.
IF imp_t_eval_ant IS SUPPLIED.
" wouldn't be executedn in 1rst call
" code execution in 2nd call
ENDIF.
What is happening on both calls two source code blocks are executed independent of the call.
Any idea?
Regards
‎2012 Feb 20 4:26 PM
Hi Gurus,
>
> I'm trying to use IS SUPPLIED statement inside a METHOD but it seems there is any problem.
> I type an example of my source code:
>
> Calling statement:
>
>
> * 1rst call) > > wd_comp_controller->set_context( imp_t_eval_act = lt_eval_act[] ). > > * 2nd call) > > wd_comp_controller->set_context( imp_t_eval_ant = lt_eval_ant[] ). > > * Method definition: > > * Import parameter: IMP_T_EVAL_ACT as optional > * Import parameter: IMP_T_EVAL_ANT as optional > > * Method source code: > > IF imp_t_eval_act IS SUPPLIED. > " code would be executed in 1rst call > " wouldn't be executed in 2nd call > ENDIF. > > IF imp_t_eval_ant IS SUPPLIED. > " wouldn't be executedn in 1rst call > " code execution in 2nd call > ENDIF. > >>
> What is happening on both calls two source code blocks are executed independent of the call.
>
> Any idea?
>
> Regards
that is the expected behaviour of 'IS SUPPLIED' statement, please check the F1 help.
-Rajesh.
‎2012 Feb 20 7:15 PM
It works as expected. Check out this code:
CLASS lcl_temp DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: check_data IMPORTING iv_1 TYPE i OPTIONAL
iv_2 TYPE i OPTIONAL.
ENDCLASS. "lcl_temp DEFINITION
*
CLASS lcl_temp IMPLEMENTATION.
METHOD check_data.
IF iv_1 IS SUPPLIED.
WRITE: / 'iv_1 supplied'.
ENDIF.
IF iv_2 IS SUPPLIED.
WRITE: / 'iv_2 supplied'.
ENDIF.
ENDMETHOD. "check_data
ENDCLASS. "lcl_temp IMPLEMENTATION
*
START-OF-SELECTION.
lcl_temp=>check_data( iv_2 = 2 ).
lcl_temp=>check_data( iv_1 = 1 ).
If the WD framework calls the method by specifying both parameters even without value, it would execute both methods.
lcl_temp=>check_data( iv_1 = 2 iv_2 = 0 ).
" will execute both codes
Regards,
Naimesh Patel
‎2012 Oct 23 7:54 PM
Hi Alfonso, when you call a method in WD_COMP_CONTROLLER (or WD_THIS), actually the WebDynpro's framework call first something like ZIWCI_Controller_Name~SET_CONTEXT, and this method will call the method in COMP_CONTROLLER.
This second method, that actually calls your implementation, call the COMP_CONTROLLER passing all the parameters received by the first method, and thats why the 'IS SUPPLIED' will not work in COMP_CONTROLLER->SET_CONTEXT.
You can check this putting a breakpoint in COMP_CONTROLLER->SET_CONTEXT and look in the call stack that this method is never called directly.
Cheers