cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the Next phase for RFx

Former Member
0 Kudos

Hi All,

I have a requirement for which I have to throw an error when the RFx is moved to Award phase.

I tried to do with the Document Lifecycle event option and target-> Pre Phase Change. But I was not able to retrieve the next phase name while doing the phase transition.

I have used other_phase variable to get the next phase.


I have used this check:

if (other_phase.equals("Award")){

throw error;

}


But the above code is not working as expected.

I came to know that this works only for Phase configurable business objects like projects and UDOs. So then I need to use Validation script to implement my requirements. But I am not sure how I can get the next phase in Validation script.


Kindly help me with this.


Thanks

Rahul

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rahul,

You can do it with the Document Lifecycle event option and target  Pre Phase Change.


Try changing the code to the following in the script :


if (other_phase.equals("Accepted")){

throw error;

}


I don't know why the award phase appears as "Accepted". You can check "printing" the other_phase variable in a log file with the following code in the same script:



import com.sap.odp.api.common.log.LogMessageIfc;

import com.sap.odp.api.common.log.Logger;

debug = true;

log = Logger.createLogMessage(session);

logInfo(message) {

  if (debug) {

log.setLogMessage("Test "+ message);

  Logger.info(log);

  }

}

logInfo("Other Phase " + other_phase);

These log files can be viewed from the log viewer NW. You can find more details in the blog below

http://scn.sap.com/community/sourcing/blog/2011/11/28/viewing-the-logs-in-sap-sourcing-70-on-premise


Regards,

Michael

former_member190023
Contributor
0 Kudos

Hello Michael,

That is actually very good information, that PrePhaseChange script triggers also for RFX. Previous info on SCN said otherwise.

I can explain why it is showing as "Accepted":

- the variables current_phase and other_phase refer to the "internal ID of current/target phase of document". In RFX this is an Enum, the string ID is highlighted below:

Regards,

Bogdan

Former Member
0 Kudos

Hi Michael,

I have used Document Lifecycle event option and target  Pre Phase Change but still I am not able to get things done.

The other_phase variable is not working as expected. The value for other_phase variable is not changing when the phase is changed to Award phase. Kindly check this from your side.

Thanks

Rahul


former_member190023
Contributor
0 Kudos

Hello Rahul,

I think there are 2 options for this, but I am not sure which will be valid:

  1. either use doc.getPendingPhase() to check if next phase is Award, but you'll need another condition, otherwise your error will be thrown on every save (if next phase is Award, not only when transitioning to it)
  2. or use doc.getCurrentPhase() to trigger the error once it is in Award (before committing).

For option 2 you can try below code to see if it works:


import com.sap.eso.api.rfx.RfxSchedPhaseEnumType;

//

if(doc.getCurrentPhase().equals(new RfxSchedPhaseEnumType(6))) {

// throw error

}

Alternatively you will have to investigate the use of RfxDocEventHandler and RfxDocCallback.

Regards,

Bogdan

Former Member
0 Kudos

Hi Bogdan,

Thanks for the reply. I have tried both the options but they don't work. Kindly check this from your side.

Thanks

Rahul