HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
2007-10-05 19:39
615 查看
这个程序将一个员工的所有主数据(PA*)克隆到一个新员工,具体代码
*&---------------------------------------------------------------------*
*& 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 'Bitte Passwort eingeben'.
exit.
endif.
select single * from pa0000 where pernr = p_per2.
if sy-subrc = 0.
message s398(00) with 'PERNR Existiert schon,bitte zuerst vollst. löschen'.
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
**----------------------------------------------------------------------*
source url: https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Snippets/HR+Clone+Pernr&
*&---------------------------------------------------------------------*
*& 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 'Bitte Passwort eingeben'.
exit.
endif.
select single * from pa0000 where pernr = p_per2.
if sy-subrc = 0.
message s398(00) with 'PERNR Existiert schon,bitte zuerst vollst. löschen'.
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
**----------------------------------------------------------------------*
source url: https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Snippets/HR+Clone+Pernr&
相关文章推荐
- HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
- HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
- HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
- HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
- HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码
- 微信小程序--(5-1)点击列表item,把item上面显示的所有数据,传递到另外一个页面
- 再来一个一键关闭所有程序的小代码
- 将文本文件中的数据读取到一个二维数组中,求出这些数据的中位数,然后求所有数据与中位数的差值的绝对值和,并求出和的最小值,最后把程序运行的结果写到一个txt文件中
- Windows把一个目录下所有的文件文件中的数据导入程序中
- 考虑下列生成二进制的过程,编译器被用来生成单个单元的目标代码,链接器被用来将多个目标单元合并成一个程序二进制,链接器如何改变指令和数据到内存地址的绑定?需要什么信息从编译器传递给链接器,以协助完成链接
- C#源代码—编写一个程序求出所有的“水仙花数”。“水仙花数”是指一个3位数,其各位数字的立方和恰好等于该数本身。例如153=1*1*1+5*5*5+3*3*3,所以153是“水仙花数”。
- 一个用vbs查找硬盘所有分区中的指定程序的代码
- 6/27 一个简单的员工管理程序:添加微软成员资格数据表
- 一个求24点所有可能解的VB源代码及程序实现
- 用unity来写 二维数组编写程序定义一个二维数组arr,该数组一共有4行3列,如下表所示,请把下表中的所有对应数据利用赋值语句赋值到该二维数组arr中去arr 第0列第1列第2列第0行第1行第2行第
- 编写程序从标准输入设备读入的元素数据建立一个int型vector对象,然后动态创建与该vector大小一致的数组,把vector对象的所有元素复制给该数组
- 任何一个傻瓜都能写出计算机可以理解的代码,惟有写出人类容易理解的代码,才是优秀的程序
- 一个int 数组,里面数据无任何限制,要求求出所有这样的数a[i],其左边的数都小于等于它,右边的数都大于等于它。能否只用一个额外数组和少量其它空间实现。
- 原始套接字,接收所有数据的设置方法,及代码。
- 一个小程序搞懂静态成员数据和静态成员函数