Skip to Content
avatar image
Former Member

Adaptive WebService and 1:n relation in the response

For an adaptive WebService the model must be instantiated manually.

This is described for 1:1 relations between model nodes, but what's about 1:n?

The root node of a 1:n relation has a setIXXX(List list) method, so in wdDoInit() i can call it with root.setXXX(new ArrayList());

But how do I have to instantiate the childs?

TIA

Thomas Paulsen

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 14, 2007 at 06:44 PM

    Hi Thomas,

    If you have any child nodes then you have to find the corresponding structure/table associated with your child node and then you have to instantiate the child nodes in the following way.

    You can write the below code in the wdDoInit() of component controller.

    public void wdDoInit()

    {

    //@@begin wdDoInit()

    // Create a new element in the Bapi_Flight_Getlist_Input node

    Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();

    wdContext.nodeBapi_Flight_Getlist_Input().bind(input);

    // Create new elements in the Destination_From and Destination_To nodes

    input.set<Destination_From>(new Bapisfldst());

    input.set<Destination_To>(new Bapisfldst());

    //Here <b>Bapisfldst </b>is a structure in R/3.

    //If it a table then you need to use add instead of set.

    ZTest_tab tab = new ZTest_tab();

    input.add<MyTab>(tab );

    //@@end

    }

    Regards,

    Jhansi

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Bertram Ganz

      Hi Bertram,

      The first thing I'd figured out:

      The "supplyingRelationRole" for "Worksapce" was missing.

      After setting it to "Item", the Table UI element shows one line.

      Only the very first, not all five.

      Regards

      Thomas

  • Mar 14, 2007 at 03:27 PM

    Hi Thomas,

    Do you have addXXX(XXX xxx) method for your model?

    Best regards, Maksim Rashchynski.

    Add comment
    10|10000 characters needed characters exceeded