Application Development 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: 

Reading and appending data to deep structure

Former Member
0 Kudos
4,239

Hi All,

I want to carry out 3 steps

1) Move the data from deep structure into an internal table

2) Clear the deep structure

3) Fill the deep structure with different data.

Please find below the code written for that. When I try to activate this code, I get an error message

**The data object "PS_RJH08_VT_PLAZ" does not have a component called **

*"UPOS_EIN-EIN". *

Let me know how to resolve this issue.

DATA : gt_tab TYPE STANDARD TABLE OF RJH08_VT_PLAZ_EIN_STR,
           gw_tab type RJH08_VT_PLAZ_EIN_STR.

gt_tab[] = PS_RJH08_VT_PLAZ-UPOS_EIN-EIN[].

CLEAR : PS_RJH08_VT_PLAZ.
REFRESH : PS_RJH08_VT_PLAZ.

LOOP AT gt_tab into gw_tab.

  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-UR_BELEINH  = gw_tab-UR_BELEINH.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-PLAZ_BE     = gw_tab-BELEGEINH.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-JVTBEPMART  = gw_tab-JVTBEPMART.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-VRTMENGE_V  = gw_tab-VRTMENGE_V.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-VRTMENGE    = gw_tab-VRTMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-BERMENGE    = gw_tab-BERMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-BLGMENGE    = gw_tab-BLGMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-XTBEL_VT    = g_SELECTIVE_BOOKING.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-XVT_PLAZ    = 'X'.
  MOVE gw_tab to PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.

  APPEND PS_RJH08_VT_PLAZ.
ENDLOOP.

9 REPLIES 9

Former Member
0 Kudos
936

Hi,

try the code given below....

DATA : gt_tab TYPE STANDARD TABLE OF RJH08_VT_PLAZ_EIN_STR,
           gw_tab type RJH08_VT_PLAZ_EIN_STR.

 DATA : fs_ein like line of PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.

gt_tab[] = PS_RJH08_VT_PLAZ-UPOS_EIN-EIN[].
 
CLEAR : PS_RJH08_VT_PLAZ.
REFRESH : PS_RJH08_VT_PLAZ.
 
LOOP AT gt_tab into gw_tab.
  clear : fs_ein.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-UR_BELEINH  = gw_tab-UR_BELEINH.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-PLAZ_BE     = gw_tab-BELEGEINH.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-JVTBEPMART  = gw_tab-JVTBEPMART.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-VRTMENGE_V  = gw_tab-VRTMENGE_V.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-VRTMENGE    = gw_tab-VRTMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-BERMENGE    = gw_tab-BERMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-BLGMENGE    = gw_tab-BLGMENGE.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-XTBEL_VT    = g_SELECTIVE_BOOKING.
  PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS-XVT_PLAZ    = 'X'.
  MOVE gw_tab to fs_ein.          "PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.
  append fs_ein to PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.
  APPEND PS_RJH08_VT_PLAZ.
refresh VT_PLAZ-UPOS_EIN-EIN.
clear PS_RJH08_VT_PLAZ.

ENDLOOP.

if you are still facing the problem please paste the structure of the PS_RJH08_VT_PLAZ

Regards,

Siddarth

former_member156446
Active Contributor
0 Kudos
936

