Skip to Content
avatar image
Former Member

DropdownBykey from RFC

Good day All,

I have the following requirment:

I have a dropdownBykey that read the values of the list from dictionary. The new requirement is to read the values from RFC. I need to know how I can set the values of the dropdownBykey UI Element from RFC?

regards,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 18, 2009 at 01:25 PM

    Hi ,

    use this peace of code.

    create an attribute(Here i m using Country attribute) and bind DropdownBykey with that attribute.

    Ymmin_Iv_Vh_Country_Input con = new Ymmin_Iv_Vh_Country_Input();

    wdContext.nodeYmmin_Iv_Vh_Country_Input().bind(con);

    try {

    con.execute();

    wdContext.nodeEt_Country().invalidate();

    } catch (WDDynamicRFCExecuteException e3) {

    wdComponentAPI.getMessageManager().reportException("Error in Country value help" + e3.getMessage(), false);

    }

    IModifiableSimpleValueSet rep = wdThis.wdGetContext().getContext().getModifiableTypeOf("Country").getSVServices().getModifiableSimpleValueSet();

    IPublicInvoiceVerification.IEt_CountryElement reple;

    size = wdContext.nodeEt_Country().size();

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

    reple = wdContext.nodeEt_Country().getEt_CountryElementAt(i);

    rep.put(reple.getLand1(), reple.getLandx());

    }

    it will solve your problem.

    Regards

    Trilochan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      >

      > first, where to put this pease of code?

      You can put this code in wdDoInit of your Component Controller, or its a good ideia, put in a private method and call this method in wdDoInit of your Component Controller.

      > second,

      > what does this part mean? rep.put(reple.getLand1(), reple.getLandx());

      Your simple type have a enumeration, when you call the method put of IModifiableSimpleValueSet, this means that you are populating the enumeration. The first parameter is a key, and the second is a description of enumeration.

      You can see this enumeration in desing time in your web dynpro explorer:

      Go to your DC -> Dictionaries -> LocalDictionaries ->Data Types -> Simple Tytpes

      Then you can click in your simple type and go to the tab enumeration. In that place you could create the values in desing time.

      Regards

  • avatar image
    Former Member
    May 18, 2009 at 01:18 PM

    Hi,

    If you want to set values from a RFC in a dropdown then use dropdownbyindex UI.

    thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 18, 2009 at 03:07 PM

    Hi Rami,

    As mentioned, the DropDownByKey requires a simple type defined in the dictionary with enumeration values defined for it.

    In case of RFCs when you import a RFC, a dictionary is created with all the attributes in the Web Dynpro DC. The RFC might have some fields which have constraints on them. These fields are imported into the dictionary with enumeration values. Hence, when they are linked to a dropdownbykey the values of constraints on the field are displayed.

    But, if you have a requirement in which the values will change on a regular basis then this approach might not work. You should fetch the new values at runtime and you can then display them in a dropdownbyindex element.

    Regards,

    Kartikaye

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 19, 2009 at 06:54 AM

    Hi,

    Suppose you want to create Dynamic Drop down for the RFC attribute 'Name' of the Node 'TestTable'.

    write the below piece of code in the init() method of the view.

    //----


    Dynamic creation of Drop Down

    //create element for the node for whose attribute DD is to be created

    IPrivateTestTimeDataView.ITestTableElement Testtable;

    // Node which contain your data

    IWDNodeInfo nodeinfo = wdContext.nodeTestTable().getNodeInfo();

    // Attribute which bind to dropdown

    IWDAttributeInfo attributeInfo = nodeinfo.getAttribute("Name");

    // Simple type will dynamically contain the RFC data

    ISimpleTypeModifiable TestDD = attributeInfo.getModifiableSimpleType();

    IModifiableSimpleValueSet valueSet = TestDD.getSVServices().getModifiableSimpleValueSet();

    valueSet.clear();

    // For one by one populating of the data

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

    {

    Testtable = wdContext.nodeTestTable().getTestTableElementAt(i);

    valueSet.put(Testtable.getName(), Testtable.getName());

    }

    I was having a similar requirement & followed the above approach only.

    Regards

    Shruti

    Add comment
    10|10000 characters needed characters exceeded