cancel
Showing results for 
Search instead for 
Did you mean: 

Condition on Button (Action)

former_member201266
Contributor
0 Kudos

Hi,

We are using Rule Based Workflow and have added a new Custom Step.

This step has 3 actions - Approve, Reject and Withdraw.

  1. Now based on the Action selected by Processor we want to trigger an condition check if it fails then the Action should not complete. And ensure user provides the data as per condition then only the request should get completed.
  2. And also based on action we have to hard-code some of the values.

Each action goes to a new step.

Please guide how I can achieve the two requirements.

Thanks,

Charan.

Accepted Solutions (0)

Answers (2)

Answers (2)

benjamin_allsopp
Active Participant
0 Kudos

If you make all 3 fields mandatory sap standard will not allow the user to approve without populating then. That's requirement 1 sorted.

If you press withdraw, SAP standard will take no notice of the madatory fields because the CR is effectively being binned so why would it care about what fields are populated. That's requirement number 2 sorted.

The only thing that is not taken care of as standard is the one field you want mandatory on the reject button. BUT the SAP standard will not allow you to reject without adding a note to the CR so the approved can inform the requester as to the reason for thier decision. Will this not be sufficient?

former_member201266
Contributor
0 Kudos

I don't think they are so simple as they are linked based on Action performed by user.

We need to define logic/condition based on the Action performed.

Please guide where I can capture the action and control the standard behavior.

Thanks,

Charan.

former_member388328
Active Contributor
0 Kudos

Hi Charan,

To my understanding , you want to know, where you can you put code to validate the actions , if am right,

1) goto se24 open the interface IF_FPM_GUIBB_FORM. in this interface you have method process_event. Put a break point here at line number 11. And press the Approve button in the approval form. Now next method which triggers after this method is Approval method in your feeder class.

2) if you have identified approval method and feeder class, you enhance this class or make zclass of it and change configuration of the component..

If you still some doubts , please provide me the feeder , so i provide some inputs.

Thanking you

Vengaiah

former_member201266
Contributor
0 Kudos

Hi,

Thank you Hasan & Vengaiah for the valuable inputs.

There are more than 1 UIBB's. I will see if we can have an Adaption at this step and have a Z Class.

Will get back on this.

Thanks,

Charan.

former_member201266
Contributor
0 Kudos

Hi Experts,

Any help on this!!!

Thanks,

Charan.

benjamin_allsopp
Active Participant
0 Kudos

I'm not sure which MDG you are implementing?

I will answer based on MDG-Material, but the principle will still be the same for other MDG implementations.

1) Before you even get to the workflow part of the process, on pressing an action button the system will check the data as standard....it will check based on your ECC config but you can also develop custom check rules using either BRF+ OR code them using the BADI USMDZ7_RULE_SERVICE

2) Again, derivation of fields will also be done, not as part of workflow but, using BRF+ OR code them using the BADI USMDZ7_RULE_SERVICE.

Whether using the BADI or BRF+ you can state when you want the rules and derivations to take place. This is usually done based on CR type and step number. But you can set it for whatever condition you want.

former_member201266
Contributor
0 Kudos

HI Benjamin,

Thank you for the response. And sorry missed out to specify that this is for BP data Model and Customer in scope.

And agreed we tried both BRF+ and said BADI - as you specified they are done based on CR type and Step Number and might be other Data Model fields or structures.

But we have requirement where in we also have to consider Action (Button) selected by processor before we can make any update to the data, hence we are not able to proceed with BRF+(Validations or Derivations) and also not with BADI '*RULE_SERVICE.'.

And most importantly there are different validations for different Actions and we cannot trigger them until Action is selected and if any of the validations/conditions fails we should not allow the workflow to got forward.

Any Suggestion will really be appreciated.

Thanks,

Charan.

benjamin_allsopp
Active Participant
0 Kudos

This would have to be done in the BADI but you could read the event id of the button pressed and use that as a condition for whatever check/derivation you want to carry out.

former_member201266
Contributor
0 Kudos

Hi,

Thank you once again.

We have tried with Feeder Class and Event ID and had condition checked and upon Failure we have custom message published.

But unfortunately the Workflow is going to next level. But our requirement is that it should stop and should not proceed.

Can you please elaborate which BADI we can use, it should get triggered before the standard action gets completed and it should also capture the Event ID.

Thanks,

Charan.

benjamin_allsopp
Active Participant
0 Kudos

Unfortunately I am not a workflow person so can not advise you how to achieve your desired outcome within workflow without spending some considerable time looking at it myself.


My idea is to try to write your rules in BADI '*RULE_SERVICE.' in the check entity but instead of doing so based on step and cr type, retrieve the last event ID and then execute your checks based on event ID. This way, the workflow is never moved on so the user will receive the error messages on screen and must deal with them immediately before further processing can be achieved.

e.g.

if  io_event->mv_event_id = 'WITHDRAW'.

<WRITE CHECK RULES>

endif.



The problem that you will have here is retrieving the event into the check entity because it is not an importing parameter. But if you look at your call stack you will probably see that before the rule service BADI is processed, method PROCESS_EVENT of class CL_FPM is in the stack. Which means that you should be able to access the Event ID (CS_QUEUE_ENTRY-EVENT) somehow.


former_member201266
Contributor
0 Kudos

HI,

Yes, we are not able get event ID, we will try again on this, but any further inputs will be helpful.

Thanks,

Charan.

former_member388328
Active Contributor
0 Kudos

Hi Charan,

I think you trying to validate data at the user dialog step stage. Appropriately , by this time all data validation should be completed.  My doubt is let us say if the has pressed Approve button, now you want again validate some data and come out with a result whether validation is success or not. Which means you are contradicting dialog user decision. Can you please explain , what is your exact business requirement. So that we help you better.

Thanking you

Vengaiah

former_member201266
Contributor
0 Kudos

Hi Vengaiah,

Thank you for the revert.

Scenario is like this:

We have 3 Editable Fields on screen and 3 Actions/Buttons for user.

When user selects the following should happen

1) Approve: All the 3 fields should be mandatory, User has to provide some valid data. Or else page should display error message.

2) Reject: Only 1 Field is Mandatory, User has to provide value in one or all 3 fields. If 1 - Mandatory Field is not filled then Page should display error message.

3) Withdraw: None of the fields should be Mandatory and System should assign/hardcode the values for all 3 fields and Workflow to goto next step.

Please suggest.

Thanks,

Charan.

h_h_ak
Participant
0 Kudos

Hello Charan,


my idea for your solution are there. In my opinion, if you have only one uibb, you have to replace this uibb feeder class with your own. So you will create a new Feeder Class and redefine Methods like get_data(), proce_event(). If you have more than one uibb on your screen than you will create for both uibb a new feeder class and replace both.



1. For Approve:

In this case, i would redefine get_data() method, and checked withinn this method, if the importing attribute   is event for approval than check the currently importing data in cs_data/ct_data. If the fields there you want to setmandatory are initial than fill the message. 

If you want to know which events will trigerred during the application, you can check/debug

    

                                             cl_fpm->run_event_loop().

2. Reject:

- replace feeder class

- redefine method get_data()

- check event and chack cs_data/ct_data content

( you can modify all fields in get_data(), you will not need the BAdi for preallacocation) If you want to allocate the fields in get_data() than you have to use attribute mo_entity!

Implement you logic in get_data().

3. Withdraw

- replace feeder class

- redefine get_data()

- check event and check mo_entity

- set fields with mo_entity ( check method set_propety & set_properities of mo_entity object)

- If you use a rule based workflow, so you should modify your decision table at brf+