on 04-08-2011 10:25 PM
Guys,
I am trying to create Sales Order from BAPI_SALESORDER_CREATEFROMDAt1. How do I initialize model node in controller to populate input values ( e.g - need to popullate Order_Items_In-Itm_number)
Regards,
manish
You will find this [link|http://help.sap.com/saphelp_nw04s/helpdata/EN/2c/0e55405e68fc41a054a9c3af8aa6ce/frameset.htm] helpful.
Navigate to the following pages to see the code implementation in the later pages.
Regards,
Sayan Ghosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to add elements to model node ..but I am getting mismatch error
IPrivateSalesOrderCreateView.IOrder_Items_InElement ele = wdContext.nodeOrder_Items_In().createElement();
Error Message -
Type mismatch : cannot convert from IWDNodeElement to IPrivateSalesOrderCreateView.Iorder_Items_InElement
Hi Manish,
if you have mapped the model node from component controller to view controller in component controller you should use the
IPpublicSalesOrder<ComponentController>.IOrder_Items_InElement ele = wdContext.nodeOrder_Items_In().createElement();
instead of
IPrivateSalesOrderCreateView.IOrder_Items_InElement ele = wdContext.nodeOrder_Items_In().createElement();
try and let us know where you are using that piece of code in view controller or in component controller.
Regards
Jeetendra
Somehow this code is working . I am not sure whether it is good practice to write the following code to initialize model node .
IPublicSalesOrder.IOrder_Items_InElement ele = wdContext.nodeOrder_Items_In().createOrder_Items_InElement(new Bapisditm());
wdContext.nodeOrder_Items_In().addElement(ele);
Edited by: Manish Kosarkar on Apr 11, 2011 11:42 PM
Now I am running into another problem as I am not able to pass values to R/3 system . Here is my Component controller code -
public void wdDoInit()
{
//@@begin wdDoInit()
//$$begin Service Controller(-86122525)
wdContext.nodeZrfc_Sales_Ord_Create_Input().bind(new Zrfc_Sales_Ord_Create_Input());
wdContext.nodeOrder_Header_In().bind(new Zsls_Ordhdr());
wdContext.nodeOrder_Items_In().bind(new Zsls_Orditm());
wdContext.nodeOrder_Partners().bind(new Zsls_Ordpar());
wdContext.nodeOrder_Schedules_In().bind(new Zsls_Ordsch());
for(int i = 1; i < 5;i++) {
IPublicOrders.IOrder_Items_InElement items = wdContext.nodeOrder_Items_In().createOrder_Items_InElement(new Zsls_Orditm());
wdContext.nodeOrder_Items_In().addElement(items);
IPublicOrders.IOrder_Schedules_InElement sch = wdContext.nodeOrder_Schedules_In().createOrder_Schedules_InElement(new Zsls_Ordsch());
wdContext.nodeOrder_Schedules_In().addElement(sch);
}
for(int i = 1; i < 2;i++) {
IPublicOrders.IOrder_PartnersElement partners = wdContext.nodeOrder_Partners().createOrder_PartnersElement(new Zsls_Ordpar());
wdContext.nodeOrder_Partners().addElement(partners);
}
//$$end
//@@end
}
Values are getting populated in model node but not getting passed to R/3
public void executeZrfc_Sales_Ord_Create_Input( )
{
//@@begin executeZrfc_Sales_Ord_Create_Input()
//$$begin Service Controller(-85554547)
IWDMessageManager manager = wdComponentAPI.getMessageManager();
manager.reportSuccess(wdContext.nodeOrder_Header_In().currentOrder_Header_InElement().getDistr_Chan());
manager.reportSuccess(wdContext.nodeOrder_Items_In().currentOrder_Items_InElement().getMaterial());
try
{
wdContext.currentZrfc_Sales_Ord_Create_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch(WDDynamicRFCExecuteException e)
{
manager.reportException(e.getMessage(), false);
}
//$$end
//@@end
}
Hi Manish,
Are you sure that the operation is returning proper values for function and you are not getting any error in nwa/logs, i doubt that any required input is missing and because of that the operation fails in back-end if there will be any 500 error please check it and let us know.
Regards
Jeetendra
Hi Manish, you can execute the RFC like this:
//RFC's Adaptive RFC 2 Model, execution template.
<ModelName>_Input RFCBapi = new <ModelName>_Input(new <ModelName>Model());
//Do the bind of our controller node to the model
wdContext.node<ModelName>_Input().bind(RFCBapi);
//Set the input parameters for the RFC (set input parameters, input structures, input tables)
wdContext.current<ModelName>_InputElement().set....(value);
...
...
try
{
//Execute the model
wdContext.current<ModelName>_InputElement().modelObject().execute();
}
catch (com.sap.tc.cmi.exception.CMIException e)
{
//In case of error when executing the RFC, we catch the exception.
wdComponentAPI.getMessageManager().reportWarning(e.getMessage());
}
finally {
//Make sure the connection is closed once the RFC's execution has finished
wdContext.current<ModelName>_InputElement().modelObject().modelInstance().disconnectIfAlive();
}
Now, you say you arent gettting values, check the following:
-The RFC is fully activated, set for remote execution, and used the function 'CONVERSION_EXIT_ALPHA_INPUT' on the input parameters when necessary so they meet the lenght requirements.
-You are expecting the results in the correct nodes at the 'Output' node.
-You imported the RFC using the correct Client number (i.e. 110).
Regards!
Julio C. Herrera
Are you using Adaptive RFC Model [Deprecated] or Adaptive RFC 2 Model?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.