SAP HR模块复制PA30的人员

来源:互联网 发布:淘宝猪哼少是正品吗 编辑:程序博客网 时间:2024/04/29 09:55

很多顾问测试HR的程序时都为录入人员头痛,下面的程序提供了快速复制人员的方法。
代码如下:
*&---------------------------------------------------------------------*
*& Report ZPPA_CLONE_PERNR
*&
*&---------------------------------------------------------------------*
*& CLONE
*& *
*&---------------------------------------------------------------------*
report zppa_clone_pernr line-size 255.
*
*----------------------------------------------------------------------*
* T A B L E S
*----------------------------------------------------------------------*
tables: pa0000.
*----------------------------------------------------------------------*
* C O N S T A N T S
*----------------------------------------------------------------------*
*constants: .

**----------------------------------------------------------------------*
** D A T A
**----------------------------------------------------------------------*
data: i_dd02l like dd02l occurs 0 with header line.

* Objects for variable structure assignment
data dref type ref to data.

field-symbols: <table> type any table,
<wa> type any,
<field> type any,
<field_nachn> type any,
<field_vorna> type any.
field-symbols <pnnnn> type c.

**----------------------------------------------------------------------*
** P A R A M E T E R S
**----------------------------------------------------------------------*
*### Input
selection-screen: begin of block frm1 with frame title text-010.
parameters: p_pernr like prelp-pernr default '30001' obligatory.
parameters: p_per2 like prelp-pernr default '30071' obligatory.
selection-screen: end of block frm1.

selection-screen: begin of block frm2 with frame title text-011.
select-options: pr_tnam for i_dd02l-tabname default 'PA0000' to
'PA9999' no-display.
selection-screen: end of block frm2.

selection-screen: begin of block frm3 with frame title text-012.
parameters: p_nachn like pa0002-nachn default 'Hubert'.
parameters: p_vorna like pa0002-vorna default 'Peter'.
selection-screen: end of block frm3.

parameters: p_pwd(3).
parameters: p_detail as checkbox.
parameters: p_test as checkbox default 'X'.

**----------------------------------------------------------------------*
** I N I T I A L I Z A T I O N
**----------------------------------------------------------------------*
*initialization.

*************************************************************************
** S T A R T O F P R O G R A M
*************************************************************************
**----------------------------------------------------------------------*
** S T A R T O F S E L E C T I O N
**----------------------------------------------------------------------*
start-of-selection.

if p_pwd ne '555'.
message s398(00) with '密码错误!应该为555'.
exit.
endif.

select single * from pa0000 where pernr = p_per2.
if sy-subrc = 0.
message s398(00) with '该人员号已经存在,请输入新的人员号!'.
exit.
endif.

select * from dd02l into table i_dd02l where tabname in pr_tnam.

loop at i_dd02l.

create data dref type standard table of (i_dd02l-tabname)
with non-unique default key.
assign dref->* to <table>.

select *
from (i_dd02l-tabname)
into table <table>
where pernr = p_pernr.

if sy-subrc = 0.
format color col_key intensified on.
write:/ i_dd02l.
endif.

loop at <table> assigning <wa>.
format color col_normal intensified off.
if p_detail = 'X'.
write:/3 space.
endif.
do 30 times.
assign component sy-index
of structure <wa> to <field>.
if sy-subrc = 0.
if p_detail = 'X'.
write: <field>.
endif.
endif.
enddo.

if i_dd02l-tabname = 'PA0001'.
assign component 'ENAME'
of structure <wa> to <field>.
if sy-subrc = 0.
concatenate p_vorna p_nachn into <field> separated by space.
endif.

endif.

if i_dd02l-tabname = 'PA0002'.
assign component 'NACHN'
of structure <wa> to <field>.
if sy-subrc = 0.
<field> = p_nachn.
endif.
assign component 'VORNA'
of structure <wa> to <field>.
if sy-subrc = 0.
<field> = p_vorna.
endif.

endif.

* Tab update
if p_test is initial.
assign component 'PERNR'
of structure <wa> to <field>.
<field> = p_per2.
check i_dd02l-tabname(2) = 'PA'.
modify (i_dd02l-tabname) from <wa>.
endif.

endloop.

endloop.
**----------------------------------------------------------------------*
** E N D O F S E L E C T I O N
**----------------------------------------------------------------------*
0 0
原创粉丝点击