Skip to Content
author's profile photo Former Member
Former Member

find org unit manger

hallow

here i try to find org unit manager but its not working well

plz some one can help

i think i have problem in dates but i not sure

thankes & regards

LOOP AT i_t_data INTO lw_t_data_0org.

SELECT begda endda sobid

FROM hrp1001

INTO TABLE lt_relat_org

WHERE objid EQ lw_t_data_0org-orgeh

AND rsign EQ 'B'

AND relat EQ '012'

AND endda GE lw_t_data_0org-datefrom

AND begda LE lw_t_data_0org-dateto.

SORT lt_relat_org BY begda DESCENDING endda DESCENDING sobid.

CLEAR lw_relat_org.

READ TABLE lt_relat_org INDEX 1 INTO lw_relat_org.

IF sy-subrc EQ '0'.

l_plans = lw_relat_org-sobid.

SELECT SINGLE pernr

FROM pa0001

INTO lw_t_data_0org-zzmanager

WHERE endda GE lw_relat_org-begda " lw_t_data_0org-datefrom

AND begda LE lw_relat_org-endda " lw_t_data_0org-dateto

AND plans EQ l_plans.

ENDIF.

APPEND lw_t_data_0org TO lc_t_data_0org.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 10:18 AM

    hi

    try puttin append inside if -- end..

    thnx

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 10:25 AM

    hi friends

    if it help

    here is table i_t_data

    datafrom datato orgeh org.manager

    19690101 99991231 50002993 00000000

    19690101 99991231 50002994 00000000

    19650101 99991231 50003004 00000000

    20050101 99991231 50003014 00000000

    19690101 99991231 50003018 00000000

    20050101 99991231 50003019 00000000

    20050101 99991231 50003020 00000000

    regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 10:46 AM

    hi friends

    naybe some one can help?

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 11:31 AM

    Hi....I have written program for that...it is working.....please modify ur code accordingly...as ur internal table names and work area names are bit complicated......

    one mistake u have done...is u used select single pernr......for that plans from pa0001......but in that date range there may be many pernrs for the same position.....so u have to get all records...n get the latest among them ...in that date range......!!! anyhow check the below code..!!!!

    tables : hrp1001.

    parameters : p_orgeh like hrp1001-objid.

    select-options : s_date for sy-datum.

    data : begin of itab occurs 0,

    begda like hrp1001-begda,

    endda like hrp1001-endda,

    sobid like hrp1001-sobid,

    end of itab.

    data : begin of itab1 occurs 0,

    pernr like pa0001-pernr,

    endda like pa0001-endda,

    begda like pa0001-begda,

    plans like pa0001-plans,

    end of itab1.

    at selection-screen.

    if s_date[] is initial.

    s_date-sign = 'I'.

    s_date-option = 'EQ'.

    s_date-low = sy-datum.

    s_date-high = sy-datum.

    append s_date.

    endif.

    Start-of-selection.

    select begda endda sobid

    from hrp1001

    into table itab

    where objid = p_orgeh

    and endda ge s_date-low

    and begda le s_date-high

    and rsign = 'B'

    and relat = '012'

    and plvar = '01'.

    if sy-subrc = 0.

    sort itab by begda descending endda descending sobid.

    Read table itab index 1.

    if sy-subrc = 0.

    select pernr endda begda plans from pa0001 into table itab1 where plans = itab-sobid and endda ge s_date-low and begda le s_date-high.

    if sy-subrc = 0.

    sort itab1 by begda descending.

    endif.

    endif.

    endif.

    end-of-selection.

    if not itab1[] is initial.

    read table itab1 index 1.

    if sy-subrc = 0.

    write :/ itab1-pernr,

    itab1-plans.

    endif.

    endif.

    Regards

    Vasu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.