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

LIKE usage

Former Member
0 Likes
537

Code#1

DATA: ITAB LIKE SPFLI.

With that code#1, we copy the table structure of spfli table (correct me if I am wrong or missing something with my statement).

Code#2

DATA: BEGIN ITAB,
               C1 LIKE SPFLI-CARRID, 
      END OF ITAB.

With this code#2, does the C1 just copies the structure of the CARRID field of table SPFLI? That is my question.

pls help. thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
505

Greetings..

yes you are right, If you defined in a table with single field, C1 will have all attributes of field CARRID..

While in Code#1 it will have all fields for SPFLI. This can be used as work area.

hope this makes things clear..

thanks!!

ags..

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
505

Yes

Cheers,

Rich Heilman

Read only

Former Member
0 Likes
506

Greetings..

yes you are right, If you defined in a table with single field, C1 will have all attributes of field CARRID..

While in Code#1 it will have all fields for SPFLI. This can be used as work area.

hope this makes things clear..

thanks!!

ags..

Read only

naimesh_patel
Active Contributor
0 Likes
505

DATA: ITAB LIKE SPFLI.

This will only create a workarea in your program which has the same strucutre of the SPFLI.

So, you can populate the values by using its fields.

Like:


ITAB-CARRID = '1'.


DATA: BEGIN ITAB,
               C1 LIKE SPFLI-CARRID, 
      END OF ITAB.

This will create a structure with only field C1 and that C1 has the same definition as the SPFLI-CARRID.

You can use ITAB-C1 to populat the contents.


ITAB-C1 = '1'.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
505

thanks people. i gave points.