"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module CATS_SEARCH_WBSELEMS, End A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZWBS_F4_HELP_CAT2_PORTAL1. "active version
IF sy-cprog = 'SAPMHTTP'.
* BREAK-POINT.
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(1),
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 : lv_count type N LENGTH 2,
mid1,
MID2.
DATA : LV_DATE TYPE d,
lv_date1 TYPE d.
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 TYPE STANDARD TABLE OF DYNPREAD,
W_DYNPFIELDS TYPE DYNPREAD.
data : ls_0105 TYPE pa0105,
gv_pernr type pa0105-pernr.
*v_pernr = CATSFIELDS-PERNR.
IF gv_pernr IS INITIAL.
SELECT SINGLE * FROM pa0105 INTO ls_0105
WHERE subty = '0001' AND usrid = sy-uname
AND endda >= sy-datum AND begda <= sy-datum.
IF sy-subrc = 0.
gv_pernr = ls_0105-pernr.
ENDIF.
ENDIF.
IF GT_PA0000[] IS INITIAL.
SELECT
PERNR
ENDDA
BEGDA
STAT2
FROM PA0000
INTO TABLE GT_PA0000
WHERE pernr = gv_pernr and
STAT2 = '3'.
ENDIF.
CLEAR : LV_DATE,lv_date1.
*LV_DATE = SY-DATUM. " cmd by chellam - 23.06.2016
LV_DATE = CATSFIELDS-inputdate. " added by chellam - 23.06.2016
lv_date1 = CATSFIELDS-inputdate + 7.
IF lv_date IS INITIAL
OR lv_date = space.
lv_date = sy-datum - 10.
lv_date1 = sy-datum + 10.
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'
AND begda <= lv_date1 AND endda >= lv_date.
ENDIF.
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.
import lv_count to lv_count from MEMORY id 'mid1'.
lv_count = lv_count + 1.
export lv_count from lv_count to MEMORY id 'mid1'.
*if lv_count = 1.
IF GT_FINAL[] IS NOT INITIAL.
refresh :tmp_result[],e_results[].
clear : tmp_result,e_results.
LOOP at gt_final INTO gs_final.
WRITE gs_final-wbs TO tmp_result-result LEFT-JUSTIFIED.
WRITE gs_final-wbs_name TO tmp_result-result2 LEFT-JUSTIFIED.
WRITE gs_final-wbs TO tmp_result-field1 LEFT-JUSTIFIED.
WRITE gs_final-wbs_name TO tmp_result-field2 LEFT-JUSTIFIED.
WRITE gs_final-wbs_name TO tmp_result-field3 LEFT-JUSTIFIED.
APPEND tmp_result.
ENDLOOP.
e_results[] = tmp_result[].
EXPORT tmp_result = tmp_result TO MEMORY ID 'MID2'.
ENDIF.
EXIT.
*ENDIF.
endif.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
ENDFUNCTION.
No comments:
Post a Comment