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

Data Declaration prob

Former Member
0 Likes
826

Hello,

Could you please help me.. I am not able to clear this error.

DATA: BEGIN OF GT_HDR OCCURS 0,

OBJECTCLAS LIKE CDOBJECTCL,

OBJECTID LIKE CDOBJECTV,

USERNAME LIKE CDUSERNAME,

UDATE LIKE CDDATUM,

END OF GT_HDR.

Error : "CDOBJECTCL" must be a flat structure. You cannot use internal tables, strings, references, or structures as components. -

Regards

Reddy.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
793

Try:

DATA: BEGIN OF gt_hdr OCCURS 0,
  objectclas TYPE cdobjectcl,
  objectid   TYPE cdobjectv,
  username   TYPE cdusername,
  udate      TYPE cddatum,
END OF gt_hdr.

Rob

6 REPLIES 6
Read only

Former Member
0 Likes
794

Try:

DATA: BEGIN OF gt_hdr OCCURS 0,
  objectclas TYPE cdobjectcl,
  objectid   TYPE cdobjectv,
  username   TYPE cdusername,
  udate      TYPE cddatum,
END OF gt_hdr.

Rob

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
793

Please change your LIKE to TYPE.



data: begin of gt_hdr occurs 0,
      objectclas  type cdobjectcl,
      objectid type cdobjectv,
      username type cdusername,
      udate type  cddatum,
      end of gt_hdr.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
793

Change it to type instead of like

Read only

ferry_lianto
Active Contributor
0 Likes
793

Hi,

Please try like this.


DATA: BEGIN OF GT_HDR OCCURS 0,
  OBJECTCLAS TYPE CDOBJECTCL,
  OBJECTID   TYPE CDOBJECTV,
  USERNAME   TYPE CDUSERNAME,
  UDATE      TYPE CDDATUM,
END OF GT_HDR.

OR


DATA: BEGIN OF GT_HDR OCCURS 0,
  OBJECTCLAS LIKE BDCP-CDOBJECTCL,
  OBJECTID   LIKE BDCP-CDOBJID,
  USERNAME   LIKE BDCP-USRNAME,
  UDATE      LIKE SY-DATUM,
END OF GT_HDR.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
793

in this case,Is there any difference between TYPE and LIKE

Read only

0 Likes
793

Hi,

When you use data element to declare your data then you have to declare with TYPE and when you declare varriable with reference to structure or internal table then you can use LIKE adition.

Regards

Gagan