ABAP - Logic for finding out the active employee

Hi,
I am trying to write the program where i need to set the flag "YES" to active employee for the particular time period for the particular position.
For example:
Row     Employee     DateTo     DateFrom          Position     FLAG
1     1     1.1.2009     31.1.2009          10     YES
2     1     1.2.2009     1.3.2009          10     NO
3     1     2.3.2009     31.3.2009          10     YES
4     1     1.4.2009     31.12.2009                           11     YES
5     2     1.1.2009     31.1.2009          12     YES          
6     2     1.2.2009     1.3.2009          10     YES
7     2     2.3.2009     31.12.2009                           13     YES
Employee 2 gets assigned as of 1.2.2009 to the same position 10 on which employee 1 is already assigned. Therefore, as of 1.2.2009 emplyoee 1 is not anymore the primary employee of position 10. As employee 2 is leaving the position as of 2.3.09 employee 1 gets again primary employee of that position as of 2.3.2009.
Can any1 suggest me the logic for this?
Regards,
Rashmi
Edited by: Rashmi G P on Jul 13, 2009 9:13 AM

Hi,
I already have a customised table where i am  trying to set the flag.
My logic is something like this:
Declarations:
DATA: pos_flag TYPE char5.
select-OPTIONS : pos for /bic/qzemployee-/bic/zhrpostn.
SELECT zemployee datefrom dateto pos_flag FROM zemployee INTO CORRESPONDING FIELDS OF TABLE
it_QZEMPLOYEE where /bic/zhrpostn in pos.
*Sort it_zhrpostn by postion and datefrom
SORT it_QZEMPLOYEE BY /bic/zhrpostn datefrom.
*Looping it_zhrpostn.
LOOP AT it_QZEMPLOYEE.
MOVE-CORRESPONDING : it_QZEMPLOYEE TO it_qzemployee_temp.
*Appending it_zhrpostn_temp to collect each postion
APPEND it_qzemployee_temp.
*At end of position
AT END OF pos_flag.
*Looping it_zhrpostn_temp table
SORT it_qzemployee_temp BY datefrom DESCENDING.
pos_flag = 'YES'.
LOOP AT it_qzemployee_temp into wa_qzemployees.
IF pos_flag = 'YES' OR wa_qzemployees-/bic/zhrpostn EQ '00000000' OR wa_qzemployees-/bic/zhrpostn EQ '99999999'.
set the flag to yes
write:       pos_flag.
INSERT into /BIC/AZPA_DS0600 VALUES wa_final.
pos_flag = 'NO'.
ELSE.
set the flag to NO
write:       pos_flag.
ENDIF.
endloop.
refresh: it_qzemployee_temp.
ENDAT.
endloop.
But here the problem is the it is taking the most recent datefrom and setting the flag as yes. How to check whether someother employee is active in the given time period and set the flag as YES? Only 1 employee can be active in the date period given.
Thanks and Regards,
Rashmi

