cancel
Showing results for 
Search instead for 
Did you mean: 

Hide portal custom field from a particular subtype

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member197348
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Siva,

Thanks for your quick response;

The problem is that the custom fields are not available on the layout tab at design time and hence I have been trying to do a dynamic binding to my fields with no success.

Any ideas on how I can do the binding?

Thanks in advance.

Regards,

Michael

former_member197348
Active Contributor
0 Kudos

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