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

header line in internal table

former_member220801
Participant
0 Likes
732

I have declared a 'table in table' structure. (is it called deep structure?)

TYPES: BEGIN of ty_test1

header TYPE ty_header,

detail TYPE ty_detail OCCURS 0,

END of ty_test1.

DATA: it_test TYPE STANDARD TABLE OF ty_test1 WITH HEADER LINE OCCURS 0.

Can I also have a header line declared for the structure 'detail' inside the internal table so that I can use related functions LIKE 'MOVE-CORRESPONDING', 'SELECT..INTO CORRESPONDING FIELDS...' and 'LOOP AT it_test-detail'?

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
699

Hi,

Yes you can Declare.

But I am not sure about this deep structure.

I have declared a 'table in table' structure. (is it called deep structure?)

TYPES: BEGIN of ty_test1

header TYPE ty_header,

detail TYPE ty_detail OCCURS 0,

END of ty_test1.

DATA: it_test TYPE STANDARD TABLE OF ty_test1 WITH HEADER LINE OCCURS 0.

Can I also have a header line declared for the structure 'detail' inside the internal table so that I can use related functions LIKE 'MOVE-CORRESPONDING', 'SELECT..INTO CORRESPONDING FIELDS...' and 'LOOP AT it_test-detail'?

Thanks!

5 REPLIES 5
Read only

Former Member
0 Likes
700

Hi,

Yes you can Declare.

But I am not sure about this deep structure.

Read only

0 Likes
699

I don't think it's possible to have a header line.

You have to declare a aux. structure.

But Phani may Know another way, for his reply.

Alexandre Nogueira.

Read only

0 Likes
699

I was getting some syntax problems with you code. I have adjusted.



types: begin of ty_test1,
           header type ty_header,
           detail type ty_detail occurs 0,
       end of ty_test1.

data: it_test type standard table of ty_test1 with header line.
data: wa_test type ty_test1.


Regards,

Rich Heilman

Read only

0 Likes
699

Ok, here is a little sample. Put it in debug and watch it work.



Types: ty_header(10) type c,
       ty_detail(10) type c.


types: begin of ty_test1,
           header type ty_header,
           detail type ty_detail occurs 0,
       end of ty_test1.

data: it_test type standard table of ty_test1 with header line.
data: wa_test type ty_test1.

data: it_detail type table of ty_detail.
data: wa_detail type ty_detail.


wa_detail = 'blahblahblah'.
append  wa_detail to it_detail.

wa_test-detail[] = it_detail[].
append wa_test to it_test.


Check sy-subrc  = 0.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
699

yes u can declare

data : wa_test like it_test.

Message was edited by: chandrasekhar jagarlamudi