Hello Experts,
I’m trying to write a complex SELECT statement to gather data from PA0000, PA0001, PA0002, PA0006 and PA0041 table but keep getting short dump. Can somebody please help me rectify this issue? For reference here is my code.
Types: begin of t_pa,
pernr01 type persno,
orgeh type orgeh,
plans type plans,
kostl type kostl,
pernr00 type persno,
stat2 type stat2,
massn type massn,
massg type massg,
pernr02 type persno,
sprsl type pad_spras,
nachn type pad_nachn,
vorna type pad_vorna,
pernr06 type persno,
subty type subty,
telty type comky, "MAIN
telnr type telnr,
com01 type comky,
num01 type comnr,
com02 type comky,
num02 type comnr,
com03 type comky,
num03 type comnr,
com04 type comky,
num04 type comnr,
pernr41 type persno,
dat01 type dardt,
dat02 type dardt,
zzrank type zrank,
end of t_pa.
Data: gt_pa type table of t_pa initial size 0.
select pa0001~pernr
pa0001~orgeh
pa0001~plans
pa0001~kostl
pa0000~pernr
pa0000~stat2
pa0000~massn
pa0000~massg
pa0002~pernr
pa0002~sprsl
pa0002~nachn
pa0002~vorna
pa0006~pernr
pa0006~subty
"pa0006~telty "MAIN
pa0006~telnr
pa0006~com01
pa0006~num01
pa0006~com02
pa0006~num02
pa0006~com03
pa0006~num03
pa0006~com04
pa0006~num04
pa0041~pernr
pa0041~dat01
pa0041~dat02
pa0041~zzrank
from ( ( ( ( pa0001 inner join pa0000
on pa0001~pernr = pa0000~pernr )
inner join pa0002
on pa0001~pernr = pa0002~pernr )
inner join pa0006
on pa0001~pernr = pa0006~pernr )
inner join pa0041
on pa0001~pernr = pa0041~pernr )
into table gt_pa
where pa0001~bukrs = c_bukrs
and pa0001~pernr in s_pern.
if gt_pa[] is initial.
message e003.
exit.
else.
sort gt_pa by pernr01 stat2.
delete gt_pa where stat2 ne '1'
and stat2 ne '3'.
endif.
Many thanks in advance.