‎2007 Feb 13 10:03 AM
Hallow I doing a program that use logic data base pnpce(my first time) and in the program I use get peras to bring the employee num and in the loop the name of employee
Something I doing wrong because its not working what?
<b>I just wont to bring to my table person_tab employee num and name.</b>
thankes
Tables :pernr
Nodes:persa
Infotypes:0000 like t_oooo,
00002 like t_0002.
START-OF-SELECTION.
GET peras.
LOOP AT t_0000.
MOVE t_0000-pernr TO person_tab-objid.
APPEND person_tab.
Endloop.
Loop at t0002.
MOVE t_0002-nachn TO person_tab-lastname.
MOVE t_0002-vorna TO person_tab-firstname.
APPEND person_tab.
ENDLOOP.
END-OF-SELECTION.
‎2007 Feb 13 10:28 AM
Tables :pernr
Nodes:persa
Infotypes:0000 like t_oooo,
00002 like t_0002.
START-OF-SELECTION.
GET peras.
LOOP AT t_0000.
MOVE t_0000-pernr TO person_tab-objid.
READ TABLE t_0002 WITH KEY penrr = t_0000-penrr.
IF sy-subrc = 0.
MOVE t_0002-nachn TO person_tab-lastname.
MOVE t_0002-vorna TO person_tab-firstname.
ENDIF.
APPEND person_tab.
Endloop.
END-OF-SELECTION.
‎2007 Feb 13 10:20 AM
Hi,
If you are using logical data base use the following type of code.
tables: pernr.
infotypes: 0000,
0001,
0002,
0006,
0021.
data: begin of itab occurs 0,
pernr type p0000-pernr,
stat2 type p0000-stat2,
bukrs type p0001-bukrs,
plans type p0001-plans,
stell type p0001-stell,
vorna type p0002-vorna,
nachn type p0002-nachn,
anzkd type p0002-anzkd,
name2 type p0006-name2,
stras type p0006-stras,
ort01 type p0006-ort01,
pstlz type p0006-pstlz,
name21 type p0006-name2,
stras1 type p0006-stras,
ort011 type p0006-ort01,
pstlz1 type p0006-pstlz,
favor type p0021-favor,
fanam type p0021-fanam,
fgbdt type p0021-fgbdt,
end of itab.
start-of-selection.
get pernr.
rp_provide_from_last p0006 '2' pn-begda pn-endda.
if pnp-sw-found = 1.
move p0006-name2 to itab-name2 .
move p0006-stras to itab-stras .
move p0006-ort01 to itab-ort01 .
move p0006-pstlz to itab-pstlz.
endif.
rp_provide_from_frst p0006 '1' pn-begda pn-endda.
if pnp-sw-found = 1.
move p0006-name2 to itab-name21 .
move p0006-stras to itab-stras1 .
move p0006-ort01 to itab-ort011 .
move p0006-pstlz to itab-pstlz1.
endif.
provide * from p0000
from p0001
from p0002
from p0021 between pn-begda and pn-endda
where p0000-stat2 = '2' or
p0000-stat2 = '3' and
p0021-subty = '2'.
move p0000-pernr to itab-pernr.
move p0000-stat2 to itab-stat2.
move p0001-bukrs to itab-bukrs.
move p0001-plans to itab-plans.
move p0001-stell to itab-stell.
move p0002-vorna to itab-vorna.
move p0002-nachn to itab-nachn.
move p0002-anzkd to itab-anzkd.
move p0006-name2 to itab-name2.
move p0006-stras to itab-stras.
move p0006-ort01 to itab-ort01.
move p0006-pstlz to itab-pstlz.
*
if p0002-anzkd > 0.
move p0021-favor to itab-favor.
move p0021-fanam to itab-fanam.
move p0021-fgbdt to itab-fgbdt.
endif.
append itab.
clear itab.
endprovide.
I think this will helpful for you.
regards,
‎2007 Feb 13 10:28 AM
Tables :pernr
Nodes:persa
Infotypes:0000 like t_oooo,
00002 like t_0002.
START-OF-SELECTION.
GET peras.
LOOP AT t_0000.
MOVE t_0000-pernr TO person_tab-objid.
READ TABLE t_0002 WITH KEY penrr = t_0000-penrr.
IF sy-subrc = 0.
MOVE t_0002-nachn TO person_tab-lastname.
MOVE t_0002-vorna TO person_tab-firstname.
ENDIF.
APPEND person_tab.
Endloop.
END-OF-SELECTION.
‎2007 Feb 13 10:29 AM
Hi!
In the second loop, you forget to position to the target record in your internal table, and use modify/update instead of append.
Loop at t0002.
READ TABLE person_tab WITH KEY pernr = t0002-pernr.
MOVE t_0002-nachn TO person_tab-lastname.
MOVE t_0002-vorna TO person_tab-firstname.
MODIFY person_tab.
ENDLOOP.