cancel
Showing results for 
Search instead for 
Did you mean: 

Value for DROP_DOWN_BY_KEY

Former Member
0 Kudos

Hello,

how can I set values for DROP_DOWN_BY_KEY element? I need to have static values such as ValueA, ValueB and ValueC and depending on user's selection define appropriate action.

Where do I define those values?

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos
Former Member
0 Kudos

Hello Maksim,

thanks for your reply.

I see in one of the examples (SWDP_TEST_EVENTS WebDynpro app) that Drop_Down_By_Keys is binded to SelectedKey which is type of WDY_APPLICATION_TYPE.

Where do I define WDY_APPLICATION_TYPE or any other type so it has values that I need such as Active/Inactive? I see that it is a Data Element. How can I assign value to it?

Thank you.

Regards,

Georgy Norkin

Message was edited by: Georgy Norkin

Message was edited by: Georgy Norkin

Message was edited by: Georgy Norkin

Former Member
0 Kudos

I cannot help with the WD ABAP API but the principle of DropDownByKey is the following:

You have a context attribute A that provides a "value set" S (S is a map of key/value pairs).

You bind the "selectedKey" property to attribute A.

If A currently contains a key K, then the drop-down list displays S(K) as its selected element.

In the drop-down list you see all values from S, but what is selected (and stored in A) is always a key.

To populate the drop-down list, you have to attach a value set to the data type of attribute A.

Armin

Former Member
0 Kudos

Hello Armin,

thanks for the reply.

This is the question that I have: "To populate the drop-down list, you have to attach a value set to the data type of attribute A."

I am not sure how to attach a value set to the data type.

Thank you.

Regards,

Georgy Norkin

Former Member
0 Kudos

You can either create a DDIC type with a value set at designtime in the IDE, or you use the DDIC runtime API to get the (modifiable) type of attribute A and to put your key/value pairs into the value set.

See

http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4884180951809e10000000a155106/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/bb/69b441b0133531e10000000a155106/content.htm

Armin

Former Member
0 Kudos

Hello Armin,

let's say I would like to do it at design time.

Which DDIC type should I use for it and how do I assign a value set to it?

Thank you.

Former Member
0 Kudos

Hi Georgy,

To populate dropdown at design time follow these steps:

1. Go to dictionary create simple type.

2. Give the type name and package name.

3. Click on simple type which you have created .In the right side you will find four options definition ,enumeration,representation and database.

4.Go to enumeration click on new and give the Enumeration value and text.

5. Create value attribute in context.

6. In the property of the value attribute assign the type field to the simple type you created in the particular package.

7 Assign this value attribute to the drop down box.

Regards,

Rajeev

former_member182372
Active Contributor
0 Kudos

Hi Georgy,

To do dynamic init of drop down I would suggest to use DROP_DOWN_BY_INDEX. In this case you are working with context node which is more convinient than working with value set.

BTW, link which I post here contains dynamic init:


data:    INFO_NODE type ref to IF_WD_CONTEXT_NODE_INFO
         LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST  
         L_VALUE type WDR_CONTEXT_ATTR_VALUE.

NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).

L_VALUE-VALUE   = ‘V1’.
L_VALUE-TEXT    = ‘yesterday’.
INSERT L_VALUE into table LT_VALUESET.

L_VALUE-VALUE   = ‘V2’.
L_VALUE-TEXT    = ‘today’.
INSERT L_VALUE into table LT_VALUESET.

L_VALUE-VALUE   = ‘V3’.
L_VALUE-TEXT    = ‘tomorrow’.
INSERT L_VALUE into table LT_VALUESET.

NODE_INFO->SET_ATTRIBUTE_VALUE_SET (
                   NAME = ‘ATTRIBUTE1’
                   VALUE_SET = LT_VALUESET ).

Bind selectedKey to attribute ATTRIBUTE1 (type STRING) from context.

Best regards, Maksim Rashchynski.

Answers (0)