Logic Required in HR ABAP Program

Hi,
First i have to check the Change Date on Infotype 0000 Actions infotype (P0000-AEDTM).  If the change date falls within the Period Selection date specified then i have to include the employee in the report.
the included fields are:
P0000-AEDTM,P0001-BUKRS,PERNR,ENAME,P0000-MASSN,P0000-MASSG,P0000-BEGDA,P0001-ORGEH,P0001-PLANS,P0001-STELLP0001-ABKRS,P0001-WERKS,P0001-BTRTL,Q0001-MSTBR,Q0001-ENAME(supervisor name)
If the change date (P0000-AEDTM) does not fall within the Period Selection Date, i have to check the Change Date in Infotype 0001 Organization Assignment infotype (P0001-AEDTM). If the change date falls within the Period Selection date specified then i have to include the employee in the report. Include in report only that information which has been changed from the previous Infotype 0001 record, except for Change Date, Company Code, Personnel Number and Name, which must always be included in the report.
For this requirement i have written the below code:
LOOP AT p0000 WHERE aedtm >= pn-begda AND
                      aedtm <= pn-endda.
   wa_final-massn = p0000-massn.
    wa_final-pernr = p0000-pernr.
    wa_final-aedtm = p0000-aedtm.
    wa_final-massg = p0000-massg.
    wa_final-begda = p0000-begda.
    wa_final-begda = p0000-begda.
    rp-provide-from-last p0001 space  p0000-begda p0000-endda.
    wa_final-bukrs = p0001-bukrs.
    wa_final-kostl = p0001-kostl.
    wa_final-mstbr = p0001-mstbr.
    wa_final-ename = p0001-ename.
    APPEND wa_final TO it_final.
    CLEAR wa_final.
ENDLOOP.
if sy-subrc ne 0.
LOOP AT p0001 WHERE aedtm >= pn-begda AND
                        aedtm <= pn-endda.
      lv_endda = p0001-begda - 1.
      READ TABLE p0001 WITH KEY pernr = p0001-pernr endda = lv_endda INTO w0001.
      IF sy-subrc = 0.
      if p0001-kostl ne w0001-kostl.
        wa_final-kostl = p0001-kostl.
      endif.
     if p0001-mstbr ne w0001-mstbr.
        wa_final-mstbr = p0001-mstbr.
     endif.
      wa_final-pernr = p0001-pernr.
      wa_final-aedtm = p0001-aedtm.
      wa_final-bukrs = p0001-bukrs.
      wa_final-ename = p0001-ename.
       APPEND wa_final TO it_final.
       CLEAR wa_final.
      Endif.
Endif..
is this code correct? or do i have to do any modifications?

This is like retro payroll run see the payroll program.
RPCUCALC00 and you will find the logic over there how it will run retroactive payroll
Best Regards

