cancel
Showing results for 
Search instead for 
Did you mean: 

usage of '?='

Former Member
0 Kudos

Hi,

What is the use of this operator '?= ' . why and where we use it? please explain.

Thanks

Mallika

Accepted Solutions (0)

Answers (4)

Answers (4)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi,

>

> What is the use of this operator '?= ' . why and where we use it? please explain.

>

> Thanks

> Mallika

This is not a Web Dynpro ABAP related question. This is a general ABAP syntax question and belongs in the ABAP general forum. Please keep the questions in this forum focused on the Web Dynpro specific aspects of the ABAP development environment.

vivekananthan_sellavel
Active Participant
0 Kudos

Down Cast

If the static type of the target variable is more specific than the static type of the source variable, you must check at runtime before the assignment is executed, whether it is less specific or the same as the dynamic type of the source variable. The name down cast arises from the fact that you are moving downwards in the inheritance space. Because the target variable can accept fewer dynamic types in comparison to the source variable, this assignment is also known as a narrowing cast. A down cast is only possible using the special assignment operator ?= (casting operator) or the statement MOVE ... ?TO .... If this prerequisite is not fulfilled, a treatable exception occurs.

Regard

Vivekananthan.S

former_member40425
Contributor
0 Kudos

Hi,

Refer the following link on online help.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c3/225b5f54f411d194a60000e8353423/frameset.htm

It will clear your concept.

Regards,

Rohit

Former Member
0 Kudos

hi,

?= this is called downcast or narrow casting operator in abap.

The purpose of this is assignment between reference variables in which the static type of the target varible more specific than the static type of the source varible.

Thanks

Pankaj Aggarwal.

Former Member
0 Kudos

thanks a lot for the reply..could u pls explain me how many types of variable used in webdynpro.

Former Member
0 Kudos

Hi,

For Ex:

The WD API has provided with the standard classes/interfaces. For the UI elements the class is

if_wd_view_element. This is a generalised one. You can declare of our own UI element and can get the reference of this specific UI element using the generalised one.

For Ex:

In MODIFYVIEW - 
View parameter is of type if_wd_view 
DATA:
lr_view_ele type ref to IF_WD_VIEW_ELEMENT,           " View UI element
lr_btn_save    type ref to cl_wd_button,              " For SAVE

  CALL METHOD VIEW->GET_ELEMENT
    EXPORTING
      ID      = 'BTN_SAVE'             "Id for the button
    RECEIVING
      ELEMENT = lr_view_ele.
***Gettig the button object reference forSAVE button
  lr_btn_save ?= lr_view_ele.

In the above example lr_view_ele is the Interface for the view element which is generalised, now to get the button reference we can pass the button Id and can get the button reference directly.

This is mainly used for the interface reference types and classe variables.

Regards,

Lekha.

Former Member
0 Kudos

hi,

If u are assigning the object of super class to the object of child class then u use this symbol.

because u can not use = operator there.