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.
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 a comment