Skip to Content
0
Former Member
Feb 17, 2007 at 12:44 PM

Facing an issue while sending data to R/3 using Adaptive RFC

20 Views

Hi All,

We have one function module in R/3 which is being called from Web Dynpro java to save TimeSheet data.

Context Node structure is as follows

ZTS_SAVE_TIMESHEET_INPUT

--->ZTIMESHEET_DATA.

We are setting data to second node as followsa nd eexecutin gunction module. Please let us know know is it correct way.

wdComponentAPI.getMessageManager().reportSuccess("We are in SaveTimeSheetData");

wdContext.currentZts_Save_Timesheet_InputElement().setPersonnel_Number("07001130");//wdContext.currentZts_Fetch_Timesheet_InputElement().getPersonnel_Number()

wdContext.currentZts_Save_Timesheet_InputElement().setSaveorrel(true);//bSaveOrRelease

//extra code

SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");

java.util.Date someDate1 = objSimpleDateFormat.parse("03.01.2005");

Calendar cal = new GregorianCalendar(someDate1.getYear()+1900, someDate1.getMonth(), someDate1.getDate());

java.sql.Date currentDate = new java.sql.Date(cal.getTime().getTime());

//end of extra code

wdContext.currentZts_Save_Timesheet_InputElement().setStartdate(currentDate);//wdContext.currentOutputElement().getStartdate()

//Zts_Fetch_Timesheet_Input.Output.Ztimesheet_Project_Activities

//Project activtities size

int nProjectActivitesSize = wdContext.nodeZtimesheet_Project_Activities().size();

wdContext.nodeZtimesheet_Project_Activities().moveFirst();

IPrivateTimeSheetHome.IZtimesheet_DataNode timesheetDataNode = wdContext.nodeZtimesheet_Data();

IPrivateTimeSheetHome.IZtimesheet_DataElement elementTimesheetData;

//nProjectActivitesSize --replace it in below 1

for(int i=0;i<1;i++)

{

Zworklist_Pers objZworklist_Pers = new Zworklist_Pers();

wdComponentAPI.getMessageManager().reportSuccess("In loop");

objZworklist_Pers.setNetwork("4000605");//wdContext.currentZtimesheet_Project_ActivitiesElement().getNetwork_Id()

objZworklist_Pers.setActivity("0010");//wdContext.currentZtimesheet_Project_ActivitiesElement().getActivity_Id()

objZworklist_Pers.setDescription("IATA ACTIVITY 1");//wdContext.currentZtimesheet_Project_ActivitiesElement().getActivity_Desc()

//Setting project Number PSPID

objZworklist_Pers.setProjno("ICE55");//wdContext.currentZtimesheet_Project_ActivitiesElement().getPspid()

objZworklist_Pers.setProjdesc("DEMO");//wdContext.currentZtimesheet_Project_ActivitiesElement().getPost1()

//Setting WBS element PROJN

objZworklist_Pers.setWbselmt("ICE551");//wdContext.currentZtimesheet_Project_ActivitiesElement().getProjn()

objZworklist_Pers.setWbsdesc("IATA WBS");//wdContext.currentZtimesheet_Project_ActivitiesElement().getWbs_Desc()

objZworklist_Pers.setDay1Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay1_Hours());//wdContext.currentZtimesheet_Project_ActivitiesElement().getDay1_Hours()

objZworklist_Pers.setDay2Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay2_Hours());

objZworklist_Pers.setDay3Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay3_Hours());

objZworklist_Pers.setDay4Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay4_Hours());

objZworklist_Pers.setDay5Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay5_Hours());

objZworklist_Pers.setDay6Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay6_Hours());

objZworklist_Pers.setDay7Hours(wdContext.currentZtimesheet_Project_ActivitiesElement().getDay7_Hours());

elementTimesheetData = wdContext.nodeZtimesheet_Data().createZtimesheet_DataElement(objZworklist_Pers);

timesheetDataNode.addElement(elementTimesheetData);

wdComponentAPI.getMessageManager().reportSuccess("TimeSheet Data Node data "+ wdContext.currentZtimesheet_DataElement().getActivity()+wdContext.currentZtimesheet_DataElement().getNetwork());

wdContext.nodeZtimesheet_Project_Activities().moveNext();

}

wdThis.wdGetTSaveCustController().executeZTS_Save_Timesheet_Input();