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

Field Symbol

Former Member
0 Likes
783

Hi can any one explain what does this statement mean?

wa_des ?= cl_abap_typedescr=>describe_by_data( <fs_wa> )

1 ACCEPTED SOLUTION
Read only

hymavathi_oruganti
Active Contributor
0 Likes
729

<b>wa_des ?= cl_abap_typedescr=>describe_by_data( <fs_wa> )</b>

in the above statement, if your doubt is about the operator ?=, below is the explanation:

generally the above operator can be used only with the reference variables.

and it must be used if the source reference variable is more generic than destination refrence variable. then we cannot use = but should only use ?=.

other wise we can use both ?= or = with the reference variables.

note: we cannot use ?= with noraml variables.

i hope u know what are refernce variables?

two types object refrence variable and data reference variables.

in the above statement <fs> would be data reference variable and wa_des would be object referece variable. if iam not wrong it may be declared like below

<b>wa_des type ref to cl_abap_typedescr</b>.

in the above statement both are reference variables so only ?= is allowed.

u try keeping = in place of ?= above, it should work then also as the source reference is specific , not generic. it specifically pointing to the class.

now coming to the class

cl_abap_typedescr=>describe_by_data( <fs_wa> )

in the above statement

<b>cl_abap_typedescr is a class is for providing run time type services.</b>. the above method in the class provides the details about the type of the variable in brackets.

i hope u understood now.

4 REPLIES 4
Read only

Former Member
0 Likes
729

cl_abap_typedescr is a global class.

You are just calling the private method describe_by_data and the storing the data in the workarea wa_des. That's it.

You can verify it by setting break-point before thie statement.

Please reward if helpful.

Read only

former_member376453
Contributor
0 Likes
729

Hi,

Go to SE24 and give cl_abap_typedescr. This actually a standard class. Within this class u can find the method DESCRIBE_BY_DATA, which holds a value in the field symbol <fs_wa>. U are copying this value to wa_des field.

Reward points if helpful.

Kuntal

Read only

hymavathi_oruganti
Active Contributor
0 Likes
730

<b>wa_des ?= cl_abap_typedescr=>describe_by_data( <fs_wa> )</b>

in the above statement, if your doubt is about the operator ?=, below is the explanation:

generally the above operator can be used only with the reference variables.

and it must be used if the source reference variable is more generic than destination refrence variable. then we cannot use = but should only use ?=.

other wise we can use both ?= or = with the reference variables.

note: we cannot use ?= with noraml variables.

i hope u know what are refernce variables?

two types object refrence variable and data reference variables.

in the above statement <fs> would be data reference variable and wa_des would be object referece variable. if iam not wrong it may be declared like below

<b>wa_des type ref to cl_abap_typedescr</b>.

in the above statement both are reference variables so only ?= is allowed.

u try keeping = in place of ?= above, it should work then also as the source reference is specific , not generic. it specifically pointing to the class.

now coming to the class

cl_abap_typedescr=>describe_by_data( <fs_wa> )

in the above statement

<b>cl_abap_typedescr is a class is for providing run time type services.</b>. the above method in the class provides the details about the type of the variable in brackets.

i hope u understood now.