cancel
Showing results for 
Search instead for 
Did you mean: 

ESS Travel and Expenses - Default a blank value in country

Former Member
0 Kudos

Hi SDN,

ESS Travel and Expenses has Country as drop-down by Key and the drop-down comes from Backend system. Now my question is how can I edit this drop down to include a blank space by Web Dynpro component editing. The problem with my current set up is that country is defaulted to 'GB' from Backend, but this should made blank to make the users choose country for every entry.

I am new to WebDynpo, so please give me some code samples for any similar case, where the drop-down is bound to a backend RFC field. This filed has to be edited from WebDynpro.

Thanks,

Vamshi

Accepted Solutions (0)

Answers (2)

Answers (2)

susmita_panigrahi
Active Participant
0 Kudos

Hi

If your text property of the Dropdown UI element is bound to the model node and your are calling the BAPI in the controller then write the following code in WdDoinit() menthos of iView:

try

{

wdThis.wdGetXXXController().GetYYY();//calling the controller method where you are executing the BAPI for the Drop down value.XXX is the controller name and YYY is the methos name

wdContext.nodeZZZ().setLeadSelection(-1); //ZZZ is the name of the model node which is bind to Text property of the drop down UI element and -1 means when the dropdown will be loaded it will show the blank space as a 1st element in the drop down

} catch(Exception ex)

{

wdComponentAPI.getMessageManager().reportException("Unable to get the Dropdown Values. Please check the server logs. ",true);

ex.printStackTrace();

}

Thanks

Susmita

former_member197348
Active Contributor
0 Kudos

Hi Vamshi,

Try like this:

If you can identify the model node and attribute bind for this dropdown, after RFC call (mostly in wdDoInit() method of the view), add this piece of code.

IPrivate<viewname>.I<modelnode>Element ele = wdContext.create<modelnode>Element(new <RFC structure name>());
ele.set<attrib1>("  "); // country description is blank
ele.set<attrib2>("  ");// country code is -1 
wdContext.node<modelnode>().addElement(ele,0);
wdContext.node<modelnode>().setLeadselection(-1);

I assumed that your dropdown is dropdownbyIndex. You need to add this whenever you call the RFC and want to show blank value.

Give more details type of dropdown, model node and attributes bind etc.

Feel free to revert in case if this does not solve your problem.

Regards,

Siva

Former Member
0 Kudos

Hi Siva/Susmita,

We have a DropdownbyKey element, so I believe these code sample might not work. Any hints of editing the model binded DropdownbyKey element from WebDynpro?

Thanks,

Vamshi

former_member197348
Active Contributor
0 Kudos

Hi Vamsi,

Try to find where you are filling the attribute. If it is simple type attribute,

In wdDoInit() and whenever you want to show blank add this code,

wdContext.currentContextElement().setSimpletype(" ");

If it is filled dynamically using IModifiableSimpleValueSet then, search that code

Add one more Value "-1" and Description " " before the country values are filled with.

Whenever you want to show blank add this code,

wdContext.currentContextElement().setSimpletype("-1 ");

Regards,

Siva

Former Member
0 Kudos

Hi Siva,

I tried implementing your suggestion and it did not work, it gives me a blank and rest of other values that are coming from the BAPI filed are missing. The drop-down element is DropDownByKey, where the DDBK element is directly mapped to a BAPI element. We tried to insert a blank space from ABAP side, since entire ESS is based on Country filed, this field at other locations is giving a dump in portal (as the fields in multiple screens are using this drop-down that are bound to same BAPi element). The final conclusion is that, it we have to edit this Drop-down from portal/ NWDS.

Please advice on how I can edit a DDBK element from NWDS.

Thanks,

Vamshi