cancel
Showing results for 
Search instead for 
Did you mean: 

Function P2000 Time Evaluation

Former Member
0 Kudos

Hi all,

In time management

I have come up with a scenario where I have to create a new Daytype (for example Daytype 4 & SAP allows Daytypes from  0-9) and it should be processed just like day type "blank"- work/paid .

The issue here is in the Function P2000,  PSP is read and Daytype is 4 .

The Function P2000 processes only when the daytype is "0" and with the Parameter (Par1) EVER when daytype"1".

As the daytype is now 4, TIP is not generating .

Can you please advise how to handle this scenario.

Regards,

Prakash

Accepted Solutions (1)

Accepted Solutions (1)

ImranSajid
Contributor
0 Kudos

Hi Prakash,

I took a look at this for you. In order to accomplish what you want to do you will have to either make a small change to standard SAP code or create a custom function to process the logic exactly like SAP did when the day type is 4. The easiest approach would be to change the standard SAP code in this case although this is not something I take lightly or recommend very often (Although I have had to do it before).

This will involve registering the object with SAP and getting the access key to change the standard code and then adding a few lines of additional code.

I looked at the source code for function P2000 and you can see there is a CASE statement to check the TAGTY (Day Type) field. The logic that is processed when Day Type = space (blank) is shown in my screenshot.

You need to replicate this logic for Day Type 4 since you want it to behave the same way as Day Type blank. You could do it in literally two lines of code by copying and pasting the SAP Code and using the following logic.

WHEN '4'.

  PERFORM tprog_in_htip USING '1'.


If you are completely against (Or your company does not allow) customizing SAPs code then you can create a new function and use the same logic that is processed in this function.


Thanks,

Imran

Former Member
0 Kudos

Hi Imran,

Many thanks for your response, Can you please advise if you come across a situation where you had to use special daytypes or have implemented the above solution as I wanted to have a good understanding before i go ahead and modify the code.

Regards,

Prakash

ImranSajid
Contributor
0 Kudos

Hi Prakash,

I cannot say that I have come across a situation where I had to customize a day type in this manner. Typically Day Type 1 signifies a holiday. Vivek and Harish both make fair points in wanting to understand your requirements to determine if this type of a customization is even necessary or if it can be handled in a different manner using standard SAP and configuration. Clearly you are creating a new day type to differentiate something, but what is it for exactly?

Although the code change I recommended above is a simple one, it is still always SAP best practice and recommendation to use configuration whenever possible. There could be other standard SAP operations that have built in logic per the day type that we are not aware about.

Thanks,

Imran

Answers (3)

Answers (3)

jagan_gunja
Active Contributor
0 Kudos

If we are going to modify standard SAP code, then it is recommended to use ABAP enhancement in this case.  This can be at the end or start of a routine.  This type of change avoids problems when SAP changes the code with OSS notes or support packs.

Other ways to change - e.g., bAPI, bADI, etc may not suit in this case.

Otherwise, as Imran said, use a copy of the standard function and change as needed.

harishtk1
Active Contributor
0 Kudos

You should not need to use Day Type 4. There are ways and means to fulfil most requirements by using other indicators such as DWS Class etc. Before going down that route, you may want to discuss with experts here the precise requirements that can only be fulfilled by defining a Day Type 4.


Former Member
0 Kudos

Hi Vivek,Imran,Harish,

Sorry for my delayed response.The  requirement comes from Shiftplanning where the Daytype has been in use to differentiate. 

I do understand the purpose of the daytype and  am completely aware that the requriement of Positive time management can be handled without using special daytypes.

Although my thoughts have been based on the fact that SAP provides us a flexibility to customise Daytypes and to have a understanding of repercussions .I wanted to understand if any of the projects have implemented the same.

I am thankful for  all your advices.

Thanks & Regards,

Prakash

harishtk1
Active Contributor
0 Kudos

Ok

So are you uising NOTP in parameter 3 for P2000? If so, can you remove it and see if it works.

You could also try not using P2000 at all, and use P2011 instead. I think P2011 works for everything

ImranSajid
Contributor
0 Kudos

Hi Prakash,

Just curious, did you decide how you wanted to ultimately handle this?

Regards,

Imran

vianshu
Active Contributor
0 Kudos

Hi Prakash,

Why do you wish to create Day Type 4? What is your actual requirement because of which you are creating Day Type 4?

Regards,

Vivek