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

ABAP code - General question

Former Member
0 Likes
477

Hi Guys,

What is the difference between the following statements? In what scenarios should we use these?

a. CREATE DATA data_ref LIKE LINE OF xth_data.

ASSIGN data_ref->* TO <ls_data>.

b. LOOP AT xth_data ASSIGNING <ls_data>.

c. LOOP AT xth_data INTO <ls_data>.

Regards

3 REPLIES 3
Read only

0 Likes
448

Hello Maha,

Thanks for the documents. One of the document (Cyanard's BPS programming document) was informative to some extent.Still, nothing was mentioned about the differences between the 3 statements I mentioned about. Are there any How-To guides or links that can explain these concepts properly.

Thank You.

Read only

former_member189059
Active Contributor
0 Likes
448

a. You are creating a variable data_ref which is a workarea of the type xth_data

and assigning that structure type to the field symbol <ls_data>

b. the field Symbol <ls_data> does not need to be assigned to any datatype

It will get assigned to the structure of xth_data

c. It is assumed that your field-symbol <ls_data> has already been assigned to the xth_data type

this code simply loops into the table

note that if your field symbol is not assigned as yet, it will result in a GETWA_NOT_ASSIGNED short dump