cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown Box in table with 25 rows

Former Member
0 Kudos

Hi All,

I need to populate the table with 25 rows . Except the first(description) and 2nd (Version-input field)column all other 4 columns(country, language,pricezone and customercodes) are dropdown boxes.

These individual dropdown boxes gets values from individual BAPIs. Also I need to set the default value in these dropdownboxes using data from a different BAPI.

But how will I populate the values in dropdown boxes in table and also set it with default value from a different BAPI?

I created a context value node for Table.My context looks like this:

TableVariant(Value Node)

---Country(value attribute)

---Language(value attribute)

---CustomerCode(value attribute)

---PriceZone(value attribute)

---Description(value attribute)

-


Version(value attribute)

On pressing "Enter" I need to populate the values and set it with default value.

I have given the following code in my action event handler for 'enter':

public void onActionEnter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionEnter(ServerEvent)

wdThis

.wdGetDISTitleCreateAndMaintainController()

.Z_Mmweb_Get_Refmaterial_Detail_Input(

"DIS",

"00001",

wdContext.currentContextElement().getBase6(),

wdContext.currentContextElement().getRefMaterial());

// Call BAPI for the country dropdown values

wdThis.wdGetDISTitleCreateAndMaintainController().Base6_Country();

IPrivateCreateVariant.ITableVariantNode countries =

wdContext.nodeTableVariant();

IPrivateCreateVariant.ITableVariantElement element;

element = countries.createTableVariantElement();

for (int i = 0; i < wdContext.nodeCountry().size(); i++) {

element.setCountry(

wdContext.nodeCountry().getElementAt(i).getAttributeAsText(

"Destctry"));

countries.addElement(element);

element = countries.createTableVariantElement();

}

// Call BAPI for the Language dropdown values

wdThis.wdGetDISTitleCreateAndMaintainController().Base6_Language();

IPrivateCreateVariant.ITableVariantNode languages =

wdContext.nodeTableVariant();

IPrivateCreateVariant.ITableVariantElement elementLanguage;

elementLanguage = languages.createTableVariantElement();

for (int i = 0; i < wdContext.nodeLanguage().size(); i++) {

elementLanguage.setLanguage(

wdContext.nodeLanguage().getElementAt(i).getAttributeAsText(

"Trglang"));

languages.addElement(elementLanguage);

elementLanguage = languages.createTableVariantElement();

}

// Call BAPI for the Customer Code dropdown values

wdThis.wdGetDISTitleCreateAndMaintainController().Base6_Customer();

IPrivateCreateVariant.ITableVariantNode customers = wdContext.nodeTableVariant();

IPrivateCreateVariant.ITableVariantElement elementCustomer;

elementCustomer = customers.createTableVariantElement();

for(int i=0;i<wdContext.nodeCustomer().size(); i++){

elementCustomer.setCustomerCodes(wdContext.nodeCustomer().getElementAt(i).getAttributeAsText("Zzcstcd"));

customers.addElement(elementCustomer);

elementCustomer = customers.createTableVariantElement();

}

// Call BAPI for the Price Zone dropdown values

wdThis.wdGetDISTitleCreateAndMaintainController().Base6_Price();

IPrivateCreateVariant.ITableVariantNode price = wdContext.nodeTableVariant();

IPrivateCreateVariant.ITableVariantElement elementPrice;

elementPrice = price.createTableVariantElement();

for(int i=0;i<wdContext.nodePrice_Zone().size(); i++){

elementPrice.setPriceZone(wdContext.nodePrice_Zone().getElementAt(i).getAttributeAsText("Zzprczn"));

price.addElement(elementPrice);

elementPrice = price.createTableVariantElement();

}

//@@end

}

Now when I run this application, its giving me more than 25 rows. Also when I select the second row the selected values in the dropdown of first row gets refreshed and sets back to the first vaue in the dropdown.

Please tell me where I went wrong in the code.

1.How can I populate values in dropdown in table ans set value to specific default one.

2. How can I select individual values in each row .

3. What is the reason for my table rows getting increased?

Is there any table row property or context property that I need to set?

Please help me in sorting out this problem...

Thanks

Anjana.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member197348
Active Contributor
0 Kudos

Hi Anjana,

Your implementation is good. But this problems is not as simple as it seems to be.

<b>3. What is the reason for my table rows getting increased?</b>

Ans: You are creating more elements. Actually how many rows you are getting? I think atleast 29, atmost 100 rows you are getting in the table. Next time give exactly how many rows are generated.Put this code in the starting of <b>for </b>loop.

elementCustomer = customers.createTableVariantElement(); 

In my view, all the model nodes country,language ... are of same size. Then use single loop for all nodes. [in future try to use as <b>less </b>RFCs as possible]

<b>2. How can I select individual values in each row ?</b>

Ans:

Create nodes for v_Country,v_Language,v_CustomerCode,v_PriceZone in side valuenode TableVariant with same attributes as of respective model nodes

Set properties

cardinality 1..1

singleton false

Now you can select individual values

<b>1.How can I populate values in dropdown in table and set value to specific default one?</b>

Just copy from model node to value node.

If you have key, value pair in the node, get the index of the key and set the leadSelection to index. if there is no key you can directly set the index.

Hope I have made it clear. Feel free to get back in case there is any issue.

regards,

Siva

Former Member
0 Kudos

Hi Shiva,

Thanks for your inputs.

I was using elementCustomer = customers.createTableVariantElement();

towards the end of each loop too.

For selecting the individual rows of the tabel I set the "SelectionChangeBehaviour" of the table property to 'manual'. It was auto before.

Thanks

Anjana

Former Member
0 Kudos

Hi,

Is your issue resolved..

Myself too encountering similar issue...

If ur issue is resolved can u please put down the method to solve it...''

Thanx..

Arjun.G

Former Member
0 Kudos

Hi Experts,

Can you please look into my issue.

Thanks

Anjana