on 12-11-2007 5:34 AM
Hi
I have 3 tables and one structure to be sent to the backend. I'm using adaptive RFC model. The model node context is as follows:
Save_Plan_Input (model class is Ztm_Save_Plan_Input)
|-- I_Plan (structure is Ztm_Plan)
|-- IT_Flight (structure is Ztm_Flight)
|-- IT_Hotel (structure is Ztm_Hotel)
|-- IT_Car (structure is Ztm_Car)
I populate the tables as follows:
Ztm_Save_Plan_Input savePlan = new Ztm_Save_Plan_Input();
wdContext.nodeSave_Plan_Input().bind(savePlan);
Ztm_Plan planData;
Ztm_Car carData;
Ztm_Flight flData;
Ztm_Hotel hotelData;
for(int i=0;i<wdContext.nodeVSavePlan_Basic().size();i++)
{
wdContext.nodeVSavePlan_Basic().setLeadSelection(i);
planData = new Ztm_Plan();
WDCopyService.copyCorresponding(wdContext.nodeVSavePlan_Basic().currentVSavePlan_BasicElement(),planData);
planData.setPernr(wdThis.wdGetFcTraUtilsInterface().getEmployeeNumber());
savePlan.setI_Plan(planData);
}
for(int i=0;i<wdContext.nodeVSaveFlight_Basic().size();i++)
{
wdContext.nodeVSaveFlight_Basic().setLeadSelection(i);
flData = new Ztm_Flight();
WDCopyService.copyCorresponding(wdContext.nodeVSaveFlight_Basic().currentVSaveFlight_BasicElement(),flData);
savePlan.addIt_Flight(flData);
}
for(int i=0;i<wdContext.nodeVSaveHotel_Basic().size();i++)
{
wdContext.nodeVSaveHotel_Basic().setLeadSelection(i);
hotelData = new Ztm_Hotel();
WDCopyService.copyCorresponding(wdContext.nodeVSaveHotel_Basic().currentVSaveHotel_BasicElement(),
hotelData);
savePlan.addIt_Hotel(hotelData);
}
for(int i=0;i<wdContext.nodeVSaveCar_Basic().size();i++)
{
wdContext.nodeVSaveCar_Basic().setLeadSelection(i);
carData = new Ztm_Car();
WDCopyService.copyCorresponding(wdContext.nodeVSaveCar_Basic().currentVSaveCar_BasicElement(),carData);
savePlan.addIt_Car(carData);
mm.reportSuccess("car data---->>>>"+carData.getDrop_Off_Loc()+"###"+carData.getDrop_Off_Date()+"###"+carData.getDrop_Off_Time()+"###"+carData.getPick_Up_Loc()+"###"+carData.getPick_Up_Date()+"###"+carData.getPick_Up_Time());
}
wdContext.currentSave_Plan_InputElement().modelObject().execute();
When I check the abap debugger, I can only see the data for I_Plan being passed and not the other table's. The table values are all 0000000 in the tables in ABAP.
But, the mm.reportSuccess("car data...line is getting displayed with the correct data after the RFC is executed.
I have tried to recreate the model node, but it just does not pass the data to the backend.
Please help.
Thanks.
Hi Jo,
2 things i would like to mention.
1. have u checked the data in flight node & hotel node etc. after copying data, whether any data is getting copied??
2. u r using "savePlan.addIt_Flight(flData);", are u sure that its the method to set the data to savePlan instead of savePlan.setIt_Flight(flData);
can u check these things & tell what's the output??
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumit
Thanks for your response.
1. I am able to see the data for flight, car and hotel.
2. I_Plan is a structure, and I pass an abstractlist into this structure and fire the rfc, IT_FLIGHT, IT_HOTEL, IT_CAR are input tables, and I need to add one record after another, and thats why I use savePlan.addIT_FLIGHT(flData).
Any thoughts?
Thanks
J
Hi Jo,
First check <b>WDCopyService.copyCorresponding</b> is working properly for all nodes. Then
add this code after this line
wdContext.nodeSave_Plan_Input().bind(savePlan);
try
{
wdContext.currentSave_Plan_InputElement().modelObject().getI_Plan();.clear();
}
catch (RuntimeException e)
{
}
try
{wdContext.currentSave_Plan_InputElement().modelObject().getIt_Flight().clear();
}
catch (RuntimeException e)
{
}
try
{
wdContext.currentSave_Plan_InputElement().modelObject().getIt_Hotel().clear();
}
catch (RuntimeException e)
{
}
try
{
wdContext.currentSave_Plan_InputElement().modelObject().getIt_Car().clear();
}
catch (RuntimeException e)
{
}
replace
savePlan.setI_Plan(planData);
with
wdContext.currentSave_Plan_InputElement().modelObject().addI_Plan(planData);
replace
savePlan.addIt_Flight(flData);
with
wdContext.currentSave_Plan_InputElement().modelObject().addIt_Flight(flData);
replace
savePlan.addIt_Hotel(hotelData);
with
wdContext.currentSave_Plan_InputElement().modelObject().addIt_Hotel(hotelData);
replace
savePlan.addIt_Car(carData);
with
wdContext.currentSave_Plan_InputElement().modelObject().addIt_Car(carData);
I am very much sure that you will see your data in backend.
regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am still facing the same problem with my ESS project. I can display and see all the data in all the tables before firing the RFC. but if I fire the RFC and check in the ABAP function in se37 after setting a breakpoint, the I_PLAN data is present, but IT_FLIGHT, IT_CAR, IT_HOTEL is empty. THey have 000000 values in them.
Is there something to do with the RFC connection? or any setting? This is driving me nuts. Some one please help. I will post my new implementation soon.
Thanks
Jo
Heres my new tried code:
Ztm_Save_Plan_Input input = new Ztm_Save_Plan_Input();
Ztm_Plan planData = new Ztm_Plan();
planData.setCountry(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getCountry());
planData.setDestination(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getDestination());
planData.setEnd_Date(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getEnd_Date());
planData.setEnd_Time(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getEnd_Time());
planData.setPernr(wdThis.wdGetFcTraUtilsInterface().getEmployeeNumber());
planData.setReason(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getReason());
planData.setStart_Date(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getStart_Date());
planData.setStart_Time(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(0).getStart_Time());
input.setI_Plan(planData);
//Flight details
Ztm_Flight flightTable;
int flightSize = wdContext.nodeVSaveFlight_Basic().size();
IPublicFcTrpPlan.IVSaveFlight_BasicElement flightData;
for(int i=0;i<flightSize;i++)
{
flightTable = new Ztm_Flight();
flightData = wdContext.nodeVSaveFlight_Basic().getVSaveFlight_BasicElementAt(i);
flightTable.setArv_Loc(flightData.getArv_Loc());
flightTable.setDep_Loc(flightData.getDep_Loc());
flightTable.setDep_Date(flightData.getDep_Date());
flightTable.setDep_Time(flightData.getDep_Time());
flightTable.set_Class(flightData.get_Class());
input.addIt_Flight(flightTable);
}
//Hotel Details
Ztm_Hotel hotelTable;
int hotelSize = wdContext.nodeVSaveHotel_Basic().size();
IPublicFcTrpPlan.IVSaveHotel_BasicElement hotelData;
for(int i=0;i<hotelSize;i++)
{
hotelTable = new Ztm_Hotel();
hotelData = wdContext.nodeVSaveHotel_Basic().getVSaveHotel_BasicElementAt(i);
hotelTable.setDate_Arr(hotelData.getDate_Arr());
hotelTable.setDate_Dep(hotelData.getDate_Dep());
hotelTable.setHotel_Id(hotelData.getHotel_Id());
hotelTable.setOth_City(hotelData.getOth_City());
hotelTable.setOth_Country(hotelData.getOth_Country());
hotelTable.setOth_Hotel(hotelData.getOth_Hotel());
input.addIt_Hotel(hotelTable);
}
//Car Details
Ztm_Car carTable;
int carSize = wdContext.nodeVSaveCar_Basic().size();
IPublicFcTrpPlan.IVSaveCar_BasicElement carData;
for(int i=0;i<carSize;i++)
{
carTable = new Ztm_Car();
carData = wdContext.nodeVSaveCar_Basic().getVSaveCar_BasicElementAt(i);
carTable.setDrop_Off_Date(carData.getDrop_Off_Date());
carTable.setDrop_Off_Loc(carData.getDrop_Off_Loc());
carTable.setDrop_Off_Time(carData.getDrop_Off_Time());
carTable.setPick_Up_Date(carData.getPick_Up_Date());
carTable.setPick_Up_Loc(carData.getPick_Up_Loc());
carTable.setPick_Up_Time(carData.getPick_Up_Time());
input.addIt_Car(carTable);
}
wdContext.nodeSave_Plan_Input().bind(input);
try
{
wdContext.currentSave_Plan_InputElement().modelObject().execute();
}
catch(WDDynamicRFCExecuteException ex)
{
mm.reportException("Data not saved. Reason: "+ex.getMessage(),true);
}
<b>Someone please help. I'm really going bonkers over this problem.</b>
Thanks
Hi Jo,
Try this.
Ztm_Save_Plan_Input input = new Ztm_Save_Plan_Input();
for(int i=0;i<wdContext.nodeVSavePlan_Basic().size();i++)
{
Ztm_Plan planData = new Ztm_Plan();
planData.setCountry(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getCountry());
planData.setDestination(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getDestination());
planData.setEnd_Date(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getEnd_Date());
planData.setEnd_Time(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getEnd_Time());
planData.setPernr(wdThis.wdGetFcTraUtilsInterface().getEmployeeNumber());
planData.setReason(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getReason());
planData.setStart_Date(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getStart_Date());
planData.setStart_Time(wdContext.nodeVSavePlan_Basic().getVSavePlan_BasicElementAt(i).getStart_Time());
input.addI_Plan(planData);
}
//Flight details
Ztm_Flight flightTable;
int flightSize = wdContext.nodeVSaveFlight_Basic().size();
IPublicFcTrpPlan.IVSaveFlight_BasicElement flightData;
for(int i=0;i<flightSize;i++)
{
flightTable = new Ztm_Flight();
flightData = wdContext.nodeVSaveFlight_Basic().getVSaveFlight_BasicElementAt(i);
flightTable.setArv_Loc(flightData.getArv_Loc());
flightTable.setDep_Loc(flightData.getDep_Loc());
flightTable.setDep_Date(flightData.getDep_Date());
flightTable.setDep_Time(flightData.getDep_Time());
flightTable.set_Class(flightData.get_Class());
input.addIt_Flight(flightTable);
}
//Hotel Details
Ztm_Hotel hotelTable;
int hotelSize = wdContext.nodeVSaveHotel_Basic().size();
IPublicFcTrpPlan.IVSaveHotel_BasicElement hotelData;
for(int i=0;i<hotelSize;i++)
{
hotelTable = new Ztm_Hotel();
hotelData = wdContext.nodeVSaveHotel_Basic().getVSaveHotel_BasicElementAt(i);
hotelTable.setDate_Arr(hotelData.getDate_Arr());
hotelTable.setDate_Dep(hotelData.getDate_Dep());
hotelTable.setHotel_Id(hotelData.getHotel_Id());
hotelTable.setOth_City(hotelData.getOth_City());
hotelTable.setOth_Country(hotelData.getOth_Country());
hotelTable.setOth_Hotel(hotelData.getOth_Hotel());
input.addIt_Hotel(hotelTable);
}
//Car Details
Ztm_Car carTable;
int carSize = wdContext.nodeVSaveCar_Basic().size();
IPublicFcTrpPlan.IVSaveCar_BasicElement carData;
for(int i=0;i<carSize;i++)
{
carTable = new Ztm_Car();
carData = wdContext.nodeVSaveCar_Basic().getVSaveCar_BasicElementAt(i);
carTable.setDrop_Off_Date(carData.getDrop_Off_Date());
carTable.setDrop_Off_Loc(carData.getDrop_Off_Loc());
carTable.setDrop_Off_Time(carData.getDrop_Off_Time());
carTable.setPick_Up_Date(carData.getPick_Up_Date());
carTable.setPick_Up_Loc(carData.getPick_Up_Loc());
carTable.setPick_Up_Time(carData.getPick_Up_Time());
input.addIt_Car(carTable);
}
wdContext.nodeSave_Plan_Input().bind(input);
try
{
wdContext.currentSave_Plan_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch(WDDynamicRFCExecuteException ex)
{
mm.reportException("Data not saved. Reason: "+ex.getMessage(),true);
}
Regards,
Mithu
Hi Mithu
I cannot do input.addI_Plan(planData); because the I_Plan is a structure and not a table. I do not get that option in NWDS at all. So I have to "SET" the data.
Will invalidating the output node help? I donno, but I'm trying that too...
Does something have to be done differently while passing a table from an ESS application? It makes no sense but I'm just thinking from all possibilities.
Thanks for your response.
Jo
Message was edited by:
Jo
Hi Jo,
Ok fine.What is the cardinality of node <b>VSavePlan_Basic</b> if it is 0..1 then
do following other wise what you have done is correct.
Ztm_Plan planData = new Ztm_Plan();
mm.reportSuccess("country : "+wdContext.currentVSavePlan_BasicElement().getCountry());
mm.reportSuccess("Destination : "+wdContext.currentVSavePlan_BasicElement().getDestination());
planData.setCountry(wdContext.currentVSavePlan_BasicElement().getCountry());
planData.setDestination(wdContext.currentVSavePlan_BasicElement().getDestination());
planData.setEnd_Date(wdContext.currentVSavePlan_BasicElement().getEnd_Date());
planData.setEnd_Time(wdContext.currentVSavePlan_BasicElement().getEnd_Time());
planData.setPernr(wdThis.wdGetFcTraUtilsInterface().getEmployeeNumber());
planData.setReason(wdContext.currentVSavePlan_BasicElement().getReason());
planData.setStart_Date(wdContext.currentVSavePlan_BasicElement().getStart_Date());
planData.setStart_Time(wdContext.currentVSavePlan_BasicElement().getStart_Time());
input.setI_Plan(planData);
Give a print message for each input value that
you are setting to ensure you are executing the RFC with correct set of inputs values.
Regards,
Mithu
Hi Mithu
The interesting thing about my problem is that I_Plan data is going to the backend. I am able to see the I_Plan data when I check the input table in the ABAP Function after setting the breakpoint, but my IT_Flight, IT_Car, IT_Hotel data is not being passed.
I put reportsuccess messages on the Save_Plan_Input model node and checked the data, and they are all displayed fine in my screen.
Any thoughts? Am I going wrong in populating the tables?
Thanks
Hi All
Thanks for your responses and help. I feel very silly for bringin up this issue, but since I've not worked on the ABAP system (SE37) earlier, I think I can excuse myself for this.
Btw, In the ABAP debugger, the first row of a table, apparently, is maintained for some temporary storage of data and in my case, always displayed 000000s! and thats the first row thats displayed everytime I double click on the IT_table:-(. My data is very much available from the second row, which was not visible.
Sorry for all the trouble and for having wasted your time too.
Thanks
J
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
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.