HR - PNPbegda/PNPendda ......PN-begda/PN-endda

Hi,
I am going through some of the sample codes on internet. While querying on any infotype table I find that  begin date/ end date on selection screen is referred as PNPbegda/PNPendda some times and PN-begda/PN-endda some times. Is there any some reason for this? what is the difference between use of these in two different ways?
Thanks
  SDN POWERED

Hi,
pnpbegda and pnpendda refer to the date fields on the selection screen.
when you use macros like RP_PROVIDE_FROM_FRST and
RP_PROVIDE_FROM_LAST you can see the pn-begda and pn-endda.
That means during the program pnpbegda and pnpendda are
assigned to pn-begda and pn-endda.
Ex: RP_PROVIDE_FROM_FRST p0001 space pn-begda pn-endda.
you can change pn- begda and pn-endda values.
Ex: pn-begda = '20080101'.
      pn-endda = '20081231'.
Ex: RP_PROVIDE_FROM_LAST p0001 space pn-begda pn-endda.
you can directly use the dates even.
EX:RP_PROVIDE_FROM_LAST p0001 space '20080101' '20081231'.
For better understanding go through the programs
SAPDBPNP and SAPDBPNPCE.

Similar Messages

  • Rp_provide_from_last p2001 space pn-begda pn-endda

    Hi Guru's,
    I  am  using  PNP as LDB and after ,
    My  requirement  is to  fetch  the records from p2001 for a specific time period mentioned in the selection screen.
    Code :
    Get  Perner.
    rp_provide_from_last p2001 space pn-begda pn-endda.
    the output   of the above is  giving  all  the data from  P2001 irrespective of the dates (Pn-begda & pn-endda.)
    But  i want  the data with in the dates (Pn-begda & pn-endda.).
    Plz suggest.
    Thanks.

    Hi,
      PROVIDE * FROM P2001
      BETWEEN Pnpbegda AND Pnpendda.
       write: p2001-pernr,p2001-begda.
      ENDPROVIDE.
    use this code..........
    Regards,
    vamshidhar .
    Edited by: vamshi naini on Apr 23, 2008 2:06 PM

  • Rp_provide_from_last infotype subtype pn-begda pn-endda.

    Hi All,
    Is there a way to find out if a subtype exists before using this macro. If a subtype does not exist then it crashes.
    rp_provide_from_last infotype subtype pn-begda pn-endda.
    Thanks,
    ~Mark

    Mark,
    Check the View  V_T591A  - Subtype Characteristics.
    It will have all Subtypes maintained in your sytem  for infotype.
    Additionally if you want to Use the Macro for an Infotype without Subtype, Pass SPACE instead of Subtype.
    RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
    Hope this helps.
    Vinodh Balakrishnan
    Edited by: Vinodh Balakrishnan on Jan 15, 2008 3:19 PM

  • Rp-provide-from-last p0002 space pn-begda pn-endda.

    Hello Gurus,
    I need to know what is the sintax to get a particular person from PNP using
    rp-provide-from-last p0002 space pn-begda pn-endda.
    Thanks

    Hello Enrique,
    Check this code, if the sy-subrc as equal 2, employee is inactive:
    *&      Form  check_pernr_exists
    *       Check if employee exists
    *      -->P_PERNR    Personnel Number
    *      <--P_SUBRC    Return code
    FORM check_pernr_exists USING p_pernr TYPE any
                            CHANGING p_subrc TYPE sysubrc.
      CLEAR p_subrc.
      CALL FUNCTION 'RP_CHECK_PERNR'
        EXPORTING
          beg                     = sy-datum
          pnr                     = p_pernr
    *   IMPORTING
    *     NAME                    =
    *     PERSA                   =
    *     BUKRS                   =
    *     KOSTL                   =
    *     MOLGA                   =
    *     PERSONNEL_SUBAREA       =
        EXCEPTIONS
          data_fault              = 1
          person_not_active       = 2
          person_unknown          = 3
          exit_fault              = 4
          pernr_missing           = 5
          date_missing            = 6
          OTHERS                  = 7
      IF sy-subrc <> 0.
        p_subrc = sy-subrc.
      ENDIF.
    ENDFORM.                    "check_pernr_exists

  • Rp_set_data_interval 'P0014' pn-begda pn-endda.

    Hi,
    Could you please tell me the diffrence of data retrival of infotype p0014 by get prenr and by using the macro:rp_set_data_interval 'P0014' pn-begda pn-endda..
    Thanks,
    Suresh

    >
    suresh kumar wrote:
    > Hi,
    >
    > Could you please tell me the diffrence of data retrival of infotype p0014 by get prenr and by using the macro:rp_set_data_interval 'P0014' pn-begda pn-endda..
    >
    >
    >
    > Thanks,
    > Suresh
    Hi Suresh,
      If you use this macro rp_set_data_interval 'P0014' pn-begda pn-endda'P0014' pn-begda pn-endda then the GET PERNR event only retrives the valid IT0014 records in the period pn-begda, pn-endda.
    If you don't use the macro rp_set_data_interval 'P0014' pn-begda pn-endda then the GET PERNR event retrieves all the available IT0014 records even if they are not valid in the interval pn-begda and pn-endda.
    Note: The macro rp_set_data_interval should be included in the START-OF-SELECTION event

  • Updating HRP infotype's begda and endda fields using RH_PNNNN_MAINTAIN.

    hi all,
            I want to change the begda and endda fields in hrpXXXX infotype tables, but use the functiom module RH_PNNNN_MAINTAIN in dialog mode, the begda and endda fields can not be edited.
    can we change these things using this FM?
    or are there any other FMs can make this?
    thanks,
    Huai Zhi

    Hello,
    Use in this way
      CALL FUNCTION 'RH_PNNNN_MAINTAIN'
           EXPORTING
                ACT_FCODE          = ACT_FCODE
                ACT_PLVAR          = IPLOG-PLVAR
                ACT_OTYPE          = IPLOG-OTYPE
                ACT_OBJID          = IPLOG-OBJID
                ACT_INFTY          = IPLOG-INFTY
                ACT_SUBTY          = IPLOG-SUBTY
                ACT_ISTAT          = IPLOG-ISTAT
                ACT_BEGDA          = IPLOG-BEGDA
                ACT_ENDDA          = IPLOG-ENDDA
                ACT_PNNNN          = IPLOG
                SUPPRESS_DIALOG    = '1'
           IMPORTING
                ACT_OK_CODE        = OUT_FCODE
                ACT_PNNNN_OUT      = IPLOG
           EXCEPTIONS
                INFTY_NOT_VALID    = 01
                NO_PLVAR           = 02
                OBJECT_NOT_DEFINED = 03
                OTYPE_NOT_VALID    = 04.

  • Begda and endda missing

    Dear experts,
    I'm making HR reports and noticed that i could only retrieve data from the current month and year. I did some problemsearching and discovered that my begda and endda infotypes aren't present in my HeadCount and Personnel Actions cube in BW.
    My question to you:
    Is there a way i can still access these infotypes for my query?
    or do i need to remake my cube?(if so, how?)

    Hi,
    Thanks Atish...
    I'm creating a custom infotype which has to be populated from more than one infotype..
    So in that dynamic action i've to check the values of begda and endda in a module... for that i don't want to include the structures of all the infotypes from which the custom infotype is going to be populated.
    I want to fetch the values of begda and endda from some other table..
    Got it my friend?

  • PNPBEGDA and PNPENDDA

    Hello,
    I am using the PNP logical database along with HR Report category set to HRDEOD01.
    The selection screen works fine for 'Payroll Period' tab.
    However, if I were to choose date range from 'period' like - Today / Current Month / Current year, etc,
    after executing the GET PERNR statement,
    PNPBEGDA and PNPENDDA are blank. They should ideally have dates corresponding to the radio button selected.
    Please can anyone suggest a fix to this problem?

    Hi Vaishali,
    PNPBEGDA & PNENDDA will only be filled when you select the Other period radiobutton and fill the dates in the Data Selection Period. You can always use the PN-BEGDA & PN-ENDDA fields in the Report.
    Regards,
    Suresh Datti

  • Why pn-begda and pn-endda not filled ? but pn-begps and pn-endps filled.

    Hi,
    Im using logical database PNP.
    in all my reports, whenever i fillPayroll period, the from date and enddate (pn-begda and pn-endda) is populated for the  given pay period.
    In one of my report, these value (pn-begda and endda) are blank.
    pn-begps and pn-endps is getting filled instead. (Why ? What setting i have to do, to bring pn-benga and pn-endda?)
    Thanks,
    Jhove.

    Hi Jhove,
    BEGPS and ENDPS refer to person selection period (whether a person exists on a specified period) whereas BEGDA and ENDDA refer to data selection period (whether a specific IT record exists in a specified period). Probably in your report person selection period fields are filled whereas data selection period fields are left blank (or these fields even do not exist in your selection screen). Thus, you need to check whether data selection period is available in selection screen and it is filled prior to report execution.
    Best regards,
    Dilek

  • BEGDA & ENDDA missing in InfoPackage selection

    Hi All,
    within my 0EMPLOYEE_ATTR extractor, the infopackage does not contain the BEGDA & ENDDA fields.  they are definately ticked for  'selection' within RSA6.  I have done replication and all other fields seem to be there besides these 2.  Any ideas how i can get them to appear on infopackage for selection?
    Thanks in advance.
    Munaf.

    Hi Munaf,
    I believe that SAP note 310304 explains the problem, to extract time dependent master data you must
    use the fields 'DATETO' and 'DATEFROM'. You can't use BEGDA and ENDDA.
    Please read the "solution" part of the note 310304 it explains what you need to do.
    Best Regards,
    Des Gallagher

  • Pnp-begda pnbegda

    Hi Experts could you tell me ,
    what is diff between  pnp-begda pnbegda

    hiii....
    pnpbegda/pnpendda is the name of the screen field in the selection screen of LDB.
    pn-begda & pn-endda takes the value entered in the sel screen when executed.
    eg.If Reporting Period is today, pnpbegda contains no value whereas pn-begda & pn-endda contains today's date.
    This holds true for Reporting period values like All/Today/Current month etc...wherein you dont need to enter start date & end date.
    In such cases pnpbegda & pnpendda returns null whereas pn-begda pn-endda returns correct value chosen in selection screen.
    Its always better to use pn-begda & pn-endda for reporting .
    Regards,
    Vidya

  • Fetch PERNR with Future BEGDA

    Hi Gurus,
    My requirement is to fetch the PERNR using GET PERNR, but when i fetching the records for current date
    Eg :  PERNR    BEGDA   AEDTM

    Hi ,
    in your report program in the Attributes Tab provide the Logical Database as PNP and do the following
    *& Tables declaration
    TABLES: PERNR.
    *& Infotypes declaration
    INFOTYPES: 0001,                       " Org Assignment
               0002,                       " Personel Data
               0006,                       " Addresses
               0003 MODE A.                " Payroll status
    *& START-OF-SELECTION EVENT
    START-OF-SELECTION.
    GET PERNR.
    PROVIDE * FROM P0001
              * FROM P0002
              * FROM P0006
        BETWEEN PN-BEGDA AND PN-ENDDA.
      IF P0001_VALID EQ 'X'.
          WRITE:
            / P0001-PERNR, P0001-BEGDA, P0001-ENDDA.
        ENDIF.
    now when u run the report select the date as current date.
    hope this help.... try out
    best of luck!!
    thanks
    Ravi Aswani

  • Report on HR

    Hi Abapers,
    Requirement:
    Development Plan templates have been created for all active associates.  It is desired by HR to be able to extract certain data from these plans into an Excel spreadsheet.  They want to be able to gauge a composite of development needs.
    selection screen fields:
    1.  Appraisal template
         drop down of available templates(f4 help). 'Development Plan' has to be selected.
    2. criteria Group
        dropdown based on template chosen
        criteria group = 'step1: create Action Plan'
    3. Form status/substatus
        Allow Selection of sub statuses from form that are to be extracted to excel.
    4. personnel area(Allow blank for All)
        only forms for associates in the included personnel areas will be extracted.
    5. personnel subarea(Allow blank for All)
    6. payscale group(Allow blank for All)
    7. pernr(Allow blank for All or selected pernr's)
    logic:
         All templates selected above that are any of the selected statuses, should be selected.
         Only templates for associates in the Organizations selected above should be selected.
          There may be one or more rows of the selected criteria.  (When you are in the form you can click on the Create icon to create up to 7 rows of Action Steps.)  All rows should be included.
        For the chosen criteria (in this case Action Steps), there are multiple columns.
        There should be one row of output for each employee with all data selected strung out in columns.
         Columns need to be fixed, so that a given field, i.e. ‘Strengths’ would always show up in the same column.
    output:
         Appraisee Pernr
         Appraisee Name
          Division
          Job Grade
         Competency or Development Area - this is a drop down on the form.  Extract the text (not the code).
         Detailed Action Steps - This is a note field (essentially a text box)   and will have a non-fixed number of characters.  Just capture them all.
         Type of Solution - this is a drop down on the form.  Extract the chosen text (not the code)
         Target Date - Date
       If there are multiple criteria for a person, they should be on the same row as defined in the spreadsheet attached to this CR entitiled.’Sample P3 Development Plan Report’
       This should be output to an excel spreadsheet format.
    output will be in excel format:
    pernr  name  division  jobgrade   competency DetailedActionsteps solution targetdate competency DetailedActionsteps solution targetdate.......
    o/p will repeat...
    How can i code this? i'm new to abap-hr. I want processing logic. kindly help me....
    points are sure for helpfull answers.....
    Thanks in advance..........

    Hi
    see the sample HR report using the LDB PNP and design with your data
    report zporgr0030
           line-size 193
           line-count 60(1)
           no standard page heading
           message-id zndc.
    Database Tables
    tables:    pernr,    " Logical PNP
               t001p,    " Personnel Subarea
               t005t,    " Country Descriptions
               t500p,    " Personnel Area
               t501,     " Employee Group
               t503k,    " Employee Subgroup
               csks,     " Cost Centers
               cskt,     " Cost Center Texts
               t513c,    " Job (Previous) Texts
               t513s,    " Job Titles
               t517t,    " Edn Est.Text
               t518b,    " Discipline Text
               t519t,    " Certificate Text
               t528t,    " Positions Texts
               t538t,    " Unit Text
               pa0003.   " Payroll Status
    infotypes:
               0000,   " Actions
               0001,   " Organizational Assignment
               0002,   " Personal Data
               0007,   " Planned working time
               0008,   " Payroll Data
               0022,   " Education Data
               0023,   " Previous Employer data
               0025,   " Performance Appraisal Data
               0041,   " Date Spcifications
               2001.   " Absences
    Declaration of Internal Tables
    Internal Table for Personal Data
    data: begin of pers_tab occurs 0,
            pernr like pa0001-pernr,      " Personal Number
            ename like pa0001-ename,      " Employee Name
            trfgr like pa0008-trfgr,      " Grade
            natio like pa0002-natio,      " Nationality
            hdate like pa0041-dat01,      " Hire Date
            gbdat like pa0002-gbdat,      " Birth Date
            plans like pa0001-plans,      " Position
            werks like pa0001-werks,      " Pers.Area
            kostl like pa0001-kostl,      " Cost Center
            ctext(40),                    " Cost Center Text
            ptext(25),                    " Position Text
            ntext(15),                    " Nation Text
            name1(23),                    " Location
          end of pers_tab.
    Internal Table for Payroll Data
    data: begin of pay_tab occurs 0,
            pernr like pa0008-pernr,      " Personal Number
            waers like pbwla-waers,       " Grade
            basic like pa0008-bet01,      " Basic Pay
            hra_allow like pa0008-bet01,  " Housing Allowance
            sup_allow like pa0008-bet01,  " Supp. Allowance
            soc_allow like pa0008-bet01,  " Social Allowance
            chl_allow like pa0008-bet01,  " Child Allowance
            fix_allow like pa0008-bet01,  " Fixed Overtime
            ra_allow  like pa0008-bet01,  " RA Allowance
            per_allow like pa0008-bet01,  " Perform. Allowance
            pen_allow like pa0008-bet01,  " Pension Allowance
            oth_allow like pa0008-bet01,  " Other Allowances
            tot_allow like pa0008-bet01,  " Total Allowances
          end of pay_tab.
    Internal Table for Educational Data
    data: begin of edn_tab occurs 0,
            pernr like pa0022-pernr,      " Personal Number
            ausbi like pa0022-ausbi,      " Discipline Name
            slart like pa0022-slart,      " Edn Establishment
            insti like pa0022-insti,      " Institute
            sland like pa0022-sland,      " Country
            slabs like pa0022-slabs,      " Certificate
            anzkl like pa0022-anzkl,      " Duration
            anzeh like pa0022-anzeh,      " Unit for Duration
            atext like t518b-atext,       " Discipline Text
            stext like t517t-stext,       " Edn Est.Text
            landx like t005t-landx,       " Country Text
            ctext like t519t-stext,       " Certificate Text
            etext like t538t-etext,       " Unit Text
          end of edn_tab.
    Internal Table for Previous Employment Data
    data: begin of pemp_tab occurs 0,
            pernr like pa0023-pernr,      " Personal Number
            arbgb like pa0023-arbgb,      " Previous Employer
            begda like pa0023-begda,      " Start Date
            endda like pa0023-endda,      " End Date
            taete like pa0023-taete,      " Last Position
            land1 like pa0023-land1,      " Country
            stltx like t513s-stltx,       " Position Text
            landx like t005t-landx,       " Country Text
          end of pemp_tab.
    Internal Table for Job History Data
    data: begin of job_tab occurs 0,
            pernr like pa0001-pernr,      " Personal Number
            begda like pa0001-begda,      " Promotion Date
            plans like pa0001-plans,      " Position
            stell like pa0001-stell,      " Job Key
            stltx like t513s-stltx,       " Job Text
            ptext like t528t-plstx,       " Position Text
          end of job_tab.
    Internal Table for Performance Appraisal Data
    data: begin of app_tab occurs 0,
            pernr like pa0001-pernr,       " Personal Number
            year(4) type     c,            " Current Year
            appr(35) type    c,            " C Y Appraisal
           year1(4) type    c,            " Last Year
           appr1(35) type   c,            " Last Year Appraisal
           year2(4) type    c,
           appr2(35) type   c,
           year3(4) type    c,
           appr3(35) type   c,
           year4(4) type    c,
           appr4(35) type   c,
          end of app_tab.
    Internal Table for Performance Appraisal Data
    data: begin of app1_tab occurs 0,
            year(4) type     c,            " Year
            appr(35) type    c,            " Appraisal
          end of app1_tab.
    Internal Table to get the Payroll Amounts
    data  wage_tab like pbwla occurs 0 with header line.
    Internal table for retreiving Employee Appraisals
    data  app_in_tab  like hrsobid occurs 0 with header line .
    data  app_out_tab like hrpe_profa  occurs 0 with header line .
    Declaration of Variables
    data : v_year(4)  type c,
           v_ayear(4) type c,
           v_cyear(4) type c,
           v_year1(4) type c,
           v_year2(4) type c,
           v_year3(4) type c,
           v_year4(4) type c,
           v_year5(4) type c,
           v_year6(4) type c,
           v_mon(2)   type c,
           v_date2  like sy-datum,
           v_date3  like sy-datum,
           v_date   like sy-datum,
           v_date1  like sy-datum.
    Declaration of Constants
    constants : c_x       type c value 'X',              " Sign
                c_pernr(8) type n value '00000000',      " Pernr
                c_p   like hrp1007-otype  value 'P',     " Object Type
                c_01  like hrp1001-plvar  value '01',    " Version
                c_val1(2) type c value '31',             " Date Type
                c_val2(2) type c value '12',             " Date Type
                c_val    like p0041-dar01 value '01',    " Date Type
                c_1      like pernr-persg value '1',     " Emp Group
                c_type   like hrp1001-otype  value 'S',  " Object Type
                c_date1  like sy-datum value '18000101', " Date
                c_date2  like sy-datum value '99991231', " Date
                c_lga01 like pa0008-lga01 value '0101',  " Wage Type
                c_lga02 like pa0008-lga01 value '0102',  " Wage Type
                c_lga03 like pa0008-lga01 value '0103',  " Wage Type
                c_lga04 like pa0008-lga01 value '0105',  " Wage Type
                c_lga05 like pa0008-lga01 value '0109',  " Wage Type
                c_lga06 like pa0008-lga01 value '0110',  " Wage Type
                c_lga07 like pa0008-lga01 value '0114',  " Wage Type
                c_lga08 like pa0008-lga01 value '0116',  " Wage Type
                c_lga09 like pa0008-lga01 value '0267',  " Wage Type
                c_kokrs  like cskt-kokrs value '1000'.   " Controlling Area
    Selection Screen
    selection-screen begin of block b1 with frame title text-003.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-060.
    parameters: r_all radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-020.
    parameters: r_per radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-021.
    parameters: r_pay radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-022.
    parameters: r_edn radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-023.
    parameters: r_pemp radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-024.
    parameters: r_job radiobutton group rb1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(33)   text-025.
    parameters: r_app radiobutton group rb1.
    selection-screen end of line.
    selection-screen end of block b1.
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
      perform validate_screen.
    Start-of-Selection
    start-of-selection.
    Selection of Period
      perform get_period.
    Get PERNR from LDB
    get pernr.
      if pernr-persg eq c_1 or pernr-pernr ne c_pernr.
        if r_all eq c_x.
    Get the Personal data from PA0001,PA0002, PA0008, PA0041
          perform get_pers_data.
    Get the Payroll data from PA0008
          perform get_pay_data.
    Get the Education data from PA0022
          perform get_edn_data.
    Get the Previous Employment data from PA0023
          perform get_pemp_data.
    Get the Job History data
          perform get_job_data.
    Get the Performance Appraisal data
          perform get_app_data.
        elseif r_per eq c_x.
    Get the Personal data from PA0001,PA0002, PA0008, PA0041
          perform get_pers_data.
        elseif r_pay eq c_x.
    Get the Payroll data from PA0008
          perform get_pay_data.
        elseif r_edn eq c_x.
    Get the Education data from PA0022
          perform get_edn_data.
        elseif r_pemp eq c_x.
    Get the Previous Employment data from PA0023
          perform get_pemp_data.
        elseif r_job eq c_x.
    Get the Job History data
          perform get_job_data.
        elseif r_app eq c_x.
    Get the Performance Appraisal data
          perform get_app_data.
        endif.
      endif.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
      perform top_of_page.
    End-of-Page
    end-of-page.
      perform end_of_page.
    End-of-Selection
    end-of-selection.
    Display the Output Report.
      perform display_report.
    Form-Routines
    *&      Form  validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Personnel Number
      clear pa0003.
      if not pnppernr[] is initial.
        select pernr
        from pa0003 up to 1 rows
          into pa0003-pernr
          where pernr in pnppernr.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personnel Number Entered'(001).
        endif.
      endif.
    Validation of Cost Center
      clear csks.
      if not pnpkostl[] is initial.
        select single kostl
          into csks-kostl
          from csks
          where kostl in pnpkostl.
        if sy-subrc <> 0.
          message e999 with 'Invalid Cost Center'(002).
        endif.
      endif.
    Validation of Personnel Area
      clear t500p.
      if not pnpwerks[] is initial.
        select persa
        from t500p up to 1 rows
          into t500p-persa
          where persa in pnpwerks.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personnel Area Entered'(004).
        endif.
      endif.
    Validation of Personnel Sub Area
      clear t001p.
      if not pnpbtrtl[] is initial.
        select btrtl
        from t001p up to 1 rows
          into t001p-btrtl
          where btrtl in pnpbtrtl.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personnel Sub Area Entered'(005).
        endif.
      endif.
    Validation of Employee Group
      clear t501.
      if not pnppersg[] is initial.
        select persg
        from t501 up to 1 rows
          into t501-persg
          where persg in pnppersg.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Employee Group Entered'(006).
        endif.
      endif.
    Validation of Employee Sub Group
      clear t503k.
      if not pnppersk[] is initial.
        select persk
        from t503k up to 1 rows
          into t503k-persk
          where persk in pnppersk.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Employee Sub Group Entered'(007).
        endif.
      endif.
    endform.                  "validate_screen
    *&      Form  get_period
    Get the Correct Period based on Selection screen selection
    form get_period.
      clear: v_year,v_mon, v_date, v_date1.
      v_year = sy-datum+0(4).
      v_mon  = sy-datum+4(2).
      if pnptimr1 = c_x.      " Current Date
        pnpbegda = sy-datum.
        pnpendda = sy-datum.
      elseif pnptimr2 = c_x.  " Current Month
        concatenate v_year v_mon c_val into v_date.
        concatenate v_year v_mon c_val1 into v_date1.
        pnpbegda = v_date.
        pnpendda = v_date1.
      elseif pnptimr3 = c_x.  " Current Year
        concatenate v_year c_val c_val into v_date.
        concatenate v_year c_val2 c_val1 into v_date1.
        pnpbegda = v_date.
        pnpendda = v_date1.
      elseif pnptimr4 = c_x.  " Upto Today
        pnpbegda = c_date1.
        pnpendda = sy-datum.
      elseif pnptimr5 = c_x.  " From Today
        pnpbegda = sy-datum.
        pnpendda = c_date2.
      else.
        if ( pnpbegda is initial and pnpendda is initial ).
          pnpbegda = c_date1.
          pnpendda = c_date2.
        elseif pnpbegda is initial and not pnpendda is initial.
          pnpbegda = c_date1.
          pnpendda = pnpendda.
        elseif not ( pnpbegda is initial and pnpendda is initial ).
          pnpbegda = pnpbegda.
          pnpendda = pnpendda.
        endif.
      endif.
    endform.              "get_period
    *&      Form  get_pers_data
    Get the Personal Data from PA0001,PA0002,PA0008, PA0041
    form get_pers_data.
    Get data from Respective Infotypes
      rp_provide_from_last p0001 space pnpbegda pnpendda.
      rp_provide_from_last p0002 space pnpbegda pnpendda.
      rp_provide_from_last p0008 space pnpbegda pnpendda.
      rp_provide_from_last p0041 space pnpbegda pnpendda.
      pers_tab-pernr    = p0001-pernr.
      pers_tab-ename    = p0001-ename.
      pers_tab-werks    = p0001-werks.
      pers_tab-plans    = p0001-plans.
      pers_tab-kostl    = p0001-kostl.
      pers_tab-gbdat    = p0002-gbdat.
      pers_tab-trfgr    = p0008-trfgr.
    Get the Engaged Date
      read table p0041 with key dar01 = c_val.
      if sy-subrc = 0.
        pers_tab-hdate = p0041-dat01.
      endif.
    Get the Cost Center Text
      clear cskt-ltext.
      select single ltext into cskt-ltext from cskt
              where spras = sy-langu and
                    kokrs = c_kokrs and
                    kostl = p0001-kostl.
      if sy-subrc = 0.
        pers_tab-ctext = cskt-ltext.
      endif.
    Get the Position Text
      clear t528t-plstx.
      select single plstx into t528t-plstx from t528t
              where plans = p0001-plans and
                    otype = c_type and
                    sprsl = sy-langu.
      if sy-subrc = 0.
        pers_tab-ptext = t528t-plstx.
      endif.
    Get the Nationality
      clear t005t-natio.
      select single natio into t005t-natio from t005t
              where spras = sy-langu and
                    land1 = p0002-natio.
      if sy-subrc = 0.
        pers_tab-ntext = t005t-natio.
      endif.
    Get the Location (Personal Area) Text
      clear t500p-name1.
      select single name1 into t500p-name1 from t500p
              where persa = p0001-werks.
      if sy-subrc = 0.
        pers_tab-name1 = t500p-name1.
      endif.
      append pers_tab.
      clear pers_tab.
      sort pers_tab by pernr.
    endform.          "get_pers_data
    *&      Form  get_pay_data
    Get the Payroll Data from Infotype 0008
    form get_pay_data.
    Get the Payroll data from Respective Infotypes
      rp_provide_from_last p0008 space pnpbegda pnpendda.
      pay_tab-pernr    = pernr-pernr.
      call function 'RP_FILL_WAGE_TYPE_TABLE_EXT'
        exporting
         appli                              = 'E'
         begda                              = p0008-begda
         endda                              = p0008-endda
         infty                              = '0008'
         objps                              = '  '
         tclas                              = 'A'
         pernr                              = pernr-pernr
         seqnr                              = '   '
         subty                              = '0   '
         dlspl                              = 'X'
         msgflg                             = ''
         nordct                             = ''
        tables
          pp0001                             = p0001
          pp0007                             = p0007
          pp0008                             = p0008
          ppbwla                             = wage_tab
      PP0230                             =
      PP0014                             =
      PP0015                             =
      PP0052                             =
    EXCEPTIONS
      ERROR_AT_INDIRECT_EVALUATION       = 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.
      loop at wage_tab.
        pay_tab-waers = wage_tab-waers.
        case wage_tab-lgart.
          when c_lga01.
            pay_tab-basic = wage_tab-betrg.
          when c_lga02.
            pay_tab-sup_allow = wage_tab-betrg.
          when c_lga03.
            pay_tab-hra_allow = wage_tab-betrg.
          when c_lga04.
            pay_tab-chl_allow = wage_tab-betrg.
          when c_lga05.
            pay_tab-soc_allow = wage_tab-betrg.
          when c_lga06.
            pay_tab-fix_allow = wage_tab-betrg.
          when c_lga07.
            pay_tab-ra_allow = wage_tab-betrg.
          when c_lga08.
            pay_tab-per_allow = wage_tab-betrg.
          when c_lga09.
            pay_tab-pen_allow = wage_tab-betrg.
          when others.
            pay_tab-oth_allow = pay_tab-oth_allow + wage_tab-betrg.
        endcase.
        pay_tab-tot_allow = pay_tab-basic + pay_tab-sup_allow +
                            pay_tab-hra_allow + pay_tab-chl_allow +
                            pay_tab-soc_allow + pay_tab-fix_allow +
                            pay_tab-ra_allow + pay_tab-per_allow +
                            pay_tab-oth_allow - pay_tab-pen_allow.
      endloop.
      append pay_tab.
      clear  pay_tab.
    endform.          "get_pay_data
    *&      Form  get_edn_data
    Get the Education Data from Infotype 0022
    form get_edn_data.
    Get the Education data from Respective Infotypes
      loop at p0022 where pernr = pernr-pernr.
        edn_tab-pernr    = pernr-pernr.
        edn_tab-ausbi    = p0022-ausbi.
        edn_tab-slart    = p0022-slart.
        edn_tab-insti    = p0022-insti.
        edn_tab-sland    = p0022-sland.
        edn_tab-slabs    = p0022-slabs.
        edn_tab-anzkl    = p0022-anzkl.
        edn_tab-anzeh    = p0022-anzeh.
    Get the Discipline Text
        clear t518b-atext.
        select single atext into t518b-atext from t518b
                where langu = sy-langu and
                      ausbi = p0022-ausbi.
        if sy-subrc = 0.
          edn_tab-atext = t518b-atext.
        endif.
    Get the Edn Establishment Text
        clear t517t-stext.
        select single stext into t517t-stext from t517t
                where slart = p0022-slart and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          edn_tab-stext = t517t-stext.
        endif.
    Get the Certificate Text
        clear t519t-stext.
        select single stext into t519t-stext from t519t
                where slabs = p0022-slabs and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          edn_tab-ctext = t519t-stext.
        endif.
    Get the Unit Text
        clear t538t-etext.
        select single etext into t538t-etext from t538t
                where zeinh = p0022-anzeh and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          edn_tab-etext = t538t-etext.
        endif.
    Get the Country Description
        clear t005t-landx.
        select single landx into t005t-landx from t005t
                where spras = sy-langu and
                      land1 = p0022-sland.
        if sy-subrc = 0.
          edn_tab-landx = t005t-landx.
        endif.
        append edn_tab.
        clear edn_tab.
      endloop.
    endform.              "edn_data
    *&      Form  get_pemp_data
    Get the Previous Employment Data from Infotype 0023
    form get_pemp_data.
    Get the Previous Employment data from Respective Infotypes
      loop at p0023 where pernr = pernr-pernr.
        pemp_tab-pernr    = pernr-pernr.
        pemp_tab-arbgb    = p0023-arbgb.
        pemp_tab-begda    = p0023-begda.
        pemp_tab-endda    = p0023-endda.
        pemp_tab-taete    = p0023-taete.
        pemp_tab-land1    = p0023-land1.
    Get the Last Job Text
        clear t513c-ltext.
        select single ltext into t513c-ltext from t513c
                where taete = pemp_tab-taete and
                      spras = sy-langu.
        if sy-subrc = 0.
          pemp_tab-stltx = t513c-ltext.
        endif.
    Get the Country Description
        clear t005t-landx.
        select single landx into t005t-landx from t005t
                where spras = sy-langu and
                      land1 = pemp_tab-land1.
        if sy-subrc = 0.
          pemp_tab-landx = t005t-landx.
        endif.
        append pemp_tab.
        clear pemp_tab.
      endloop.
      sort pemp_tab by pernr.
    endform.              "pemp_data
    *&      Form  get_job_data
    Get the Job History Data from Infotype
    form get_job_data.
    Get the Job History data from Respective Infotypes
      loop at p0001 where pernr = pernr-pernr.
        job_tab-pernr    = pernr-pernr.
        job_tab-begda    = p0001-begda.
        job_tab-plans    = p0001-plans.
        job_tab-stell    = p0001-stell.
    Get the Last Job Text
        clear t513s-stltx.
        select single stltx into t513s-stltx from t513s
                where stell = job_tab-stell and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          job_tab-stltx = t513s-stltx.
        endif.
    Get the Position Text
        clear t528t-plstx.
        select single plstx into t528t-plstx from t528t
                where plans = job_tab-plans and
                      otype = c_type and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          job_tab-ptext = t528t-plstx.
        endif.
        append job_tab.
        clear  job_tab.
      endloop.
      sort job_tab by pernr.
    endform.          "get_job_data
    *&      Form  get_app_data
    Get the Performance Appraisal Data from Infotype
    form get_app_data.
      clear: v_cyear, v_year1, v_year2, v_year3, v_year4,
             v_year5, v_year6, v_ayear, v_date2, v_date3.
      v_cyear = sy-datum+0(4) - 1.
      v_year1 = v_cyear - 1.
      v_year2 = v_cyear - 2.
      v_year3 = v_cyear - 3.
      v_year4 = v_cyear - 4.
      v_year5 = v_cyear - 5.
      v_year6 = v_cyear - 6.
      concatenate v_cyear c_date2+4(4) into v_date2.
      concatenate v_year6 c_date1+4(4) into v_date3.
      clear: app_in_tab, app_out_tab.
      refresh: app_in_tab, app_out_tab.
      app_in_tab-plvar = c_01.
      app_in_tab-otype = c_p.
      app_in_tab-sobid = pernr-pernr.
      append app_in_tab.
    Get Appraisals data from Respective Infotypes
      call function 'RHPA_APPRAISEES_APP_READ'
       exporting
         begda               =   v_date3
         endda               =   v_date2
      WITH_STEXT          = 'X'
      WITH_ADD_INFO       = 'X'
        tables
          appraisees          = app_in_tab
          appraisals          = app_out_tab
       exceptions
         no_authority        = 1
         undefined           = 2
         others              = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      sort app_out_tab  by sobid vbegd vendd appraisal_adate descending .
      delete adjacent duplicates from app_out_tab
                comparing  sobid vbegd vendd.
      loop at app_out_tab where appraisal_histo = 'X' .
        condense app_out_tab-appraisal_result.
        app1_tab-year = app_out_tab-vendd+0(4).
        app1_tab-appr = app_out_tab-appraisal_result_text.
        append app1_tab.
        clear app1_tab.
      endloop.
      sort app1_tab by year descending.
      loop at app1_tab.
        app_tab-pernr    = pernr-pernr.
        move-corresponding  app1_tab to app_tab.
        append app_tab.
        clear: app1_tab, app_tab.
      endloop.
      refresh app1_tab.
      sort app_tab by pernr.
      delete app_tab where year = ' ' and appr = ' ' .
    endform.          "get_app_data
    *&      Form  top_of_page
    Write the Report and Column Headings
    form top_of_page.
      skip.
      format color col_heading on.
      if r_all eq c_x.
        write: /1(193) 'NATIONAL DRILLING COMPANY'(009) centered,
               /1(193) 'Employee Details Report'(066) centered.
      elseif r_per eq c_x.
        write: /1(193) 'NATIONAL DRILLING COMPANY'(009) centered,
               /1(193) 'Employee Details - Personal Data'(010)
                                                centered.
      elseif r_pay eq c_x.
        write: /1(172) 'NATIONAL DRILLING COMPANY'(009) centered,
               /1(172) 'Employee Details - Payroll Data'(027)
                                                centered.
      elseif r_edn eq c_x.
        write: /1(172) 'NATIONAL DRILLING COMPANY'(009) centered,
               /1(172) 'Employee Details - Education Data'(028)
                                                centered.
      elseif r_pemp eq c_x.
        write: /1(97) 'NATIONAL DRILLING COMPANY'(009) centered,
              /1(97) 'Employee Details - Previous Employment Data'(029)
                                                centered.
      elseif r_job eq c_x.
        write: /1(75) 'NATIONAL DRILLING COMPANY'(009) centered,
              /1(75) 'Employee Details - Job History Data'(030)
                                                centered.
      elseif r_app eq c_x.
        write: /1(192) 'NATIONAL DRILLING COMPANY'(009) centered,
              /1(192) 'Employee Details - Performance Appraisal Data'(031)
                                                centered.
      endif.
      format color off.
      if pnptimr1 = c_x.      " Current Date
        write: /2 'Period From     :'(008), sy-datum,
                         'To:'(019), sy-datum.
      elseif pnptimr2 = c_x.  " Current Month
        write: /2 'Period From     :'(008), v_date, 'To:'(019), v_date1.
      elseif pnptimr3 = c_x.  " Current Year
        write: /2 'Period From     :'(008), v_date, 'To:'(019), v_date1.
      elseif pnptimr4 = c_x.  " Upto Today
        write: /2 'Period From     :'(008), c_date1, 'To:'(019), sy-datum.
      elseif pnptimr5 = c_x.  " From Today
        write: /2 'Period From     :'(008), sy-datum, 'To:'(019), c_date2.
      else.
        if ( pnpbegda is initial and pnpendda is initial ).
          write: /2 'Period From     :'(008), c_date1, 'To:'(019), c_date2.
        elseif pnpbegda is initial and not pnpendda is initial.
          write: /2 'Period From     :'(008), c_date1, 'To:'(019), pnpendda.
        elseif not ( pnpbegda is initial and pnpendda is initial ).
          write: /2 'Period From     :'(008), pnpbegda,
                   'To:'(019), pnpendda.
        endif.
      endif.
      if not ( r_pemp eq c_x or r_job eq c_x ).
        write: 140 'Report Run Date:'(073), sy-datum.
        if not pnpkostl[] is initial.
          if pnpkostl-high is initial.
            write: /2 'Cost Center     :'(074), pnpkostl-low,
                  125 'Time           :'(075), sy-uzeit.
          else.
            write: /2 'Cost Center From:'(076), pnpkostl-low+7(3),
                                      'To:'(019), pnpkostl-high,
                  140 'Time           :'(075), sy-uzeit.
          endif.
        else.
          write: /140  'Time           :'(075), sy-uzeit.
        endif.
        if not pnppernr[] is initial.
          if pnppernr-high is initial.
            write: /2 'Personal Number :'(077), pnppernr-low,
                   140 'User           :'(078), sy-uname.
          else.
            write: /2 'Personal No.From:'(079),  pnppernr-low,
                                      'To:'(019), pnppernr-high,
                   140 'User           :'(078), sy-uname.
          endif.
        else.
          write: /140 'User           :'(078), sy-uname.
        endif.
        write: /140 'Page No        :'(080), sy-pagno.
      else.
        write: 48 'Report Run Date:'(073), sy-datum.
        if not pnpkostl[] is initial.
          if pnpkostl-high is initial.
            write: /2 'Cost Center     :'(074), pnpkostl-low,
                  48 'Time           :'(075), sy-uzeit.
          else.
            write: /2 'Cost Center From:'(076), pnpkostl-low+7(3),
                                      'To:'(019), pnpkostl-high,
                  48 'Time           :'(075), sy-uzeit.
          endif.
        else.
          write: /48  'Time           :'(075), sy-uzeit.
        endif.
        if not pnppernr[] is initial.
          if pnppernr-high is initial.
            write: /2 'Personal Number :'(077), pnppernr-low,
                   48 'User           :'(078), sy-uname.
          else.
            write: /2 'Personal No.From:'(079),  pnppernr-low,
                                      'To:'(019), pnppernr-high,
                   48 'User           :'(078), sy-uname.
          endif.
        else.
          write: /48 'User           :'(078), sy-uname.
        endif.
        write: /48 'Page No        :'(080), sy-pagno.
      endif.
      skip.
      if r_per eq c_x.
        write /1(193) sy-uline.
        format color col_heading on.
        write:/1 sy-vline,  2(10) 'Employee #'(011),
              12 sy-vline, 13(40) 'Name'(012) centered,
              53 sy-vline, 54(8)  'Grade'(013) centered,
              62 sy-vline, 63(15) 'Nationality'(017) centered,
              78 sy-vline, 79(10) 'Eng.Date'(014) centered,
              89 sy-vline, 90(10) 'Birth Date'(016) centered,
             100 sy-vline,101(25) 'Location'(026) centered,
             126 sy-vline,127(25) 'Position'(015) centered,
             152 sy-vline,153(40) 'Division'(018) centered,
             193 sy-vline.
        format color off.
        write /1(193) sy-uline.
      elseif r_pay eq c_x.
        write /1(188) sy-uline.
        format color col_heading on.
        write:/1 sy-vline,  2(10) 'Employee #'(011),
              12 sy-vline, 13(15) 'Basic'(033) centered,
              28 sy-vline, 29(15) 'Housing Allow.'(034) centered,
              44 sy-vline, 45(15) 'Sup.Allow.'(035) centered,
              60 sy-vline, 61(15) 'Social Allow.'(036) centered,
              76 sy-vline, 77(15) 'Child Allow.'(037) centered,
              92 sy-vline, 93(15) 'Fixed Overtime'(038) centered,
             108 sy-vline,109(15) 'R.A.Allow.'(041) centered,
             124 sy-vline,125(15) 'Perform.Allow.'(039) centered,
             140 sy-vline,141(15) 'Pension.Allow.'(059) centered,
             156 sy-vline,157(15) 'Others'(040) centered,
             172 sy-vline,173(15) 'Total'(042) centered,
             188 sy-vline.
        format color off.
        write /1(188) sy-uline.
      elseif r_edn eq c_x.
        write /1(172) sy-uline.
        format color col_heading on.
        write:/1 sy-vline,  2(10) 'Employee #'(011),
              12 sy-vline, 13(25) 'Discipline'(043) centered,
              38 sy-vline, 39(20) 'Edu.Establishment'(044) centered,
              59 sy-vline, 60(45) 'Institute'(045) centered,
             105 sy-vline,106(15) 'Country'(046) centered,
             121 sy-vline,122(30) 'Certificate'(047) centered,
             152 sy-vline,153(19) 'Duration of Course'(048) centered,
             172 sy-vline.
        format color off.
        write /1(172) sy-uline.
      elseif r_pemp eq c_x.
        write /1(97) sy-uline.
        format color col_heading on.
        write:/1 sy-vline, 12 sy-vline,
              33 sy-vline, 34(21) 'Employment Period'(055) centered,
              55 sy-vline, 81 sy-vline,
              97 sy-vline.
        write:/1 sy-vline,  2(10) 'Employee #'(011),
              12 sy-vline, 13(20) 'Employer'(049) centered,
              33 sy-vline, 34(10) 'From'(050) centered,
              44 sy-vline, 45(10) 'To'(051) centered,
              55 sy-vline, 56(25) 'Last Position'(052) centered,
              81 sy-vline, 82(15) 'Country'(053) centered,
              97 sy-vline.
        format color off.
        write /1(97) sy-uline.
      elseif r_job eq c_x.
        write /1(75) sy-uline.
        format color col_heading on.
        write:/1 sy-vline,
              12 sy-vline,13(10) 'Date of'(054) centered,
              23 sy-vline,49 sy-vline,
              75 sy-vline.
        write:/1 sy-vline,2(10)  'Employee #'(011),
              12 sy-vline,13(10) 'Upgrading/'(058) centered,
              23 sy-vline,24(25) 'Position'(015) centered,
              49 sy-vline,50(25) 'Job'(056) centered,
              75 sy-vline.
        write:/1 sy-vline, 12 sy-vline,
              13(10) 'Promotion'(057) centered,
              23 sy-vline, 49 sy-vline,
              75 sy-vline.
        format color off.
        write /1(75) sy-uline.
      elseif r_app eq c_x.
        format color col_heading on.
         write: /1 sy-vline,2(56) sy-uline, 58 sy-vline,
                /1 sy-vline, 2(56) text-025 centered color 3, 58 sy-vline.
         write /1(58) sy-uline.
         format color col_heading on.
         write:/1 sy-vline,  2(10) 'Employee #'(011),
               12 sy-vline, 13(4)  'Year'(067),
               17 sy-vline, 18(40) 'Appraisal Text'(068) centered,
               58 sy-vline.
        format color off.
        write /1(58) sy-uline.
      endif.
    endform.               "top_of_page
    *&      Form  end_of_page
    Write the Page footers
    form end_of_page.
      if r_per eq c_x.
        write : /(193) sy-uline.
      elseif r_pay eq c_x.
        write : /(188) sy-uline.
      elseif r_edn eq c_x.
        write : /(172) sy-uline.
      elseif r_pemp eq c_x.
        write /1(97) sy-uline.
      elseif r_job eq c_x.
        write /1(75) sy-uline.
      elseif r_app eq c_x.
        write /1(217) sy-uline.
      endif.
    endform.               "end_of_page
    *&      Form  Display_report
    Write the Report Output
    form display_report.
      if r_all eq c_x.
        if pers_tab[] is initial.
          message i999 with
           'No Personal Data found'(061).
        else.
          write: /1 sy-vline,2(51) sy-uline, 53 sy-vline,
                 /1 sy-vline, 2(50) text-020 centered color 3, 53 sy-vline.
          write /1(193) sy-uline.
          format color col_heading on.
          write:/1 sy-vline,  2(10) 'Employee #'(011),
                12 sy-vline, 13(40) 'Name'(012) centered,
                53 sy-vline, 54(8)  'Grade'(013) centered,
                62 sy-vline, 63(15) 'Nationality'(017) centered,
                78 sy-vline, 79(10) 'Eng.Date'(014) centered,
                89 sy-vline, 90(10) 'Birth Date'(016) centered,
               100 sy-vline,101(25) 'Location'(026) centered,
               126 sy-vline,127(25) 'Position'(015) centered,
               152 sy-vline,153(40) 'Division'(018) centered,
               193 sy-vline.
          format color off.
          write /1(193) sy-uline.
          sort pers_tab by pernr.
          loop at pers_tab.
            format color col_normal.
            write:/1 sy-vline,  2(10) pers_tab-pernr,
                  12 sy-vline, 13(40) pers_tab-ename,
                  53 sy-vline, 56(6)  pers_tab-trfgr,
                  62 sy-vline, 63(15) pers_tab-ntext,
                  78 sy-vline, 79(10) pers_tab-hdate,
                  89 sy-vline, 90(10) pers_tab-gbdat,
                 100 sy-vline,101(25) pers_tab-name1,
                 126 sy-vline,127(25) pers_tab-ptext,
                 152 sy-vline,153(40) pers_tab-ctext,
                 193 sy-vline.
          endloop.
          write /1(193) sy-uline.
        endif.
        skip 3.
        if pay_tab[] is initial.
          message i999 with
           'No Standard Pay Data found'(062).
        else.
          write: /1 sy-vline,2(42) sy-uline, 44 sy-vline,
                 /1 sy-vline, 2(42) text-021 centered color 3, 44 sy-vline.
          format color col_heading on.
          write /1(188) sy-uline.
          write:/1 sy-vline,  2(10) 'Employee #'(011),
                12 sy-vline, 13(15) 'Basic'(033) centered,
                28 sy-vline, 29(15) 'Housing Allow.'(034) centered,
                44 sy-vline, 45(15) 'Sup.Allow.'(035) centered,
                60 sy-vline, 61(15) 'Social Allow.'(036) centered,
                76 sy-vline, 77(15) 'Child Allow.'(037) centered,
                92 sy-vline, 93(15) 'Fixed Overtime'(038) centered,
               108 sy-vline,109(15) 'R.A.Allow.'(041) centered,
               124 sy-vline,125(15) 'Perform.Allow.'(039) centered,
               140 sy-vline,141(15) 'Pension.Allow.'(059) centered,
               156 sy-vline,157(15) 'Others'(040) centered,
               172 sy-vline,173(15) 'Total'(042) centered,
               188 sy-vline.
          format color off.
          write /1(188) sy-uline.
          sort pay_tab by pernr.
          loop at pay_tab.
            format color col_normal.
            write:/1 sy-vline,  2(10) pay_tab-pernr,
                  12 sy-vline,
                  13(15) pay_tab-basic currency pay_tab-waers no-zero,
                  28 sy-vline,
                  29(15) pay_tab-hra_allow currency pay_tab-waers no-zero,
                  44 sy-vline,
                  45(15) pay_tab-sup_allow currency pay_tab-waers no-zero,
                  60 sy-vline,
                  61(15) pay_tab-soc_allow currency pay_tab-waers no-zero,
                  76 sy-vline,
                  77(15) pay_tab-chl_allow currency pay_tab-waers no-zero,
                  92 sy-vline,
                  93(15) pay_tab-fix_allow currency pay_tab-waers no-zero,
                 108 sy-vline,
                 109(15) pay_tab-ra_allow currency pay_tab-waers no-zero,
                 124 sy-vline,
                 125(15) pay_tab-per_allow currency pay_tab-waers no-zero,
                 140 sy-vline.
            pay_tab-pen_allow = pay_tab-pen_allow * -1.
            write: 141(15) pay_tab-pen_allow currency pay_tab-waers no-zero,
                   156 sy-vline,
                   157(15) pay_tab-oth_allow currency pay_tab-waers no-zero,
                   172 sy-vline,
                   173(15) pay_tab-tot_allow currency pay_tab-waers no-zero,
                   188 sy-vline.
          endloop.
          write /1(188) sy-uline.
        endif.
        skip 3.
        if edn_tab

  • How to debug a program when it is SUBMITed from another program

    Hi All,
    Now one more query.  While SUBMITing a Z program1 from Z program2, I want to debug the Z program1.  Even when I keep a break point in Z program1, it is not triggering there.  Any help would be appreciated.
    Regards,
    Balaji

    Hi all,
    Please find the full code.  I want to debug the sub routine PERFORM send_mail.
    1.  The main program.
    REPORT  Z_ITSLIP_MAIL                           .
    TABLES : pa0000, pa0001.                         .
    SELECT-OPTIONS : pernr FOR pa0000-pernr NO INTERVALS.
    DATA : count LIKE tbtcjob-jobcount.
    DATA : released LIKE btch0000-char1.
    DATA:
            l_valid,
            ls_params LIKE pri_params,
            l_jobcount LIKE tbtcjob-jobcount.
    PARAMETERS: p_job TYPE tbtcjob-jobname NO-DISPLAY.
    PARAMETERS: p_prog(30) TYPE c NO-DISPLAY..
    PARAMETERS: p_sdat LIKE sy-datum DEFAULT sy-datum .
    PARAMETERS: p_stim TYPE sy-uzeit DEFAULT sy-uzeit .
    PARAMETERS : payroll LIKE qppnp-xabkr OBLIGATORY.
    *PARAMETERS : period LIKE qppnp-pabrp OBLIGATORY.
    *PARAMETERS : year LIKE qppnp-pabrj OBLIGATORY.
    select-options : Period for sy-datum.
    DATA : BEGIN OF it_p0001 OCCURS 0,
           pernr LIKE pa0001-pernr,
           END OF it_p0001.
    p_sdat = p_sdat + 1.
    *Get Print Parameters
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        no_dialog      = 'X'
      IMPORTING
        valid          = l_valid
        out_parameters = ls_params.
    IF pernr[] IS INITIAL.
      SELECT pernr
       INTO TABLE it_p0001
       FROM pa0001.
      SORT it_p0001 BY pernr.
      DELETE ADJACENT DUPLICATES FROM it_p0001.
      LOOP AT it_p0001.
        MOVE it_p0001-pernr TO pernr-low.
        APPEND pernr.
        CLEAR pernr.
      ENDLOOP.
    ENDIF.
    LOOP AT pernr.
      CLEAR p_job.
      p_stim = p_stim + 120.
      CONCATENATE'ITSlip' pernr-low p_job sy-datum INTO p_job SEPARATED BY
    space.
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname  = p_job
        IMPORTING
          jobcount = l_jobcount.
      SUBMIT ZPR022_INNCOMETAX_REPORT_copy
        WITH PNPTIMR6 = 'X'
        WITH PNPBEGDA = period-low
        WITH PNPENDDA = period-high
        WITH PNPPERNR-LOW = PERNR-LOW
        WITH PNPABKRS-LOW = 'IN'
           VIA JOB     p_job
            NUMBER  l_jobcount
           TO SAP-SPOOL WITHOUT SPOOL DYNPRO
               SPOOL PARAMETERS ls_params
               WITH immediately = space
                  AND RETURN.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount  = l_jobcount
          jobname   = p_job
          strtimmed = 'X'
         PRDMINS = 2.
          sdlstrtdt = p_sdat
          sdlstrttm = p_stim.
    ENDLOOP.
    2.  The called program.
    REPORT  zpr022_inncometax_report_copy NO STANDARD PAGE HEADING LINE-SIZE
    89.
    TABLES : pernr, t512e, t512t,pa0105.
          Infotypes
    INFOTYPES : 0000, 0001, 0008, 0580.
          Types                    Begin with TY_
    DATA : BEGIN OF wa_lgart,
           lgart TYPE t512e-lgart,
           windo TYPE t512e-windo,
           slart TYPE t512e-slart,
           lgtxt TYPE t512t-lgtxt,
           kztxt TYPE t512t-kztxt,
           END OF wa_lgart.
    DATA : BEGIN OF wa_income,
           particular(24) TYPE c,
           lgart    TYPE lgart,
           cumm(13) TYPE p DECIMALS 2,
           proj(13) TYPE p DECIMALS 2,
           exem(13) TYPE p DECIMALS 2,
           annu(13) TYPE p DECIMALS 2,
           END OF wa_income.
    DATA : BEGIN OF wa_income1,
           particular(24) TYPE c,
           lgart    TYPE lgart,
           cumm(13) TYPE c,
           proj(13) TYPE c,
           exem(13) TYPE c,
           annu(13) TYPE c,
           END OF wa_income1.
    DATA : BEGIN OF wa_invest,
           particular(40) TYPE c,
           betrg(13) TYPE p DECIMALS 2,
           END OF wa_invest.
    DATA : BEGIN OF wa_invest1,
           particular(40) TYPE c,
           betrg(13) TYPE c,
           END OF wa_invest1.
    DATA : BEGIN OF wa_deduct,
           particular(40) TYPE c,
           sbs TYPE pin_sbsec,
           betrg(13) TYPE p DECIMALS 2,
           END OF wa_deduct.
    DATA : BEGIN OF wa_deduct1,
           particular(40) TYPE c,
           sbs TYPE c,
           betrg(13) TYPE c,
           END OF wa_deduct1.
    DATA: BEGIN OF cocd OCCURS 10.
            INCLUDE STRUCTURE pincc.
    DATA: END OF cocd.
    DATA: BEGIN OF f16 OCCURS 10.
            INCLUDE STRUCTURE pin16.
    DATA: END OF f16.
          Constants                Begin with C_
          Data                     Begin with W_
    DATA : w_clstrid TYPE t500l-relid,         "Cluster ID
           w_molga   TYPE t500p-molga,         "Country Code
           w_period(6) TYPE c,
           w_var(2) TYPE n,
           w_pr_from1 TYPE t569v-pabrj,        "year
           w_pr_to1 TYPE t569v-pabrp,          "period
           w_fpper-low1 TYPE pc261-fpper,
           w_year(4) TYPE n,
           w_ltaexe(13) TYPE p DECIMALS 2,
           w_cumm(13) TYPE p DECIMALS 2,
           w_lgtxt(20) TYPE c,
           w_lgart     TYPE lgart,
           w_amount(13) TYPE p DECIMALS 2,
           w_wage(4)   TYPE c,
           w_flag(1) TYPE c,
           w_total(13) TYPE p DECIMALS 2,
           w_start TYPE sy-datum,
           w_end   TYPE sy-datum,
           w_date  TYPE sy-datum,
           w_index(2) TYPE n VALUE 00,
           w_investnm(40),
           w_investnm1(40),
           w_ded0585(13) TYPE p DECIMALS 2,
           w_itext TYPE t7ini3-itext,
           w_dtext TYPE t7ini8-sbdds,
           w_inprvemp(13) TYPE p DECIMALS 2,
           w_nettaxin(13) TYPE p DECIMALS 2,
           w_ptaxprvemp(13) TYPE p DECIMALS 2,
           w_ptaxcremp(13) TYPE p DECIMALS 2,
           w_othtaxin(13) TYPE p DECIMALS 2,
           w_gssin(13) TYPE p DECIMALS 2,
           w_dedtot(13) TYPE p DECIMALS 2,
           w_invtot(13) TYPE p DECIMALS 2,
           w_inchrtax(13) TYPE p DECIMALS 2,
           w_nettaxpay(13) TYPE p DECIMALS 2,
           w_surchr(13) TYPE p DECIMALS 2,
           w_cess(13) TYPE p DECIMALS 2,
           w_totintax(13) TYPE p DECIMALS 2,
           w_tdsothin(13) TYPE p DECIMALS 2,
           w_cessrec(13) TYPE p DECIMALS 2,
           w_prvemp(13) TYPE p DECIMALS 2,
           w_tottaxpay(13) TYPE p DECIMALS 2,
           w_var1(13) TYPE p DECIMALS 2,
           w_var2(13) TYPE p DECIMALS 2,
           w_balit(13) TYPE p DECIMALS 2,
           w_avgmon(13) TYPE p DECIMALS 2,
           w_remmon(2) TYPE n,
           w_profund(13) TYPE p DECIMALS 2,
           w_pf(13) TYPE p DECIMALS 2,
           w_dept(25) TYPE c,
           w_desig(25) TYPE c,
           w_join TYPE sy-datum,
           w_annperk(13) TYPE p DECIMALS 2,
           w_percent TYPE pin_txexm,
           w_limit TYPE pin_sdvlt,
           w_st0008  TYPE sy-datum,
           w_en0008  TYPE sy-datum.
    DATA: w_cmonth(2) TYPE n,
          w_cyear(4)  TYPE n,
          w_cdate LIKE sy-datum,
          w_ldate LIKE sy-datum.
          Internal tables          Begin with IT_
    DATA : it_0001 TYPE STANDARD TABLE OF pa0001,
           it_data TYPE STANDARD TABLE OF pa0001,
           it_0000 TYPE STANDARD TABLE OF pa0000,
           it_lgart LIKE STANDARD TABLE OF wa_lgart,
           it_pc261 TYPE STANDARD TABLE OF pc261,
           it_payrt_result TYPE payin_result,
           it_income LIKE STANDARD TABLE OF wa_income,
           it_income1 LIKE STANDARD TABLE OF wa_income1,
           it_wage   LIKE it_income,
           it_invest LIKE STANDARD TABLE OF wa_invest,
           it_invest1 LIKE STANDARD TABLE OF wa_invest1,
           it_deduct LIKE STANDARD TABLE OF wa_deduct,
           it_deduct1 LIKE STANDARD TABLE OF wa_deduct1,
           it_0586 TYPE STANDARD TABLE OF pa0586,
           it_0580 TYPE STANDARD TABLE OF pa0580,
           it_0584 TYPE STANDARD TABLE OF pa0584,
           it_0585 TYPE STANDARD TABLE OF pa0585,
           it_t7ini3 TYPE STANDARD TABLE OF t7ini3,
           it_info TYPE STANDARD TABLE OF zpt011_fep_pay,
           it_0008 TYPE STANDARD TABLE OF pa0008,
           it_rt TYPE STANDARD TABLE OF pbwla WITH HEADER LINE.
    DATA    : p_email1 LIKE somlreci1-receiver,
                                     DEFAULT '[email protected]'
               p_sender LIKE somlreci1-receiver.
                                         DEFAULT '[email protected]',
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    data: date like sy-datum.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
          Work Area                Begin with WA_
    DATA : wa_0001 LIKE LINE OF it_0001,
           wa_data LIKE LINE OF it_data,
           wa_0000 LIKE LINE OF it_0000,
           wa_pc261 LIKE LINE OF it_pc261,
           wa_payrt_result TYPE LINE OF hrpay99_rt,
           wa_paycrt_result TYPE LINE OF hrpay99_crt,
           wa_0586 LIKE LINE OF it_0586,
           wa_0580 LIKE LINE OF it_0580,
           wa_0584 LIKE LINE OF it_0584,
           wa_0585 LIKE LINE OF it_0585,
           wa_t7ini3 LIKE LINE OF it_t7ini3,
           wa_in LIKE LINE OF it_income,
           wa_info LIKE LINE OF it_info,
           wa_0008 LIKE LINE OF it_0008,
           wa_wage LIKE wa_income,
           wa_rt TYPE pbwla.
          Field Symbols            Begin with FS_
    FIELD-SYMBOLS: <itc> TYPE ANY,
                   <ain> TYPE ANY,
                   <amt> TYPE ANY,
                   <sbdnn> TYPE ANY,
                   <tot> TYPE ANY.
          Select Options          Begin with SO_
    *SELECT-OPTIONS :
          Parameters              Begin with PR_
    *PARAMETERS     :
          Initialisation
    INITIALIZATION.
    date = sy-datum.
          Selection-Screen
          S T A R T   O F   S E L E C T I O N
    START-OF-SELECTION.
    GET pernr.
      SELECT * FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE it_0001
                    WHERE pernr IN pnppernr
                    AND   abkrs IN pnpabkrs
                    AND   bukrs IN pnpbukrs.
      DELETE ADJACENT DUPLICATES FROM it_0001 COMPARING pernr.
      SELECT * FROM pa0000 INTO CORRESPONDING FIELDS OF TABLE it_0000
                    WHERE pernr IN pnppernr.
      SELECT   t512e~lgart
               t512e~slart
               t512t~lgtxt
               t512t~kztxt
               INTO CORRESPONDING FIELDS OF TABLE it_lgart
               FROM t512e INNER JOIN t512t ON
                                     t512elgart = t512tlgart AND
                                     t512emolga = t512tmolga
               WHERE t512e~forml = 'ZPY2' AND
                     t512t~sprsl = sy-langu AND
                     t512e~molga = '40' AND
                     t512e~windo EQ 'W1' .
      LOOP AT it_lgart INTO wa_lgart WHERE lgart+0(1) EQ '/'.
        DELETE it_lgart.
      ENDLOOP.
      SORT it_lgart BY lgart.
    **---Here we are getting the start and the End of the financial year...
      CLEAR : w_date, w_start, w_end, w_year.
      w_date = sy-datum.
    **---Here we get the start date of the year.....
      IF w_date+4(2) BETWEEN '01' AND '04'.
        w_year = w_date+0(4).
        w_year = w_year - 1.
        CONCATENATE w_year '04' '01' INTO w_start.
      ELSE.
        CONCATENATE w_date+0(4) '04' '01' INTO w_start.
      ENDIF.
    **---Here we get the end date of the year......
      CLEAR : w_year.
      IF w_date+4(2) BETWEEN '01' AND '04'.
        CONCATENATE w_date+0(4) '03' '31' INTO w_end.
      ELSE.
        w_year = w_date+0(4).
        w_year = w_year + 1.
        CONCATENATE w_year '03' '31' INTO w_end.
      ENDIF.
      CLEAR : w_year.
          E N D       O F   S E L E C T I O N
    END-OF-SELECTION.
    **---perform for getting the Income tax Calculation part....
      PERFORM f000_get_income.
      PERFORM send_mail.
          User Command Processing
    *AT USER-COMMAND.
          Top Of Page
    TOP-OF-PAGE.
      WRITE : / 'Mindtree Consulting Pvt Ltd',
              / 'No.42, 27th Cross',
              / '2nd Stage, Banashankari',
              / 'Bangalore - 560070'.
    *&      Form  f000_get_income
          text
         -->P_IT_0001  text
         -->P_IT_LGART  text
    FORM f000_get_income.
      LOOP AT it_0001 INTO wa_0001.
        CLEAR : wa_invest, wa_deduct, wa_income.
        REFRESH : it_invest, it_deduct, it_income.
        CONCATENATE pnppabrj pnppabrp INTO w_period.
    **---Here we are getting the Earnings in India from RT Table...
    **---Getting the relid for each employee....
        CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'
          EXPORTING
            employee                    = wa_0001-pernr
          IMPORTING
            relid                       = w_clstrid
            molga                       = w_molga
          EXCEPTIONS
            error_reading_infotype_0001 = 1
            error_reading_molga         = 2
            error_reading_relid         = 3
            OTHERS                      = 4.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    **---Reading the rgdir of cluster 'CU' for each of the employees...
        CALL FUNCTION 'CU_READ_RGDIR'
          EXPORTING
            persnr          = wa_0001-pernr
          TABLES
            in_rgdir        = it_pc261
          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_lgtxt, w_cumm, w_ltaexe, w_flag.
        LOOP AT it_pc261 INTO wa_pc261 WHERE fpper = w_period
                                       AND   srtza  = 'A'.
    **---Importing the Payroll cluster results for each employee from RT....
          CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
            EXPORTING
              clusterid                    = w_clstrid
              employeenumber               = wa_0001-pernr
              sequencenumber               = wa_pc261-seqnr
            CHANGING
              payroll_result               = it_payrt_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.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    **---Processing....
          LOOP AT it_lgart INTO wa_lgart.
            CLEAR : wa_income.
            IF wa_lgart-lgart NE '5004' AND
               wa_lgart-lgart NE '5007' AND
               wa_lgart-lgart NE '5008' AND
               wa_lgart-lgart NE '5011' AND
               wa_lgart-lgart NE '5012' AND
               wa_lgart-lgart NE '5014' AND
               wa_lgart-lgart NE '5017' AND
               wa_lgart-lgart NE '5018' AND
               wa_lgart-lgart NE '5027' AND
               wa_lgart-lgart NE '5029' AND
               wa_lgart-lgart NE '5031' AND
               wa_lgart-lgart NE '5039' AND
               wa_lgart-lgart NE '5060' AND
               wa_lgart-lgart NE '7004' AND
               wa_lgart-lgart NE '7007' AND
               wa_lgart-lgart NE '7008' AND
               wa_lgart-lgart NE '7011' AND
               wa_lgart-lgart NE '7012' AND
               wa_lgart-lgart NE '7014' AND
               wa_lgart-lgart NE '7017' AND
               wa_lgart-lgart NE '7018' AND
               wa_lgart-lgart NE '7027' AND
               wa_lgart-lgart NE '7029' AND
               wa_lgart-lgart NE '7031' AND
               wa_lgart-lgart NE '7039' AND
               wa_lgart-lgart NE '7060'.
              LOOP AT it_payrt_result-inter-crt INTO wa_paycrt_result
                      WHERE cumty = 'Y' AND lgart EQ wa_lgart-lgart.
                IF wa_lgart-lgart+0(1) = '7'.
                  LOOP AT it_payrt_result-inter-crt INTO wa_paycrt_result
                           WHERE cumty = 'M' AND lgart EQ wa_lgart-lgart.
                    READ TABLE it_payrt_result-inter-rt INTO
                               wa_payrt_result WITH
                               KEY lgart = wa_lgart-lgart.
                    IF sy-subrc = 0.
                      wa_income-particular = wa_lgart-lgtxt.
                      wa_income-lgart      = wa_paycrt_result-lgart.
                      wa_income-cumm       = wa_paycrt_result-betrg.
                    ENDIF.
                  ENDLOOP.
                ELSE.
                  wa_income-particular = wa_lgart-lgtxt.
                  wa_income-lgart      = wa_paycrt_result-lgart.
                  wa_income-cumm       = wa_paycrt_result-betrg.
                ENDIF.
              ENDLOOP.
              REFRESH : it_0008.
              CLEAR : wa_0008.
              PERFORM f010_get_date USING pnppabrp pnppabrj.
              CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
                EXPORTING
                  day_in            = w_cdate
                IMPORTING
                  last_day_of_month = w_ldate
                EXCEPTIONS
                  day_in_not_valid  = 1
                  OTHERS            = 2.
              SELECT * FROM pa0008 INTO CORRESPONDING FIELDS OF TABLE
                       it_0008 WHERE pernr = wa_0001-pernr
                               AND   begda <= w_cdate
                               AND   endda >= w_ldate.
              IF it_0008 IS INITIAL.
                SELECT * FROM pa0008 INTO CORRESPONDING FIELDS OF TABLE
                         it_0008 WHERE pernr = wa_0001-pernr
                                 AND   begda BETWEEN w_cdate AND w_ldate.
                IF it_0008 IS INITIAL.
                  SELECT * FROM pa0008 INTO CORRESPONDING FIELDS OF TABLE
                        it_0008 WHERE pernr = wa_0001-pernr
                                AND   begda = w_cdate.
                ENDIF.
              ENDIF.
              CLEAR : w_st0008, w_en0008.
              LOOP AT it_0008 INTO wa_0008.
                w_st0008 = wa_0008-begda.
                w_en0008 = wa_0008-endda.
                EXIT.
              ENDLOOP.
              CLEAR : wa_rt.
              REFRESH : it_rt.
              CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE'
                EXPORTING
                  begda                        = w_st0008
                  endda                        = w_en0008
                  infty                        = '0008'
                  pernr                        = wa_0001-pernr
                TABLES
                  ppbwla                       = it_rt
                EXCEPTIONS
                  error_at_indirect_evaluation = 1
                  OTHERS                       = 2.
              LOOP AT it_rt INTO wa_rt.
                CLEAR : w_var.
                IF wa_rt-lgart         = '5000' AND         "Basic
                   wa_lgart-lgart        = '5000'.
                  w_var = 12 - pnppabrp.
                  wa_income-proj = wa_rt-betrg * w_var.
                  wa_income-lgart = wa_rt-lgart.
    **---Here we are checking for the arrers of Basic to deduct from the
    *cummulation amount...
                  READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                             WITH KEY lgart = '7000'.
                  IF sy-subrc = 0.
                    wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                  ENDIF.
                ENDIF.
                IF wa_rt-lgart         = '5001' AND         "HRA
                   wa_lgart-lgart        = '5001'.
                  w_var = 12 - pnppabrp.
                  wa_income-proj = wa_rt-betrg * w_var.
                  wa_income-lgart = wa_rt-lgart.
    **---Here we are checking for the arrers of HRA to deduct from the
    *cummulation amount...
                  READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                             WITH KEY lgart = '7001'.
                  IF sy-subrc = 0.
                    wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                  ENDIF.
                ENDIF.
                IF wa_rt-lgart         = '5003' AND         "Conveyance
                   wa_lgart-lgart        = '5003'.
                  w_var = 12 - pnppabrp.
                  wa_income-proj = wa_rt-betrg * w_var.
                  wa_income-lgart = wa_rt-lgart.
    **---Here we are checking for the arrers of Conveyance to deduct from
    *the cummulation amount...
                  READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                             WITH KEY lgart = '7003'.
                  IF sy-subrc = 0.
                    wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                  ENDIF.
                ENDIF.
                IF wa_rt-lgart         = '5005' AND         "Special Pay
                   wa_lgart-lgart        = '5005'.
                  w_var = 12 - pnppabrp.
                  wa_income-proj = wa_rt-betrg * w_var.
                  wa_income-lgart = wa_rt-lgart.
    **---Here we are checking for the arrers of Special pay to deduct from
    *the cummulation amount...
                  READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                             WITH KEY lgart = '7005'.
                  IF sy-subrc = 0.
                    wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                  ENDIF.
                ENDIF.
                IF wa_rt-lgart         = '5002' AND         "CLA
                   wa_lgart-lgart        = '5002'.
                  w_var = 12 - pnppabrp.
                  wa_income-proj = wa_rt-betrg * w_var.
                  wa_income-lgart = wa_rt-lgart.
    **---Here we are checking for the arrers of CLA to deduct from the
    *cummulation amount...
                  READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                             WITH KEY lgart = '7002'.
                  IF sy-subrc = 0.
                    wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                  ENDIF.
                ENDIF.
              ENDLOOP.
             LOOP AT it_payrt_result-inter-rt INTO wa_payrt_result
                     WHERE lgart = wa_lgart-lgart.
               CLEAR : w_var.
               IF wa_payrt_result-lgart = '5000' AND         "Basic
                  wa_lgart-lgart        = '5000'.
                 w_var = 12 - pnppabrp.
                 wa_income-proj = wa_payrt_result-betrg * w_var.
                 wa_income-lgart = wa_payrt_result-lgart.
               ENDIF.
    ***---Here we are checking for the arrers of Basic to deduct from the
    *cummulation amount...
                 READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                            WITH KEY lgart = '7000'.
                 IF sy-subrc = 0.
    *wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                 ENDIF.
               IF wa_payrt_result-lgart = '5001' AND         "HRA
                  wa_lgart-lgart        = '5001'.
                 w_var = 12 - pnppabrp.
                 wa_income-proj = wa_payrt_result-betrg * w_var.
                 wa_income-lgart = wa_payrt_result-lgart.
               ENDIF.
    ***---Here we are checking for the arrers of HRA to deduct from the
    *cummulation amount...
                 READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                            WITH KEY lgart = '7001'.
                 IF sy-subrc = 0.
    *wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                 ENDIF.
               IF wa_payrt_result-lgart = '5003' AND         "Conveyance
                  wa_lgart-lgart        = '5003'.
                 w_var = 12 - pnppabrp.
                 wa_income-proj = wa_payrt_result-betrg * w_var.
                 wa_income-lgart = wa_payrt_result-lgart.
               ENDIF.
    ***---Here we are checking for the arrers of Conveyance to deduct from
    *the cummulation amount...
                 READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                            WITH KEY lgart = '7003'.
                 IF sy-subrc = 0.
    *wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                 ENDIF.
               IF wa_payrt_result-lgart = '5005' AND         "Special Pay
                  wa_lgart-lgart        = '5005'.
                 w_var = 12 - pnppabrp.
                 wa_income-proj = wa_payrt_result-betrg * w_var.
                 wa_income-lgart = wa_payrt_result-lgart.
               ENDIF.
    ***---Here we are checking for the arrers of Special pay to deduct from
    *the cummulation amount...
                 READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                            WITH KEY lgart = '7005'.
                 IF sy-subrc = 0.
    *wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                 ENDIF.
               IF wa_payrt_result-lgart = '5002' AND         "CLA
                  wa_lgart-lgart        = '5002'.
                 w_var = 12 - pnppabrp.
                 wa_income-proj = wa_payrt_result-betrg * w_var.
                 wa_income-lgart = wa_payrt_result-lgart.
               ENDIF.
    ***---Here we are checking for the arrers of CLA to deduct from the
    *cummulation amount...
                 READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                            WITH KEY lgart = '7002'.
                 IF sy-subrc = 0.
    *wa_income-cumm = wa_income-cumm - wa_payrt_result-betrg.
                 ENDIF.
             ENDLOOP.
              IF wa_lgart-lgart = '5065'.
                READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                           WITH KEY lgart = '5065'.
                IF sy-subrc = 0.
                  wa_income-particular = wa_lgart-lgtxt.
                  wa_income-lgart      = wa_lgart-lgart.
                  wa_income-cumm       = wa_payrt_result-betrg.
                  wa_income-proj       = 0.
                ENDIF.
              ENDIF.
              CLEAR : wa_payrt_result.
              IF wa_lgart-lgart = '5001'.
                "HRA Exemptions
                READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                           WITH KEY lgart = '/4E4'.
                IF sy-subrc = 0.
                  wa_income-exem = wa_payrt_result-betrg.
                 wa_income-lgart = wa_payrt_result-lgart.
                ENDIF.
              ENDIF.
              CLEAR : wa_payrt_result.
              IF wa_lgart-lgart = '5003'.
                "Conveyance Exemptions
                READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                           WITH KEY lgart = '/4E3'.
                IF sy-subrc = 0.
                  wa_income-exem = wa_payrt_result-betrg.
                 wa_income-lgart = wa_payrt_result-lgart.
                ENDIF.
              ENDIF.
              CLEAR : wa_payrt_result.
              IF wa_lgart-lgart = '5025'.
                "Leave Encashment
                READ TABLE it_payrt_result-inter-rt INTO wa_payrt_result
                           WITH KEY lgart = '/4E7'.
                IF sy-subrc = 0.
                  wa_income-particular = wa_lgart-lgtxt.
                 wa_income-lgart      = wa_payrt_result-lgart.
                  wa_income-cumm       = wa_payrt_result-betrg.
                  wa_income-exem       = wa_payrt_result-betrg.
                ENDIF.
              ENDIF.
    **---Here we are calculating the annual field of the IT it_income....
              wa_income-annu = ( wa_income-cumm + wa_income-proj ) -
              wa_income-exem.
              IF wa_income IS NOT INITIAL.
                APPEND wa_income TO it_income.
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDLOOP.
        READ TABLE  it_payrt_result-inter-rt INTO wa_payrt_result
                    WITH KEY lgart = '5038'.
        IF sy-subrc EQ 0.
          READ TABLE it_lgart INTO wa_lgart WITH KEY lgart = '5038'.
          wa_wage-annu       = wa_payrt_result-betrg.
          wa_wage-particular = wa_lgart-lgtxt.
          wa_wage-lgart      = w_lgart.
          wa_wage-cumm       = wa_payrt_result-betrg.
          APPEND wa_wage TO it_wage.
        ENDIF.
    **---Here we are looping the RGDIR internal table for the LTA Amount in
    *Offcycle....
        LOOP AT it_pc261 INTO wa_pc261 WHERE fpper = '000000'
                                       AND   srtza = 'A'.
          IF w_flag IS INITIAL.
            IF wa_pc261-fpbeg+4(2) = '01' OR
               wa_pc261-fpbeg+4(2) = '02' OR
               wa_pc261-fpbeg+4(2) = '03'.
              w_year = wa_pc261-fpbeg+0(4) - 1.
              w_pr_from1 = w_year.
            ELSE.
              w_pr_from1 = wa_pc261-fpbeg+0(4).
            ENDIF.
            IF wa_pc261-fpbeg+4(2) EQ '01'.
              w_pr_to1 = '10'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '02'.
              w_pr_to1 = '11'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '03'.
              w_pr_to1 = '12'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '04'.
              w_pr_to1 = '01'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '05'.
              w_pr_to1 = '02'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '06'.
              w_pr_to1 = '03'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '07'.
              w_pr_to1 = '04'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '08'.
              w_pr_to1 = '05'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '09'.
              w_pr_to1 = '06'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '10'.
              w_pr_to1 = '07'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '11'.
              w_pr_to1 = '08'.
            ELSEIF wa_pc261-fpbeg+4(2) EQ '12'.
              w_pr_to1 = '09'.
            ENDIF.
            CONCATENATE w_pr_from1 w_pr_to1 INTO w_fpper-low1.
            IF w_period = w_fpper-low1.
              w_flag = 'X'.
              CLEAR : wa_payrt_result.
    **---Importing the Payroll cluster results for each employee from RT....
              CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
                EXPORTING
                  clusterid                    = w_clstrid
                  employeenumber               = wa_0001-pernr
                  sequencenumber               = wa_pc261-seqnr
                CHANGING
                  payroll_result               = it_payrt_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.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.
              LOOP AT it_lgart INTO wa_lgart WHERE lgart = '5039'.
                "LTA
                LOOP AT it_payrt_result-inter-crt INTO wa_paycrt_result
                        WHERE lgart = '5039' AND cumty = 'C'.
                  w_lgtxt = wa_lgart-lgtxt.
                  w_lgart = wa_paycrt_result-betrg.
                  w_cumm  = wa_paycrt_result-betrg.
                ENDLOOP.
              ENDLOOP.
            ENDIF.
          ENDIF.
        ENDLOOP.
    **---Here we are looping through the RT table to get the LTA Exemptions
    *Amount....
        LOOP AT it_payrt_result-inter-rt INTO wa_payrt_result
                WHERE lgart = '/4E5'.                    "LTA Exemptions
          w_ltaexe = wa_payrt_result-betrg.
          wa_income-particular = w_lgtxt.
          wa_income-lgart      = w_lgart.
          wa_income-cumm       = w_cumm.
          wa_income-exem       = w_ltaexe.
        ENDLOOP.
    **---Here we are deducting the arrears amount from the original wagetype
    *of the
    **---arrear and then calculating the total of the annual column....
       CLEAR : wa_income.
       LOOP AT it_income INTO wa_income.
         CLEAR : w_wage.
         IF wa_income-lgart+0(1) = '5'.
           CONCATENATE '7' wa_income-lgart+1(3) INTO w_wage.
           READ TABLE it_income INTO wa_in WITH KEY lgart = w_wage.
           IF sy-subrc = 0.
             CLEAR : w_amount.
             w_amount = wa_in-annu.
             wa_income-annu = wa_income-annu - w_amount.
             MODIFY it_income FROM wa_income TRANSPORTING annu.
           ENDIF.
         ENDIF.
       ENDLOOP.
        APPEND LINES OF it_wage TO it_income.
    **---perform to get the data of the Investments of the employee...
        PERFORM f00_investmants USING wa_0001.
        LOOP AT it_income INTO wa_income.
          READ TABLE it_0000 INTO wa_0000 WITH KEY pernr = wa_0001-pernr
                                                   massn = 'GO'.
          IF sy-subrc EQ 0 AND wa_0000-begda0(6) = w_cdate0(6).
            CLEAR wa_income-proj.
            wa_income-annu = wa_income-cumm - wa_income-exem.
            MODIFY it_income FROM wa_income.
          ENDIF.
        ENDLOOP.
        LOOP AT it_income INTO wa_income.
          READ TABLE it_0000 INTO wa_0000 WITH KEY pernr = wa_0001-pernr
                                                   massn = 'FF'.
          IF sy-subrc EQ 0 AND wa_0000-begda0(6) = w_cdate0(6).
            CLEAR wa_income-proj.
            wa_income-annu = wa_income-cumm - wa_income-exem.
            MODIFY it_income FROM wa_income.
          ENDIF.
        ENDLOOP.
    **---Perform to reach to the Income chargable to Tax of the Employee....
        PERFORM f001_chargeable_income USING wa_0001.
    **---perform to display the data in IT form.....
        PERFORM f00_output_data TABLES it_income it_deduct it_invest
                                USING  wa_0001.
      ENDLOOP.
    ENDFORM.                    " f000_get_income
    *&      Form  f00_output_data
          text
         -->P_IT_INCOME  text
         -->P_WA_0001  text
    FORM f00_output_data  TABLES   p_it_income STRUCTURE wa_income
                                   p_it_deduct STRUCTURE wa_deduct
                                   p_it_invest STRUCTURE wa_invest
                          USING    p_wa_0001 TYPE pa0001.
      CLEAR : w_dept, w_desig, w_join.
      rp-provide-from-last p0001 space '18000101' '99991231'.
      rp-provide-from-frst p0000 space '18000101' '99991231'.
      w_join = p0000-begda.
      SELECT SINGLE plstx FROM t528t INTO w_desig
                      WHERE sprsl = 'E'
                      AND   plans = p0001-plans.
      SELECT SINGLE orgtx FROM t527x INTO w_dept
                    WHERE sprsl = 'E'
                    AND   orgeh = p0001-orgeh.
      WRITE : /.
      WRITE : / 'EMPLOYEE NUMBER :',
              p_wa_0001-pernr.
      WRITE AT 35 'EMPLOYEE NAME :'.
      WRITE : p_wa_0001-ename.
      WRITE : / 'DEPARTMENT      :',
              w_dept.
      WRITE AT 35 'DESIGNATION   :'.
      WRITE : w_desig.
      WRITE : / 'DATE OF JOINING :',
              w_join.
    **---Here we are starting the output of the IT Report....
      WRITE : /.
      ULINE.
      WRITE AT 28 'INCOME TAX CALCULATION'.
      ULINE.
      WRITE : /.
      WRITE : / 'Particulars'.
      WRITE AT 26 'Cummulative Total'.
      WRITE AT 45 'Add:Projected'.
      WRITE AT 61 'Less:Exempted'.
      WRITE AT 77 'Annual. Rs.'.
      WRITE : /.
      LOOP AT p_it_income INTO wa_income.
        CLEAR : wa_income1.
        WRITE wa_income-particular TO wa_income1-particular.
        WRITE wa_income-lgart RIGHT-JUSTIFIED TO wa_income1-lgart.
        WRITE wa_income-cumm RIGHT-JUSTIFIED TO wa_income1-cumm.
        WRITE wa_income-proj RIGHT-JUSTIFIED TO wa_income1-proj.
        WRITE wa_income-exem RIGHT-JUSTIFIED TO wa_income1-exem.
        WRITE wa_income-annu RIGHT-JUSTIFIED TO wa_income1-annu.
        APPEND wa_income1 TO it_income1.
      ENDLOOP.
      LOOP AT it_income1 INTO wa_income1.
        WRITE : / wa_income1-particular LEFT-JUSTIFIED UNDER 'Particulars',
                wa_income1-cumm       UNDER 'Cummulative Total',
                wa_income1-proj       UNDER 'Add:Projected',
                wa_income1-exem       UNDER 'Less:Exempted',
                wa_income1-annu       UNDER 'Annual. Rs.'.
         w_total = w_total + wa_income-annu.
     

  • Calculation of working hours

    Hi all,
    I need a function module for the calculation of working hours. supose in the selection screen if i give 01.02.2007 to 01.10.2007 i need the calculation of working hours in that given range depending upon the personal number. Suppose if the employee is absent for 3 or 4 days within particular period of theat given range that days needs to be eliminated and should calculate for the rest of the days. Please find the below code iam finding a problem in this piece of code. Please this issue is very urgent please reply ASAP.
      gv_day = sy-datum - 7.
      CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
        EXPORTING
          datum    = gv_day
          week_pst = 0
          week_ftr = 0
        IMPORTING
          begda    = gv_begda
          endda    = gv_endda.
      IF sy-subrc <> 0.
      ENDIF.
    *AT SELECTION-SCREEN OUTPUT.
      pnpbegda = gv_begda.
      pnpendda = gv_endda.
    START-OF-SELECTION.
      SELECT sachn
             usrid
        FROM t526 INTO TABLE git_tmadmin
       WHERE sachn NE space
         AND usrid NE space.
      IF sy-subrc EQ 0.
        SORT git_tmadmin BY usrid.
      ENDIF.
    GET pernr.
      rp-provide-from-last p0001 space pn-begda pn-endda.
      IF pnp-sw-found <> 1.
        REJECT.
      ELSE.
        IF p0001-kostl NOT IN s_cctr.
          REJECT.
        ELSE.
          rp-provide-from-last p0007 space pn-begda  pn-endda.
          IF pnp-sw-found = 1.
            MOVE p0007-wostd TO gs_empdtls-wostd.
          ENDIF.
          MOVE :  p0001-pernr TO gs_empdtls-pernr,
                  p0001-kostl TO gs_empdtls-kostl,
                  p0001-ename TO gs_empdtls-ename,
                  p0001-sachz TO gs_empdtls-sachz.
        Employee Position from PA0001
          MOVE: p0001-plans TO gs_empdtls-plans.
          APPEND gs_empdtls TO git_empdtls.
          CLEAR gs_empdtls.
        ENDIF.
      ENDIF.
    Regards
    Mahesh

    What error are you getting?

Maybe you are looking for

  • IPhoto books- Delete text boxes?

    For several pages in an iPhoto book I am making, I do not want any text or descriptions. However, there are empty text boxes whose outlines are still showing up. I don't want the pages to print with the text box outlines. There is nothing typed in th

  • Synchronize table changes from Database to ODI

    HI all, which is the best approach to synchronize database changes into ODI. Is there any way of automate it? FOr instance, if we have a datastore as target and some data types are changes in the database, re-reverse will not apply these changes ...

  • SCEP Build and Capture

    Is it a best practice to install SCEP together with its definition updates during build and capture? If yes, will the definition updates get installed during the "Install Software Update" step?

  • WLCs 5508, HA enabled and Internal DHCP

    Hi: Designing a new project for a customer in which a pair of WLC-5508 and a bunch of AP-3602I will be deployed. Controllers running 7.4 image, and I'd also like to use them as internal DHCP servers for clients in different WLANs As for the redundanc

  • Relation between BSEG with Asset Tables

    HI Guru's, how to find relation between BSEG with Asset Tables like ANLA and ANEP.. regards JK