Пример программы для чтения результатов расчета заработной платы с помощью GET PAYROLL (ЛБД PNP)

В системе есть стандартная программа пример в которой для чтения результатов расчета зарплаты используется операция GET PAYROLL

Название программы:EXAMPLE_PNP_GET_PAYROLL

Ниже исходный код программы:

  1. ***********************************************************************
  2. * EXAMPLE Report EXAMPLE_PNP_GET_PAYROLL *
  3. * PNP: New event: GET PAYROLL for access to payroll results *
  4. * *
  5. * Use '900' as selection screen (report attributes) *
  6. * *
  7. * The selection screen can be customized by assigning a PNP payroll *
  8. * reportclass to this report (the default is PY_DEF): Go to -> *
  9. * report properties -> Button HR reportclass -> check the box "Payroll*
  10. *-reportclass -> Press create to enter the customizing view. *
  11. * *
  12. * 4.6C VRM Small changes *
  13. * *
  14. * 4.6A VRM New report *
  15. * *
  16. ***********************************************************************
  17. REPORT EXAMPLE_PNP_GET_PAYROLL.
  18.  
  19. * These three tables need to be declared for the selection screen-.
  20. * Currently, the declarations of pyorgscreen, pytimescreen HAS to
  21. * be done in addition to setting selection screen = 900 .
  22. TABLES: pernr,pyorgscreen, pytimescreen.
  23.  
  24. * Declare the country specific structure:
  25. * payXX_result with XX = country code, e.g. payDE_result for Germany
  26. * Country = 99 is an exception: If this structure is used, the
  27. * international part of every payroll result is returned regardless
  28. * of country code. In the other case, pernr's whose country code do
  29. * not fit the structure are skipped.
  30. NODES: payroll TYPE pay99_result.
  31.  
  32. * this section is example specific
  33. TABLES: t512t.
  34. DATA: wa_rt LIKE LINE OF payroll-inter-rt.
  35. DATA: wa_crt LIKE LINE OF payroll-inter-crt.
  36. DATA: wa_wpbp LIKE LINE OF payroll-inter-wpbp.
  37. Data: g_result_counter type i.
  38.  
  39. * Declarations for modifying the result list after GET PERNR
  40. DATA mylist LIKE pc261 OCCURS 0 .
  41. DATA wa_mylist LIKE LINE OF mylist.
  42. DATA pay TYPE REF TO cl_pay. "global class
  43.  
  44. * nothing to do here
  45.  
  46. *----------------------------------------
  47. GET pernr.
  48. * A progress indicator based on the number of pernrs processed / total
  49. * number of selected pernrs is automatically calculated & displayed.
  50.  
  51.  
  52. WRITE: / 'Currently working on:'(021), pernr-pernr.
  53. g_result_counter = 0.
  54.  
  55. * The infotypes could be accessed here as in any other PNP
  56. * based report. The same holds true for the infotype based
  57. * authorizations.
  58.  
  59.  
  60.  
  61. * You can use the methods of class "pay" to read and modify
  62. * the list of payroll result that is going to be processed at
  63. * the <get payroll> event. However, these method calls might
  64. * change with the next release.
  65.  
  66. CREATE OBJECT pay.
  67. * pay->LDB = 'SAPDB_MY_OWN_LDB'. "only if you copied the LDB PNP
  68.  
  69. CALL METHOD pay->read_result IMPORTING list = mylist.
  70.  
  71. "delete mylist index 2. "For example: Remove an unwanted payroll result
  72.  
  73. CALL METHOD pay->write_result EXPORTING list = mylist.
  74.  
  75. *--------------------------------------
  76. * After all payroll results for ONE pernr are processed, the event GET
  77. * LATE is triggered. A good place to e. g. sum up results.
  78. GET pernr LATE.
  79.  
  80. SKIP 1.
  81. WRITE: / 'Found'(022), g_result_counter, 'results for #'(023),
  82. pernr-pernr.
  83. if g_result_counter = 0.
  84. 'No results ? Did you assign the right structure to node PAYROLL?'(024).
  85.  
  86. *--------------------------------------
  87. GET payroll.
  88. * At the event <payroll> the complex struture payroll is filled
  89. * with the payroll result for the specific person. The structure
  90. * of payroll is as declared above.
  91.  
  92. g_result_counter = g_result_counter + 1.
  93.  
  94. * Print some parts of the result (ignore splits for simplicity)
  95. WRITE: / '*****************************************************'.
  96. WRITE: / 'Seqnr = '(014), payroll-evp-seqnr,
  97. 'In period ='(015), payroll-inter-versc-inper,
  98. 'For period ='(016), payroll-inter-versc-fpper,
  99. 'Pay date ='(017), payroll-inter-versc-paydt.
  100.  
  101. LOOP AT payroll-inter-wpbp INTO wa_wpbp.
  102. WRITE: / 'Personal Area ='(018), wa_wpbp-werks,
  103. 'Sub Area ='(019), wa_wpbp-btrtl.
  104. SKIP 1.
  105.  
  106. LOOP AT payroll-inter-rt INTO wa_rt.
  107. SELECT SINGLE * FROM t512t
  108. WHERE sprsl EQ sy-langu
  109. AND molga EQ payroll-inter-versc-molga
  110. AND lgart EQ wa_rt-lgart.
  111. WRITE: / wa_rt-lgart,
  112. t512t-lgtxt,
  113. wa_rt-betrg CURRENCY payroll-inter-versc-waers.
  114. SKIP 1.
  115.  
  116. WRITE: / 'Cumulations:'(020).
  117. LOOP AT payroll-inter-crt INTO wa_crt.
  118. SELECT SINGLE * FROM t512t
  119. WHERE sprsl EQ sy-langu
  120. AND molga EQ payroll-inter-versc-molga
  121. AND lgart EQ wa_crt-lgart.
  122. WRITE: / wa_crt-lgart,
  123. t512t-lgtxt,
  124. wa_crt-betrg CURRENCY payroll-inter-versc-waers.

Комментарии