Advertisement
yaramohamed78

test2

Feb 23rd, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.11 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_9912 TYPE STANDARD TABLE OF p9912 WITH HEADER LINE .
  13. DATA: it_9913 TYPE STANDARD TABLE OF p9913 WITH HEADER LINE .
  14. DATA: it_9914 TYPE STANDARD TABLE OF p9914 WITH HEADER LINE .
  15.  
  16.  
  17. TYPES :
  18. BEGIN OF t_master_data,
  19. pernr TYPE pa0001-pernr,
  20. name TYPE emnam,
  21. END OF t_master_data.
  22.  
  23.  
  24. TYPES: BEGIN OF t_talent.
  25. INCLUDE TYPE t_master_data.
  26. INCLUDE TYPE ps9912.
  27. TYPES: END OF t_talent.
  28.  
  29.  
  30. TYPES: BEGIN OF t_english.
  31. INCLUDE TYPE t_master_data.
  32. INCLUDE TYPE ps9913.
  33. TYPES: END OF t_english.
  34.  
  35.  
  36. TYPES: BEGIN OF t_appraisal.
  37. INCLUDE TYPE t_master_data.
  38. INCLUDE TYPE ps9914.
  39. TYPES: END OF t_appraisal.
  40.  
  41. DATA it_talent TYPE TABLE OF t_talent WITH HEADER LINE.
  42. DATA it_english TYPE TABLE OF t_english WITH HEADER LINE.
  43. DATA it_appraisal TYPE TABLE OF t_appraisal WITH HEADER LINE.
  44.  
  45. DATA: i_fcat TYPE slis_t_fieldcat_alv,
  46. wa_fcat TYPE slis_fieldcat_alv.
  47.  
  48.  
  49. * Selection Screen.
  50.  
  51. SELECTION-SCREEN BEGIN OF BLOCK pernr WITH FRAME TITLE text-003.
  52. SELECT-OPTIONS s_pernr FOR zhcm_pernr-zzpernr NO INTERVALS.
  53. SELECTION-SCREEN END OF BLOCK pernr.
  54.  
  55. SELECTION-SCREEN SKIP.
  56. SELECTION-SCREEN BEGIN OF BLOCK PERIOD WITH FRAME TITLE text-001.
  57. PARAMETER : P_LATEST RADIOBUTTON GROUP GR1,
  58.  
  59. P_ALL RADIOBUTTON GROUP GR1.
  60. SELECTION-SCREEN END OF BLOCK PERIOD.
  61.  
  62. SELECTION-SCREEN BEGIN OF BLOCK REPORT_TYPE WITH FRAME TITLE text-002.
  63. PARAMETER : P_PROF RADIOBUTTON GROUP GR2,
  64. P_TALENT RADIOBUTTON GROUP GR2,
  65. P_TEST RADIOBUTTON GROUP GR2,
  66. P_APP RADIOBUTTON GROUP GR2.
  67. SELECTION-SCREEN END OF BLOCK REPORT_TYPE.
  68.  
  69. INITIALIZATION.
  70.  
  71. *PERFORM f_initialize.
  72.  
  73. START-OF-SELECTION.
  74.  
  75. * 1)Check Personnal Number .
  76.  
  77. DATA r_pernr TYPE TABLE OF selopt WITH HEADER LINE.
  78.  
  79. IF s_pernr IS NOT INITIAL.
  80. MOVE-CORRESPONDING s_pernr[] TO r_pernr[].
  81. ELSE.
  82. CLEAR r_pernr[].
  83. ENDIF.
  84.  
  85. IF P_APP = 'X'.
  86. PERFORM f_get_appraisal_data.
  87. IF it_appraisal IS NOT INITIAL.
  88.  
  89. *Start Forming the ALV
  90. CLEAR wa_fcat.
  91. CLEAR i_fcat[].
  92. wa_fcat-outputlen = 15.
  93. wa_fcat-col_pos = '1'.
  94. wa_fcat-fieldname = 'PERNR'.
  95. wa_fcat-seltext_m = 'Personnel No.'.
  96. APPEND wa_fcat TO i_fcat.
  97. CLEAR wa_fcat.
  98. wa_fcat-outputlen = 40.
  99. wa_fcat-col_pos = '2'.
  100. wa_fcat-fieldname = 'NAME'.
  101. wa_fcat-seltext_m = 'Name'.
  102. APPEND wa_fcat TO i_fcat.
  103. CLEAR wa_fcat.
  104. wa_fcat-outputlen = 40.
  105. wa_fcat-col_pos = '3'.
  106. wa_fcat-fieldname = 'APPRAISAL_DATE'.
  107. wa_fcat-seltext_m = 'Appraisal Date'.
  108. APPEND wa_fcat TO i_fcat.
  109. CLEAR wa_fcat.
  110. wa_fcat-outputlen = 40.
  111. wa_fcat-col_pos = '4'.
  112. wa_fcat-fieldname = 'OVERALL_RATING'.
  113. wa_fcat-seltext_m = 'Overall Rating'.
  114. APPEND wa_fcat TO i_fcat.
  115. CLEAR wa_fcat.
  116.  
  117. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  118. EXPORTING
  119. i_structure_name = 'PS9914'
  120. it_fieldcat = i_fcat
  121. i_grid_title = 'Appraisal Report'
  122. TABLES
  123. t_outtab = it_appraisal.
  124. ENDIF.
  125.  
  126. ELSEIF P_TEST = 'X'.
  127. PERFORM f_get_test_data.
  128. IF it_english IS NOT INITIAL.
  129.  
  130.  
  131. *Start Forming the ALV
  132. CLEAR wa_fcat.
  133. CLEAR i_fcat[].
  134. wa_fcat-outputlen = 15.
  135. wa_fcat-col_pos = '1'.
  136. wa_fcat-fieldname = 'PERNR'.
  137. wa_fcat-seltext_m = 'Personnel No.'.
  138. APPEND wa_fcat TO i_fcat.
  139. CLEAR wa_fcat.
  140. wa_fcat-outputlen = 40.
  141. wa_fcat-col_pos = '2'.
  142. wa_fcat-fieldname = 'NAME'.
  143. wa_fcat-seltext_m = 'Name'.
  144. APPEND wa_fcat TO i_fcat.
  145. CLEAR wa_fcat.
  146. wa_fcat-outputlen = 40.
  147. wa_fcat-col_pos = '3'.
  148. wa_fcat-fieldname = 'ZTEST_DATE'.
  149. wa_fcat-seltext_m = 'English Test Date'.
  150. APPEND wa_fcat TO i_fcat.
  151. CLEAR wa_fcat.
  152. wa_fcat-outputlen = 40.
  153. wa_fcat-col_pos = '4'.
  154. wa_fcat-fieldname = 'ZPROGRAM'.
  155. wa_fcat-seltext_m = 'Program'.
  156. APPEND wa_fcat TO i_fcat.
  157. CLEAR wa_fcat.
  158. wa_fcat-outputlen = 40.
  159. wa_fcat-col_pos = '5'.
  160. wa_fcat-fieldname = 'ZTEST'.
  161. wa_fcat-seltext_m = 'Test'.
  162. APPEND wa_fcat TO i_fcat.
  163. CLEAR wa_fcat.
  164. wa_fcat-outputlen = 40.
  165. wa_fcat-col_pos = '6'.
  166. wa_fcat-fieldname = 'ZRESULT'.
  167. wa_fcat-seltext_m = 'Result'.
  168. APPEND wa_fcat TO i_fcat.
  169. CLEAR wa_fcat.
  170. wa_fcat-outputlen = 40.
  171. wa_fcat-col_pos = '7'.
  172. wa_fcat-fieldname = 'ZPERCENT'.
  173. wa_fcat-seltext_m = 'Percent'.
  174. APPEND wa_fcat TO i_fcat.
  175. CLEAR wa_fcat.
  176. wa_fcat-outputlen = 40.
  177. wa_fcat-col_pos = '8'.
  178. wa_fcat-fieldname = 'ZREFERENCE_REPORT_NO'.
  179. wa_fcat-seltext_m = 'Reference Report No'.
  180. APPEND wa_fcat TO i_fcat.
  181. CLEAR wa_fcat.
  182.  
  183. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  184. EXPORTING
  185. i_structure_name = 'PS9913'
  186. it_fieldcat = i_fcat
  187. i_grid_title = 'English Test'
  188. TABLES
  189. t_outtab = it_english.
  190. ENDIF.
  191.  
  192. ENDIF.
  193.  
  194.  
  195.  
  196. FORM f_get_appraisal_data .
  197.  
  198. CLEAR it_appraisal[].
  199. CLEAR it_9914[].
  200.  
  201. CALL FUNCTION 'Z_INFOTYPE_9914'
  202. TABLES
  203. IM_PERNRS_SELOPT = r_pernr
  204. EX_TAB_INFTY = it_9914
  205. .
  206. IF it_9914[] IS NOT INITIAL.
  207. PERFORM f_fill_appraisal_data.
  208. ENDIF.
  209. ENDFORM.
  210.  
  211. FORM f_get_test_data .
  212.  
  213. CLEAR it_english[].
  214. CLEAR it_9913[].
  215.  
  216. CALL FUNCTION 'Z_INFOTYPE_9913'
  217. TABLES
  218. IM_PERNRS_SELOPT = r_pernr
  219. EX_TAB_INFTY = it_9913
  220. .
  221. IF it_9913[] IS NOT INITIAL.
  222. PERFORM f_fill_test_data.
  223. ENDIF.
  224. ENDFORM.
  225.  
  226. FORM f_fill_appraisal_data .
  227.  
  228. *Clear Internal Table.
  229. CLEAR it_appraisal[].
  230.  
  231. *Personal Data BAPI
  232. DATA it_personal_data TYPE TABLE OF bapip0001b.
  233. **
  234. MOVE-CORRESPONDING it_9914[] TO it_appraisal[].
  235.  
  236. *Start Looping through the personal data
  237. LOOP AT it_appraisal.
  238. CLEAR it_personal_data[].
  239.  
  240. CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'
  241. EXPORTING
  242. employee_id = it_appraisal-pernr
  243. TABLES
  244. org_assignment = it_personal_data
  245. * PERSONAL_DATA =
  246. * INTERNAL_CONTROL =
  247. * COMMUNICATION =
  248. * ARCHIVELINK =
  249. .
  250.  
  251. *Add name to the data
  252. CHECK it_personal_data IS NOT INITIAL.
  253. it_appraisal-name = it_personal_data[ 1 ]-name.
  254. MODIFY it_appraisal.
  255. ENDLOOP .
  256. ENDFORM.
  257.  
  258. *f_fill_test_data
  259. FORM f_fill_test_data .
  260.  
  261. *Clear Internal Table.
  262. CLEAR it_english[].
  263.  
  264. *Personal Data BAPI
  265. DATA it_personal_data TYPE TABLE OF bapip0001b.
  266. **
  267. MOVE-CORRESPONDING it_9913[] TO it_english[].
  268.  
  269. *Start Looping through the personal data
  270. LOOP AT it_english.
  271.  
  272. CLEAR it_personal_data[].
  273.  
  274. CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'
  275. EXPORTING
  276. employee_id = it_english-pernr
  277. TABLES
  278. org_assignment = it_personal_data
  279. * PERSONAL_DATA =
  280. * INTERNAL_CONTROL =
  281. * COMMUNICATION =
  282. * ARCHIVELINK =
  283. .
  284.  
  285. *Add name to the data
  286. CHECK it_personal_data IS NOT INITIAL.
  287.  
  288. it_english-name = it_personal_data[ 1 ]-name.
  289. MODIFY it_english.
  290. ENDLOOP .
  291. ENDFORM.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement