‎2009 Dec 18 6:49 AM
Hi All,
I want to create Internal table in inside another internal table in my program. so is it possible??
I have craete like below but its giving error to me....
DATA: BEGIN OF wt_tab1 occurs 0,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
BEGIN OF wt_tab2 occurs 0,
eadet like ekpo-eadet,
END OF wt_tab2,
END OF wt_tab1.
If anyone have idea so please let me know.....
Thanks
Jigar Bhatt
‎2009 Dec 18 6:57 AM
HI Jigar,
Initially create a structure, and later include this structure while creating your table. This will work. Refer some standard program, where nested tables are used a lot. Eg: If i rember correctly, ALV using OOPs uses nested table for making cells editable.
‎2009 Dec 18 7:05 AM
Hi Saravanan,
Thanks for reply...
Could you give me some standard program name? so its useful for me....
Thanks
Jigar
‎2009 Dec 18 6:58 AM
Hi,
Refer following code
types: BEGIN OF ty_s_clear_doc,
bukrs TYPE bukrs, "Company Code
header TYPE bapiache09, "Header data
account TYPE bapiacgl09_tab, "Account Data
curramount TYPE bapiaccr09_tab, "Currency Amount
END OF ty_s_clear_doc,
data : it_clear_doc type standard table of ty_s_clear_doc.
Regards,
Prashant
‎2009 Dec 18 7:04 AM
Hi,
Try below code:
Types: BEGIN OF wt_tab2,
eadat like ekpo-aedat,
END OF wt_tab2.
DATA: BEGIN OF wt_tab1 occurs 0,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp.
data: it_tab2 type table of wt_tab2,
END OF wt_tab1.
Cheers,
Surinder
‎2009 Dec 18 7:14 AM
Hi Jigar,
Try this :
DATA: BEGIN OF struct1,
field1 TYPE c,
field2 TYPE c,
END OF struct1.
DATA: BEGIN OF struct2,
field3 TYPE c,
field4 TYPE c.
INCLUDE STRUCTURE struct1. " The structure is included here
DATA END OF struct2.
‎2009 Dec 18 7:18 AM
Hi Vasuki,
Can you please elaborate how your code would create a internal table inside an internal table as per what i know it wud create a structure inside the table.
Cheers,
Surinder
‎2009 Dec 18 7:34 AM
Hi Jigar,
Yes you are right. To have nested internal tabel try this :
TYPES: BEGIN OF struct3,
field1 TYPE c,
field2 TYPE c,
END OF struct3.
DATA it_itab1 TYPE table of struct3.
TYPES: BEGIN OF struct4,
field3 TYPE c,
field4 TYPE c,
it_tab1 like it_itab1,
END OF struct4.
DATA : it_tab2 TYPE table of struct4. "This is the nested Internal table
‎2009 Dec 18 7:47 AM
Hi Vasuki,
this one is not working.....
i want internal table inside internal table.... not a structure....
Thanks
Jigar
‎2009 Dec 18 8:05 AM
Hi Jigar,
It is a nested internal table.
In this case it_tab2 is an internal table which holds another internal table it_tab1 .Please try debugging and see. You can notice that in debugging.
‎2009 Dec 18 8:24 AM
Hi,
I hope your talking about the deep structure con..
use the below link ..
http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb2fcc358411d1829f0000e829fbfe/content.htm.
~linganna
‎2009 Dec 18 8:27 AM
‎2009 Dec 18 9:32 AM
Refer this link for an example on nested internal table :
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9eaa35c111d1829f0000e829fbfe/content.htm
You'll find the example code under the section "Formatting Data Using Nested Internal Tables"
‎2009 Dec 18 10:05 AM
Please check the below declaration.
Types : Begin of g_makt,
spras type spras,
maktx type maktx,
End of g_makt.
Types : g_makt_t Type standard table of g_makt.
Data : Begin of g_matnr,
matnr type matnr,
ersda type ersda,
lt_makt type g_makt_t,
End of g_matnr.
Data : gt_mtnr Like table of g_matnr Initial Size 0.
Here gt_mtnr is an internal table with another internal table lt_makt inside it.
Thanks,
Nitin Sethi
‎2009 Dec 23 10:25 AM