Include name LCY18F02
FORM CHECK_PERSON.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form CHECK_PERSON, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZCJ20N_VALIDATION_NEW. "active version
*********** ADDED BY CHELLAM - 20.04.2015 , REQ BY SIVASANKAR ******************
DATA : LV_BUKRS TYPE MSEG-BUKRS,
LV_BUKRS1 TYPE MSEG-BUKRS,
lv_bukrs_in type char4,
LV_KST01 TYPE PA0027-KST01,
lv_BTRTL type pa0001-BTRTL.
data : lv_short type char20,
lv_OBJEKTID type char20.
Data: num_list(10) type c value '0123456789',
x type n.
********** added by chellam - 05.06.2015
DATA: w_field(40).
FIELD-SYMBOLS: <fs_short>.
**break testabap.
w_field = '(SAPLCY18)CYSPLITIN-SHORT'.
ASSIGN (w_field) TO <fs_short>.
********** end of added by chellam - 05.06.2015
DATA:
G_MESSAGE_V1 TYPE STRING,
G_MESSAGE_V2 TYPE STRING.
DATA: IT_DYNPREAD1 TYPE STANDARD TABLE OF DYNPREAD,
LS_DYNPREAD1 TYPE DYNPREAD,
LV_REPID1 TYPE SY-REPID,
LV_DYNNR1 TYPE SY-DYNNR.
IF SY-TCODE = 'CJ20N' AND *AFVGD-AUFNRD IS NOT INITIAL AND *AFVGD-ARBPL IS NOT INITIAL." and sy-Uname = 'TESTABAP'.
IF *AFVGD-ARBPL IS NOT INITIAL AND *AFVGD-WERKS IS NOT INITIAL.
* CLEAR : IT_DYNPREAD1[].
* LV_REPID1 = 'SAPLCY18'.
* LV_DYNNR1 = '1108'.
* CALL FUNCTION 'DYNP_VALUES_READ'
* EXPORTING
* DYNAME = LV_REPID1
* DYNUMB = LV_DYNNR1
* REQUEST = 'A'
* TABLES
* DYNPFIELDS = IT_DYNPREAD1.
*LOOP AT IT_DYNPREAD1 INTO LS_DYNPREAD1.
* DELETE IT_DYNPREAD1 WHERE FIELDNAME <> 'CYSPLITIN-SHORT'.
* DELETE IT_DYNPREAD1 WHERE FIELDVALUE IS INITIAL.
*ENDLOOP.
*SORT IT_DYNPREAD1 DESCENDING BY STEPL.
*READ TABLE IT_DYNPREAD1 INTO LS_DYNPREAD1 INDEX 1.
*break testabap.
* READ TABLE IT_DYNPREAD1 INTO LS_DYNPREAD1 INDEX 1.
* IF SY-SUBRC = 0.
* IF CYSPLITIN-OBJEKTID IS INITIAL.
* CYSPLITIN-OBJEKTID = LS_DYNPREAD1-FIELDVALUE.
* ENDIF.
* ELSE.
* CYSPLITIN-OBJEKTID = ''.
* ENDIF.
*BREAK TESTABAP.
IF <fs_short> IS INITIAL.
CYSPLITIN-OBJEKTID = ''.
ELSE.
IF <fs_short> CA SY-abcde.
CYSPLITIN-OBJEKTID = CYSPLITIN-OBJEKTID.
ELSE.
CYSPLITIN-OBJEKTID = <fs_short>.
ENDIF.
ENDIF.
*IF SY-SUBRC = 0.
* IF LS_DYNPREAD1-FIELDVALUE CA SY-ABCDE. "<<<CHECK FOR ANY ALPHABET.
* IF <fs_short> IS NOT INITIAL.
* IF CYSPLITIN-OBJEKTID IS INITIAL.
* CYSPLITIN-OBJEKTID = <fs_short>.
* ELSE.
* CYSPLITIN-OBJEKTID = CYSPLITIN-OBJEKTID.
* ENDIF.
* ENDIF.
* ELSE.
* IF CYSPLITIN-OBJEKTID <> LS_DYNPREAD1-FIELDVALUE. " ADDED BY CHELLAM - 04.06.2015
* CYSPLITIN-OBJEKTID = LS_DYNPREAD1-FIELDVALUE.
* ENDIF.
* ENDIF.
*ELSE.
* CYSPLITIN-OBJEKTID = ''.
*ENDIF.
* break testabap.
IF CYSPLITIN-OBJEKTID IS NOT INITIAL.
CLEAR : LV_BUKRS,LV_BUKRS1,LV_KST01,G_MESSAGE_V1,G_MESSAGE_V2,lv_bukrs_in,lv_BTRTL,LV_BUKRS_IN.
SELECT SINGLE BUKRS FROM T001K INTO LV_BUKRS WHERE BWKEY = *AFVGD-WERKS.
IF LV_BUKRS IS NOT INITIAL.
LV_BUKRS_IN = LV_BUKRS.
ENDIF.
SELECT SINGLE BUKRS BTRTL FROM PA0001 INTO (LV_BUKRS1,lv_BTRTL) WHERE PERNR = CYSPLITIN-OBJEKTID AND ENDDA >= CYSPLITIN-DATE .
IF LV_BUKRS <> LV_BUKRS1.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'Not Allowed for' 'Company Code' lv_bukrs INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 .
ENDIF.
IF LV_BUKRS_IN = 'IN10' .
IF *AFVGD-WERKS = 'IN11'.
IF *AFVGD-WERKS = lv_BTRTL.
ELSE.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' *AFVGD-WERKS INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 ."DISPLAY LIKE 'E'.
ENDIF.
elseif *AFVGD-WERKS = 'IN10' or *AFVGD-WERKS = 'IN12' or *AFVGD-WERKS = 'IN13'.
IF lv_BTRTL = 'IN11'.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' *AFVGD-WERKS INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 .
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
FM name HR_PERSON_SELECT
FUNCTION HR_PERSON_SELECT.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module HR_PERSON_SELECT, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZCJ20N_VALIDATE_PERSON_ASSIGN1. "active version
********* added by - 12.04.2015
break testing.
data: it_dynpread type standard table of dynpread,
ls_dynpread type dynpread.
data : lv_act_per_assign_flag,
lv_repid type sy-repid,
lv_dynnr type sy-dynnr.
clear : lv_act_per_assign_flag,it_dynpread[].
if sy-uname = 'TESTING' .
if sy-tcode = 'CJ20N'.
lv_repid = 'SAPLCONW'.
lv_dynnr = '1700'.
CALL FUNCTION 'DYNP_VALUES_READ'
exporting
dyname = lv_repid
dynumb = lv_dynnr
request = 'A'
tables
dynpfields = it_dynpread.
read table it_dynpread into ls_dynpread with key fieldname = 'AFVGD-ARBPL' stepl = '0' .
if sy-subrc = 0 and ls_dynpread-fieldvalue is not initial.
lv_act_per_assign_flag = 'X'.
endif.
if lv_act_per_assign_flag is not initial and string_name is not initial.
break testing.
endif.
endif.
endif.
********* end of added by - 12.04.2015 - Reg
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
FORM CHECK_PERSON.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form CHECK_PERSON, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZCJ20N_VALIDATION_NEW. "active version
*********** ADDED BY CHELLAM - 20.04.2015 , REQ BY SIVASANKAR ******************
DATA : LV_BUKRS TYPE MSEG-BUKRS,
LV_BUKRS1 TYPE MSEG-BUKRS,
lv_bukrs_in type char4,
LV_KST01 TYPE PA0027-KST01,
lv_BTRTL type pa0001-BTRTL.
data : lv_short type char20,
lv_OBJEKTID type char20.
Data: num_list(10) type c value '0123456789',
x type n.
********** added by chellam - 05.06.2015
DATA: w_field(40).
FIELD-SYMBOLS: <fs_short>.
**break testabap.
w_field = '(SAPLCY18)CYSPLITIN-SHORT'.
ASSIGN (w_field) TO <fs_short>.
********** end of added by chellam - 05.06.2015
DATA:
G_MESSAGE_V1 TYPE STRING,
G_MESSAGE_V2 TYPE STRING.
DATA: IT_DYNPREAD1 TYPE STANDARD TABLE OF DYNPREAD,
LS_DYNPREAD1 TYPE DYNPREAD,
LV_REPID1 TYPE SY-REPID,
LV_DYNNR1 TYPE SY-DYNNR.
IF SY-TCODE = 'CJ20N' AND *AFVGD-AUFNRD IS NOT INITIAL AND *AFVGD-ARBPL IS NOT INITIAL." and sy-Uname = 'TESTABAP'.
IF *AFVGD-ARBPL IS NOT INITIAL AND *AFVGD-WERKS IS NOT INITIAL.
* CLEAR : IT_DYNPREAD1[].
* LV_REPID1 = 'SAPLCY18'.
* LV_DYNNR1 = '1108'.
* CALL FUNCTION 'DYNP_VALUES_READ'
* EXPORTING
* DYNAME = LV_REPID1
* DYNUMB = LV_DYNNR1
* REQUEST = 'A'
* TABLES
* DYNPFIELDS = IT_DYNPREAD1.
*LOOP AT IT_DYNPREAD1 INTO LS_DYNPREAD1.
* DELETE IT_DYNPREAD1 WHERE FIELDNAME <> 'CYSPLITIN-SHORT'.
* DELETE IT_DYNPREAD1 WHERE FIELDVALUE IS INITIAL.
*ENDLOOP.
*SORT IT_DYNPREAD1 DESCENDING BY STEPL.
*READ TABLE IT_DYNPREAD1 INTO LS_DYNPREAD1 INDEX 1.
*break testabap.
* READ TABLE IT_DYNPREAD1 INTO LS_DYNPREAD1 INDEX 1.
* IF SY-SUBRC = 0.
* IF CYSPLITIN-OBJEKTID IS INITIAL.
* CYSPLITIN-OBJEKTID = LS_DYNPREAD1-FIELDVALUE.
* ENDIF.
* ELSE.
* CYSPLITIN-OBJEKTID = ''.
* ENDIF.
*BREAK TESTABAP.
IF <fs_short> IS INITIAL.
CYSPLITIN-OBJEKTID = ''.
ELSE.
IF <fs_short> CA SY-abcde.
CYSPLITIN-OBJEKTID = CYSPLITIN-OBJEKTID.
ELSE.
CYSPLITIN-OBJEKTID = <fs_short>.
ENDIF.
ENDIF.
*IF SY-SUBRC = 0.
* IF LS_DYNPREAD1-FIELDVALUE CA SY-ABCDE. "<<<CHECK FOR ANY ALPHABET.
* IF <fs_short> IS NOT INITIAL.
* IF CYSPLITIN-OBJEKTID IS INITIAL.
* CYSPLITIN-OBJEKTID = <fs_short>.
* ELSE.
* CYSPLITIN-OBJEKTID = CYSPLITIN-OBJEKTID.
* ENDIF.
* ENDIF.
* ELSE.
* IF CYSPLITIN-OBJEKTID <> LS_DYNPREAD1-FIELDVALUE. " ADDED BY CHELLAM - 04.06.2015
* CYSPLITIN-OBJEKTID = LS_DYNPREAD1-FIELDVALUE.
* ENDIF.
* ENDIF.
*ELSE.
* CYSPLITIN-OBJEKTID = ''.
*ENDIF.
* break testabap.
IF CYSPLITIN-OBJEKTID IS NOT INITIAL.
CLEAR : LV_BUKRS,LV_BUKRS1,LV_KST01,G_MESSAGE_V1,G_MESSAGE_V2,lv_bukrs_in,lv_BTRTL,LV_BUKRS_IN.
SELECT SINGLE BUKRS FROM T001K INTO LV_BUKRS WHERE BWKEY = *AFVGD-WERKS.
IF LV_BUKRS IS NOT INITIAL.
LV_BUKRS_IN = LV_BUKRS.
ENDIF.
SELECT SINGLE BUKRS BTRTL FROM PA0001 INTO (LV_BUKRS1,lv_BTRTL) WHERE PERNR = CYSPLITIN-OBJEKTID AND ENDDA >= CYSPLITIN-DATE .
IF LV_BUKRS <> LV_BUKRS1.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'Not Allowed for' 'Company Code' lv_bukrs INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 .
ENDIF.
IF LV_BUKRS_IN = 'IN10' .
IF *AFVGD-WERKS = 'IN11'.
IF *AFVGD-WERKS = lv_BTRTL.
ELSE.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' *AFVGD-WERKS INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 ."DISPLAY LIKE 'E'.
ENDIF.
elseif *AFVGD-WERKS = 'IN10' or *AFVGD-WERKS = 'IN12' or *AFVGD-WERKS = 'IN13'.
IF lv_BTRTL = 'IN11'.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' CYSPLITIN-OBJEKTID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' *AFVGD-WERKS INTO G_MESSAGE_V2 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V2.
MESSAGE E000(ZPS_MSG) WITH G_MESSAGE_V1 G_MESSAGE_V2 .
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
FM name HR_PERSON_SELECT
FUNCTION HR_PERSON_SELECT.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module HR_PERSON_SELECT, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZCJ20N_VALIDATE_PERSON_ASSIGN1. "active version
********* added by - 12.04.2015
break testing.
data: it_dynpread type standard table of dynpread,
ls_dynpread type dynpread.
data : lv_act_per_assign_flag,
lv_repid type sy-repid,
lv_dynnr type sy-dynnr.
clear : lv_act_per_assign_flag,it_dynpread[].
if sy-uname = 'TESTING' .
if sy-tcode = 'CJ20N'.
lv_repid = 'SAPLCONW'.
lv_dynnr = '1700'.
CALL FUNCTION 'DYNP_VALUES_READ'
exporting
dyname = lv_repid
dynumb = lv_dynnr
request = 'A'
tables
dynpfields = it_dynpread.
read table it_dynpread into ls_dynpread with key fieldname = 'AFVGD-ARBPL' stepl = '0' .
if sy-subrc = 0 and ls_dynpread-fieldvalue is not initial.
lv_act_per_assign_flag = 'X'.
endif.
if lv_act_per_assign_flag is not initial and string_name is not initial.
break testing.
endif.
endif.
endif.
********* end of added by - 12.04.2015 - Reg
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
No comments:
Post a Comment