cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Context Attribute

Former Member
0 Kudos
125

Hi,

If i create a context attribute dynamically as follow:

IWDAttributeInfo FieldContext = wdContext.wdGetAPI().getRootNodeInfo().addAttribute("FldContext", "ddic:com.sap.dictionary.string");

can i, instead writing ddic:com.sap.dictionary.string, refer dynamically to a type in the the dictonary.

hope it's clear

Joseph

Message was edited by: joseph fryda

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Joseph,

As Valery said, you can use IDataType class to get the datatype of the attribute

IWDAttributeInfo attr1 = wdContext.getNodeInfo().getAttribute("vaVisibility");

IDataType dt1 = attr1.getDataType();

String strDataTypeClassName = dt1.getAssociatedClass().getName();

IWDAttributeInfo FieldContext = wdContext.wdGetAPI().getRootNodeInfo().addAttribute("FldContext", strDataTypeClassName);

Hope this is want you are looking for. If you require any further clarification let me know.

Regards,

Santhosh.C

Former Member
0 Kudos

Ok,

I'm getting from bapi BAPI_HELPVALUES_GET a table with the meta data (name of coloumn, type, lenght of the column) of a search help.

Now in my webdynpro I would like to build InputField with the same meta data. I don't want to set all my field with the string type.

Former Member
0 Kudos

Joseph, my pardons, but what requirements force you to hand-code things carried out by WD Adaptive RFC generator automatically???

Believe me -- reconstructing IDataType by DD definition is a hard thing, and sooner or later force you to enter non-public WD APIs.

Could you describe your requirements from higher-level perspective?

VS

Former Member
0 Kudos

Hi Valery,

I want to build Search Help (F4 in SAP) in my webdynpro.

So I send Business Object and searh help name to a bapi, and the bapi return me the sturcture of the search help. In fact it return me the name of the column, the lengh and the ID of the column.

Now that I got all this I need to build a table and also fields name that correspond to column that compose the search help, to let the user make search.

So I was thinking that i want my field reflect the "reality". That means that if I have a field like BUKRS (company Code), I want the lengh of this field to be 4 Char. And not to be only a String field with no specific lengh.

Thank you Valery,

Joseph

Former Member
0 Kudos

ok I think I resolved it.

List listDesc = wdContext.currentOutputValElement().modelObject().getDescription_For_Helpvalues();

For(j=0; j<listDesc.size();j++){

Bapif4E desc = (Bapif4E)listDesc.get(j);

IWDInputField field = (IWDInputField)view.createElement(IWDInputField.class, "Fld"+j);

field.setLength(Integer.parseInt(desc.getLeng()));

}

Message was edited by: joseph fryda

Former Member
0 Kudos

Hi Joseph,

I mean whether your requirement to display arbitrary ABAP structure / table or just to work over some <b>concrete</b> RFC function and its paramteres?

If the second is true then why not to use Adaptive RFC Model generated? You will get all value help, length restriction etc automatically...

VS

Former Member
0 Kudos

Adaptive RFC Model generated? can you tell more on this?

I'm using 2 Bapi

1)BAPI_HELPVALUES_GET_SEARCHHELP

2)BAPI_HELPVALUES_GET

After executing the second, what else can I do? I loop trought table DESCRIPTION_FOR_HELPVALUES, build my table and then loop on table HELPVALUES ans assign the value to their respective column.

Am i missing a step?

Former Member
0 Kudos

No, you are not missing a point.

But what you do is getting type metada for constructing WD Data Dictionary type. As far as I understand this task could not be disconnected from entering data itself (unless you are emulating ABAP development environment in WD

Please re-read my recent 2 posts in this topic: I were asking you what is top-level task for you application, what data should be edited? Hardly believe that reconstructing value help with BAPI calls could be such one

VS

Former Member
0 Kudos

Hi Valery,

I'm not using metag for constructing WD data dictionary.

I loop on the table that contain the description of my fields and then create fields/label, and also draw my table that conatins the values

In fact i made it like that and it works fine.

thank you Valery and Santhosh for your help

Message was edited by: joseph fryda

Former Member
0 Kudos

Yes, you may get IDataType from other attribute or from CMIModelClassInfo (like from model class info of Dynamic RFC Model Class).

VS

Former Member
0 Kudos

Hi Joseph,

Could you explain the scenario in detail? In what case, you want to refer to the dictionary data type at runtime?

Regards,

Santhosh.C