cancel
Showing results for 
Search instead for 
Did you mean: 

Using Permits to form "Release Strategy" for Orders!

Former Member
0 Kudos

Dear Experts,

I want various levels of release based on the planned cost of the maintenance orders using permits?. The idea is to set a criteria based on planned cost of the orders. Let's say if the planned cost is USD 2000 approval from ABC is required.

Please help setting that criteria!

Thanks & Regards

Rubab Zehra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Rubab,

You can achieve this many ways. One of it is as below. You need to take ABAP help.

1)  Exit IWO10002. This exit is for specific check during order release.

2) Create a Ztable where you will maintain user'id in following format

                  USER ID       Release level     Description


                   ABC              1                      ( More that  1000 USD)

2) You need to write a code  in include ZXWO1U02, such that if an order planed cost is greater than 1000 USD, program will check logon user ID SY-UNAME = user ID maintained against release level 1. If true, system will set  NO_RELEASE = Blank else  NO_RELEASE = X.

Regards,

Amol

Former Member
0 Kudos

Thanks Amol,

I have few questions here:

1) How are we relating user exit IWO10002 with that of include "ZXWO1U02" ? I mean what will be the role of user exit "IWO10002 here?

2) Why is the role of permit here?

3) Can you please guide how to create a Ztable here.

Thanks & Regards

Rubab Zehra

Former Member
0 Kudos

Correction : What is the role of permit here?

Former Member
0 Kudos

Hi Rubab,

This solution is not using permit. As I mentioned, you can achieve this using many ways, this solution is one of it.

My answers to your questions

1) This exit has an include inside it. If you go to SMOD, and open this customer exit, you will see this include where you can write your own code as per your business requirement.

2) No role of permit here

3) This is ABAP job, You need to consult ABAP person, explain him this requirement. ABAP'er will take care of this task

Regards,

Amol

Answers (5)

Answers (5)

jogeswararao_kavala
Active Contributor
0 Kudos

Complete solution with improvised code has been documented here Release strategy for Work Orders based on Plan Cost (user-exit IWO10002)

Former Member
0 Kudos

Awesome step by step process to achieve "release levels" as per planned cost Great Sir!!

Regards

Rubab Zehra

jogeswararao_kavala
Active Contributor
0 Kudos

Rubab

Here is the complete solution using IWO10002 . (All this your ABAPer needs to understand and execute)

Step1.

Create Ztable like this. (with TMG to maintain table entries)

Maintain Table entries like below

Now code to put in the include ZXWO1U02 of user-exit IWO10002.


DATA: v_stat TYPE char1.

SELECT SINGLE iphas FROM afih INTO v_stat WHERE aufnr = caufvd_imp-aufnr.

IF v_stat = '0'.

   DATA:v_cost TYPE bp_wpl,

        v_wrt  TYPE bp_wpl.

   SELECT SINGLE cost FROM zplancost INTO v_cost WHERE uname = sy-uname.

   SELECT SINGLE wrt01 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   IF v_wrt IS INITIAL.

     SELECT SINGLE wrt02 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt03 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt04 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt05 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt06 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt07 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt08 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt09 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt10 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt11 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ELSEIF v_wrt IS INITIAL.

     SELECT SINGLE wrt12 FROM pmco INTO v_wrt WHERE objnr = caufvd_imp-objnr.

   ENDIF.

   IF v_wrt > v_cost.

     MESSAGE: 'Plan costs exceed your DOP limit, Order can not be released.' TYPE 'E' DISPLAY LIKE 'I'.

   ENDIF.

ENDIF.

It is done. Here on if the user ABCD_EFGH tries to release an Order (with CRTD status) whose plan cost is more than 5000 the system will throw below error (when clicked on REL flag).

Means he will not be able to release.

IMPORTANT

We are talking about Plan costs , means we are talking about things after the Order is Saved. If someone tries to Release at the time of Order creation itself with excessive plan costs the code will not stop.

For  this puprose you need to put the following code in the include ZXWOCU07 of user-exit IWO10009,  which stops the user from Releasing an Order during its Creation (IW31).


IF sy-tcode = 'IW31' AND caufvd_imp-iphas = '2'.

   MESSAGE: 'Order can not be Released at creation time.' TYPE 'E' DISPLAY LIKE 'I'.

ENDIF.

Note:

Your ABAPer will give yo facility to update the Ztable as and when required

That's all.

Good luck

KJogeswaraRao

Former Member
0 Kudos

Hello Sir,

That's Awesome. perfect step by step guide.

Regards,

Amol

Former Member
0 Kudos

Many thanks Sir !! that is seriously very helpful.

You caught the problem right.

Thanks & Regards

Rubab Zehra

piyush_potey
Participant
0 Kudos

Hello Rubab,

You can refer below link as well .

Regards,

Piyush

jogeswararao_kavala
Active Contributor
0 Kudos

Hello Rubab,

Two ways have come-up. But none of them is using your word Permits. Because your requirement is not necessarily be using Permits . So focusing on the requirement and not on the word Permit...


My opinion is

  • Usually, when Functional way of achieving this is possible using Status profile and authObjects as shown in the screen captures (OIBS), there is no need of looking at User-exit.
  • But for this you should be very conversant or need to take help of person who is conversant with OIBS way of configuring and controlling things.
  • It is might not be possible to learn about total solution using OIBS in this discussion.
  • Because the money figure is involved here, to me it seems use of some user-exit is unavoidable though we go for Status profile way of doing it.
  • If it is so, we can prefer doing it with user-exit only i.e., IWO10002 (Checks while Releasing an Order) using a Ztable having the UserID and entitled amount etc. and code the exit accordingly. Even we can use exit IWO10009 (Checks while Saving Order) for this.
  • So I vote for user-exit way of doing this.

About your conceptual question on 'How are we relating ZXWO1U02 to IWO10002?'

  • They are already linked.
  • Every user-exit will be having an Include whose name starts with ZX where system allows us to specify our requirements in the form of ABAP code lines. So  ZXWO1U02 is the include of user-exit IWO10002.
  • Like-wise  ZXWOCU07 is the include of use-exit IWO10009.

Regards

KJogeswaraRao

Former Member
0 Kudos

Sir,

My ABAPer is unable to find the right code. We have formed the Ztable but in include "ZXWO1U02" some problem is faced in the coding. Can I be helped with the code here?

Former Member
0 Kudos

HI Rubab,

Ztable can be defined seperately. It need not be defined within include.

Within include you just need to call the table

Pseudocode for reference - Irs just  guideline for ABAP'er.

-----------------------------------------------------------------------------------------------------------

IF

planned cost > 1000 USD,

Set flag " REL STR = 1

Else,

planned cost > 2000 USD

set flag REL STR = 2.

ENDIF.

CASE REL STR

When 1,

Business Operation BFRE shoud be done by USER ID - ABC

When 2

Business operation BFRE should be done by user ID - DEF

----------------------------------------------------------------------------------------------------------

jogeswararao_kavala
Active Contributor
0 Kudos

First Question

Whether your ABAPer has verified that the exit is activated? Means a break-point in the include should trigger De-bugging screen when you press Release button. whether this is happening?

2nd question

What is the code related query?

pardhreddyc
Active Contributor
0 Kudos

Dear,

In our business we have set the approvals for maintenance order based on user status if the maintenance order cost is above 1 lakh, plant head needs to be approved before they close the order technically.

You can use the user exit where system triggers the assignment of user status while saving the order.

Here i assigned transaction control for GMAR status as

You can set control here ,as per your business requirement for each status.

Even you can set these with permits, but What i feel is using USER STATUS is more convenient.

Regards,

Pardhu