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

DeepStructure-table-table[] ?

Former Member
0 Likes
493

I have problem copying data from an internal table:

Please consider the

TYPE-POOL QPRE

data gets passed into a  a deep structure g_lsproben  from a program. The data that I want to work with is withhin this deep structure in an  internal standard table  PHYSPRTAB.

g_lsproben  has one of the components:  POSTAB  and this further has a component:  PHYSPRTAB.

g_lsproben is a structure:

POSTAB  is a standard table

PHYSPRTAB is a standard table

Now If I want to copy the contents of POSTAB into an internal table it works as follows:

data: int1 TYPE  TABLE OF QPRE_PRNVPOS.

int1 = g_lsproben-POSTAB[]   " This works perfectly I can see the data in the debugger

If I want to copy the data from the deeper standard table:

data int2 type table of qprs

int2 = G_LSPROBEN-POSTAB[]-PHYSPRTAB[]  " This does not work  it says that there is no component called POSTAB[]  in G_LSPROBEN

So I tried this :

int2 = G_LSPROBEN-POSTAB-PHYSPRTAB[]  " This says that the data object does not have the component called POSTAB-PHYSPRTAB !!

I also tries:

int2   =  int1-PHYSPRTAB[]   " This says int1 is an internal table without a headerline and therefore has no component  called PHYSPRTAB.

I thought I was referring to the records by adding the square brackets at the end.

I guess there is some error in my understanding of how the data components in a deepstructure or an internal table get refrenced.

Can you please assist me to understand where I am going wrong  and how can I can copy such data so that it can be passed on to a smart form ?     

Many Thanks and Kind Regards

SG

Inline image 1

Inline image 2

Inline image 3

Inline image 4

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
432

Hi boss,

It is simple and see it below.

TYPE-POOLS QPRE.


DATA: G_LSPROBEN TYPE QPRE_LOSPROBEN.                        " Declare the Base structure similar to QPRE_LOSPROBEN

DATA G_POSTAB TYPE QPRE_PRNVPOS.                                  " Declare the structure(Work area)  similar to QPRE_PRNVPOS

DATA G_PHYSPRTAB TYPE QPRS.                                           " Declare the structure (work area) similar to PHYSPRTAB ( which is indirectly QPRS)

LOOP AT G_LSPROBEN-POSTAB INTO G_POSTAB.                    " Loop the contents of POSTAB internal table into G_POSTAB structure

  LOOP AT G_POSTAB-PHYSPRTAB INTO G_PHYSPRTAB.      " In g_postab structure one field is PHYSPRTAB which is a internal table and loop that

                                                                                                " Internal table using work area g_physprtab (similar to QPRS structure).    

  " Write your required content here.

ENDLOOP.

ENDLOOP.

Regrads,

Praveen Chitturi

Message was edited by: chitturi praveen

1 REPLY 1
Read only

Former Member
0 Likes
433

Hi boss,

It is simple and see it below.

TYPE-POOLS QPRE.


DATA: G_LSPROBEN TYPE QPRE_LOSPROBEN.                        " Declare the Base structure similar to QPRE_LOSPROBEN

DATA G_POSTAB TYPE QPRE_PRNVPOS.                                  " Declare the structure(Work area)  similar to QPRE_PRNVPOS

DATA G_PHYSPRTAB TYPE QPRS.                                           " Declare the structure (work area) similar to PHYSPRTAB ( which is indirectly QPRS)

LOOP AT G_LSPROBEN-POSTAB INTO G_POSTAB.                    " Loop the contents of POSTAB internal table into G_POSTAB structure

  LOOP AT G_POSTAB-PHYSPRTAB INTO G_PHYSPRTAB.      " In g_postab structure one field is PHYSPRTAB which is a internal table and loop that

                                                                                                " Internal table using work area g_physprtab (similar to QPRS structure).    

  " Write your required content here.

ENDLOOP.

ENDLOOP.

Regrads,

Praveen Chitturi

Message was edited by: chitturi praveen