Professional Documents
Culture Documents
*
*
*
*
OTHERS
= 2
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*include bdcrecx1.
start-of-selection.
loop at it_tab into wa.
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
using 'PSPAR-PERSG'
wa-persg.
using 'PSPAR-PERSK'
wa-persk.
using 'MP000200' '2001'.
using 'BDC_CURSOR'
'Q0002-GBPAS'.
using 'BDC_OKCODE'
'=UPD'.
using 'P0002-BEGDA'
wa-begda.
using 'P0002-ENDDA'
wa-endda.
using 'Q0002-ANREX'
wa-anrex.
using 'P0002-NACHN'
wa-nachn.
using 'P0002-VORNA'
wa-vorna.
using 'Q0002-GBPAS'
wa-gbpas.
using 'P0002-SPRSL'
wa-sprsl.
using 'P0002-NATIO'
wa-natio.
using 'MP000100' '2000'.
using 'BDC_OKCODE'
'/EBCK'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'SAPLSPO1' '0200'.
using 'BDC_OKCODE'
'=YES'.
wa1-dynbegin = 'X'.
append wa1 to it_tab1.
endform.
" BDC_DYNPRO
*&---------------------------------------------------------------------*
*&
Form BDC_FIELD
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_0290
text
*
-->P_WA_BEGDA text
*----------------------------------------------------------------------*
form bdc_field using fnam fval.
clear wa1.
wa1-fnam = fnam.
wa1-fval = fval.
append wa1 to it_tab1.
endform.
" BDC_FIELD
*&---------------------------------------------------------------------*
*& Report ZHR_KAR2_BDC_EMP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zhr_kar2_bdc_emp.
type-pools: truxs.
types: begin of zstruct,
pernr type pspar-pernr,
begda type string, "p0002begda,
endda type string, "p0002endda,
massn type massn,
massg type massg,
werks type werks,
persg type persg,
persk type persk,
anrex type anrex,
nachn type nachn,
vorna type vorna,
gbpas type gbpas,
sprsl type sprsl,
natio type natio,
end of zstruct.
types:begin of st_valid,
pernr type rp50g-pernr,
end of st_valid.
data: it_file type table of zstruct,
wa_file type zstruct,
it_file1 type table of bdcdata,
wa_file1 type bdcdata,
field_name
like dynpread-fieldname,
w_struct type truxs_t_text_data,
it_bdcmsg type table of bdcmsgcoll,
it_valid type table of st_valid,
wa_valid type st_valid.
parameters: p_file(128) type c obligatory.
parameters : p_create radiobutton group rb1.
parameters : p_update radiobutton group rb1.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name
= field_name
importing
file_name
= p_file.
*
*
*
*
*
*
*
* Creation
start-of-selection.
if p_create = 'X' .
loop at it_file into wa_file.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
*
*
*
*
*
*
*
*
*
*
*
*
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_dynpro
PERFORM bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
USING 'P0002-SPRSL'
wa_file-sprsl.
USING 'P0002-NATIO'
wa_file-natio.
USING 'MP000100' '2000'.
USING 'BDC_OKCODE'
'/EBCK'.
USING 'BDC_CURSOR'
'P0001-BEGDA'.
USING 'SAPLSPO1' '0200'.
USING 'BDC_OKCODE'
'=YES'.
using 'SAPMP50A' '1000'.
using 'BDC_OKCODE'
'=INS'.
using 'RP50G-PERNR'
wa_file-pernr.
using 'BDC_CURSOR'
'T582S-ITEXT(01)'.
using 'RP50G-SELEC(01)'
'X'.
using 'RP50G-TIMR6'
'X'.
using 'MP000000' '2000'.
using 'BDC_CURSOR'
'PSPAR-PERSK'.
using 'BDC_OKCODE'
'=UPD'.
using 'P0000-BEGDA'
'16.03.2016'.
using 'P0000-MASSN'
'01'.
using 'PSPAR-WERKS'
'1000'.
using 'PSPAR-PERSG'
wa_file-persg.
using 'PSPAR-PERSK'
wa_file-persk.
using 'MP000200' '2001'.
using 'BDC_CURSOR'
'Q0002-GBPAS'.
using 'BDC_OKCODE'
'=UPD'.
using 'P0002-BEGDA'
'16.03.2016'.
using 'P0002-ENDDA'
'31.12.9999'.
using 'Q0002-ANREX'
'Mr.'.
using 'P0002-NACHN'
wa_file-nachn.
using 'P0002-VORNA'
wa_file-vorna.
using 'Q0002-GBPAS'
wa_file-gbpas.
perform bdc_field
using 'P0002-SPRSL'
'EN'.
perform bdc_dynpro
using 'MP000100' '2000'.
perform bdc_field
using 'BDC_OKCODE'
'/EEND'.
perform bdc_field
using 'BDC_CURSOR'
'P0001-BEGDA'.
perform bdc_dynpro
using 'SAPLSPO1' '0200'.
perform bdc_field
using 'BDC_OKCODE'
'=YES'.
*perform bdc_transaction using 'PA30'.
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
using 'PSPAR-WERKS'
wa_file-werks.
using 'PSPAR-PERSG'
wa_file-persg.
using 'PSPAR-PERSK'
wa_file-persk.
using 'MP000200' '2001'.
using 'BDC_CURSOR'
'P0002-NATIO'.
using 'BDC_OKCODE'
'=UPD'.
using 'P0002-BEGDA'
wa_file-begda.
using 'P0002-ENDDA'
wa_file-endda.
using 'Q0002-ANREX'
wa_file-anrex.
using 'P0002-NACHN'
wa_file-nachn.
using 'P0002-VORNA'
wa_file-vorna.
using 'Q0002-GBPAS'
wa_file-gbpas.
using 'P0002-SPRSL'
wa_file-sprsl.
using 'P0002-NATIO'
wa_file-natio.
using 'MP000100' '2000'.
using 'BDC_OKCODE'
'/EBCK'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'SAPLSPO1' '0200'.
using 'BDC_OKCODE'
'=YES'.
REPORT
" BDC_FIELD
type-pools : truxs.
types: begin of zstruct_cre,
empno type pspar-pernr,
earea type pspar-werks,
egroup type pspar-persg,
esubgrp type pspar-persk,
title type p0002-titel,
lname type p0002-nachn,
fname type p0002-vorna,
bdate type q0002-gbpas,
langu type p0002-sprsl,
nation type p0002-natio,
end of zstruct_cre.
types: begin of zstruct_upd,
llname type p0002-nachn,
ffname type p0002-vorna,
end of zstruct_upd.
*
*
*
*
*
.
if sy-subrc = 0.
message 'EMPLOYEE RECORDS UPLOADED SUCCESSFULLY' type 'I'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*include bdcrecx1.
loop at itab_cre into wa_cre.
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
*perform bdc_transaction
wa_cre-title.
using 'P0002-NACHN'
wa_cre-lname.
using 'P0002-VORNA'
wa_cre-fname.
using 'Q0002-GBPAS'
wa_cre-bdate.
using 'P0002-SPRSL'
wa_cre-langu.
using 'P0002-NATIO'
wa_cre-nation.
using 'MP000100' '2000'.
using 'BDC_OKCODE'
'/EBCK'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'SAPLSPO1' '0200'.
using 'BDC_OKCODE'
'=NO'.
using 'MP000100' '2000'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'BDC_OKCODE'
'/00'.
using 'P0001-BEGDA'
'01.01.2016'.
using 'P0001-ENDDA'
'31.12.9999'.
using 'P0001-ABKRS'
'D2'.
using 'MP000100' '2000'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'BDC_OKCODE'
'=UPD'.
using 'P0001-BEGDA'
'01.01.2016'.
using 'P0001-ENDDA'
'31.12.9999'.
using 'P0001-ABKRS'
'D2'.
using 'P0001-VDSK1'
'1000'.
using 'MP000600' '2001'.
using 'BDC_OKCODE'
'/EBCK'.
using 'BDC_CURSOR'
'P0006-BEGDA'.
using 'PA30'.
*perform close_group.
call transaction 'PA30' using it_bdcdata mode 'N' update 'S' messages in
to it_msglog.
refresh it_bdcdata.
endloop.
loop at it_msglog into wa_msglog.
wa_msgalv-msgid
= wa_msglog-msgid.
wa_msgalv-msgnr
= wa_msglog-msgnr.
wa_msgalv-msgv1
= wa_msglog-msgv1.
append wa_msgalv to it_msgalv.
clear: wa_msgalv, wa_msglog.
endloop.
*
*
*
*
*
*
*
*
perform bdc_field
using 'BDC_OKCODE'
'UPD'.
perform bdc_field
using 'P0002-BEGDA'
'24.03.1992'.
perform bdc_field
using 'P0002-ENDDA'
'31.12.9999'.
perform bdc_field
using 'Q0002-ANREX'
'Mr.'.
perform bdc_field
using 'P0002-NACHN'
wa_upd-llname.
perform bdc_field
using 'P0002-VORNA'
wa_upd-ffname.
perform bdc_field
using 'Q0002-GBPAS'
'24.03.1992'.
perform bdc_field
using 'P0002-SPRSL'
'EN'.
perform bdc_field
using 'P0002-NATIO'
'IN'.
*perform bdc_transaction using 'PA30'.
*perform close_group.
call transaction 'PA30' using it_bdcdata mode 'N' update 'S' messages in
to it_msglog.
refresh it_bdcdata.
endloop.
endif.
type-pools: slis.
data: it_fieldcat type slis_t_fieldcat_alv, wa_fieldcat
slis_fieldcat_alv.
wa_fieldcat-fieldname = 'MSGID'.
wa_fieldcat-seltext_m = 'Msg Id'.
append wa_fieldcat to it_fieldcat.
type
wa_fieldcat-fieldname = 'MSGNR'.
wa_fieldcat-seltext_m = 'Msg Number.'.
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'MSGV1'.
wa_fieldcat-seltext_m = 'Env'.
append wa_fieldcat to it_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = it_fieldcat
tables
t_outtab
= it_msgalv.
* EXCEPTIONS
*
*
PROGRAM_ERROR
OTHERS
= 1
= 2
.
if sy-subrc <> 0.
write 'No msg'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*----------------------------------------------------------------------*
*
Start new screen
*
*----------------------------------------------------------------------*
form bdc_dynpro using program dynpro.
clear wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro
= dynpro.
wa_bdcdata-dynbegin = 'X'.
append wa_bdcdata to it_bdcdata.
endform.
"bdc_dynpro
**---------------------------------------------------------------------*
**
Insert field
**---------------------------------------------------------------------form bdc_field using fnam fval.
clear wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
append wa_bdcdata to it_bdcdata.
endform.
report
"bdc_field
type-pools: truxs.
types: begin of ty_emp,
pernr type rp50g-pernr,
begda type q0002-gbpas,
werks type pspar-werks,
persg type pspar-persg,
persk type pspar-persk,
nachn type p0002-nachn,
vorna type p0002-vorna,
gbpas type q0002-gbpas,
sprsl type p0002-sprsl,
natio type p0002-natio,
end of ty_emp.
"personnel no
"start date
"personnel area
"employee group
"employee subgroup
"Last name
"First name
"DOB
"Language
"Nation
clear it_emp1.
refresh it_emp1.
selection-screen begin of block blck with frame title text-011.
parameters: up_file type localfile obligatory.
parameters: up_file1 type localfile obligatory.
selection-screen end of block blck.
tables
i_tab_converted_data
= it_emp1
exceptions
conversion_failed
= 1
others
= 2
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if p_create = 'X' .
loop at it_emp into wa_emp.
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
using 'P0002-BEGDA'
wa_emp-begda.
using 'P0002-ENDDA'
'31.12.9999'.
using 'Q0002-ANREX'
'Mr.'.
using 'P0002-NACHN'
wa_emp-nachn.
using 'P0002-VORNA'
wa_emp-vorna.
using 'Q0002-GBPAS'
wa_emp-gbpas.
using 'P0002-SPRSL'
wa_emp-sprsl.
using 'P0002-NATIO'
wa_emp-natio.
using 'MP000100' '2000'.
using 'BDC_OKCODE'
'/EEND'.
using 'BDC_CURSOR'
'P0001-BEGDA'.
using 'SAPLSPO1' '0200'.
using 'BDC_OKCODE'
'=YES'.
**********************
*
Call transaction 'PA30' using bdcdata mode 'N' update 'S' messages into
it_status.
*
*
REFRESH it_status.
endloop.
elseif p_update = 'X' .
loop at it_emp1 into wa_emp1.
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
*
*
*
*
using 'RP50G-TIMR6'
'X'.
perform bdc_dynpro
using 'MP000200' '2000'.
perform bdc_field
using 'BDC_CURSOR'
'P0002-ANZKD'.
perform bdc_field
using 'BDC_OKCODE'
'UPD'.
perform bdc_field
using 'P0002-BEGDA'
'30.03.1992'.
perform bdc_field
using 'P0002-ENDDA'
'31.12.9999'.
perform bdc_field
using 'Q0002-ANREX'
'Mr.'.
perform bdc_field
using 'P0002-NACHN'
'Hooper'.
perform bdc_field
using 'P0002-VORNA'
'Kingsley'.
perform bdc_field
using 'P0002-GBDAT'
'30.03.1992'.
perform bdc_field
using 'P0002-SPRSL'
'EN'.
DATA: v_char TYPE BDCDATA-FVAL.
clear v_char.
v_char = wa_emp-anzkd.
CONDENSE v_char.
perform bdc_field1
using 'P0002-ANZKD'
wa_emp1-anzkd .
perform bdc_field
using 'P0002-NATIO'
'IN'.
PERFORM bdc_transaction USING 'PA30'.
call transaction 'PA30' using bdcdata mode 'N' update 'S'
messages into it_bdcmsg1.
refresh bdcdata.
endloop.
perform close_group.
endif.
form bdc_field1 using fnam fval.
if fval <> nodata.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
condense bdcdata-fval.
append bdcdata.
endif.
endform.
report zhr_kar_bdc_update
no standard page heading line-size 255.
type-pools: truxs.
types: begin of ty_emp1,
pernr type rp50g-pernr, "personnel no
*
fatxt TYPE q0002-fatxt,
anzkd type p0002-anzkd,
end of ty_emp1.
data: it_emp1 type table of ty_emp1,
wa_emp1 type ty_emp1,
it_bdcmsg1 type table of bdcmsgcoll.
data: x_stru1 type truxs_t_text_data.
clear it_emp1.
refresh it_emp1.
selection-screen begin of block blck with frame title text-011.
parameters: up_file1 type localfile obligatory.
selection-screen end of block blck.
at selection-screen on value-request for up_file1.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name
= 'Filename '
importing
file_name
= up_file1.
start-of-selection.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
*
I_FIELD_SEPERATOR
=
*
I_LINE_HEADER
=
i_tab_raw_data
= x_stru1
i_filename
= up_file1
tables
i_tab_converted_data
= it_emp1
exceptions
conversion_failed
= 1
others
= 2
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
include bdcrecx1.
start-of-selection.
perform open_group.
loop at it_emp1 into wa_emp1.
perform bdc_dynpro
perform bdc_field
*
*
*
*
using 'P0002-ANZKD'
wa_emp1-anzkd .
using 'P0002-NATIO'
'IN'.