Advertisement
yaramohamed78

Untitled

Feb 23rd, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 4.53 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  Z_ASSESSMENT_RECORDS_REPORT
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8.  
  9. REPORT Z_ASSESSMENT_RECORDS_REPORT.
  10. TABLES zhcm_pernr.
  11. *INFOTYPES:  9913 , 9914.
  12. DATA: it_9913 TYPE STANDARD TABLE OF p9913 WITH HEADER LINE .
  13. DATA: it_9914 TYPE STANDARD TABLE OF p9914 WITH HEADER LINE .
  14.  
  15. TYPES :
  16. BEGIN OF t_master_data,
  17.   pernr TYPE pa0001-pernr,
  18.   name TYPE emnam,
  19.   END OF t_master_data.
  20.  
  21. TYPES: BEGIN OF t_english.
  22.         INCLUDE TYPE  t_master_data.
  23.         INCLUDE TYPE  ps9913.
  24. TYPES: END OF t_english.
  25.  
  26.  
  27. TYPES: BEGIN OF t_appraisal.
  28.         INCLUDE TYPE  t_master_data.
  29.         INCLUDE TYPE  ps9914.
  30. TYPES: END OF t_appraisal.
  31.  
  32. DATA it_english   TYPE  TABLE OF t_english   WITH HEADER LINE.
  33. DATA it_appraisal TYPE  TABLE OF t_appraisal WITH HEADER LINE.
  34.  
  35. DATA: i_fcat TYPE slis_t_fieldcat_alv,
  36.       wa_fcat TYPE slis_fieldcat_alv.
  37.  
  38.  
  39. * Selection Screen.
  40.  
  41. SELECTION-SCREEN BEGIN OF BLOCK pernr WITH FRAME TITLE text-003.
  42. SELECT-OPTIONS s_pernr FOR zhcm_pernr-zzpernr NO INTERVALS.
  43. SELECTION-SCREEN END OF BLOCK pernr.
  44.  
  45. SELECTION-SCREEN SKIP.
  46. SELECTION-SCREEN BEGIN OF BLOCK PERIOD WITH FRAME TITLE text-001.
  47. PARAMETER : P_LATEST RADIOBUTTON GROUP GR1,
  48.  
  49. P_ALL RADIOBUTTON GROUP GR1.
  50. SELECTION-SCREEN END OF BLOCK PERIOD.
  51.  
  52. SELECTION-SCREEN BEGIN OF BLOCK REPORT_TYPE WITH FRAME TITLE text-002.
  53. PARAMETER : P_PROF RADIOBUTTON GROUP GR2,
  54. P_TALENT RADIOBUTTON GROUP GR2,
  55. P_TEST RADIOBUTTON GROUP GR2,
  56. P_APP RADIOBUTTON GROUP GR2.
  57. SELECTION-SCREEN END OF BLOCK REPORT_TYPE.
  58.  
  59. INITIALIZATION.
  60.  
  61. *PERFORM f_initialize.
  62.  
  63. START-OF-SELECTION.
  64.  
  65. * 1)Check Personnal Number .
  66.  
  67.   DATA r_pernr TYPE TABLE OF selopt WITH HEADER LINE.
  68.  
  69.   IF s_pernr IS NOT INITIAL.
  70.     MOVE-CORRESPONDING s_pernr[] TO r_pernr[].
  71.   ELSE.
  72.     CLEAR r_pernr[].
  73.   ENDIF.
  74.  
  75. IF P_APP = 'X'.
  76.   PERFORM f_get_appraisal_data.
  77.   IF it_appraisal IS NOT INITIAL.
  78.  
  79. *Start Forming the ALV
  80.   CLEAR wa_fcat.
  81.   CLEAR i_fcat[].
  82.   wa_fcat-outputlen = 15.
  83.   wa_fcat-col_pos = '1'.
  84.   wa_fcat-fieldname = 'PERNR'.
  85.   wa_fcat-seltext_m = 'Personnel No.'.
  86.   APPEND wa_fcat TO i_fcat.
  87.   CLEAR wa_fcat.
  88.   wa_fcat-outputlen = 40.
  89.   wa_fcat-col_pos = '2'.
  90.   wa_fcat-fieldname = 'NAME'.
  91.   wa_fcat-seltext_m = 'Name'.
  92.   APPEND wa_fcat TO i_fcat.
  93.   CLEAR wa_fcat.
  94.     wa_fcat-outputlen = 40.
  95.   wa_fcat-col_pos = '3'.
  96.   wa_fcat-fieldname = 'APPRAISAL_DATE'.
  97.   wa_fcat-seltext_m = 'Appraisal Date'.
  98.   APPEND wa_fcat TO i_fcat.
  99.   CLEAR wa_fcat.
  100.       wa_fcat-outputlen = 40.
  101.   wa_fcat-col_pos = '4'.
  102.   wa_fcat-fieldname = 'OVERALL_RATING'.
  103.   wa_fcat-seltext_m = 'Overall Rating'.
  104.   APPEND wa_fcat TO i_fcat.
  105.   CLEAR wa_fcat.
  106.  
  107. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  108.     EXPORTING
  109.       i_structure_name = 'PS9914'
  110.       it_fieldcat      = i_fcat
  111.       i_grid_title     = 'Appraisal Report'
  112.     TABLES
  113.       t_outtab         = it_appraisal.
  114.   ENDIF.
  115.  
  116. ELSEIF P_TEST = 'X'.
  117.  
  118. ENDIF.
  119.  
  120.  
  121.  
  122. FORM f_get_appraisal_data .
  123.  
  124.   CLEAR it_appraisal[].
  125.   CLEAR it_9914[].
  126.  
  127.    CALL FUNCTION 'Z_INFOTYPE_9914'
  128.      TABLES
  129.        IM_PERNRS_SELOPT       = r_pernr
  130.        EX_TAB_INFTY           = it_9914
  131.              .
  132.   IF it_9914[] IS NOT INITIAL.
  133.     PERFORM f_fill_appraisal_data.
  134.   ENDIF.
  135. ENDFORM.
  136.  
  137. FORM f_fill_appraisal_data .
  138.  
  139. *Clear Internal Table.
  140.   CLEAR it_appraisal[].
  141.  
  142. *Personal Data BAPI
  143.   DATA it_personal_data TYPE TABLE OF bapip0001b.
  144. **
  145.   MOVE-CORRESPONDING it_9914[] TO it_appraisal[].
  146.  
  147. *Start Looping through the personal data
  148.   LOOP AT it_appraisal.
  149.     CLEAR it_personal_data[].
  150.  
  151.     CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'
  152.       EXPORTING
  153.         employee_id    = it_appraisal-pernr
  154.       TABLES
  155.         org_assignment = it_personal_data
  156. *       PERSONAL_DATA  =
  157. *       INTERNAL_CONTROL       =
  158. *       COMMUNICATION  =
  159. *       ARCHIVELINK    =
  160.       .
  161.  
  162. *Add name to the data
  163.     CHECK it_personal_data IS NOT INITIAL.
  164.     it_appraisal-name = it_personal_data[ 1 ]-name.
  165.     MODIFY it_appraisal.
  166.   ENDLOOP .
  167. ENDFORM.
  168.  
  169.  
  170. *  CLEAR it_profile_ext[].
  171. *    CLEAR it_profile_9188[].
  172. *  CALL FUNCTION 'ZHCM_GET_PROFILE_XT_9188'
  173. *    EXPORTING
  174. *      im_latest_only   = p_latest
  175. *    TABLES
  176. *      im_pernrs_selopt = r_pernr
  177. *      ex_tab_infty     = it_profile_9188.
  178. *  IF it_profile_9188[] IS NOT INITIAL.
  179. *    PERFORM f_fill_prf_ext.
  180. *
  181. *  ELSE.
  182. *    MESSAGE 'No talent test data found for selected personal no.' TYPE 'I'.
  183. *  ENDIF.
  184. *ENDFORM.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement