function help_start.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module HELP_START, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZWBS_F4_HELP_CAT2. "active version
IF SY-TCODE = 'CAT2' AND HELP_INFOS-FIELDNAME = 'RPROJ' AND HELP_INFOS-DYNPROFLD = 'CATSD-RPROJ'
AND HELP_INFOS-DYNPPROG = 'SAPLCATS'AND HELP_INFOS-MENUFUNCT = 'HC' .
TYPES: BEGIN OF TY_PA0000,
PERNR TYPE PA0000-PERNR,
ENDDA TYPE PA0000-ENDDA,
BEGDA TYPE PA0000-BEGDA,
STAT2 TYPE PA0000-STAT2,
END OF TY_PA0000.
DATA : GT_PA0000 TYPE TABLE OF TY_PA0000,
GS_PA0000 TYPE TY_PA0000.
TYPES : BEGIN OF TY_EMP,
OBJID TYPE HRP1001-OBJID,
VARYF TYPE HRP1001-VARYF,
BEGDA TYPE HRP1001-BEGDA,
ENDDA TYPE HRP1001-ENDDA,
SOBID TYPE HRP1001-SOBID,
PROZT TYPE HRP1001-PROZT,
DEL_FLAG,
END OF TY_EMP.
DATA : GT_HRP1001 TYPE TABLE OF TY_EMP,
GS_HRP1001 TYPE TY_EMP.
TYPES : BEGIN OF TY_FINAL,
WBS TYPE PRPS-POSID,
WBS_NAME TYPE PRPS-POST1,
END OF TY_FINAL.
DATA : GT_FINAL TYPE TABLE OF TY_FINAL,
GS_FINAL TYPE TY_FINAL.
DATA W_RETURN TYPE BAPIRETURN1.
DATA: P_RECORD TYPE P9011.
DATA : LV_SEQNR TYPE PA9011-SEQNR,
LV_CHECK_PERNR TYPE PA9011-PERNR.
DATA : LV_START_DATE TYPE SY-DATUM,
LV_END_DATE TYPE SY-DATUM.
TYPES: BEGIN OF TY_PA9011,
PERNR TYPE PA9011-PERNR,
SUBTY TYPE PA9011-SUBTY,
OBJPS TYPE PA9011-OBJPS,
SPRPS TYPE PA9011-SPRPS,
ENDDA TYPE PA9011-ENDDA,
BEGDA TYPE PA9011-BEGDA,
SEQNR TYPE PA9011-SEQNR,
AEDTM TYPE PA9011-AEDTM,
UNAME TYPE PA9011-UNAME,
CLNT_CODE TYPE PA9011-CLNT_CODE,
CLIENT TYPE PA9011-CLIENT,
TEAM_CODE TYPE PA9011-TEAM_CODE,
TEAM TYPE PA9011-TEAM,
BILLABLE TYPE PA9011-BILLABLE,
END OF TY_PA9011.
DATA : GT_PA9011 TYPE TABLE OF TY_PA9011,
GS_PA9011 TYPE PA9011.
DATA : LV_PSPHI TYPE PRPS-PSPHI.
DATA : LV_FNAME TYPE CHAR40,
LV_LNAME TYPE CHAR40,
LV_EMPNO TYPE CHAR10,
G_MESSAGE_V1 TYPE STRING,
G_MESSAGE_V2 TYPE STRING,
G_MESSAGE_V3 TYPE STRING,
G_MESSAGE_V4 TYPE STRING.
DATA: W_FIELD(40).
FIELD-SYMBOLS: <FS_START_DATE>.
DATA: W_PERNR(40).
FIELD-SYMBOLS: <FS_PERNR>.
DATA : LV_DATE TYPE CHAR10.
TYPES : BEGIN OF TY_EMP1,
EMPLOYEE_NO TYPE PA0001-PERNR,
EMPLOYEE_NAME TYPE PA0001-ENAME,
END OF TY_EMP1.
DATA : GT_FINAL1 TYPE TABLE OF TY_EMP1,
GS_FINAL1 TYPE TY_EMP1.
DATA : LV_PROJ TYPE PRPS-POSID.
DATA : GV_PRPS TYPE PRPS.
DATA : LV_INDEX TYPE I VALUE 1.
TYPES : T_RETURN_TAB TYPE DDSHRETVAL.
DATA: I_RETURN_TAB TYPE STANDARD TABLE OF T_RETURN_TAB,
W_RETURN_TAB TYPE T_RETURN_TAB.
DATA: I_DYNPFIELDS LIKE STANDARD TABLE OF DYNPREAD,
W_DYNPFIELDS TYPE DYNPREAD.
W_PERNR = '(SAPLCATS)CATSFIELDS-PERNR'.
ASSIGN (W_PERNR) TO <FS_PERNR>.
CONDENSE <FS_PERNR>.
IF GT_PA0000[] IS INITIAL.
SELECT
PERNR
ENDDA
BEGDA
STAT2
FROM PA0000
INTO TABLE GT_PA0000
WHERE PERNR = <FS_PERNR>
AND STAT2 = '3'.
ENDIF.
IF GT_PA0000[] IS NOT INITIAL.
CLEAR : GT_HRP1001[].
SELECT
OBJID
VARYF
BEGDA
ENDDA
SOBID
PROZT
FROM HRP1001
INTO CORRESPONDING FIELDS OF TABLE GT_HRP1001
FOR ALL ENTRIES IN GT_PA0000
WHERE OBJID = GT_PA0000-PERNR
AND OTYPE = 'P'
AND SCLAS = 'PJ' .
ENDIF.
* W_FIELD = '(SAPLCATS)CATSFIELDS-DATEFROM'.
* ASSIGN (W_FIELD) TO <FS_START_DATE>.
* CONDENSE <FS_START_DATE>.
* LV_DATE = <FS_START_DATE>.
data : gv_workdate type char10,
mid3(3).
clear : gv_workdate.
IMPORT gv_workdate TO gv_workdate FROM MEMORY ID mid3.
LV_DATE = gv_workdate.
LV_INDEX = 1.
IF GT_HRP1001[] IS NOT INITIAL.
LOOP AT GT_HRP1001 INTO GS_HRP1001.
IF LV_DATE BETWEEN GS_HRP1001-BEGDA AND GS_HRP1001-ENDDA.
GS_HRP1001-DEL_FLAG = ''.
ELSE.
GS_HRP1001-DEL_FLAG = 'X'.
ENDIF.
MODIFY GT_HRP1001 FROM GS_HRP1001 INDEX LV_INDEX TRANSPORTING DEL_FLAG.
CLEAR : GS_HRP1001.
LV_INDEX = LV_INDEX + 1.
ENDLOOP.
DELETE GT_HRP1001 WHERE DEL_FLAG = 'X'.
ENDIF.
IF GT_HRP1001[] IS NOT INITIAL.
CLEAR : GT_FINAL[].
LOOP AT GT_HRP1001 INTO GS_HRP1001.
CONCATENATE 'PR' GS_HRP1001-SOBID INTO GS_HRP1001-SOBID.
CONDENSE GS_HRP1001-SOBID.
CLEAR : LV_PSPHI,LV_PROJ,GV_PRPS.
DATA : LV_PS_POSNR TYPE PRPS-PSPNR.
SELECT SINGLE PSPNR POST1 FROM PRPS INTO ( LV_PS_POSNR,GS_FINAL-WBS_NAME ) WHERE OBJNR = GS_HRP1001-SOBID.
CALL FUNCTION 'CJDW_PRPS_SELECT_SINGLE'
EXPORTING
POSNR = LV_PS_POSNR
IMPORTING
E_PRPS = GV_PRPS
EXCEPTIONS
MISSING_PARAMETER = 1
NOT_FOUND = 2
OTHERS = 3.
GS_FINAL-WBS = LV_PS_POSNR.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
INPUT = GS_FINAL-WBS
IMPORTING
OUTPUT = GS_FINAL-WBS.
APPEND GS_FINAL TO GT_FINAL.
CLEAR : GS_FINAL.
LV_INDEX = LV_INDEX + 1.
ENDLOOP.
ENDIF.
IF GT_FINAL[] IS NOT INITIAL.
CLEAR : I_RETURN_TAB[],I_DYNPFIELDS[].
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'WBS'
DYNPPROG = 'SAPLCATS'
DYNPNR = '2200'
DYNPROFIELD = 'CATSD-RPROJ'
WINDOW_TITLE = ' F4 HELP FOR WBS'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = GT_FINAL
RETURN_TAB = I_RETURN_TAB.
IF SY-SUBRC = 0 AND LINES( I_RETURN_TAB ) = 1.
READ TABLE I_RETURN_TAB INTO W_RETURN_TAB INDEX 1.
SELECTION = 'X'.
SELECT_VALUE = W_RETURN_TAB-FIELDVAL.
EXIT.
ENDIF.
ENDIF.
EXIT.
ENDIF.
**********************************
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
No comments:
Post a Comment