2009 Mar 05 8:53 AM
Hi,
can you please demonstrate through a code sniplet the follwing topics .
structures containing internal tables as components (deep structures)
Internal tables whose line type contains further internal tables.
Thx in advance
Regards
sas
2009 Mar 05 10:06 AM
Hi,
Check the code
TYPES : BEGIN OF t_gr,
wrbtr TYPE ekbe-wrbtr,
menge TYPE ekbe-menge,
bwart TYPE ekbe-bwart,
END OF t_gr.
DATA : i_gr TYPE TABLE OF t_gr.
*
TYPES : BEGIN OF t_ekbe,
ebeln TYPE ekbe-ebeln,
ebelp TYPE ekbe-ebelp,
*llggr LIKE i_gr,*
END OF t_ekbe.
DATA : i_ekbe TYPE TABLE OF t_ekbe.
SELECT ebeln
ebelp
wrbtr
FROM ekbe
INTO TABLE i_ekbe1
FOR ALL ENTRIES IN i_data1
WHERE ebeln = i_data1-ebeln AND
ebelp = i_data1-ebelp AND
bewtp = c_e AND
( bwart = c_101 OR
bwart = c_102 OR
bwart = c_103 OR
bwart = c_104 ).
loop at i_ekbe1 into wa_ekbe1.
wa_ekbe = wa_ekbe1.
wa_gr-wrbtr = wa_ekbe-wrbtr
append wa_gr to i_gr.
on change of wa_ekbe1-ebeln.
*INSERT LINES OF i_gr INTO wa_ekbe-llggr INDEX 1.*
*APPEND wa_ekbe TO i_ekbe.*
endon.
edloop.the above code the ekbe table is having one move itab l_gr
l_gr is updated in each loop and and each change the i_ekbe is updated with one set of l_gr data as internal table line for i_ekbe.
regards,
Nandha
2009 Mar 05 10:05 AM
Hello
Below you find a simple example:
TYPES: BEGIN OF ty_s_struct.
TYPES: bukrs TYPE bukrs.
TYPES: customers TYPE STANDARD TABLE OF knb1.
TYPES: END OF ty_s_struct.
TYPES: ty_t_itab TYPE STANDARDA TABLE OF ty_s_struct
WITH DEFAULT KEY.
DATA:
lt_itab TYPE ty_s_itab,
ls_struct TYPE ty_s_struct,
ls_knb1 TYPE knb1.
CLEAR: ls_struct.
ls_struct-bukrs = '1000'.
SELECT * FROM knb1 INTO TABLE ls_struct-customers
WHERE bukrs = ls_struct-bukrs.
APPEND ls_struct TO lt_itab.
Regards
Uwe
2009 Mar 05 10:06 AM
Hi,
Check the code
TYPES : BEGIN OF t_gr,
wrbtr TYPE ekbe-wrbtr,
menge TYPE ekbe-menge,
bwart TYPE ekbe-bwart,
END OF t_gr.
DATA : i_gr TYPE TABLE OF t_gr.
*
TYPES : BEGIN OF t_ekbe,
ebeln TYPE ekbe-ebeln,
ebelp TYPE ekbe-ebelp,
*llggr LIKE i_gr,*
END OF t_ekbe.
DATA : i_ekbe TYPE TABLE OF t_ekbe.
SELECT ebeln
ebelp
wrbtr
FROM ekbe
INTO TABLE i_ekbe1
FOR ALL ENTRIES IN i_data1
WHERE ebeln = i_data1-ebeln AND
ebelp = i_data1-ebelp AND
bewtp = c_e AND
( bwart = c_101 OR
bwart = c_102 OR
bwart = c_103 OR
bwart = c_104 ).
loop at i_ekbe1 into wa_ekbe1.
wa_ekbe = wa_ekbe1.
wa_gr-wrbtr = wa_ekbe-wrbtr
append wa_gr to i_gr.
on change of wa_ekbe1-ebeln.
*INSERT LINES OF i_gr INTO wa_ekbe-llggr INDEX 1.*
*APPEND wa_ekbe TO i_ekbe.*
endon.
edloop.the above code the ekbe table is having one move itab l_gr
l_gr is updated in each loop and and each change the i_ekbe is updated with one set of l_gr data as internal table line for i_ekbe.
regards,
Nandha