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

Deep structure

Former Member
0 Likes
851

Dear all,

I'm trying to populate a deep structure from an internal table without success.]

I've got 2 internal table : is_hd_gen type table of gs_hd_gen

is_it_gen type table of gs_it_gen

Now I've got a deep structure "deep" created from se11 with two components "hd" and "it" which are both tables of line gs_hd_gen and gs_it_gen.

When I try a move-corresponding is_hd_gen to deep-hd it says that is_hd_gen has no header line.

No idea?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
748

Hi

see the sample and do accordingly

structures containing internal tables as components or

Internal table containing Structure as components are called Deep Internal table.

Please check this link for reading a deep structure.

Example:

TYPES: BEGIN OF TYPE_DEEP,

MATNR TYPE MATNR,

T_MARC TYPE MARC OCCURS 0,

END OF TYPE_DEEP.

DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.

DATA: WA_DEEP TYPE TYPE_DEEP.

DATA: T_MARC TYPE TABLE OF MARC.

DATA: S_MARC TYPE MARC.

  • Populating data.

WA_DEEP-MATNR = 'TEST'.

S_MARC-MATNR = 'TEST'.

S_MARC-WERKS = '9090'.

APPEND S_MARC TO T_MARC.

  • Append second level internal table.

WA_DEEP-T_MARC[] = T_MARC[].

  • Append.

APPEND WA_DEEP TO T_DEEP.

  • Process the internal table.

LOOP AT T_DEEP INTO WA_DEEP.

WRITE: / WA_DEEP-MATNR.

  • PROCESS the second level internal table.

LOOP AT WA_DEEP-T_MARC INTO S_MARC.

WRITE: S_MARC-WERKS.

ENDLOOP.

ENDLOOP.

Regards

Anji

5 REPLIES 5
Read only

Former Member
0 Likes
749

Hi

see the sample and do accordingly

structures containing internal tables as components or

Internal table containing Structure as components are called Deep Internal table.

Please check this link for reading a deep structure.

Example:

TYPES: BEGIN OF TYPE_DEEP,

MATNR TYPE MATNR,

T_MARC TYPE MARC OCCURS 0,

END OF TYPE_DEEP.

DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.

DATA: WA_DEEP TYPE TYPE_DEEP.

DATA: T_MARC TYPE TABLE OF MARC.

DATA: S_MARC TYPE MARC.

  • Populating data.

WA_DEEP-MATNR = 'TEST'.

S_MARC-MATNR = 'TEST'.

S_MARC-WERKS = '9090'.

APPEND S_MARC TO T_MARC.

  • Append second level internal table.

WA_DEEP-T_MARC[] = T_MARC[].

  • Append.

APPEND WA_DEEP TO T_DEEP.

  • Process the internal table.

LOOP AT T_DEEP INTO WA_DEEP.

WRITE: / WA_DEEP-MATNR.

  • PROCESS the second level internal table.

LOOP AT WA_DEEP-T_MARC INTO S_MARC.

WRITE: S_MARC-WERKS.

ENDLOOP.

ENDLOOP.

Regards

Anji

Read only

Former Member
0 Likes
748

Hi Cany,

Declare your Internal table like,

<b>data : is_hd_gen like table of gs_hd_gen with header line.

or

data : is_hd_gen type table of gs_hd_gen occors0.</b>

Thanks,

Reward If Helpful.

Read only

abdulazeez12
Active Contributor
0 Likes
748

Obviously, is_hd_gen is a table type and has no header line..infact gs_hd_gen is a line type. So, do the following..u will not get errors:

get the record in gs_hd_gen

and move it to internal table..

move-corresponding gs_hd_gen to deep-hd

Cheers

Shakir

Read only

Former Member
0 Likes
748

Hi,

when you declare it in the top you can

use is_hd_gen with header line

regards

Gururaj

Read only

former_member404244
Active Contributor
0 Likes
748

Hi,

check the below code sample..

  • Type declaration for BCset records

TYPES: BEGIN OF t_scprrecord,

tabname LIKE scprdata-tablename, "Table name

tabtype LIKE objh-objecttype, "Table type

tabtext LIKE dd02t-ddtext, "Table text

tablen TYPE i, "Table length

keylen TYPE i, "Key length

objname LIKE objh-objectname, "Object name

objtype LIKE objh-objecttype, "Object type

activity LIKE scprreca-activity, "Activity

rawrec LENGTH scpr_maxdatalen, "Length

importable, "Importable

status(1), "Status

descr_reduced(1), "Desc reduced

descr TYPE scpr_flddescr OCCURS 10, "Table for fielddesc

sellist LIKE vimsellist OCCURS 10, "Table for sellist

header LIKE vimdesc OCCURS 10, "Table for header

namtab LIKE vimnamtab OCCURS 10, "Table for namtab

END OF t_scprrecord.

  • Internal table for IMG activity

data : i_activities TYPE scpr_activities .

  • Declaration of field symbols

FIELD-SYMBOLS : <lfs_descr> TYPE scpr_descr,

<lfs_flddescrs> TYPE t_scprrecord.

LOOP AT i_flddescrs ASSIGNING <lfs_flddescrs>.

WRITE :/2 text-010.

WRITE 😕 sy-uline(100).

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE : /1 sy-vline, text-011,

31 sy-vline,text-012,

61 sy-vline,text-013,

100 sy-vline.

WRITE : sy-uline(100).

FORMAT COLOR OFF INTENSIFIED OFF.

LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_descr>.

WRITE :/1 sy-vline,2 <lfs_descr>-fieldname,

31 sy-vline,32 <lfs_descr>-fieldtext,

61 sy-vline,62 <lfs_descr>-reptext,

100 sy-vline.

WRITE : sy-uline(100).

CLEAR <lfs_descr>.

ENDLOOP. " LOOP AT i_flddescrs ASSIGNING <lfs_descr>.

CLEAR <lfs_flddescrs>.

ENDLOOP. "LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_flddescrs>.

reward if helpful.

Regards,

nagaraj