Check this [search results|https://forums.sdn.sap.com/search.jspa?q=deep%20structures&dateRange=last90days&searchID=23203757&rankBy=10001&start=0]

and try to search before you post... thanks.

0 Kudos
936

How to populate the deep structure with values.

I have a structure as below

1. RJH08_VT_PLAZ_STR

This structure has got the fields as follow

POS TYPE RJH08_VT_PLAZ_POS_STR ( Structure )

UPOS_EIN TYPE RJH08_VT_PLAZ_UPOS_EIN_TAB ( Table Type )

UPOS_EIN has got the structure as

UPOS TYPE RJH08_VT_PLAZ_UPOS_STR ( Structure )

EIN TYPE RJH08_VT_PLAZ_EIN_TAB ( Table Type )

EIN has got the structure as line type with 10 fields.

I have to populate the field UPOS_EIN of the structure RJH08_VT_PLAZ_STR.

I have the data for UPOS and EIN of structure UPOS_EIN in two different work areas.

0 Kudos
936

I am not finding any std structure as you provided in ECC5.0

to read data from deep strcutres struc1-struc2-field1 where struc1 is the main strcuture and struc2 is the deep structure which has a field1 as field..

0 Kudos
936

Thanks for the response, This structure is of SAP IS-media Solution in ECC 6.0.

Please find the code below with comments :

DATA : gt_tab1 TYPE STANDARD TABLE OF RJH08_VT_PLAZ_EIN_STR,
       gw_tab1 type RJH08_VT_PLAZ_EIN_STR,
       gt_tab TYPE STANDARD TABLE OF RJH08_VT_PLAZ_UPOS_EIN_STR,
       gw_tab type RJH08_VT_PLAZ_UPOS_EIN_STR.

DATA : fs_ein type RJH08_VT_PLAZ_EIN_STR.

DATA : BOOKING_UNIT_MZ    type CHAR10_T,
       BOOKING_UNIT       type UR_BELEINH,
       SELECTIVE_BOOKING  type XTBEL_VT,
       gw_bu_bapi         TYPE CHAR10,
       g_index            TYPE SY-TABIX.

DATA : gs_pos type RJH08_VT_PLAZ_UPOS_STR.

CLEAR : gt_tab, gs_pos.
REFRESH : gt_tab.

IMPORT BOOKING_UNIT_MZ FROM MEMORY ID 'BU_MZ'.
IMPORT BOOKING_UNIT FROM MEMORY ID 'IBU'.
IMPORT SELECTIVE_BOOKING FROM MEMORY ID 'MZ_FLAG'.

FREE MEMORY ID : 'BU_MZ', 'IBU', 'MZ_FLAG'.

MOVE PS_RJH08_VT_PLAZ-UPOS_EIN to gt_tab.

LOOP AT gt_tab INTO gw_tab.

  LOOP AT gw_tab-ein INTO gw_tab1 .
    APPEND gw_tab1 to gt_tab1.
  ENDLOOP.

ENDLOOP.

LOOP AT gt_tab1 INTO gw_tab1.
  g_index = SY-TABIX.

  READ TABLE BOOKING_UNIT_MZ INTO gw_bu_bapi WITH KEY TABLE_LINE = gw_tab1-BELEGEINH.
  IF sy-subrc ne 0.
    DELETE gt_tab1 INDEX g_index.
  ENDIF.
  clear : gw_bu_bapi, gw_tab1, g_index.
ENDLOOP.


CLEAR : PS_RJH08_VT_PLAZ.

LOOP AT gt_tab1 into gw_tab1.
gs_pos-UR_BELEINH  = gw_tab1-UR_BELEINH.
gs_pos-PLAZ_BE     = gw_tab1-BELEGEINH.
gs_pos-JVTBEPMART  = gw_tab1-JVTBEPMART.
gs_pos-VRTMENGE_V  = gw_tab1-VRTMENGE_V.
gs_pos-VRTMENGE    = gw_tab1-VRTMENGE.
gs_pos-BERMENGE    = gw_tab1-BERMENGE.
gs_pos-BLGMENGE    = gw_tab1-BLGMENGE.
gs_pos-XTBEL_VT    = SELECTIVE_BOOKING.
gs_pos-XVT_PLAZ    = 'X'.

CLEAR : gt_tab, gw_tab.
REFRESH : gt_tab.

MOVE-CORRESPONDING gs_pos to gw_tab-UPOS. "Till this line everything is fine
MOVE-CORRESPONDING gw_tab1 to gw_tab-EIN. "I get error for this line saying ""EIN" is not a structure or internal table with header line.		"

APPEND gw_tab to PS_RJH08_VT_PLAZ.
ENDLOOP.

I want to pass the data finally to PS_RJH08_VT_PLAZ which has the 2 structures POS and UPOS_EIN as described in my previous reply.

Please Suggest.

Thanks,

Chandravadan

0 Kudos
936

Since EIN is type TABLE, you just have to Append your records from GW_TAB1 to GW_TAB-EIN.

LIke:


LOOP AT gt_tab1 into gw_tab1.
gs_pos-UR_BELEINH  = gw_tab1-UR_BELEINH.
gs_pos-PLAZ_BE     = gw_tab1-BELEGEINH.
gs_pos-JVTBEPMART  = gw_tab1-JVTBEPMART.
gs_pos-VRTMENGE_V  = gw_tab1-VRTMENGE_V.
gs_pos-VRTMENGE    = gw_tab1-VRTMENGE.
gs_pos-BERMENGE    = gw_tab1-BERMENGE.
gs_pos-BLGMENGE    = gw_tab1-BLGMENGE.
gs_pos-XTBEL_VT    = SELECTIVE_BOOKING.
gs_pos-XVT_PLAZ    = 'X'.
 
CLEAR : gt_tab, gw_tab.
REFRESH : gt_tab.
 
MOVE-CORRESPONDING gs_pos to gw_tab-UPOS. "Till this line everything is fine
gw_tab-EIN = gw_tab1 .  " << 
APPEND gw_tab to PS_RJH08_VT_PLAZ.
ENDLOOP.

Regards,

Naimesh Patel

0 Kudos
936

Hi,

As I have informed you earlier with the code....

instead of the line

MOVE-CORRESPONDING gw_tab1 to gw_tab-EIN.

use the code below...

data : fs like line of gw_tab-EIN.

MOVE-CORRESPONDING gw_tab1 to fs.
append fs to gw_tab-EIN.

APPEND gw_tab to PS_RJH08_VT_PLAZ.

clear gw_tab-EIN.
clear fs.
clear gw_tab

Regards,

Siddarth

0 Kudos
936

Naimesh,

Thanks for the reply.

LOOP AT gt_tab1 into gw_tab1.
gs_pos-UR_BELEINH  = gw_tab1-UR_BELEINH.
gs_pos-PLAZ_BE     = gw_tab1-BELEGEINH.
gs_pos-JVTBEPMART  = gw_tab1-JVTBEPMART.
gs_pos-VRTMENGE_V  = gw_tab1-VRTMENGE_V.
gs_pos-VRTMENGE    = gw_tab1-VRTMENGE.
gs_pos-BERMENGE    = gw_tab1-BERMENGE.
gs_pos-BLGMENGE    = gw_tab1-BLGMENGE.
gs_pos-XTBEL_VT    = SELECTIVE_BOOKING.
gs_pos-XVT_PLAZ    = 'X'.

CLEAR : gt_tab, gw_tab.
REFRESH : gt_tab.

MOVE-CORRESPONDING gs_pos to gw_tab-UPOS.
gw_tab-EIN = gt_tab1. << This is working now.

APPEND gw_tab to PS_RJH08_VT_PLAZ. " for this line I get error saying ""PS_RJH08_VT_PLAZ" is not
                                                     an internal table - the "OCCURS n" specification is missing
		
if I change  the code as below then I get the error saying "The data object "PS_RJH08_VT_PLAZ" does not have a component called "UPOS_EIN-UPOS"."		

APPEND gw_tab-UPOS to PS_RJH08_VT_PLAZ-UPOS_EIN-UPOS.
APPEND gw_tab-EIN to PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.

Please let me know how can I fill the structure PS_RJH08_VT_PLAZ using gw_tab-UPOS and gw_tab-EIN

Thanks,

Chandravadan

Former Member
0 Kudos
936

Hi,

Change this line from

APPEND gw_tab-EIN to PS_RJH08_VT_PLAZ-UPOS_EIN-EIN.

to

APPEND gw_tab-EIN to PS_RJH08_VT_PLAZ-EIN.

and remove the line...

APPEND gw_tab to PS_RJH08_VT_PLAZ.

Regards,

Siddarth