on 10-28-2008 3:34 PM
Hello Experts,
I have added to extra fields in primary office bizcard for address (SAP ESS) iview.
The fileds show up in a new bizcard for primary office under the bizcard for primary address and everything works fine.
but, when I add a primary address with future date.
All fields in bizcard of primary office do not show up.
just want to be clear on the layout
I have 2 bizcards one for primary home and other primary office.
In primarry home if I add a home address which is valid with future date. The data is not shown in the bizcard of primary office.
Below is the code WDdomodify code and and code which populates the primary office biz card. can any one please look into it and show where its goign wrong.
====
public static void wdDoModifyView(IPrivateBizCardsView wdThis, IPrivateBizCardsView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
BizcardFieldInfo[] fieldInfo;
//Date defaultBegda = wdContext.currentContextElement().getDefault_Begda();
String bizcardField1 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField1");
String bizcardField2 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField2");
String bizcardField3 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField3");
fieldInfo = new BizcardFieldInfo[] { new BizcardFieldInfo(bizcardField1, "Stras"),
new BizcardFieldInfo(bizcardField2, "Ort01"),
new BizcardFieldInfo(bizcardField3, "Telnr")};
// OverviewHelper.CreateOverview(wdThis.wdGetContext().nodeInfotypeList(),
// wdThis.wdGetContext().nodeSubtypes(),
// view,
// fieldInfo,
// defaultBegda,
// "Anssa");
wdThis.wdGetFcPersInfoInterface().CreateOverview(
wdThis.wdGetContext().nodeInfotypeList(),
view,
fieldInfo,
"Anssa");
// Retrieve Bizcards information for Primary Office Subtype:
try
{
IWDNode nodeInfotypes = wdThis.wdGetContext().nodeInfotypeList();
IWDNode nodeSubtypes = wdThis.wdGetContext().nodeSubtypes();
final int iPrimaryOfficeSubtype = 10; // Primary Office Subtype = 10
String sPrimaryOfficeStext = "";
// Get Stext information for Primary Office Subtype:
for (int i = 0; i < nodeSubtypes.size(); i++)
{
String sCurrentSubtype = nodeSubtypes.getElementAt(i).getAttributeValue("Subtype").toString();
int iCurrentSubtype = Integer.parseInt(sCurrentSubtype);
if (iCurrentSubtype == iPrimaryOfficeSubtype)
{
sPrimaryOfficeStext = nodeSubtypes.getElementAt(i).getAttributeValue("Stext").toString();
break;
}
}
// Find bizcard for Primary Office Subtype:
boolean bIsBizCardFound = false;
int iBizCardLocation = 0;
for (int i = 0; i < nodeInfotypes.size(); i++)
{
IWDGroup groupBizCard = (IWDGroup) view.getElement("bizcard_" + i);
String sBizCardStext = groupBizCard.getHeader().getText();
if (sBizCardStext.equalsIgnoreCase(sPrimaryOfficeStext))
{
iBizCardLocation = i;
bIsBizCardFound = true;
break;
}
}
// Add new Labels and Textviews for Primary Office Subtype:
if (bIsBizCardFound)
{
AddNewPrimaryOfficeContent (wdThis, nodeInfotypes, view, iBizCardLocation);
}
}
catch (Exception ex)
{
}
//@@end
}
private static void AddNewPrimaryOfficeContent(IPrivateBizCardsView wdThis, IWDNode nodeInfotypes, IWDView view, int iBizCardLocation)
{
if (iBizCardLocation < 0)
{
return;
}
// String BizcardField1 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField1"); // c/o
// String BizcardField2 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField2"); // Relationship
String BizcardField3 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField3"); // House #
String BizcardField4 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField4"); // City
String BizcardField5 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField5"); // State
String BizcardField6 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField6"); // Zip Code
String BizcardField7 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField7"); // PObox
BizcardFieldInfo[] fieldInfo;
fieldInfo = new BizcardFieldInfo[] {
// new BizcardFieldInfo(BizcardField1, "Name2"), // c/o
// new BizcardFieldInfo(BizcardField2, "Locat"), // Relationship
new BizcardFieldInfo(BizcardField3, "Stras"), // House #
new BizcardFieldInfo(BizcardField4, "Ort01"), // City
new BizcardFieldInfo(BizcardField5, "State"), // State
new BizcardFieldInfo(BizcardField6, "Pstlz"), // Zip Code
new BizcardFieldInfo(BizcardField7, "Zpo_box") //pobox
// Mail Description
};
IWDNodeElement elementRecord = nodeInfotypes.getElementAt(iBizCardLocation);
IWDGroup groupBizCard = (IWDGroup) view.getElement("bizcard_" + iBizCardLocation);
groupBizCard.destroyAllChildren();
IWDGridLayout grid = (IWDGridLayout) groupBizCard.getLayout();
grid.setColCount(2);
for (int k = 0; k < fieldInfo.length; k++)
{
IWDLabel labelView = (IWDLabel) view.createElement(IWDLabel.class, "labelView" + iBizCardLocation + k);
labelView.setText(fieldInfo[k].label);
IWDGridData labelGridData = (IWDGridData) labelView.createLayoutData(IWDGridData.class);
labelGridData.setWidth("100px");
labelView.setWidth("35%");
IWDTextView textView = (IWDTextView) view.createElement(IWDTextView.class, "textView" + iBizCardLocation + k);
textView.setText(elementRecord.getAttributeValue(fieldInfo[k].fieldname).toString());
groupBizCard.addChild(labelView);
groupBizCard.addChild(textView);
}
}
====
Thanks,
Boiler
Boiler,
You don;t need to do so much extra coding to display the fields....so in the Bizcard just add the fields you want to display like others:
String bizcardField1 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField1");
String bizcardField2 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField2");
String bizcardField3 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField3");
fieldInfo = new BizcardFieldInfo[] { new BizcardFieldInfo(bizcardField1, "Stras"),
new BizcardFieldInfo(bizcardField2, "Ort01"),
new BizcardFieldInfo(bizcardField3, "Telnr"),
new BizcardFieldInfo(bizcardField4,"<fieldname>")};
just create as many bizcard fields like :
String bizcardField4 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField4");and add line of code as shown in bold above
and define the bizcardField4 in the Message Pool with Label you want .....then goto the ess~per DC Webdynpro -> FcPersInfo Component Controller -> Implementaiton Tab -> CreateOverView() method ...and check for the Subtype and fieldInfo Label and display the fields accordingly inside the for loop where it loops though the fieldinfo class array as:
for (int k = 0; k < fieldInfo.length; k++)
Hope this helps.
Shikhil
Edited by: Shikhil Arora on Oct 28, 2008 6:13 PM
Edited by: Shikhil Arora on Oct 28, 2008 6:14 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Shikhil,
are you saying , I won't need the function AddNewPrimaryOfficeContent? do I have to implement its all there in the domodifymethod of the view?
Can you let me know. actually I have like 5 custom field which need to be displayed on bizcard apart from 3 which sap gives.
Let me know.
Thanks,
boiler
Boiler,
This is what I have in the wddomodifyview() method of the essusaddr webdynpro -> Webdynpro components -> VcPerAddressUSOverview -> BizcardsView -> Implementation tab:
BizcardFieldInfo[] fieldInfo;
//Date defaultBegda = wdContext.currentContextElement().getDefault_Begda();
String bizcardField1 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField1");
String bizcardField2 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField2");
String bizcardField3 = wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizcardField3");
fieldInfo = new BizcardFieldInfo[] { new BizcardFieldInfo(bizcardField1, "Stras"),
new BizcardFieldInfo(bizcardField2, "Ort01"),
new BizcardFieldInfo(bizcardField3, "Telnr")};
// OverviewHelper.CreateOverview(wdThis.wdGetContext().nodeInfotypeList(),
// wdThis.wdGetContext().nodeSubtypes(),
// view,
// fieldInfo,
// defaultBegda,
// "Anssa");
wdThis.wdGetFcPersInfoInterface().CreateOverview(
wdThis.wdGetContext().nodeInfotypeList(),
view,
fieldInfo,
"Anssa");
I don't know how you have that additional function for AddNewPrimaryOfficeContent()....anyway if you just want to add the custom fields then just add them according to what I posted earlier....
Shikhil
You could have a look at the CreateOverview method that creates the view dynamically. The containers have IDs that are generated. When you know the generation logic (should be easy to find out ... if needed just debug) you can retrieve the correct container and add an additional textview to display the information you want only for the appropriate subtype.
Thats what I said earlier ...you can check for the infotype and the subtype in the createOverview() method of the ess~per webdynpro ....and write code inside the for loop
for (int k = 0; k < fieldInfo.length; k++)
Get the infotype value as:
wdcontext.currentInitPernrElement.getInfty().equalsignorecase("0006")
Get the subtype value as:
IWDNodeElement ele = records.getElementAt(i);
String sub;
sub=ele.getAttributeValue(subtypeFieldName).toString();
And check for the field label as:
fieldInfo[k].label.equalsIgnoreCase("<Value put in the MessagePool of the Bizcard");
Hope it helps.
Shikhil
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.