Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REPORT zhr_payslip_period." NO STANDARD PAGE HEADING LINE-SIZE 132.
- TABLES pernr.
- INFOTYPES: 0001.
- SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
- SELECTION-SCREEN BEGIN OF LINE.
- SELECTION-SCREEN COMMENT 1(31) text-t01 FOR FIELD p_month1.
- PARAMETERS p_month1 LIKE pnppabrp OBLIGATORY.
- PARAMETERS p_yaer1 LIKE pnppabrj OBLIGATORY.
- SELECTION-SCREEN COMMENT 50(10) text-t02 FOR FIELD p_month2.
- PARAMETERS p_month2 LIKE pnppabrp OBLIGATORY.
- PARAMETERS p_yaer2 LIKE pnppabrj OBLIGATORY.
- SELECTION-SCREEN END OF LINE.
- PARAMETERS p_report LIKE sy-repid DEFAULT 'HRUCEDT0' NO-DISPLAY.
- PARAMETERS p_vari LIKE rsvar-variant DEFAULT 'CUS&RG2' OBLIGATORY.
- PARAMETERS p_double AS CHECKBOX USER-COMMAND but01.
- SELECTION-SCREEN END OF BLOCK b1.
- PARAMETERS c_line TYPE i DEFAULT '75'."'65'.
- "PARAMETERS c_line_count TYPE i DEFAULT '75'."'65'.
- CONSTANTS c_line_size TYPE i VALUE '132'.
- CONSTANTS c_line_size_2 TYPE i VALUE '238'. "'227'.
- CONSTANTS c_pos_2 TYPE i VALUE '127'."'115'.
- DATA g_flag.
- DATA g_linno TYPE sy-linno.
- DATA g_line_size TYPE i.
- DATA g_period_from TYPE pc261-fpper.
- DATA g_period_to TYPE pc261-fpper.
- DATA g_period_cur TYPE pc261-fpper.
- DATA gt_549q LIKE TABLE OF t549q WITH HEADER LINE.
- DATA l_index TYPE sy-tabix.
- *=======================================================================
- AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
- PERFORM f4_variant.
- AT SELECTION-SCREEN OUTPUT.
- IF ( p_double IS INITIAL ).
- p_vari = 'CUS&RG2'.
- ELSE.
- p_vari = 'CUS&RG-EMPL_2'. "'CUS&RUSG-EMPL'.
- ENDIF.
- *=======================================================================
- INITIALIZATION.
- p_month1 = p_month2 = sy-datum+4(2).
- p_yaer1 = p_yaer2 = sy-datum(4).
- *=======================================================================
- START-OF-SELECTION.
- g_linno = sy-linno.
- CONCATENATE p_yaer1 p_month1 INTO g_period_from.
- CONCATENATE p_yaer2 p_month2 INTO g_period_to.
- IF ( g_period_from > g_period_to ).
- MESSAGE i015(hrbas00_pnpce).
- REJECT.
- ENDIF.
- SELECT * INTO TABLE gt_549q FROM t549q WHERE permo = '01'
- AND pabrj <= p_yaer2
- AND pabrj >= p_yaer1.
- IF ( p_double IS INITIAL ).
- g_line_size = c_line_size.
- ELSE.
- g_line_size = c_line_size_2.
- ENDIF.
- NEW-PAGE LINE-COUNT c_line
- LINE-SIZE g_line_size.
- *=======================================================================
- GET pernr.
- g_period_cur = g_period_from.
- WHILE g_period_cur <= g_period_to.
- READ TABLE gt_549q WITH KEY pabrj = g_period_cur(4)
- pabrp = g_period_cur+4(2).
- IF ( sy-subrc = 0 ).
- l_index = sy-tabix + 1.
- ELSE.
- MESSAGE e505(pg) WITH g_period_cur+4(2) g_period_cur(4).
- EXIT.
- ENDIF.
- PERFORM get_data USING g_period_cur+4(2) g_period_cur(4).
- READ TABLE gt_549q INDEX l_index.
- IF ( sy-subrc = 0 ).
- CONCATENATE gt_549q-pabrj gt_549q-pabrp INTO g_period_cur.
- ELSE.
- EXIT.
- ENDIF.
- ENDWHILE.
- *=======================================================================
- FORM get_data USING p_month p_year.
- DATA lv_lines TYPE i.
- DATA lt_data TYPE TABLE OF abaplist.
- DATA contents_data TYPE TABLE OF solisti1.
- DATA ls_contents_data TYPE solisti1.
- * Чистим память перед импортом результата
- DO.
- CALL FUNCTION 'LIST_FREE_MEMORY'
- TABLES
- listobject = lt_data.
- CALL FUNCTION 'LIST_FROM_MEMORY'
- TABLES
- listobject = lt_data
- EXCEPTIONS
- not_found = 1
- OTHERS = 2.
- CHECK sy-subrc <> 0.
- EXIT.
- ENDDO.
- rp-provide-from-last p0001 '' pn-begda pn-endda.
- SUBMIT (p_report) USING SELECTION-SET p_vari
- WITH pnppernr EQ pernr-pernr
- WITH pnpxabkr EQ p0001-abkrs "pnpxabkr
- WITH pnpabkrs IN pnpabkrs
- WITH pnptimr9 EQ abap_false "pnptimr9
- WITH pnptimra EQ abap_true "pnptimra
- WITH pnppabrp EQ p_month
- WITH pnppabrj EQ p_year
- WITH prt_prot EQ ' '
- EXPORTING LIST TO MEMORY
- AND RETURN.
- CALL FUNCTION 'LIST_FROM_MEMORY'
- TABLES
- listobject = lt_data
- EXCEPTIONS
- not_found = 1
- OTHERS = 2.
- CALL FUNCTION 'LIST_TO_ASCI'
- TABLES
- listasci = contents_data
- listobject = lt_data
- EXCEPTIONS
- empty_list = 1
- list_index_invalid = 2
- OTHERS = 3.
- IF ( sy-subrc = 0 AND g_flag = abap_true ).
- * NEW-PAGE.
- "SKIP.
- ENDIF.
- lv_lines = lines( contents_data ).
- lv_lines = lv_lines + g_linno.
- IF ( lv_lines > c_line ).
- NEW-PAGE LINE-COUNT c_line
- LINE-SIZE g_line_size.
- ENDIF.
- LOOP AT contents_data INTO ls_contents_data.
- IF ( ls_contents_data IS INITIAL ).
- SKIP.
- ELSE.
- IF ( p_double IS INITIAL ).
- WRITE: / ls_contents_data.
- ELSE.
- WRITE: /14(c_line_size) ls_contents_data,
- AT c_pos_2(c_line_size) ls_contents_data.
- ENDIF.
- ENDIF.
- ENDLOOP.
- IF ( sy-subrc = 0 ).
- g_flag = abap_true.
- g_linno = sy-linno + 1.
- ENDIF.
- ENDFORM. "get_data
- *&---------------------------------------------------------------------*
- *& Form f4_variant
- *&---------------------------------------------------------------------*
- FORM f4_variant.
- CALL FUNCTION 'RS_VARIANT_CATALOG'
- EXPORTING
- report = p_report
- new_title = text-s01
- IMPORTING
- sel_variant = p_vari
- EXCEPTIONS
- no_report = 1
- report_not_existent = 2
- report_not_supplied = 3
- no_variants = 4
- no_variant_selected = 5
- variant_not_existent = 6
- OTHERS = 7.
- ENDFORM. "f4_variant
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement