on 08-07-2007 1:51 PM
Hi Gurus,
I'm having trouble executing a BAPI via RFC.
I'm running BAPI_CUSTOMER_CREATEFROMDATA.
I get the error message "[code]Mandatory parameter PI_ADDRESS of method BAPI_CUSTOMER_CREATEFROMDATA missing[/code]" so I assume I am not binding the Model input data correctly.
In my controller I have the following Controller code in method wdDoInit() and the method I call from the view executeBapi_Customer_Createfromdata_Input( 😞
[code]
public void wdDoInit()
{
//@@begin wdDoInit()
//$$begin Service Controller(-269566583)
wdContext.nodeBapi_Customer_Createfromdata_Input().bind(new Bapi_Customer_Createfromdata_Input());
//$$end
//@@end
}
[/code]
[code] public void executeBapi_Customer_Createfromdata_Input( )
{
//@@begin executeBapi_Customer_Createfromdata_Input()
//$$begin Service Controller(1372492586)
try
{
Bapi_Customer_Createfromdata_Input noface = new Bapi_Customer_Createfromdata_Input();
noface.getPi_Address().setFirst_Name("x");
noface.getPi_Address().setName("x");
noface.getPi_Address().setStreet("x");
noface.getPi_Address().setPostl_Code("x");
noface.getPi_Address().setCity("x");
noface.getPi_Address().setCountry("x");
noface.getPi_Address().setCountraiso("x");
noface.getPi_Address().setLangu("x");
noface.getPi_Address().setLangu_Iso("x");
noface.getPi_Copyreference().setDistr_Chan("x");
noface.getPi_Copyreference().setDivision("x");
noface.getPi_Copyreference().setRef_Custmr("x");
noface.getPi_Copyreference().setSalesorg("x");
wdContext.nodeBapi_Customer_Createfromdata_Input().bind(noface);
}
catch(Exception e)
{
e.getStackTrace();
}
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{
wdContext.currentBapi_Customer_Createfromdata_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch(WDDynamicRFCExecuteException e)
{
manager.reportException(e.getMessage(), false);
}
String message = "Return: ";
// message += wdContext.currentReturnElement().getMessage();
wdComponentAPI.getMessageManager().reportWarning(message);
//$$end
//@@end
}[/code]
I presume I'm missing code from the wdDoInit() method similar to the code in the FlightBooking sample app but the documentation model binding is less than stellar:
[code] public void wdDoInit()
{
//@@begin wdDoInit()
//Create a new element in node Bapi_Flbooking_Createfromdata_Input
Bapi_Flbooking_Createfromdata_Input input = new Bapi_Flbooking_Createfromdata_Input();
wdContext.nodeBapi_Flbooking_Createfromdata_Input().bind(input);
//Create a new element in node Booking_data
input.setBooking_Data(new Bapisbonew());
//Create a new element in node Bapi_Flight_Checkavailibility_Input
Bapi_Flight_Checkavailibility_Input inputAvailibility = new Bapi_Flight_Checkavailibility_Input();
wdContext.nodeBapi_Flight_Checkavailibility_Input().bind(inputAvailibility);
//Create a new element in node B
Bapi_Transaction_Commit_Input inputCommit = new Bapi_Transaction_Commit_Input();
wdContext.nodeBapi_Transaction_Commit_Input().bind(inputCommit);
//@@end
}[/code]
Thanks,
Gregor
Hi
I guess PI_ADDRESS is structure listed under Table or under import as Structure.
if that is the case then: you need to this differently
Bapi_Customer_Createfromdata_Input noface = new Bapi_Customer_Createfromdata_Input();
Z_Pi_Address address = new Z_Pi_Address();
address.setFirstName("");
......................................
noface.addPi_Address(address);
After this line write the next steps of execution and invalidation.
Z_Pi_Address i assumed as the structure in Tables
Thanks
Srikant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.