Skip to Content
avatar image
Former Member

Hide portal custom field from a particular subtype

Hi

Requirement:

I need to hide a custom field on the portal side for specific subtypes but have it show for others on IT0006

What I have done:

I have tried using table V_T588MFPROPC but did not work

I have also tried to set the attribute value from BADI HRPAD00INFTYUI but did not work.

I cannot use the personalization option because the field will be hidden in all the subtypes

I have written webdynpro code as below which executes successfully with no exception or error but does not work.

IWDTransparentContainer container = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

try{

IWDAttributeInfo attrInfo = (IWDAttributeInfo)wdContext.currentSelectedInfotypeElement().getAttributePointer

("Zzbuilding").getAttributeInfo();

container.getCustomExtensionField(attrInfo).setVisible(WDVisibility.NONE);

}catch(Exception ex){ex.printStackTrace();}

What could be the problem with my code? Your assistance will be highly appreciated.

Regards,

Michael Mayisana

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 27, 2009 at 11:38 AM

    Hi Michael,

    Try the following:

    Create a context attribute ZzbuildingVis. Change property type to com.sap.ide.webdynpro.uielementdefinitions.Visibility

    In properties type , click on ... button. Dictionaries-> Local Dictionary -> uielementdefinitions->Visibility

    Now open the Layout tab of the Vie. browse to the UI element that you want to hide. In properties of the UI element bind visible property to ZzbuildingVis

    Now whenever you want to hide this field ( in wdDoInit() or on some event etc )

    wdContext.currentContextElement().setZzbuildingVis(WDVisibility.NONE);

    and whenever you want to show this field

    wdContext.currentContextElement().setZzbuildingVis(WDVisibility.VISIBLE);

    Let me know if you have any issues.

    Regards,

    Siva

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      My dear Michael,

      Unless you explain exact coding or something about your display logic where UI is created and how it is very difficult to give answer. Try to find out which part of your program is rendering the field then try to hide it.

      I am just trying to explain different possibilities of dynamic display.

      If it is dynamically created then the display logic is maintained in the wdDoModifyView(). Then why don't you put a condition there itself before display.

      e.g. if you can identify the ID of the UI element i.e.where Zzbuilding is bound

      // get the id 
      // set visibility to none

      If you are using BizCardsView then try like this:

      BizcardFieldInfo[] fieldInfo;
      		
      		String bizcardField1 = wdThis.wdGetAPI().getComponent()
      				.getTextAccessor().getText("BizcardField1");
      if( want to display) 		
      {
      String bizcardField2 = wdThis.wdGetAPI().getComponent()
      				.getTextAccessor().getText("BizcardField2");
      }
      		String bizcardField3 = wdThis.wdGetAPI().getComponent()
      				.getTextAccessor().getText("BizcardField3");
      if( want to display) 		
      {
      		fieldInfo = new BizcardFieldInfo[] {
      				new BizcardFieldInfo(bizcardField1, "xxx"),
      				new BizcardFieldInfo(bizcardField2, "Zzbuilding"),
      				new BizcardFieldInfo(bizcardField3, "yyy") };
        }
      else
      {
      		fieldInfo = new BizcardFieldInfo[] {
      				new BizcardFieldInfo(bizcardField1, "xxx"),
      			//	new BizcardFieldInfo(bizcardField2, "Zzbuilding"), comment this line
      				new BizcardFieldInfo(bizcardField3, "yyy") };
        }

      Let me know if it does not serve the purpose.

      Regards,

      Siva