09-26-2008 11:08 AM
hi,
I m doing Outbound Interface and this is my requirement>pls go through the description listed below and give some suggetions.
For all employees who have Infotype 0194 records valid in the time period or payroll period selected who have the vendor selected on the selection screen, you have to read the payroll results and find the Garnishment document in the GRORD if it exists. If a time period is selected, you must search for all payroll results with a check date that falls in that time period. If a payroll period is selected, search for that particular payroll and any off-cycle payroll whose check date falls between the begin date and end date of that pay period.
Once you searched IT 0194 for Employees (EE) with the Garnishment Vendor selected and then found the payroll results to process, you must search through payroll internal GRDOC and find the same vendor. If the vendor is found, search the payroll Results Table (RT) for the V0 split which matches the GRDOC record. Then use this amount(s) for the Deduction Amount field.
In Summary:
EE Selects Time Period and Vendor -> search through table 0194 for that vendor in that time period -> for the garnishment records found, search payrolls in the time period to see if the garnishment was deducted
This are the fields i need to download with deduction amount
Case Number:
P0194-GCASE
Social Security Number:
P0002-PERID
Employee First Name:
P0002-VORNA
Employee Last Name:
P0002-NACHN
Deduction Amount:
Payroll Results RT
09-26-2008 11:30 AM
For retrieving data from infotypes:
use ldb - PNPCE in program attributes
use macro RP_PROVIDE_FROM_LAST
for payroll refer the sample code:
&----
*& Include ZMRM_HR_PAYROLL_DECLARATIONS
&----
&----
*& TABLES
*&
&----
tables : pernr.
&----
*& NODES
*&
&----
nodes : peras.
&----
*& TYPE-POOLS
*&
&----
type-pools: slis.
&----
*& STRUCTURES Begin with ty_
*&
&----
types : begin of ty_final,
pernr type p0001-pernr, "Personnel Number
name(80) type c, "Employee Name
basic type betrg, "Basic salary
absent type abwtg, "Attendance and Absence Days
gross type betrg, "Gross Salary
end of ty_final.
&----
*& INTERNAL TABLE Begin with it_
*&
&----
data : it_final type standard table of ty_final, "Final Internal table
it_rgdir type table of pc261, "Cluster directory
it_result type pay99_result, "Payroll Result
it_fieldcat type slis_t_fieldcat_alv. "Fieldcatalog
&----
*& WORK AREA Begin with wa_
*&
&----
data : wa_final type ty_final, "Final work area
wa_rt type pc207, "Work area for RT table
wa_ab type pc20i, "WOrk Area for Absent table
wa_fieldcat type slis_fieldcat_alv, "Work Area for fieldcat
wa_layout type slis_layout_alv. " Work Area for ALV layout
&----
*& INFOTYPES
*&
&----
infotypes : 0002. "Personnel data
&----
*& DATA BEGIN with w_
*&
&----
data :w_molga type molga, "Country Key
w_relid type relid_pcl, "Cluster ID
w_seqnr type pc261-seqnr. "Sequence Number
&----
*& START OF SELECTION
*&
&----
start-of-selection.
refresh it_final.
clear wa_final.
get peras.
break-point.
rp_provide_from_last p0002 space pnpbegda pnpendda.
if pnp-sw-found = 1.
wa_final-pernr = p0002-pernr.
concatenate p0002-vorna p0002-nachn into wa_final-name separated by space. " Get the employee Name
endif.
perform read_salary. " Subroutine to read from RT table
append wa_final to it_final.
&----
*& END OF SELECTION
*&
&----
end-of-selection.
wa_layout-colwidth_optimize = 'X'.
perform fill_fieldcat.
perform final_display.
form read_salary .
clear : w_molga , it_rgdir.
call function 'CU_READ_RGDIR'
exporting
persnr = p0002-pernr
BUFFER =
NO_AUTHORITY_CHECK = ' '
importing
molga = w_molga
tables
in_rgdir = it_rgdir
exceptions
no_record_found = 1
others = 2
.
*
*if it_rgdir is not INITIAL.
clear: w_seqnr.
call function 'CD_READ_LAST'
exporting
begin_date = pnpbegda
end_date = pnpendda
importing
out_seqnr = w_seqnr
tables
rgdir = it_rgdir
exceptions
no_record_found = 1
others = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
clear : w_relid.
select single relid
from t500l
into w_relid
where molga = w_molga. "Read cluster
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = w_relid
employeenumber = p0002-pernr
sequencenumber = w_seqnr
READ_ONLY_BUFFER = ' '
read_only_international = 'X'
ARC_GROUP = ' '
CHECK_READ_AUTHORITY = 'X'
FILTER_CUMULATIONS = 'X'
CLIENT =
IMPORTING
VERSION_NUMBER_PAYVN =
VERSION_NUMBER_PCL2 =
changing
payroll_result = it_result
exceptions
illegal_isocode_or_clusterid = 1
error_generating_import = 2
import_mismatch_error = 3
subpool_dir_full = 4
no_read_authority = 5
no_record_found = 6
versions_do_not_match = 7
error_reading_archive = 8
error_reading_relid = 9
others = 10
.
if sy-subrc <> 0.
endif.
sort it_result-inter-rt by lgart ascending.
read table it_result-inter-rt into wa_rt
with key lgart = '/101'
binary search.
if wa_rt is not initial.
wa_final-gross = wa_rt-betrg.
endif.
clear wa_rt.
read table it_result-inter-rt into wa_rt
with key lgart = '/121'
binary search.
if wa_rt is not initial.
wa_final-basic = wa_rt-betrg.
endif.
read table it_result-inter-ab into wa_ab
with key awart = '0100'
binary search.
if wa_ab is not initial.
wa_final-absent = wa_ab-abwtg.
endif.
endform. " read_salary
&----
*& Form fill_fieldcat
&----
text
----
--> p1 text
<-- p2 text
----
form fill_fieldcat .
refresh it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-fieldname = 'PERNR'.
wa_fieldcat-seltext_m = 'Personnel No'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext_m = 'Name'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-fieldname = 'BASIC'.
wa_fieldcat-seltext_m = 'Basic Pay'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-fieldname = 'GROSS'.
wa_fieldcat-seltext_m = 'Gross Salary'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-fieldname = 'ABSENT'.
wa_fieldcat-seltext_m = 'Absent days'.
append wa_fieldcat to it_fieldcat.
endform. " fill_fieldcat
&----
*& Form final_display
&----
text
----
--> p1 text
<-- p2 text
----
form final_display .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " final_display
09-26-2008 1:08 PM
hi milind,
Thanks for ur reply and do u understand one point in descritpion given that is finding garnishment document in GRORD.