cancel
Showing results for 
Search instead for 
Did you mean: 

Page Customization for Projects - How to hide extension fields depending on current phase

isaac_ariza_cruz
Participant
0 Kudos

Hi all,

I'm trying to execute following requirement:

  • We have created 2 extension fields for Projects:
    • ApproverField_1
    • ApproverField_2
  • Depending on the phase, these fields must be hidden:
    • In phase1: both fields must be hidden
    • In phase2: only ApproverField_1 must be displayed.
    • In phase3: both fields must be displayed

To cover previous requirement, we are trying to use Page Customization feature. But we are not able to do it because we don't know which Project field is containing the current phase. I mean, in customization data for Project Page Customization, we have used following information:

  • Field Name: Field: ApproverField1
  • Property: Hidden
  • Value: Yes
  • Dimension on Parent: (empty)
  • Value List
  • Value List Type: Project Phase

Regarding Dimension Field, we have used several tries but neither of them has been correct. Therefore, could you please help us on how this field must be filled? Which Project field should be used in that way?

Furthermore, is there any SAP guideliness available to be used on how to use Page Customization feature?

Thanks in advance for the help and support!

Best regards,

Isaac

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Its may not possible to hide/unhide fields based on Phase of document. But we can make the fields disable/enable by using the lock/unlock functionality. You can create a script, so that a specific extension field disabled or enabled based on Phase of document.

Example:

customdocstatus = doc.getCurrentPhase();
if(customdocstatus.getDisplayName(session).equals("Draft")){
IapiDocumentLockManager.lockField(session,doc,"ApproverField_2"); // disables field ApproverField_2 if document is in draft phase }

else if(customdocstatus.getDisplayName(session).equals("FirstLevelApproved")){
IapiDocumentLockManager.lockField(session,doc,"ApproverField_1"); // disables field ApproverField_1  if document is in FirstLevelApproved phase
IapiDocumentLockManager.unlockField(session,doc,"ApproverField_2");} // enables field ApproverField_2 if document is in FirstLevelApproved phase

Hope this meets your requirement.

isaac_ariza_cruz
Participant
0 Kudos

Hi Shyam,

Thanks for your reply.

We have covered this requirement by creating an auxiliar field which is managed in PRE-CHANGE and POST-CHANGE phase scripts. Now, we can hide/unhide fields by using this field and Page Customization feature.

Thanks and regards,

Isaac

Former Member
0 Kudos

HI,

adding further what do you mean by auxiliar field ?

I need to lock dowm extension field which is valuelist  for particular phase and i am not able to lock down can you suggest.

 

 

ProjectIBeanIfc proj = (ProjectIBeanIfc)doc;

LocalizedObjectReferenceIfc getField = (LocalizedObjectReferenceIfc) proj.getExtensionField(

"Temp_1").get();

 

if(getField.getDisplayName().equals("A"))

{

IapiDocumentLockManager.lockField(session,proj

,"Temp_1");

}

can you suggest how to lock valuelist field

isaac_ariza_cruz
Participant
0 Kudos

Hi Pallavi,

If I've understood correclty your requirement:

  • For a project, you have N phases:
    • Phase A
    • Phase B
    • Phase C
    • ....

Then, if you one to lock one field in Phase B, you could do the following:

  1. Create a document lifecycle for Pre-Phase change.
  2. Then, add following code:

import com.sap.odp.api.doc.IapiDocumentLockManager;

// Retrieve the current phase:

if (!hasValue(current_phase)){return;}

//Depending on the phase, execute corresponding logic:

//------------------------------------------------------------------

switch(other_phase) {

     case "Phase B":

          //Lock fields:

          IapiDocumentLockManager.lockField(session,doc,"<FIELD_NAME>");

          break;

     default: break;

}

We have used this code and it's working.

Please, let me know if it helps you.

Best regards,

Isaac

Answers (0)