Posted: Sat Apr 12, 2008 5:55 pm Post subject: BAPI_APPLICATION_CREATE
BAPI_APPLICATION_CREATE - Create application
Code:
*&---------------------------------------------------------------------*
*& Form DATA_CONVERSION
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> beg_month
* --> beg_year
* --> end_month
* --> end_year
* <-- begda
* <-- endda
*----------------------------------------------------------------------*
FORM data_conversion USING beg_month TYPE month
beg_year TYPE jahr
begda TYPE begda
end_month TYPE month
end_year TYPE jahr
endda TYPE endda
mode TYPE c.
IF mode = '1'.
MOVE beg_year TO begda(4).
MOVE beg_month TO begda+4(2).
IF beg_month IS INITIAL AND beg_year IS INITIAL.
MOVE '00' TO begda+6(2).
ELSE.
MOVE '01' TO begda+6(2).
ENDIF.
MOVE end_year TO endda(4).
MOVE end_month TO endda+4(2).
IF end_month IS INITIAL AND end_year IS INITIAL.
MOVE '00' TO endda+6(2).
ELSE.
MOVE '01' TO endda+6(2).
ENDIF.
CLEAR: beg_month, beg_year,
end_month, end_year.
ELSE.
beg_year = begda(4).
beg_month = begda+4(2).
end_year = endda(4).
end_month = endda+4(2).
PERFORM re247 USING beg_month end_month.
ENDIF.
ENDFORM. "DATA_CONVERSION
*&---------------------------------------------------------------------*
*& Form RE247
*&---------------------------------------------------------------------*
FORM re247 USING date TYPE month
*date TYPE month.
IF sw_months_already_selected = no.
sw_months_already_selected = yes.
SELECT * FROM t247 INTO TABLE i247
WHERE spras = sy-langu.
ENDIF.
READ TABLE i247 WITH KEY mnr = date.
IF sy-subrc = 0.
MOVE i247 TO t247.
ELSE.
CLEAR t247.
ENDIF.
READ TABLE i247 WITH KEY mnr = *date.
IF sy-subrc = 0.
MOVE i247 TO *t247.
ELSE.
CLEAR *t247.
ENDIF.
ENDFORM. "RE247
*&---------------------------------------------------------------------*
*& Form UPDATE_APPLICATION
*&---------------------------------------------------------------------*
* Anlegen einer neuen Bewerbung
*----------------------------------------------------------------------*
FORM update_application.
TABLES pspar.
DATA i4002 LIKE p4002 OCCURS 5 WITH HEADER LINE.
DATA i0002 LIKE p0002.
DATA i0006 LIKE p0006.
DATA i0105 LIKE p0105.
* v========================== XRGN431870 ============================v
* DATA ip0022 LIKE i0022 OCCURS 5 WITH HEADER LINE.
* DATA ip0023 LIKE i0023 OCCURS 5 WITH HEADER LINE.
* DATA ip0024 LIKE i0024 OCCURS 5 WITH HEADER LINE.
* ^========================== XRGN431870 ============================^
DATA old_p0022 LIKE tab0022. "XJGN211259
DATA old_p0023 LIKE tab0023. "XJGN211259
DATA old_p0024 LIKE tab0024. "XJGN211259
* XJGN211259 start
DATA: i_p0022 TYPE TABLE OF p0022 WITH HEADER LINE.
DATA: i_p0023 TYPE TABLE OF p0023 WITH HEADER LINE.
DATA: i_p0024 TYPE TABLE OF p0024 WITH HEADER LINE.
* XJGN211259 end
DATA return LIKE bapireturn1.
DATA: retcode LIKE sy-subrc, ind LIKE syst-index.
DATA: profile_add LIKE bapiqualific_tab OCCURS 50 WITH HEADER LINE.
DATA: profile_delete LIKE bapiqualific_tab OCCURS 50 WITH HEADER LINE.
DATA lin TYPE i.
DATA: BEGIN OF tab OCCURS 5,
subty LIKE t591a-subty,
END OF tab.
DATA: sobid LIKE bapiqualific-sobid.
* v============================ XRGN0426748 =========================v
*------------------------ SKBN594031 begin --------------------------*
* TYPES: begin of struc,
* name(5),
* space,
* value(32),
* end of struc.
* DATA it_pactv type table of struc.
* DATA wa_pactv type struc.
* DATA wa_p4003 type p4003.
* DATA it_p4003 type table of p4003.
* DATA wa_pme15 type pme15.
*------------------------- SKBN594031 end ---------------------------*
DATA number type p0001-seqnr.
* DATA seq_number type p0001-seqnr. "SKBN594031
* ^============================ XRGN0426748 =========================^
data wa_vacancies like line of s_vacancies. "SKBN584846
*------------------------ XDVN480519 begin -----------------------------
DATA: lv_plvar LIKE plog-plvar.
DATA: lv_orga LIKE t77s0-gsval.
DATA: lv_obj_begda LIKE sy-datum.
DATA: lv_obj_endda LIKE sy-datum.
*------------------------ XDVN480519 end -------------------------------
DATA: lv_lin_profile_add TYPE i. "XDVIM1879332_2002
DATA: lv_lin_profile_del TYPE i. "XRGIM618014_2002
DATA: lv_rcode type pspar-rcode. "XDVN618905
DATA: lt_initial_values TYPE TABLE OF pinit. "XDVN618905
DATA: ls_4002 LIKE LINE OF i4002. "XDVN618905
*
CLEAR success.
CLEAR information_300.
pspar-tclas = 'B'.
CALL FUNCTION 'BAPI_APPLICANT_ENQUEUE'
EXPORTING
applicantnumber = rpapp-aplno
IMPORTING
return = bapi_rcode1.
IF bapi_rcode1 CN ' 0'.
IF internal_appl NE yes.
text_1000_2 = bapi_rcode1-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
*-------------------------- SKBN584846 begin -------------------------*
* check if applicant has already applied for the same vacancy
* (depending on the vacancy status)
describe table s_vacancies lines lin.
if lin ne 0.
if retcode = 0.
clear wa_vacancies.
read table s_vacancies into wa_vacancies with key indic = 'X'.
if sy-subrc = 0.
loop at i4002 where otype = wa_vacancies-otype
and objid = wa_vacancies-objid
and ( apstv = '1'
or apstv = '2'
or apstv = '5'
or apstv = '7' )
and endda >= sy-datum.
endloop.
if sy-subrc = 0.
rollback work.
if internal_appl NE yes.
text_1000_2 = text-er2.
text_1000_1 = text-err.
exit.
else.
information_300 = text-er2.
exit.
endif.
endif.
endif.
endif.
endif.
clear i4002. refresh i4002.
*-------------------------- SKBN584846 end -------------------------*
* v==================== XRG XDV new ===============================v
IF change_applicant_data <> 'X'.
* ^==================== XRG XDV new ===============================^
* Bewerbung anlegen und Gesamtstatus auf 'In Bearbeitung' setzen
CALL FUNCTION 'BAPI_APPLICATION_CREATE'
EXPORTING
validitybegin = sy-datum
medium = int_defaults-media
advert = advert
unsappg = int_defaults-spapl
applnumber = rpapp-aplno
IMPORTING
* v============================ XRGN0426748 =========================v
number = number.
* ^============================ XRGN0426748 =========================^
return = bapi_rcode1.
IF bapi_rcode1 CN ' 0'.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = bapi_rcode1-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
************************************************************************
perform create_activities using number
changing return.
*-------------------------- SKBN594031 end ---------------------------*
* if error: rollback work, set messages and exit...
IF return CN ' 0'.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
*------------------------- SKBN594031 begin --------------------------*
* clear wa_p4003.
* ENDLOOP.
* IF return CN '0 '.
* EXIT.
* ENDIF.
* ELSE. "SKBN589253
* clear wa_p4003. "SKBN589253
* ENDIF. "SKBN589253
*
* ENDIF.
* ^============================ XRGN0426748 =========================^
*-------------------------- SKBN594031 end ---------------------------*
* v==================== XRG XDV new ===============================v
endif.
* ^==================== XRG XDV new ===============================^
************************************************************************
* Haben sich Daten des Bewerbers verдndert -> neue IT 0002, 0006, 0022
* 0105, 0023, 0024 Sдtze anlegen
* v========================== XRGN431870 ============================v
* CLEAR: i0002, i0006, i0105, ip0022, ip0023, ip0024.
* REFRESH: ip0022, ip0023, ip0024.
CLEAR: i0002, i0006, i0105.
* ^========================== XRGN431870 ============================^
CLEAR: i_p0022, i_p0023, i_p0024. "XJGN211259
REFRESH: i_p0022, i_p0023, i_p0024. "XJGN211259
* Check integration of infotype 0024 (qualifications)
CALL FUNCTION 'RH_INTEGRATION_CHECK'
IMPORTING
integrated_plvar = planvar
org_integration = orga
qual_integration = plogi_quali
EXCEPTIONS
OTHERS = 0.
IF internal_appl NE yes.
READ TABLE appl_p0002 INDEX 1.
IF appl_p0002 NE p0002.
* v======================== XRGIM618068_2002 ========================v
IF p0002-gbdat <> p0002-gbpas AND NOT p0002-gbdat IS INITIAL.
p0002-gbpas = p0002-gbdat.
ENDIF.
* ^======================== XRGIM618068_2002 ========================^
MOVE p0002 TO i0002.
ENDIF.
READ TABLE appl_p0006 INDEX 1.
IF appl_p0006 NE p0006.
MOVE p0006 TO i0006.
ENDIF.
** IT0105
READ TABLE appl_p0105 WITH KEY subty = '0010'.
IF appl_p0105 NE p0105.
MOVE p0105 TO i0105.
ENDIF.
** IT0022
*-------------------- XDVIM1879332_2002 begin --------------------------
LOOP AT tab0022.
CLEAR i_p0022.
READ TABLE appl_p0022 WITH key rownumber = tab0022-rownumber.
IF sy-subrc = 0.
MOVE-CORRESPONDING appl_p0022 TO old_p0022.
IF tab0022 NE old_p0022.
MOVE-CORRESPONDING appl_p0022 TO i_p0022.
MOVE-CORRESPONDING tab0022 TO i_p0022.
MOVE tab0022-slart TO i_p0022-subty.
MOVE rpapp-aplno TO i_p0022-pernr.
APPEND i_p0022.
ENDIF.
ELSE.
MOVE-CORRESPONDING tab0022 TO i_p0022.
MOVE tab0022-slart TO i_p0022-subty.
MOVE rpapp-aplno TO i_p0022-pernr.
APPEND i_p0022.
ENDIF.
ENDLOOP.
* LOOP AT tab0022.
** XJGN211259
* READ TABLE appl_p0022 WITH KEY
* slart = tab0022-slart
* begda = tab0022-begda "LCP46C Note211259
* sltp1 = tab0022-sltp1 "LCP46C Note211259
* sltp2 = tab0022-sltp2 "LCP46C Note211259
* insti = tab0022-insti "LCP46C Note211259
* slabs = tab0022-slabs "LCP46C Note211259
* sland = tab0022-sland.
* MOVE-CORRESPONDING appl_p0022 TO old_p0022.
* IF tab0022 NE old_p0022.
* MOVE-CORRESPONDING appl_p0022 TO i_p0022.
* MOVE-CORRESPONDING tab0022 TO i_p0022.
* MOVE rpapp-aplno TO i_p0022-pernr.
* APPEND i_p0022.
* ENDIF.
* ENDLOOP.
*-------------------- XDVIM1879332_2002 end ---------------------------
* v========================== XRGIM618014_2002 ======================v
LOOP AT appl_p0022.
READ TABLE tab0022 WITH KEY
rownumber = appl_p0022-rownumber.
IF sy-subrc <> 0
OR sy-subrc EQ 0 AND "XDVIM1879332_2002
( tab0022-endda NE appl_p0022-endda OR "XDVIM1879332_2002
tab0022-begda NE appl_p0022-begda OR "XDVIM1879332_2002
tab0022-slart NE appl_p0022-slart ) . "XDVIM1879332_2002
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = appl_p0022-infty
NUMBER = appl_p0022-pernr
SUBTYPE = appl_p0022-subty
OBJECTID = appl_p0022-objps
LOCKINDICATOR = appl_p0022-sprps
VALIDITYEND = appl_p0022-endda
VALIDITYBEGIN = appl_p0022-begda
RECORDNUMBER = appl_p0022-seqnr
RECORD = appl_p0022
OPERATION = 'DEL'
TCLAS = 'B'
NOCOMMIT = 'X'
IMPORTING
RETURN = return
.
IF NOT return IS INITIAL.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ELSE.
DELETE appl_p0022.
ENDIF.
ENDIF.
ENDLOOP.
* ^========================== XRGIM618014_2002 ======================^
** it0023
*------------------- XDVIM1879332_2002 begin --------------------------
LOOP AT tab0023.
CLEAR i_p0023.
READ TABLE appl_p0023 WITH key rownumber = tab0023-rownumber.
IF sy-subrc = 0.
MOVE-CORRESPONDING appl_p0023 TO old_p0023.
IF tab0023 NE old_p0023.
MOVE-CORRESPONDING appl_p0023 TO i_p0023.
MOVE-CORRESPONDING tab0023 TO i_p0023.
MOVE rpapp-aplno TO i_p0023-pernr.
APPEND i_p0023.
ENDIF.
ELSE.
MOVE-CORRESPONDING tab0023 TO i_p0023.
MOVE rpapp-aplno TO i_p0023-pernr.
APPEND i_p0023.
ENDIF.
ENDLOOP.
* LOOP AT tab0023.
* READ TABLE appl_p0023 WITH KEY
* begda = tab0023-begda
* ort01 = tab0023-ort01 "LCP46C Note211259
* land1 = tab0023-land1 "LCP46C Note211259
* taete = tab0023-taete "LCP46C Note211259
* arbgb = tab0023-arbgb.
* MOVE-CORRESPONDING appl_p0023 TO old_p0023.
* IF tab0023 NE old_p0023.
* MOVE-CORRESPONDING appl_p0023 TO i_p0023.
* MOVE-CORRESPONDING tab0023 TO i_p0023.
* MOVE rpapp-aplno TO i_p0023-pernr.
* APPEND i_p0023.
* ENDIF.
* ENDLOOP.
*------------------- XDVIM1879332_2002 end ---------------------------
* v========================== XRGIM618014_2002 ======================v
LOOP AT appl_p0023.
READ TABLE tab0023 WITH KEY
rownumber = appl_p0023-rownumber.
IF sy-subrc <> 0
OR sy-subrc EQ 0 AND "XDVIM1879332_2002
( tab0023-endda NE appl_p0023-endda OR "XDVIM1879332_2002
tab0023-begda NE appl_p0023-begda ). "XDVIM1879332_2002
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = appl_p0023-infty
NUMBER = appl_p0023-pernr
SUBTYPE = appl_p0023-subty
OBJECTID = appl_p0023-objps
LOCKINDICATOR = appl_p0023-sprps
VALIDITYEND = appl_p0023-endda
VALIDITYBEGIN = appl_p0023-begda
RECORDNUMBER = appl_p0023-seqnr
RECORD = appl_p0023
OPERATION = 'DEL'
TCLAS = 'B'
NOCOMMIT = 'X'
IMPORTING
RETURN = return
.
IF NOT return IS INITIAL.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ELSE.
DELETE appl_p0023.
ENDIF.
ENDIF.
ENDLOOP.
* ^========================== XRGIM618014_2002 ======================^
** It0024
*------------------- XDVIM1879332_2002 begin --------------------------
IF planvar IS INITIAL OR plogi_quali(1) <> '1'.
LOOP AT tab0024.
CLEAR i_p0024.
READ TABLE appl_p0024 WITH key rownumber = tab0024-rownumber.
IF sy-subrc = 0.
MOVE-CORRESPONDING appl_p0024 TO old_p0024.
IF tab0024 NE old_p0024.
MOVE-CORRESPONDING appl_p0024 TO i_p0024.
MOVE-CORRESPONDING tab0024 TO i_p0024.
MOVE rpapp-aplno TO i_p0024-pernr.
APPEND i_p0024.
ENDIF.
ELSE.
MOVE-CORRESPONDING tab0024 TO i_p0024.
MOVE rpapp-aplno TO i_p0024-pernr.
APPEND i_p0024.
ENDIF.
ENDLOOP.
* LOOP AT tab0024.
* CLEAR tab0024-line. "4.6C
* READ TABLE appl_p0024 WITH KEY quali = tab0024-quali
* auspr = tab0024-auspr.
* MOVE-CORRESPONDING appl_p0024 TO old_p0024.
* IF tab0024 NE old_p0024.
* MOVE-CORRESPONDING appl_p0024 TO i_p0024.
* MOVE-CORRESPONDING tab0024 TO i_p0024.
* MOVE rpapp-aplno TO i_p0024-pernr.
* APPEND i_p0024.
* ENDIF.
* ENDLOOP.
*------------------- XDVIM1879332_2002 end ---------------------------
* v========================== XRGIM618014_2002 ======================v
LOOP AT appl_p0024.
READ TABLE tab0024 WITH KEY
rownumber = appl_p0024-rownumber.
IF sy-subrc <> 0.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = appl_p0024-infty
NUMBER = appl_p0024-pernr
SUBTYPE = appl_p0024-subty
OBJECTID = appl_p0024-objps
LOCKINDICATOR = appl_p0024-sprps
VALIDITYEND = appl_p0024-endda
VALIDITYBEGIN = appl_p0024-begda
RECORDNUMBER = appl_p0024-seqnr
RECORD = appl_p0024
OPERATION = 'DEL'
TCLAS = 'B'
NOCOMMIT = 'X'
IMPORTING
RETURN = return
.
IF NOT return IS INITIAL.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ELSE.
DELETE appl_p0024.
ENDIF.
ENDIF.
ENDLOOP.
* ^========================== XRGIM618014_2002 ======================^
ENDIF. "XDVIM1879332_2002
ELSE.
** Interner Bewerber
MOVE p0002 TO i0002.
MOVE p0006 TO i0006.
MOVE p0105 TO i0105.
ENDIF.
* Internetadresse anlegen.
* IF i0105 CN ' 0'. "XJG Unicode
* IF NOT i0105-usrid IS INITIAL AND "XDVIM2046629_2002
IF NOT i0105-usrid IS INITIAL OR "XDVIM2046629_2002
NOT i0105-usrid_long IS INITIAL.
i0105-begda = sy-datum.
i0105-endda = '99991231'.
i0105-pernr = rpapp-aplno.
i0105-usrty = '0010'.
i0105-subty = '0010'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0105'
number = rpapp-aplno
subtype = '0010'
validityend = '99991231'
validitybegin = sy-datum
record = i0105
operation = 'INS'
tclas = 'B'
dialog_mode = '0'
nocommit = 'X'
IMPORTING
return = return.
IF return CN ' 0'.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
ENDIF.
** Anlegen von Bewerberstammsдtzen
CALL FUNCTION 'HR_ADD_APPLICANT_DATA'
EXPORTING
applicantnumber = rpapp-aplno
begda = sy-datum
endda = '99991231'
infty_0002 = i0002
infty_0006 = i0006
dialog_mode = '0'
nocommit = 'X'
IMPORTING
return = return
TABLES
infty_0022 = i_p0022 "XJGN211259
infty_0023 = i_p0023 "XJGN211259
infty_0024 = i_p0024. "XJGN211259
IF return CN '0 '.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = return-message.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
* Anlegen der Qualifikationen im Falle der Integration
IF NOT planvar IS INITIAL AND plogi_quali(1) EQ '1'.
* v========================== XRGN431870 ============================v
* LOOP AT ip0024.
* profile_add-obj_id = ip0024-quali.
* profile_add-rating = ip0024-auspr.
* LOOP AT i_p0024. "XDVIM1879332_2002
* profile_add-obj_id = i_p0024-quali. "XDVIM1879332_2002
* profile_add-rating = i_p0024-auspr. "XDVIM1879332_2002
* ^========================== XRGN431870 ============================^
* APPEND profile_add. "XDVIM1879332_2002
* ENDLOOP. "XDVIM1879332_2002
*----------------- XDVIM1879332_2002 begin ----------------------------
CLEAR profile_add. REFRESH profile_add.
CLEAR profile_delete. REFRESH profile_delete.
LOOP AT tab0024.
READ TABLE appl_p0024 WITH key rownumber = tab0024-rownumber.
IF sy-subrc = 0.
MOVE-CORRESPONDING appl_p0024 TO old_p0024.
IF tab0024 NE old_p0024.
profile_add-obj_id = tab0024-quali.
profile_add-rating = tab0024-auspr.
profile_add-begda = tab0024-begda.
profile_add-endda = tab0024-endda.
APPEND profile_add.
* new / J. Naeckel
******* Anlegen der zusдtzlichen Appl. Daten ********
DATA errorf TYPE i.
* PERFORM it0077_bdc_update USING rpapp-aplno "KVHN819751
* CHANGING appl_p0077 errorf. "KVHN819751
IF ( errorf <> 0 ).
ROLLBACK WORK.
information_300 = text-err.
EXIT.
ENDIF.
* END new / J. Naeckel
* ----------------------- XDVN618905 begin -----------------------------
* When updating it4002,the corresponding A/048-relationship should be
* created in case of integration. To achieve this, subroutine
* update_pernr is used. Here a commit work is done immediately.
* Thatґs why the processing of the vacancy assignment is moved to the
* end of subroutine update_application.
IF change_applicant_data <> 'X'.
******** Anlegen einer neuen Vakanzzuordnung ********
DESCRIBE TABLE s_vacancies LINES lin.
IF lin NE 0.
* ** Bestimmung der mцglichen Prioritдten
SELECT * FROM t591a WHERE infty EQ '4002'.
tab-subty = t591a-subty.
APPEND tab.
CLEAR tab.
ENDSELECT.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'B'
pernr = rpapp-aplno
infty = '4002'
begda = sy-datum
endda = '99991231'
BYPASS_BUFFER = 'X'
IMPORTING
subrc = retcode
TABLES
infty_tab = i4002
EXCEPTIONS
OTHERS = 0.
IF retcode EQ '0'.
LOOP AT tab.
READ TABLE i4002 WITH KEY aprio = tab-subty.
IF sy-subrc = 0.
DELETE tab.
ENDIF.
ENDLOOP.
ENDIF.
* ** Vakanzzuordnungen anlegen
ind = 0.
CLEAR i4002. REFRESH i4002.
* ------------------------ XDVN480519 begin -----------------------------
CALL FUNCTION 'RH_INTEGRATION_CHECK'
IMPORTING
INTEGRATED_PLVAR = LV_PLVAR
ORG_INTEGRATION = LV_ORGA.
* ------------------------ XDVN480519 end -------------------------------
LOOP AT s_vacancies WHERE indic = 'X'.
* ADD 1 TO ind. "XDVN480519
* READ TABLE tab INDEX ind. "XDVN480519
* i4002-aprio = tab-subty. "XDVN480519
i4002-apstv = '1'.
i4002-objid = s_vacancies-objid.
i4002-otype = 'S'.
i4002-otypo = 'AP'.
i4002-pernr = rpapp-aplno.
i4002-begda = sy-datum.
i4002-endda = '99991231'.
* ------------------------ XDVN480519 begin ----------------------------
IF ( NOT LV_PLVAR IS INITIAL ) AND LV_ORGA EQ 'X'.
CALL FUNCTION 'RH_READ_OBJECT'
EXPORTING
PLVAR = lv_plvar
OTYPE = 'S'
OBJID = i4002-objid
IMPORTING
OBEG = lv_obj_begda
OEND = lv_obj_endda
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC = 0.
IF lv_obj_endda LT sy-datum.
CLEAR i4002.
ELSE.
i4002-endda = lv_obj_endda.
ENDIF.
ENDIF.
ENDIF.
IF NOT i4002 IS INITIAL.
ADD 1 TO ind.
READ TABLE tab INDEX ind.
IF sy-subrc NE 0.
lv_rcode = '01'. "XDVN618905
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = text-er1.
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
IF lv_rcode CN ' 0'. "XDVN618905
EXIT. "XDVN618905
ENDIF. "XDVN618905
i4002-aprio = tab-subty.
* ------------------------ XDVN480519 end ------------------------------
MOVE-CORRESPONDING i4002 TO ls_4002.
perform fill_initial_values tables lt_initial_values
using ls_4002
changing pspar-supdg.
perform update_pernr(SAPFP50g) tables lt_initial_values
using ls_4002-pernr 'INS' '4002'
space space ls_4002-begda
ls_4002-endda 'X' lv_rcode.
IF lv_rcode CN ' 0'.
ROLLBACK WORK.
IF internal_appl NE yes.
text_1000_2 = text-er1. "XDVN618905
text_1000_1 = text-err.
EXIT.
ELSE.
information_300 = text-err.
EXIT.
ENDIF.
ENDIF.
CLEAR i4002.
CLEAR ls_4002.
ENDIF. "XDVN480519
ENDLOOP.
IF lv_rcode CN '0 '.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* ----------------------- XDVN618905 end ------------------------------
CLEAR: text_1000_2, text_1000_1.
COMMIT WORK.
* Speichern der Originale im opt. Archiv
PERFORM save_orig_data USING rpapp-aplno. "WBIK
CALL FUNCTION 'BAPI_APPLICANT_DEQUEUE'
EXPORTING
applicantnumber = rpapp-aplno.
IF internal_appl EQ yes.
information_300 = text-055.
*** check if Service 'Application Status' is not deactivated
** CALL FUNCTION 'HR_ESS_DEACTIVED_SERVICE'
** EXPORTING
** SERVICE = ESS_STATUSSERVICE
** MOLGA = MOLGA
** IMPORTING
** DEACTIVATED = DEACTIVATED.
** IF DEACTIVATED = FALSE.
** new within 4.6C: Check authorization
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
EXPORTING
tcode = ess_statustransaction
EXCEPTIONS
ok = 1
not_ok = 2
OTHERS = 3.
IF sy-subrc = 1.
*&---------------------------------------------------------------------*
*& Form create_activities
*&---------------------------------------------------------------------*
* Anlegen von Bewerbervorgдngen
*----------------------------------------------------------------------*
* -->P_NUMBER text
* <--P_RETURN text
*----------------------------------------------------------------------*
*------------------------- SKBN594031 begin --------------------------*
FORM create_activities USING P_NUMBER like p0001-seqnr
CHANGING P_RETURN like bapireturn1.
TYPES: begin of struc,
name(5),
space,
value(32),
end of struc.
DATA it_pactv type table of struc.
DATA wa_pactv type struc.
DATA wa_p4003 type p4003.
DATA it_p4003 type table of p4003.
DATA seq_number type p0001-seqnr.
DATA i0001 type standard table of p0001.
DATA wa_0001 like line of i0001.
DATA wa_pme15 type pme15.
DATA back like p0001-subty.
clear wa_pme15.
* Fill structure wa_pme15
* Read feature EVTAP to obtain action (MASSN)
wa_pme15-hgmid = '0'.
wa_pme15-apsta = '1'.
CALL FUNCTION 'HR_FEATURE_BACKFIELD'
EXPORTING
FEATURE = 'EVTAP'
STRUC_CONTENT = wa_pme15
KIND_OF_ERROR = ' '
IMPORTING
BACK = BACK
* CHANGING
* STATUS =
EXCEPTIONS
OTHERS = 1.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.