首页 > 编程语言 >HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码

HR--一个员工的所有主数据(PA*)克隆到一个新员工的程序代码

时间:2022-10-12 19:36:02浏览次数:77  
标签:selection parameters HR endif 员工 tabname dd02l ---------------------------------


货铺QQ群号:834508274



这个程序将一个员工的所有主数据(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.



                  type any,



                type any,



                type any,



                type any.



field-symbols  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.



   select *



          from (i_dd02l-tabname)



          where pernr = p_pernr.



   if sy-subrc = 0.



     format color col_key intensified on.



     write:/ i_dd02l.



   endif.



     format color col_normal intensified off.



     if p_detail = 'X'.



       write:/3 space.



     endif.



     do 30 times.



       assign component sy-index



          of structure to .



       if sy-subrc = 0.



         if p_detail = 'X'.



           write: .



         endif.



       endif.



     enddo.



     if i_dd02l-tabname = 'PA0001'.



       assign component 'ENAME'



  of structure to .



       if sy-subrc = 0.



         concatenate p_vorna p_nachn into separated by space.



       endif.



     endif.



     if i_dd02l-tabname = 'PA0002'.



       assign component 'NACHN'



          of structure to .



       if sy-subrc = 0.



         = p_nachn.



       endif.



       assign component 'VORNA'



          of structure to .



       if sy-subrc = 0.



         = p_vorna.



       endif.



     endif.



* Tab update



     if p_test is initial.



       assign component 'PERNR'



          of structure to .



       = p_per2.



       check i_dd02l-tabname(2) = 'PA'.



       modify (i_dd02l-tabname) from .



     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​​&



标签:selection,parameters,HR,endif,员工,tabname,dd02l,---------------------------------
From: https://blog.51cto.com/u_15680210/5751348

相关文章