Skip to Content
avatar image
Former Member

How can I ? End routine compare field values at the same time and derive new field

Hi Experts,

I have scenario that in my Result Package i have Employee Pin and C_Status and comparing c_status i have do fill value for f_status. the problem is there are cases where 1 employee have more than one c_status.

Below c_status values have text in MD. 0 = Not started, 1 = completed, 3 = fail , 2 = in progress.

Emp Pin C_status F_status 1234 1 2 1234 0 2 5678 0 5678 0 6547 3 6547 1 6935 1

in above example i have to read Emp Pin 1234 c_status if any of them is NW 1 then F_STATUS = 2 for both lines.

Same for empl 5678 c_status = 0 so F_status should be 0.

for emp 6547 c_status is 3 & 1 ==> so F_status should be 2 (in progress).

when there is only 1 record then perform below -

if c_Status = 1 then f_status = 1

else

f_status = 2.

Can some one provide me the code for this logic ASAP ? i am trying to do this in end routine.

My problem is when employee has more than one C_Status and i dont know how can i read them once to do comparison check.

Thanks...

FL


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Mar 17, 2017 at 06:17 PM

    Here is the sample data ....in msg it didnt save the format i entered. so attaching the image.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 20, 2017 at 10:36 AM

    copy the result_package itab to a second itab, lets call it result2. when looping over result_package, read result2 for same emp and check if there i an entry with c_status 0. do the same for 1, 2 and 3. for every read put the an 'X' or a ' ' into a variable. Check the combination of 'X' to determine f_status.

    should not be that difficult to program.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 28, 2017 at 09:35 AM

    Hi Dinesh,

    Employee C_status is based on time lines i.e, start date (BEGDA) and End date (ENDDA). All are time dependent values. So in this situation you have to enhance you Employee master data (Add one more time dependent attribute) and update this C_status using start date and End date at 0EMPLOYEE.

    Hope this will help you. Later if you want to use this data to update in your transaction data. Please call function module at field level routine "READ_MASTER_DATA" and pass employee number (PERNR) and End date (ENDDA). You will get accurate attribute values.

    Regards,

    Krishna Chaitanya.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Krishna,

      There is no master data involved in this. i am loading data DSO to DSO. you missunderstood my question.

      Thanks

  • avatar image
    Former Member
    Apr 13, 2017 at 12:36 PM

    Hi,

    Any abapers can help me pls ? My code doesnt work all the time...for some employees i have correct f_status derived but for some its wrong. I am not abaper can some one provide me example code for my above scenario ?

    Thanks for help

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 13, 2017 at 05:06 PM

    Hi Disney FL,

    Please share sample data along with expected result in image, so will help you.


    Regards

    Nanda

    Add comment
    10|10000 characters needed characters exceeded