Skip to Content
0
Former Member
Feb 25, 2009 at 01:09 PM

Report for wage type from infotype 0014

127 Views

Hi All

I am trying developing a report , where selection criteria is payroll area which is GM, wage type between 8107 - 8212, for current payroll period.

the out put require

urn - p0014-zuord

amt - p0014-betrg

frst_name- p0002-vorna

etc

I want the records to be displayed per wagetype .

I have written the follwoing code.......... but it doesnt displays the records which full fill the criteria per wage tyep.

&----


*& Report ZSAYE

*&

&----


*&

*&

&----


REPORT ZSAYE.

nodes pernr.

tables : t512t.

infotypes : 0002, 0014, 0000.

data : f_datum like sy-datum.

data : l_datum like sy-datum.

types: begin of header,

head(6) type c,

clnt_code(10) type c,

Contact_Name(70) type c,

Contact_number(20) type c,

fadte(16) type c,

no_of_recs(6) type c,

cont_src_unit(40) type c,

due_dt(9) type c,

locate_type type c,

file_type_ind(2) type c,

curr(3) type c,

file_freq(1) type c,

total_funds(15) type c,

end of header.

data : t_fh type standard table of header,

h_fh type header.

types : begin of t_det,

party_urn like p0014-zuord,

hold_urn like p0014-zuord,

contr_amt(15) type c,

prefix(20) type c,

frst_name like p0002-vorna,

last_name like p0002-nachn,

ni like p0002-perid,

tax_id(50) type c,

pay_ref like p0000-pernr,

payroll_unit(20) type c,

corp_unit(20) type c,

legacy_acc_no(7) type c,

legacy_seccd(3) type c,

end of t_det.

data : t_tab type standard table of t_det,

wa_tab type t_det.

data : wa_p0002 LIKE p0002,

wa_p0014 like p0014.

data : v_atext type t522t-atext.

*SELECT-OPTIONS: language FOR p0002-sprsl.

PARAMETERS: p_lgart NO-DISPLAY DEFAULT '1'. " radiobutton group rg1

PARAMETERS: p_pernr NO-DISPLAY. "radiobutton group rg1

SELECT-OPTIONS: s_lgart FOR t512t-lgart.

SELECTION-SCREEN: SKIP.

parameters: p_file(128) TYPE c DEFAULT '
Tlasapd1\Intrface\saye\test.txt'.

initialization.

PERFORM initial_values.

&----


*& Form INITIAL_VALUES

&----


  • Set initial values for selection criteria *

----


FORM initial_values.

  • Payroll Period

MOVE 'GM' TO pnpxabkr.

  • Payroll Areas

CLEAR pnpabkrs.

MOVE: 'GM' TO pnpabkrs-low,

'I' TO pnpabkrs-sign,

'EQ' TO pnpabkrs-option.

APPEND pnpabkrs.

  • Wage Types

CLEAR pnpabkrs.

MOVE: '8100' TO s_lgart-low,

'8212' TO s_lgart-high,

'I' TO s_lgart-sign,

'BT' TO s_lgart-option.

APPEND s_lgart.

ENDFORM. " INITIAL_VALUES

start-of-selection.

*FILE HEADER SEGMENT

***********************

h_fh-head = 'HEADER'.

h_fh-clnt_code = 'CLIENTCODE'.

h_fh-Contact_Name = 'LYNSEY CORDER'.

h_fh-Contact_number = '(+44)207-540-1400'.

h_fh-fadte = SY-DATUM.

h_fh-no_of_recs = 'OPTIONAL' .

h_fh-cont_src_unit = 'MANDATORY'.

h_fh-due_dt = 'MANDATORY'.

h_fh-locate_type = 'P'.

h_fh-file_type_ind = 'EF'.

h_fh-curr = 'GBP'.

h_fh-file_freq = 'W'.

h_fh-total_funds = 'TOTALFUNDS'.

Append H_FH TO T_FH.

  • cl_abap_file_utilities=>create_utf8_file_with_bom(

*EXPORTING file_name = p_file ).

*

open dataset p_file for output in text mode ENCODING UTF-8.

transfer H_FH TO p_file.

  • CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

  • EXPORTING

  • IV_DATE = sy-datum

  • IMPORTING

  • EV_MONTH_BEGIN_DATE = f_datum

  • EV_MONTH_END_DATE = l_datum.

get pernr.

RP-PROVIDE-FROM-LAST P0014 SPACE PN-BEGDA PN-ENDDA.

RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA.

if pernr-abkrs = 'GM'.

if p0014-lgart between s_lgart-low and s_lgart-high.

sort s_lgart.

  • provide * into wa_p0014 from p0014 between pn-begda and pn-endda.

  • wa_tab-party_urn = wa_p0014-zuord.

  • wa_tab-hold_urn = wa_p0014-zuord.

  • wa_tab-contr_amt = wa_p0014-betrg.

  • endprovide.

*

  • provide * into wa_p0002 from p0002 between pn-begda and pn-endda.

*

  • wa_tab-prefix = wa_p0002-anred.

  • wa_tab-frst_name = wa_p0002-vorna.

  • wa_tab-last_name = wa_p0002-nachn.

  • wa_tab-ni = wa_p0002-perid.

  • wa_tab-pay_ref = wa_p0002-pernr.

  • endprovide.

IF pnp-sw-found EQ '1'.

wa_tab-party_urn = p0014-zuord.

wa_tab-hold_urn = p0014-zuord.

wa_tab-contr_amt = p0014-betrg.

select single atext from t522t into v_atext where sprsl = 'E' and anred = p0002-anred.

wa_tab-prefix = v_atext.

wa_tab-frst_name = p0002-vorna.

wa_tab-last_name = p0002-nachn.

wa_tab-ni = wa_p0002-perid.

wa_tab-tax_id = ''.

wa_tab-pay_ref = wa_p0002-pernr.

wa_tab-payroll_unit = ''.

wa_tab-corp_unit = ''.

wa_tab-legacy_acc_no = ''.

wa_tab-legacy_seccd = ''.

if sy-subrc = 0.

append wa_tab to t_tab.

transfer wa_tab TO p_file.

write : / wa_tab.

clear wa_tab.

endif.

endif.

endif.

endif.

*end-of-selection.

*open dataset p_file for output in text mode ENCODING UTF-8.

*transfer wa_tab TO p_file .

*CLOSE DATASET p_file.