Similar Messages

  • How to find out the active associations and clear inactive associations?

    Hi guys,
    I can find out the associates on IOS AP using the command "show dot11 associations client". The output includes all associations even though the clients have left for a long while.
    1.How to find out the active associations?
    2.How to clear the inactive associations?
    3.What is the by default timeout for the inactive associations?
    Thanks,
    yytellmey

    Hi Huang,
    try this:
    Show the associated clients:
    sh dot11 associations all-client
    Deauthenticate client
    clear dot11 client
    Activity Timeout
    show dot11 activity-timeout
    per standard 60 secs.
    Best regards,
    Frank

  • How to find out the active status of catalog area..

    Hi Team,
    In COMM_PCAT_ADM, we can find out the catalog view > catalog areas and product and their status.
    I am working on a requirement where i need to create a report program which will fetch the catalog id, catalog view, catalo area, catalog area status, product id and status.  Input is the catalog id and View ids (can give a range of views).
    Using tables comv_pcat_itm_a, comv_pcat_itm and comm_pcat_view i was able to retrieve the details except the catalog area status.
    Can anyone help me on this..

    Hi,
    Use Tcode st05 for search required table.
    Denis.

  • Finding out the active user in last 10 min

    Hi frends,
    i have the requirement where i have to find out the the following....
    1. who r the user accssing the portal for last 10 min....
    2. what r the pages they r viewing.......
    3. do they got any time out ......
    4. in what page they got the time out........
    can anyone help me out in this regards...
    thanks in advance......
    sithi

    Hi Martin,
    my complete code is as below:
    Pls check it for correctness.
    IPortalComponentResponse response = (IPortalComponentResponse)this.getResponse();       
          Form myForm = this.getForm(); // get the form from DynPage
          int dat = 6000060600;
    IUserAccountFactory useraccfact = UMFactory.getUserAccountFactory();
    try{
      IUserAccountSearchFilter srcFilt = useraccfact.getUserAccountSearchFilter();
      Date secondDate = Calendar.getInstance().getTime();
      Date firstDate = new Date(secondDate.getTime()-dat);
      srcFilt.setLoggedInBetween(secondDate,firstDate);
      ISearchResult result = useraccfact.search(srcFilt);
      List list = new LinkedList();
      while(result.hasNext()){
      String id= (String)result.next();
      response.write("<br>hi"+id);
      list.add(id);
    Collections.sort(list);
    Iterator iter = list.iterator();
      int count = list.size();
      while(iter.hasNext()){
    IUserAccount useracc = useraccfact.getUserAccount(iter.next().toString());
    String disp = useracc.getAssignedUserID();
    response.write("<br>"+disp);
      response.write("<br> <b>No of Hits = <b>"+count );
      catch (UMException e) {
      response.write("<br>Searching failed - " + e.getLocalizedMessage());
    Regards,
    Sithi

  • How to find out the activation log for a info* from Business content

    Hi,
      I work in a BW 3.5 environment where a lot of projects are being done simultaneously and a lot of Business content are getting activated. BW often activates a lot of other objects when a certain section of seemingly unrelated Business contents are activated without much caution.
      When I look into some of the objects related to my area of the Business content, I find them already activated.
      How do I find the activation( who, what time etc ) log history of certain objects like info objects, cubes, ODS, Infosource etc..
      This will help me immensely to communicate with various people( who inadvertently activeted them)  and find issues quickly.
       Thanks
    Arun

    Hi,
    The tables in which application logs are stored are:
    BAL_AMODAL                     Application Log: INDX table for amodal com
    BAL_INDX                       Application Log: INDX tables             
    BALC                           Application Log: Log or message context  
    BALDAT                         Application Log: Log data                
    BALHANDLE                      Application Log: Lock
    object dummy table 
    BALHDR                         Application log: log header              
    BALHDRP                        Application log: log parameter           
    BALM                           Application log: log message             
    BALMP                          Application log: message parameter       
    BALOBJ                         Application log: objects                 
    BALOBJT                        Application log: object texts            
    BALSUB                         Application log: sub-objects             
    BALSUBT                        Application log: Sub-object texts
    Within Tcode SLG1 you can query systemwide object activation on various selection criteria.
    Ofcourse furthermore for objects already once transported to PRD you can search transport requests or object lists via Tcode SE01.
    Kind regards Patrick Rieken

  • Table for finding out the User details

    Hi All,
    We need to create a KPI for number of hours a user has looged into a system. Is there any specific table where all the user related information is captured.If the information is not present in a table where  can we find the above information?Please someone help me out.....
    Also is it the same in all the systems or does this information differ from system to system?If it differs then how do we find the number of hours a user has logged in for a BW system, for a CRM system and for ECC system?
    Regards,
    Shravani

    Hello,
    USR01User master record (run-time data)
    USR02 Logon data
    USR03 User address data
    USR04 User master authorizations
    USR05 User Master Parameter ID
    USR06 Additional data per user
    USR07 Object/values of last failed authorization check
    USR08 Table for user menu entries
    USR09 Entries for user menus (work areas)
    USR10 User master authorization profiles
    USR11 User Master Texts for Profiles (USR10)
    USR12 User master authorization values
    USR13 Short Texts for Authorizations
    USR14 Surchargeable language versions per user
    USR15 External User Name
    USR20 Date of last user master reorganization
    USR30 Additional Information for User Menu
    USR40 Table for illegal passwords
    USR41 User master: Additional data
    USRCOBJ Object Filters for Exploding Product Structures
    USRM0 Material Master User Settings: User Screen Reference
    USRM1 Material Master User Settings: Organizational Levels
    USRM2 Material Master User Settings: Logical Screens
    USRMM User settings: material master
    Might be these can help you.
    Thanks
    Geeta

  • Reg:finding out the function module to manager of organization unit

    Hi Experts,
    Is there any function module for finding out the Manager to organization unit.

    RH_GET_LEADING_POSITION gives you the position of the manager

  • Finding out the actual Class of an Object

    I have an AdvancedDataGrid (ADG) where the top level items
    are instances of my custom valueObject Class "State". The second
    level items are instances of another custom valueObject Class -
    "City". When I select an item in the ADG, I want to know which
    Class each item is - "State" or "City". Is there some way to find
    this out? I'm not looking for how to capture the event, I'm wanting
    to find out if there is some function or utility for finding out
    the Class of an Object.
    FYI, when I capture the event, and pop an Alert with the
    following code...
    Alert.show(item.constructor.toString());
    ...I see either "[class State]" or "[class City]". So, I feel
    like I'm close...
    Thanks.

    This link might be of interest:
    http://onrails.org/articles/2007/02/24/flex-introspection-api-describetype-value-xml
    http://ajaxandbeyond.blogspot.com/2008/04/object-introspection-in-flex.html
    http://livedocs.adobe.com/flex/2/docs/00000460.html#225061
    In generally, you might wish to goole for
    flex introspection

  • Have to diplay all the active employees in an Organizational unit n HR ABAP

    HI,
    I am new to HR ABAP.
    In my selection screen I have to get the Organizational unit from the user and based on that organizational unit value i have to display the details like  pernr,fname and other fields of all the active employee in that OU.
    I have to use logical database in the program .
    so it would be helpful if anyone of you can give some idea or send some sample programs or materials for reference.
    Regards,
    Kiruthi

    HI,
    I am new to HR ABAP.
    In my selection screen I have to get the Organizational unit from the user and based on that organizational unit value i have to display the details like  pernr,fname and other fields of all the active employee in that OU.
    I have to use logical database in the program .
    so it would be helpful if anyone of you can give some idea or send some sample programs or materials for reference.
    Regards,
    Kiruthi

  • How to find out the list of workflows with active event linkage?

    Hi All,
    I want to find out the list of workflows whoe event linkage is activated in the system.
    Through SWU0, we can get a list of workflows attached to a particular event of a business object.
    Thanks,
    Sivagami

    Hi,
    Thanx for ur reply..
    I got the list from the table...
    thanks,
    sivagami

  • Query to find out the time used by an user for an application

    Hello All,
    I want to know the query to find out the whole time used by the user for an application. Please view the below data
    Employee:
    SNO EMP_ID EMP_NAME EMP_DATE LOGIN_TIME LOGOUT_TIME
    1 10 Visu 21-Nov-2010 06:30:00 07:30:00
    2 10 Visu 21-Nov-2010 06:40:00 07:20:00
    3 10 Visu 21-Nov-2010 06:50:00 07:50:00
    4 10 Visu 21-Nov-2010 07:30:00 08:30:00
    5 10 Visu 21-Nov-2010 09:30:00 10:30:00
    By checking the above data we can say that the total time Visu used the application is
    8.30 - 6.30 (From 1,2,3,4 records) = 2hrs
    10.30 - 9.30 (Based on 5th rec) = 1hr
    So the total time Visu used the application would be 3 hrs = 180 mins.
    Could you please help me in getting the result from that data using a query?

    odie_63 wrote:
    I think it may be solved with analytics too.
    with t1 as (
                select 1 sno,10 emp_id,'Visu' emp_name,'21-Nov-2010' emp_date,'06:30:00' login_time,'07:30:00' logout_time from dual union all
                select 2,10,'Visu','21-Nov-2010','06:40:00','07:20:00' from dual union all
                select 3,10,'Visu','21-Nov-2010','06:50:00','07:50:00' from dual union all
                select 4,10,'Visu','21-Nov-2010','07:30:00','08:30:00' from dual union all
                select 5,10,'Visu','21-Nov-2010','09:30:00','10:30:00' from dual
         t2 as (
                select  emp_id,
                        emp_name,
                        emp_date,
                        to_date(emp_date || login_time,'DD-MON-YYYYHH24:MI:SS') login_time,
                        to_date(emp_date || logout_time,'DD-MON-YYYYHH24:MI:SS') logout_time
                  from  t1
         t3 as (
                select  t2.*,
                        case
                          when login_time < max(logout_time) over(
                                                                  partition by emp_id,emp_date
                                                                  order by login_time
                                                                  rows between unbounded preceding
                                                                           and 1 preceding
                            then 0
                          else 1
                        end start_of_group
                  from  t2
         t4 as (
                select  t3.*,
                        sum(start_of_group) over(partition by emp_id,emp_date order by login_time) grp
                  from  t3
         t5 as (
                select  emp_id,
                        emp_date,
                        min(login_time) login_time,
                        max(logout_time) logout_time
                  from  t4
                  group by emp_id,
                           emp_date,
                           grp
    select  emp_id,
            numtodsinterval(sum(logout_time - login_time),'day') time_spent
      from  t5
      group by emp_id
      order by emp_id
        EMP_ID TIME_SPENT
            10 +000000000 03:00:00.000000000
    SQL> SY.

  • How to find out the link for the tables for sub contract PO

    Dear All,
    How to find out the link for the tables for sub contract PO, I am looking for the fields Material, Unit, Batch no., quantity.
    Please provide the solution for the Table related to ABAP.
    Thanks,
    V.V.

    Hi,
       Make use of the table EKKO, EKPO...
    For subcontract please select the option in EKPO-PSTYP.
    Regards
    GK.

  • Transaction to find out the authorised transactions for a user

    Hi Abap Gurus,
    Could you please suggest any transaction which can be used to find out the authorised transcations that can be executed for a particular user?
    Points will be rewarded.
    Regards,
    Mansi.

    Hello,
    I think there is no separete Tcode to find it out.
    You need to check the Profile of the user.
    Use the Tcode SU21 also.
    Regards,
    Vasanth

  • HT204088 how to I find out the most recent deductions to my account from the app store (say, for a recent download for additional functionality on a iPad game)

    How to I find out the most recent deductions to my account from the app store (say, for a recent download for additional functionality on a iPad game). Much as I try, I can't seem to get to see my account in enough detail to see what I have spent downloading apps to the ipad.

    You need to punch in the passcode for any purchase right, not just for new apps??
    If one of the other students, or anyone else, got access to your iTunes Store account, necessary to make any purchases, then they'd have all the information they'd need to also make in-app purchases. But an in-app purchase can only be made through the account through which the original app was purchased. Either your son bought the game (free or paid) and then shared it with someone else along with the account information (necessary to authorize the app on someone else's device), or someone else downloaded the game as well, not just made in-app purchases.
    In any case, changing your iTunes Store password should now have cut off any such unauthorized activity, though of course if your son gives the new password out, you'll be back to square one.
    Regards.

  • How to find out the Idoc number triggered for any material transfer frm SAP

    Hi Folks,
    Can any body let me know How to find out the Idoc number triggered for any material transfer frm SAP?
    Do we have any navigation for that in MM03?
    Thanks,
    SPMD.

    Hi Shabbirmdpasha,
    If you know the user name then you can find the idoc numbers created by that user. But the problem here is it not only gives the material it gives all the idocs created by that user. Go to SE16 --> table name EDIDS --> here you can fill the approximate date and in UNAME give the userid and execute. This will give all the idocs created by that user. I know it is only a partial solution.
    Also would suggest to post the same in abap forums for more answers:
    ABAP Development
    Regards,
    ---Satish

Maybe you are looking for

  • How to start with datamodelling

    *Am a starter in Datamodellinga nd my task is to create a DataModel for Health Care ,* *Can anybody tell me on what are the things that should be collected to start with LDM , and steps to create a LDM and PDM .* *Please guide on the requirement gath

  • 1 inch square screen HTML page while drilldown from BI to ERP

    Hi, We are trying to publish BI reports in the Portal server as Iviews. As per the requirement we are drilling down to the ERP from the BI report using RRI. 1) We have an Iview in Controlling (Cost Center range: Transaction Drill down). 2) Once we dr

  • CMS Configuration in XI/PI-7.0 inSunsolaris & Oracle Database

    Hello, I am trying to configure CMS in XI/PI-7.0 inSunsolaris & Oracle Database, I downloaded all components from SMP,1.)DI_DTR  2.) DI_CBS  3.) DI_CMS  these are zip files i am unable apply through SDM, pls let me know the procedure and any guide, i

  • Old data capture

    Is there any option to capture old data from tally 7.2 to Sap B1.

  • Creating an effect - sort of Star Trek-like tractor beam effect

    I'm trying to come up with a way to make a particle effect that sort of looks like a tractor beam effect from Star Trek. I want a line or thin rectangle to be the particle. The particle itself wouldn't spread out or have any speed itself, but I'd lik