Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IS SUPPLIED statement not work???

Former Member
0 Likes
981

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

3 REPLIES 3
Read only

rajesh_paruchuru
Active Participant
0 Likes
710

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.

Read only

naimesh_patel
Active Contributor
0 Likes
710

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

Read only

Former Member
0 Likes
710

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