Skip to Content
author's profile photo Former Member
Former Member

What exactly happens in controller???

Hi ,

I am new to web dynpros.now I am developing the Webdynpro application for the Creating the POC(Purchase order creation).So before that I was going trogh the example "Accessing ABAP Functions in Web Dynpro (4)" in sdn.sap.com.I didn/t understood the following code in the controller Like why is he creating an input node.And Kindly even mention what are the methods to be implemented for the transaction application for eg.Purchase Order creation.

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.setDestination_From(new Bapisfldst());

input.setDestination_To(new Bapisfldst());

//@@end

}

public void executeBapi_Flight_Getlist_Input( ) {

//@@begin executeBapi_Getlist_Input()

try

{

// Calls remote function module BAPI_FLIGHT_GETLIST

wdContext.currentBapi_Flight_Getlist_InputElement().modelObject().execute();

// Synchronise the data in the context with the data in the model

wdContext.nodeOutput().invalidate();

}

catch (Exception ex)

{

// If an exception is thrown, then the stack trace will be printed

ex.printStackTrace();

}

//@@end

}

Thanks,

Kumar.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Aug 02, 2006 at 03:05 PM

    Hi Kumar,

    First of all, welcome to the magic world of WebDynpro 😉

    Second, i'm gonna to explain you thoses lines.

    <i>Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();

    wdContext.nodeBapi_Flight_Getlist_Input().bind(input);</i>

    You have to understand the difference between an adding element and the binding element. Adding process, as the name said, it used for adding a new element in the node. The binding process, is used to replace the existing elements to the elements you want to bind. Thus, in the above two lines, we set an element to the bapi's node (this is usefull if you don't know what there is inside the node, it is a kind of eraseall function). We have to do that, because unfortunatly, webdynpro can initialize itself.

    <i>input.setDestination_From(new Bapisfldst());

    input.setDestination_To(new Bapisfldst());</i>

    Ok, now you have to initialize the inputs. Keep in mind the "input" is an instance of the current element of the bapi's node (because you had bind it above).

    Add comment
    10|10000 characters needed characters exceeded

    • Hello,

      I'm not sure to get your request, but nevermind...

      To make a transaction, you have to create a node to your "context". This node is binded to the model.

      Example :

      in your MODEL :

      BAPI_MATERIAL_GETLIST_INPUT

      blablabl

      blablabl

      blablabl

      blabla

      (...)

      in your CONTEXT :

      BAPI_MATERIAL_GETLIST_INPUT

      blablabl

      blablabl

      output

      return

      (...)

      the names are not neceserly the same between the model and the context but <b>it has to be bind to each other</b>.

      The result is stored in the return node or whatever the name you have choosen.

      To conclude, you have to create a node to put en retreiuve data from your BAPI.

      Regards

      ps : hope I answer to your question ?!