2012 Jan 10 8:14 PM
Hi Sap gurus,
Am in a bit of a fix right now..............
I have got an internal table in the format - Doknr and a nested table.....such that for every doknr multiple records may exist in the nested table.............
it is if the format:::: begin of ty_nested, doknr type doknr, include structure zstruct, types: end of ty_nested.
now i want to append data into this particular table so that whenever a particuar doknr comes up all the corresponding data fro the doknr should go into the nested table
it should be of the format........ doknr->nestedtable. '/' denotes the multiple records that exist in the nested table
10 2/3/4
20 1/3
30 3/4/5
any help will be appreciated......
2012 Jan 10 8:21 PM
> it is if the format:::: begin of ty_nested, doknr type doknr, include structure zstruct, types: end of ty_nested.
if this a nested table? including a structure just adds the fields from the structure. right? so along with docnr you have other fields from zstruct. its not making it a nested table
2012 Jan 10 8:21 PM
> it is if the format:::: begin of ty_nested, doknr type doknr, include structure zstruct, types: end of ty_nested.
if this a nested table? including a structure just adds the fields from the structure. right? so along with docnr you have other fields from zstruct. its not making it a nested table
2012 Jan 10 8:41 PM
sorry i forgot to add that the zstuct is actually a dictionary table type................so in other words it is a nested internal table
2012 Jan 10 8:56 PM
have you done CTRL+F2 on your program, isnt it showing error?
your syntax should be
include type <a table type name>
not include structure <a table type name>
ok lets check your query now
2012 Jan 10 9:12 PM
try this code. i have kept it simple... try to understand. execute this. its will trigger a break point. then check the content of TB
types: begin OF testy,
system type BAPILOGSYS,
include type BAPIRET2_T."ZVBAk.
types: end of testy.
DATA: ts type testy,
tb type TABLE OF testy,
wa type BAPIRET2,
wt type BAPIRET2_t,
wt2 type BAPIRET2_t,
pt type TABLE OF bapilogsys,
ps like LINE OF pt.
*lets have to systems
append '1ST_SYSTEM' to pt.
append '2ND_SYSTEM' to pt.
*-- lets have data for bapiret2_t table with 2 systems
wa-MESSAGE = '1st one, for 1st system'.
wa-system = '1ST_SYSTEM'.
APPEND wa to wt.
wa-MESSAGE = '2nt one, for 1st system'.
wa-system = '1ST_SYSTEM'.
APPEND wa to wt.
wa-MESSAGE = '3rd one, for 2nd system'.
wa-system = '2ND_SYSTEM'.
APPEND wa to wt.
wa-MESSAGE = '4th one, for 2nd system'.
wa-system = '2ND_SYSTEM'.
APPEND wa to wt.
*-- now pass final table
LOOP AT pt into ps.
ts-system = ps.
wt2 = wt."temp table
DELETE wt2 where system NE ts-system. " so you have only only 1 systems data
ts-include = wt2.
append ts to tb.
ENDLOOP.
BREAK-POINT.
2012 Jan 10 9:17 PM
by the way this include in the type declaration has nothing to do with key word INCLUDE. you can write ABC here .. that also will work
types: begin OF testy,
system type BAPILOGSYS,
include type BAPIRET2_T."-- you can write abc type bapiret2_t
types: end of testy.