Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

functionmodule

Former Member
0 Likes
559

Hi abapers,

my requirement is in HR module.i have to send appraisal templates to employees as per

organization number(pchobjid),template id(template),personnel area(werks),employeegroup(persg),

employee subgroup(persk).so i copird that standard report to zreport1 and add the select-options like pers area,

empl group,empl subgrp.my logic flow is:i getting positions and persons from hrp1001 table and pass the persons

pa0001 table to get the werks persg persk.

i am passing the selection screen values in submit report.

the submit report is actualy giving the output in alv report.

i am using the standard report RHXHAP_APP_DOC_PREPARE.

my problem is in output i am getting all the 20 records along with the filtered values.

the function module given below is giving the alv output.

CALL FUNCTION 'HRHAP_PA_DOCUMENT_PREP_ORG'

EXPORTING

plan_version = pchplvar

template_id = template

ap_start_date = pchbegda

ap_end_date = pchendda

t_org_units = lt_objects

  • EXTRACT_M_N = ' '

based_on_last_doc = lastdoc

skip_in_preparation = skipprep

test_run = test_run.

my coding:

loop at it_pa0001 INTO wa_pa0001 WHERE BEGDA le SY-DATUM

AND ENDDA ge sy-datum.

pchbegda = wa_pa0001-begda.

pchendda = wa_pa0001-endda.

if pchplvar = '01' and pchbegda le sy-datum and pchendda ge sy-datum.

lw_object-plvar = pchplvar.

lw_object-otype = pchotype.

lw_object-sobid = objec-objid.

APPEND lw_object TO lt_objects.

endloop.

IF pchbegda le sy-datum AND pchendda ge sy-datum.

call function module'HRHAP_PA_DOCUMENT_PREP_ORG''

endif.

please give some codings how to restrict the output of the function module.

Moderator message: please use more descriptive subject lines and code tags for your posts.

Edited by: Thomas Zloch on Dec 23, 2010 4:21 PM

3 REPLIES 3
Read only

Former Member
0 Likes
521

Hi,

I think you are using LDB PCH in your program. Please look at the report RHHAP_PA_APP_DOC_PREPARE_ORG.

While getting records from PA0001 filter using the conditions.

select ... from pa0001 where pernr = <pernr> and
                                                    endda ge sy-datum and
                                                    begda le sy-datum and
                                                    werks in s_werks and 
                                                    persg in s_persg and 
                                                    persk in s_persk.

loop at it_pa0001 INTO wa_pa0001 WHERE BEGDA le SY-DATUM
                     AND ENDDA ge sy-datum.
   pchbegda = wa_pa0001-begda.
   pchendda = wa_pa0001-endda.

if pchplvar = '01' and pchbegda le sy-datum and pchendda ge sy-datum.

lw_object-plvar = pchplvar.
lw_object-otype = pchotype.
lw_object-sobid = objec-objid.
APPEND lw_object TO lt_objects.

endif.

endloop.

sort lt_objects by plvar otype objid.
delete adjacent duplicates from lt_objects comparing plvar otype objid.

end-of-selection.

  CALL FUNCTION 'HRHAP_PA_DOCUMENT_PREP_ORG'
    EXPORTING
        plan_version        = pchplvar
        template_id         = template
        ap_start_date       = pchbegda
        ap_end_date         = pchendda
        t_org_units         = lt_objects
.
.
.


Regards,

Srini.

Read only

0 Likes
521

Thanks Srini for your reply.

i coded sobid insted of objid i.e sort lt_objects by plvar otype sobid.

delete adjacent duplicates from lt_objects comparing plvar otype sobid.

i am getting data.

here i have one more issue.while debaugging the FM HRHAP_PA_DOCUMENT_PREP_ORG

i am getting 20 records ,i mean while going into the above FM there are other FMs in backend which has a internal table which

contains 20 records.In those 20 records some records are duplicates.It is happening in standard FM.so could you please

provide me some codings to delete the duplicates entries of the standard FM.I could not find way to delete the duplicates

of standard FM.Please give me some codings.

Read only

0 Likes
521

My issue is that how to delete the duplicate entries of standard Function module.

while debagging the standard FM HRHAP_PA_DOCUMENT_PREP_ORG,I am getting 20 records in Function modules

which are in back end.but i could not make any changes in standard Function modules.These 20 records have some

duplicate entries.i need to delete the duplicates from the standard function modules.

Please give me some codings.