Include name LMP01F1T
form ok_code_0350 tables t_persons type mpdb_person_table_type
changing fcode like sy-ucomm.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form OK_CODE_0350, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 3 ZCMP2_VALIDATION. "active version
******* added by - 09.06.2015
IF SY-TCODE = 'CMP2' AND FCODE = 'SAVE' AND CRHD-ARBPL IS NOT INITIAL." AND SY-UNAME = 'TESTABAP'.
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:
G_MESSAGE_V1 TYPE STRING,
G_MESSAGE_V2 TYPE STRING.
IF CRHD-ARBPL IS NOT INITIAL AND CRHD-WERKS IS NOT INITIAL.
LOOP AT T_PERSONS WHERE MARK = 'X'.
CLEAR : LV_BUKRS,LV_KST01,G_MESSAGE_V1,G_MESSAGE_V2,LV_BUKRS_IN.
SELECT SINGLE BUKRS FROM T001K INTO LV_BUKRS WHERE BWKEY = CRHD-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 = T_PERSONS-OBJID AND ENDDA >= T_PERSONS-ENDDA .
IF LV_BUKRS <> LV_BUKRS1.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' T_PERSONS-OBJID 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 CRHD-WERKS = 'IN11'.
IF CRHD-WERKS = LV_BTRTL.
ELSE.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' T_PERSONS-OBJID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' CRHD-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 CRHD-WERKS = 'IN10' OR CRHD-WERKS = 'IN12' OR CRHD-WERKS = 'IN13'.
IF LV_BTRTL = 'IN11'.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' T_PERSONS-OBJID INTO G_MESSAGE_V1 SEPARATED BY SPACE.
CONDENSE G_MESSAGE_V1.
CONCATENATE 'not allowed to plant' CRHD-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.
ENDLOOP.
ENDIF.
ELSEIF SY-TCODE = 'CMP3' AND FCODE = 'SAVE' AND AFVGD-ARBPL IS NOT INITIAL.
IF AFVGD-ARBPL IS NOT INITIAL AND AFVGD-WERKS IS NOT INITIAL.
LOOP AT T_PERSONS WHERE MARK = 'X'.
CLEAR : LV_BUKRS,LV_KST01,G_MESSAGE_V1,G_MESSAGE_V2.
LV_BUKRS = AFVGD-BUKRS.
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 = T_PERSONS-OBJID AND ENDDA >= T_PERSONS-ENDDA .
IF LV_BUKRS <> LV_BUKRS1.
CLEAR : G_MESSAGE_V1,G_MESSAGE_V2.
CONCATENATE 'Person Number:' T_PERSONS-OBJID 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:' T_PERSONS-OBJID 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.
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:' T_PERSONS-OBJID 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.
ENDLOOP.
ENDIF.
ENDIF.
******* end of added by
No comments:
Post a Comment