Similar Messages

  • Logical path using in abap program

    hay,
    I want to create file in application server directory.
    so i want the user to select the Logical path and file name from screen.so that he can create the file and seved in selected logical path.{path used must be from Instance profile DIR_LOGGING,GLOBALPATH directory etc).
    could you pls tell me how to do this using parameter for user input selecting FILE PATH.
    Do we have Functional module for Retrieving physical path
    from logical path?
    could you pls help me..
    ambichan.

    hey,
    Thanks for your reply.
    Instead of using logical file name as input, can we allow the user to select logical path using parameter?
    I want user to select Logical path or logical file name from parameter. is it possible?
    (I want to avoid user to input insteal want to allow user to select the path)
    ambichan
    Message was edited by: ambi chan

  • LOGICAL DATABASE IN HR ABAP PRPGRAMMING

    Hi Friends,
    what is use of LOGICAL DATABASE IN HR ABAP PROGRAMMING
    AND END-OF-SELECTION EVENT IN HR PROGRAMMING PROGRAMMING???
    regards,
    vijay.

    hi
    HR Logical Databases
    In Human Resources (HR), the following logical databases can be used as a data source for HR InfoSets:
    PNP (PNPCE)
    PAP
    PCH
    By selecting a logical database, you determine the HR data that can be reported on using an InfoSet.
    Logical Database PCH
    This logical database generally enables you to report on all HR infotypes. However, you are advised not to use this logical database unless you want to report on Personnel Planning data.
    Logical Database PNP (or PNPCE)
    Use logical database PNP to report on HR master data. It is possible to use logical database PCH to access this data, but PNP meets such reporting requirements more quickly because it is best suited to the task of selecting persons.
    Logical database PNP enables you to access HR master data and infotypes from Personnel Planning. For example, you have the following options:
    Reporting on the costs, number of attendees booked, and instructor for a business event on which an employee is booked
    Reporting on working time and planned compensation for a position that an employee occupies
    Reporting on the validity and proficiency of a qualification that an employee fulfils
    From a technical perspective, this means you can use PNP to report on all of the infotypes that exist for objects (infotype 1000) that have a direct relationship (infotype 1001) with the Person object.
    The ability to access infotypes from Personnel Planning using logical database PNP is a special feature that you can only use in the context of SAP Query and Ad Hoc Query. You cannot use this functionality for ABAP reports you programmed yourself.
    You can also use logical database PNP to report on data from Personnel Time Management (infotypes 2000 to 2999) and Payroll (special payroll infotypes for the USA and customer infotypes; for more information, access Customizing for the Human Resources Information System and see Payroll Results).
    Logical Database PAP
    Logical database PAP enables you to access data from Recruitment.
    regards
    navjot
    reward if helpfull

  • Is Logical Database used in ABAP?????

    Hi All,
    I m very confused whether LDB's are used in ABAP or not.
    i have undergone a small training in ABAP-HR (HCM).
    In that training i was told that there is an advantage in HCM that LDB's are used here
    which were not used in ABAP.
    And i have read somewhere that LDB's are used in ABAP.
    can plz sumone give a light on this.
    Thanks,
    Sonali

    hi,
    The use of a logical database provides you with an alternative to having to program database accesses individually. Logical databases retrieve data records and make them available to ABAP programs.
    The same logical database can be the data source for several Quick Views, queries, and programs. In the Quick View, the LDB can be specified directly as a data source. A query works with the logical database when the functional area that generated the query is defined with a logical database. In the case of type 1 programs, the LDB is entered in the attributes or called using function module LDB_PROCESS. See appendix for information on how to use the function module.
    Logical databases offer several advantages:
    The system generates a selection screen. The use of selection screen versions or variants provides the required flexibility.
    The user does not have to know the exact structure of the tables involved (especially the foreign key dependencies); the data is made available in the correct order at GET events.
    Performance improvements within logical databases directly affect all programs linked to the logical database, without having to change the programs themselves.
    Maintenance can be performed at a central location.
    Authorization checks can also be performed centrally.
    A logical database is an ABAP program that reads predefined data from the database and makes it available to other programs.
    A hierarchical structure determines the order in which the data is supplied to the programs. A logical database also provides a selection screen that checks user entries and conducts error dialogs. These can be extended in programs.
    SAP provides some 200 logical databases in Release 4.6. The names of logical databases have been extended to 20 places in Release 4.0 (namespace prefix max. 10 characters).
    In the case of executable programs, you can enter a logical database in the attributes.
    Use the NODES statement to specify the nodes of the logical database that You want to use in the program. NODES allocates the appropriate storage space for the node - that is, a work area or a table area depending on the node type.
    The logical database makes the data records available for the corresponding GET events.
    The sequence in which these events are processed is determined by the structure of the logical database.
    Logical databases are made up of several sub-objects. The structure determines the hierarchy, and thus the read sequence of the data records.
    Hope this helps, Do reward

  • How to get data in ABAP program from multicube in external BW system

    Hi friends,
         I want to get data from one multicube which resides in an external BW system, in my ABAP program internal table. Is there any SAP standard RFC / BAPI for this or is there any other way around or I have to design my own program to get the data ?
        To make my requirement clearer, my ABAP program is in one BW box and the above mentioned multicube in another BW box. I want to get data from the multicube into my program.
        Any help is appreciated with points.

    Look at the following FM; you may find the FM RSDRI_INFOPROV_READ_RFC useful.
    Call the FM in your program and read data and update.
    RSAD_INFOCUBE_READ_REMOTE_DATA
    RSDRI_INFOPROV_READ_RFC
    Ravi Thothadri

  • How to use FTI_TR_CASH_FLOWS ldb in abap programming.

    I want to use FTI_TR_CASH_FLOWS  logical database in existing ABAP program but i am not able to use this logical data base in the program.Please suggest how to use this logical database in the program.

    I have developed a customized report and i want to use  logical database "FTI_TR_CASH_FLOWS" into my program . i don't know how to use SAPDBFTI_TR_CASH_FLOWS  into my report. how i pass data from my report to this LDB report. plz suggest.

  • Add Voting buttons in MS Outlook from SAP ABAP program

    I have a requirment where SAP ABAP program will send an email.
    I need to have the voting buttons (yes/no) in the email. It does not have to be in the content of the email but the typically voting buttons that we can add to the MS Outlook email.
    If there is someone who can give me the steps and documentations, greatly appreciate.
    The main critieria is that it has to be MS outlook.

    Hi,
    here is the solution i think.
    INCLUDE ole2incl .
    DATA: ole_outlook  TYPE ole2_object,
          ole_CItem    TYPE ole2_object,
          ole_body      TYPE string.
      CREATE OBJECT ole_outlook 'Outlook.Application'.
      CALL METHOD OF ole_outlook 'CreateItem' = ole_CItem
        EXPORTING #1 = 0.
      SET PROPERTY OF ole_CItem 'To' = 'receiver @ mail.com'.
      SET PROPERTY OF ole_CItem 'Subject' = 'E-mail Title'.
      CALL METHOD OF ole_CItem 'Display'.
      CONCATENATE ole_body
                  'Dear Sir/Madam,'
                  cl_abap_char_utilities=>newline
                  cl_abap_char_utilities=>newline
        INTO ole_body.
    SET PROPERTY OF ole_CItem 'Body' = ole_body.
    CALL METHOD OF ole_CItem 'ATTACHMENTS' = ATTS.
    CALL METHOD OF ATTS 'ADD'
    EXPORTING #1 = 'C:\File_Location\File_name.extension'.
    SET PROPERTY  OF ole_CItem 'VotingOptions' = 'Yes;No'.
    FREE OBJECT ole_outlook.
    *you can replace the voting option to what you want, for example 'Yes;No' or 'Approve;Reject'.

  • Calling ABAP Program / Transaction in WAD

    Hello Experts,
    We have requirement to call ABAP program/transaction in WAD. Can you please help us with your valuable inputs. We are using BI 7.0 !
    Thanks and Regards,
    Prawin Kumar

    Hi Praveen,
    you can try calling the ABAP class/transaction  using a custom extension as described here:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/99bd42b407114be10000000a421937/content.htm
    Brgds,
    Marcel

  • How do u find logical datanase exist for ur program requirement?

    How do u find logical datanase exist for ur program requirement?

    Hi,
    The transaction Code SE36 is where you can find all the Logical Database that exist in the SAP system. You can find the existing logical database that exist and can use which ever that suits your needs.
    Logical Databases are mostly used in HR ABAP and in HCM Reports.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • Can I use logical databases in a WebDynpro ABAP program?

    can I use logical databases in a WebDynpro ABAP program?
    I need to build a WDA screen that is similar to the SAPDBPNP selection screen (user can find the personnel number based on several criteria, such as last_name/first_name of the employee).  So it seems that the existing logical databases have already many nice features already built (like the selection screens, the logic behind the screens etc). So I was wondering if/how I can use them in my WDA application.

    Hello, Tiberiu.
    You cannot use LDB directly within your WDA programa. BUT, you can fetch results from this LDB by using FM LDB_PROCESS. This function module can be called anytime from any kind of ABAP program. But you will still have to create the screen, as it only processes data, not screens.
    Regards,
    Andre
    PS: Pls reward points if it helps.

  • Can I use logical databases in a WebDynpro for ABAP program?

    can I use logical databases in a WebDynpro ABAP program?
    I need to build a WDA screen that is similar to the SAPDBPNP selection screen (user can find the personnel number based on several criteria, such as last_name/first_name of the employee).  So it seems that the exisinting logical databases have already many nice features already built (like the selection screens, the logic behind the screens etc). So I was wondering if/how I can use them in my WDA application.

    Hi
    Please let me also know the solution to this. I am a beginner to WebDynpro  and want to know if I can make use of LDB's as we do in our normal HR programming do develop a WDA in HR.
    Thanks and regards,
    Uma.

  • MDX - ABAP program variable to select the required month

    Dear all,
    Please I would like to ask you about the following MDX issue.
    We have run the following MDX in SAP R/3 using the OLAP BAPI with successful results:
    SELECT
    [Measures].MEMBERS ON AXIS(0) ,
    NON EMPTY [0SALESORG].[LEVEL01].MEMBERS
    [0DISTR_CHAN].[LEVEL01].MEMBERS
    [0MATERIAL].[LEVEL01].MEMBERS
    properties member_name
    ON AXIS(1)
    FROM [EPSDC108/ZTD_EPSDC108_Q002]
    We now want to select a specific calendar month for the data and generated the following MDX:
    SELECT
    [Measures].MEMBERS ON AXIS(0) ,
    NON EMPTY [0SALESORG].[LEVEL01].MEMBERS
    [0DISTR_CHAN].[LEVEL01].MEMBERS
    [0MATERIAL].[LEVEL01].MEMBERS
    properties member_name
    ON AXIS(1)
    FROM [EPSDC108/ZTD_EPSDC108_Q002]
    SAP VARIABLES [CALMONTH] INCLUDING <member>
    We would like to know how we use an ABAP program variable to select the required month.
    Thank you in advance for you reply
    Regards
    Ales

    hello,
    the syntax of the MDX should be:
    SELECT
    [Measures].MEMBERS ON AXIS(0) ,
    NON EMPTY [0SALESORG].[LEVEL01].MEMBERS
    [0DISTR_CHAN].[LEVEL01].MEMBERS
    [0MATERIAL].[LEVEL01].MEMBERS
    properties member_name
    ON AXIS(1)
    FROM [EPSDC108/ZTD_EPSDC108_Q002]
    SAP VARIABLES [CALMONTH] INCLUDING [0CALMONTH].[200412]
    CALMONTH is the Queryvariable!!
    If you wanna use a ABAP veriable you have to concatenate the MDX statement in your ABAP.
    Kind reg.
    Michael

  • How do u find if a logical database exsits  for ur program requirements.

    hi
    how do u find if a logical database exsits  for ur program requirements.

    Hai friend
    you just open your program and than from your MENU BAR select GOTO menu from that select ATTRIBUTE and enter then check LOGICAL DATABASE name hase give or not.
    1. open your program.
    2. from menu bar select GOTO
    3. from GOTO menu select ATTRIBUTES.
    4. check for LOGICAL DATABASE name has given or not, If give that is  your logical database name.
    reward if useful.
    uk

  • How do you find if a LOGICAL DATABASE exists for your program requirements?

    how do you find if a LOGICAL DATABASE exists for your program requirements?
    please explain.

    Hi Ramana
      One may not accurately pin point the LDB for ones requirement. But there some ways.
    1. You can find with respect to the application you are working on. You can refer to the Table field TRDIR-APPL. The following are the values it has. So suppose if you have requirement for HR you can search for application 'P' :
    A Assets accounting
    D DASS control station
    E RIVA
    F Financial accounting
    G General Ledger
    H Human resources planning
    I Maintenance
    J RK projects
    K Cost accounting
    L Warehouse management
    M Materials management
    N Hospital
    P Human resources
    Q QSS
    S System
    V Sales
    Y Customer head office
    Z Customer branch
    2. You can see the package in which your current is stored in SE80. Under the same package you can see if there are any LDBs.

  • Logic to run Unix script file through ABAP program

    Hi Friends,
    I need to run the Unix script file from abap program, for that user provided file directory of application server.
    Is there any logic/FM  to run through abap programing.
    pls can any one provide logic.
    Thanks,
    Ravi

    report zsrchsap.
    *-This is a demo report for Search Sap
    *-Author : Sandeep Kulkarni
    *-Date : 09/20/2001
    parameters : p_sfile(60) lower case
              "File to be moved
              "Eg : /home/in/SFILE1.txt
                p_dfile(60) lower case.
              "File's Destination
              "Eg: /home/archive/SFILE1.txt
    data : t_btcxpm
           like btcxpm occurs 0,
           p_addparam
           like sxpgcolist-parameters.
      concatenate
      '/home/ABAP/scripts/Archive_file.sh'
      p_sfile
      p_dfile
      into p_addparam separated by space.
      refresh t_btcxpm. clear t_btcxpm.
      call function 'SXPG_CALL_SYSTEM'
        exporting
          commandname = 'ZSHELL'
          additional_parameters = p_addparam
        tables
          exec_protocol = t_btcxpm
        exceptions
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          program_start_error        = 6
          program_termination_error  = 7
          x_error                    = 8
          parameter_expected         = 9
          too_many_parameters        = 10
          illegal_command            = 11
          others                     = 12.
      if sy-subrc = 0.
        write : /
        'File',p_sfile,'moved to',p_dfile.
      else.
        write : / 'Error Occured'.
      endif.

Maybe you are looking for