cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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


Accepted Solutions (0)

Answers (5)

Answers (5)

ccc_ccc
Active Contributor
0 Kudos

Hi Disney FL,

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


Regards

Nanda

Former Member
0 Kudos

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

former_member185177
Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Krishna,

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

Thanks

former_member186445
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Mario,

in the f_status - i am not supposed to have 'X' or blank.

Depending upon c_status value I need to have the values for f_status.

and because one employee can have different c_status based on that i need to derive f_Status.

I am not abap expert can you provide me the whole code pls ?

Thanks

former_member186445
Active Contributor
0 Kudos

I do not provide codes.

Former Member
0 Kudos

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