Beruflich Dokumente
Kultur Dokumente
try { String userId=new String(); IWDClientUser wduser= WDClientUser.getCurrentUser(); com.sap.security.api.IUser user=wduser.getSAPUser(); if(user != null) { IUserAccount[] acc=user.getUserAccounts(); if(acc[0] != null) { String fname=user.getFirstName(); if(fname==null)fname=""; String lname = user.getLastName(); if(lname==null)lname=""; String name = fname+lname; // String username=user.getFirstName().concat(user.getLastName() wdContext.currentSFREQUESTORElement().setNAME(name); // wdContext.currentContextElement().setReName(username); String userEmail = user.getEmail(); wdContext.currentSFREQUESTORElement().setEMAIL(userEmail); // wdContext.currentContextElement().setReEmail(userEmail); } } //code for documenttype dropdownlist. String[] count={"NB - Purch.requis. Stand","EC - Purch.requis.EBP","FO - Framework requisn","IN - Purch.requis,I-Comm","MV - Model specification","RV - Outl.agmt.requisn"}; Arrays.sort(count); List elements=new ArrayList(); IPublicPRCompInterface.IDOCUMENTTYPEElement ele; // IPrivateVenkatapproverComp.IDocumentTypeElement ele; for(int i=0;i<=count.length-1;i++) { ele=wdContext.createDOCUMENTTYPEElement(); ele.setVALUE(count[i]); ele.setKEY(count[i]); elements.add(ele); } wdContext.nodeDOCUMENTTYPE().bind(elements); wdContext.nodeDOCUMENTTYPE().setLeadSelection(0);
// PurchaseGroupElement
code for
Rfc_Read_Table_Input purchaseinput = new Rfc_Read_Table_Input (); wdContext.nodeRfc_Read_Table_Input().bind(purchaseinput); purchaseinput.setQuery_Table("T024"); purchaseinput.setDelimiter(":"); wdContext.nodeRfc_Read_Table_Input().bind(purchaseinput); wdContext.currentRfc_Read_Table_InputElement().modelObject().execute(); IPublicPRCompInterface.IPURCHASEGROUPElement purchaseGroupElement; for(int i=0;i<wdContext.nodeData1().size();i++) { String strWa = wdContext.nodeData1().getData1ElementAt(i).getWa(); String[] arrayWa = strWa.split(":"); purchaseGroupElement = wdContext.createPURCHASEGROUPElement(); purchaseGroupElement.setKEY(arrayWa[1]); purchaseGroupElement.setVALUE(arrayWa[2]); wdContext.nodePURCHASEGROUP().addElement(purchaseGroupElement);
new Rfc_Read_Table_Input();
for(int { String
masterGroupElement=wdContext.createMATERIALGROUPElement(); masterGroupElement.setKEY(arrayWa[2]); masterGroupElement.setVALUE(arrayWa[3]); wdContext.nodeMATERIALGROUP().addElement(masterGroupElement); } wdContext.nodeMATERIALGROUP().setLeadSelection(0); // code for plant Element Rfc_Read_Table_Input plantinput = new Rfc_Read_Table_Input(); wdContext.nodeRfc_Read_Table_Input().bind(plantinput); plantinput.setQuery_Table("T001W"); plantinput.setDelimiter(":");
for(int i=0;i<wdContext.nodeData1().size();i++)
//
Rfc_Db_Opt();
wdContext.nodeRfc_Read_Table_Input().bind(input);
wdContext.currentRfc_Read_Table_InputElement().modelObject().execute();
IPublicPRCompInterface.ISTORAGELOCATIONElement
storageLocationElement;
//wdContext.nodeSTORAGELOCATION().invalidate(); for(int
i=0;i<wdContext.nodeData1().size();i++)
storageLocationElement = wdContext.createSTORAGELOCATIONElement();
storageLocationElement.setKEY(arrayWa[2]);
storageLocationElement.setVALUE(arrayWa[3]);
wdContext.currentRfc_Read_Table_InputElement().modelObject().execute(); IPublicPRCompInterface.IITEMCATEGORYElement itemcatagoryElement; for(int i=0;i<wdContext.nodeData1().size();i++) strWa = wdContext.nodeData1().getData1ElementAt(i).getWa(); arrayWa = strWa.split(":"); { String String[]
// IWDAttributeInfo iteminfo = wdContext.nodeITEMCATEGORY().getNodeInfo().getAttribute("VALUE"); // IModifiableSimpleValueSet valueSet = iteminfo.getModifiableSimpleType().getSVServices().getModifiableSimpleV alueSet(); //for(int j=0;j<strWa.length();j++) //{ // valueSet.put(arrayWa[2],arrayWa[3]); // } itemcatagoryElement = wdContext.createITEMCATEGORYElement(); itemcatagoryElement.setKEY(arrayWa[2]); itemcatagoryElement.setVALUE(arrayWa[3]); wdContext.nodeITEMCATEGORY().addElement(itemcatagoryElement);
} wdContext.nodeITEMCATEGORY().setLeadSelection(0); wdContext.currentSFSUBMITFORAPPROVELElement().setFORMVIEW("REQUESTER "); //this.generatePD F(); }catch(Exception e) { wdComponentAPI.getMessageManager().reportSuccess(e.toString()); e.printStackTrace(); } $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
inputPdfContent.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_1_1);
inputLineItemCount.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_1_1); wdComponentAPI.getMessageManager().reportSuccess("2t");
IGPCOResultStateInfo approve =technicalDescription.addResultState("APPROVED"); approve.setDescriptionKey("APPROVED"); wdComponentAPI.getMessageManager().reportSuccess("3t"); IGPCOResultStateInfo reject = technicalDescription.addResultState("REJECTED"); reject.setDescriptionKey("REJECTED"); wdComponentAPI.getMessageManager().reportSuccess("4t"); } catch(GPInvocationException e) { e.printStackTrace(); wdComponentAPI.getMessageManager().reportSuccess("5t"); } catch (Exception e) { e.printStackTrace(); } return technicalDescription;
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
try{ wdContext.currentPDFSOURCEElement().setPDFSOURCE(null);
wdComponentAPI.getMessageManager().reportSuccess("2e");
wdContext.nodeSFITEMLIST().addElement(wdContext.createSFITEMLISTElement ()); wdComponentAPI.getMessageManager().reportSuccess("4e1"); } //IGPStructure output = executionContext.getOutputStructure(); //String prnumber = output.getAttributeAsString("PR_NUMBER"); //wdContext.currentOutput1Element().setExppurchaseord er(prnumber); //tranfer pdf data to context
wdContext.currentSFSUBMITFORAPPROVELElement().setFORMVIEW("APPROVER");
wdComponentAPI.getMessageManager().reportSuccess("6e"); //prefileDropDowns(); //merge context data to pdf //wdContext.currentSFSUBMITFORAPPROVELElement().setFO RMVIEW("APPROVER"); IWDPDFDocumentAccessibleContext ctx = WDPDFDocumentFactory.getDocumentHandler().getDocumentAccessibleContext( ); wdComponentAPI.getMessageManager().reportSuccess("14e"); ctx.setPDF(wdContext.currentPDFSOURCEElement().getPDFSOURCE()); wdComponentAPI.getMessageManager().reportSuccess("15e");
wdComponentAPI.getMessageManager().reportSuccess("1g"); ctx.setTemplate(getTemplate("PurchaseRequisitionForm1.xdp")); wdComponentAPI.getMessageManager().reportSuccess("2g"); ctx.setData(WDInteractiveFormHelper.getContextDataAsStream(wdContext.no dePURCHASEREQUISITIONFORM())); IWDPDFDocument doc = ctx.execute(); wdContext.currentPDFSOURCEElement().setPDFSOURCE(doc.getPDF()); wdComponentAPI.getMessageManager().reportSuccess("3g"); } catch(Exception e) { wdComponentAPI.getMessageManager().reportException("Error Occurred while crating pdf Document.please contact system administrator:" ,false); wdComponentAPI.getMessageManager().reportSuccess("4g"); e.printStackTrace(); } //@@end }
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Bapimepoheader();
wdComponentAPI.getMessageManager().reportSuccess("3"); bapimepoheader.setComp_Code("4000"); String doc_Type = wdContext.nodeDOCUMENTTYPE().currentDOCUMENTTYPEElement().getVALUE(); if(doc_Type != null && doc_Type != "") bapimepoheader.setDoc_Type("NB"); wdComponentAPI.getMessageManager().reportSuccess("4"); bapimepoheader.setStatus("9"); wdComponentAPI.getMessageManager().reportSuccess("5"); Calendar cal = Calendar.getInstance(); java.sql.Date sqldate =new java.sql.Date(cal.getTimeInMillis()); wdComponentAPI.getMessageManager().reportSuccess("6"); bapimepoheader.setCreat_Date(sqldate); bapimepoheader.setItem_Intvl("00010"); wdComponentAPI.getMessageManager().reportSuccess("9" + sqldate.toString()); bapimepoheader.setVendor("DELL"); bapimepoheader.setLangu("EN"); wdComponentAPI.getMessageManager().reportSuccess("10"); bapimepoheader.setPurch_Org("4000");
String pur_Group = wdContext.nodePURCHASEGROUP().currentPURCHASEGROUPElement().getVALUE(); // if(pur_Group != null && pur_Group != "") //bapimepoheader.setPur_Group(pur_Group); bapimepoheader.setPur_Group("400");
wdComponentAPI.getMessageManager().reportSuccess("10" + pur_Group); bapimepoheader.setCurrency("USD"); bapimepoheader.setCurrency_Iso("USD"); wdComponentAPI.getMessageManager().reportSuccess("11"); bapimepoheader.setExch_Rate(new BigDecimal("1.00000")); DateFormat d1 = new SimpleDateFormat("MM/dd/yyyy"); wdComponentAPI.getMessageManager().reportSuccess("12"); Date date1 = new Date(System.currentTimeMillis()); bapimepoheader.setDoc_Date(sqldate); bapimepoheader.setSubitemint("00001"); bapimepoheader.setVat_Cntry("US"); bapimepoheader.setVat_Cntry_Iso("US"); wdComponentAPI.getMessageManager().reportSuccess("13" + date1); bapiPoCreate1Input.setPoheader(bapimepoheader);
wdComponentAPI.getMessageManager().reportSuccess("14"); Bapimepoheaderx bapimepoheaderx = new Bapimepoheaderx(); bapimepoheaderx.setComp_Code(true); bapimepoheaderx.setDoc_Type(true); bapimepoheaderx.setStatus(true); wdComponentAPI.getMessageManager().reportSuccess("15"); bapimepoheaderx.setCreat_Date(true); bapimepoheaderx.setItem_Intvl(true); wdComponentAPI.getMessageManager().reportSuccess("17"); bapimepoheaderx.setVendor(true); wdComponentAPI.getMessageManager().reportSuccess("18"); bapimepoheaderx.setLangu(true); bapimepoheaderx.setPurch_Org(true); bapimepoheaderx.setPur_Group(true); wdComponentAPI.getMessageManager().reportSuccess("16"); bapimepoheaderx.setCurrency(true); bapimepoheaderx.setCurrency_Iso(true);
wdComponentAPI.getMessageManager().reportSuccess("19"); bapimepoheaderx.setExch_Rate(true); bapimepoheaderx.setDoc_Date(true); bapimepoheaderx.setSubitemint(true); bapimepoheaderx.setVat_Cntry(true); bapimepoheaderx.setVat_Cntry_Iso(true); wdComponentAPI.getMessageManager().reportSuccess("20"); bapiPoCreate1Input.setPoheaderx(bapimepoheaderx); for(int i =0; i<wdContext.nodeSFITEMLIST().size();i++) { //code for Bapimepoitem wdComponentAPI.getMessageManager().reportSuccess("21"); Bapimepoitem poitem = new Bapimepoitem(); String item_Attr =wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getITEM(); if(item_Attr != null && item_Attr != "") poitem.setPo_Item(item_Attr); wdComponentAPI.getMessageManager().reportSuccess("22 " + item_Attr); poitem.setShort_Text("BROTHER PRINTER MFC 1360C"); poitem.setMaterial("PRINTER01"); poitem.setEmaterial("PRINTER01"); wdComponentAPI.getMessageManager().reportSuccess("23"); //String plant = wdContext.nodePLANT().currentPLANTElement().getVALUE(); // if(plant != null && plant != "") //poitem.setPlant(plant); poitem.setPlant("4200"); String material_Attr =wdContext.nodeMATERIALGROUP().getMATERIALGROUPElementAt(i).getVALUE(); if(material_Attr != null && material_Attr != "") poitem.setMatl_Group(material_Attr); wdComponentAPI.getMessageManager().reportSuccess("24"); poitem.setInfo_Rec("5300000002"); wdComponentAPI.getMessageManager().reportSuccess("25"); int quantity_Attr = wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getQUANTITY().intV alue(); if(quantity_Attr > 0 )
BigDecimal(quantity_Attr));
poitem.setQuantity(new
wdComponentAPI.getMessageManager().reportSuccess("26 " + quantity_Attr); String units_Attr = wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getUNITS(); if(units_Attr != null && units_Attr != "") { poitem.setPo_Unit(units_Attr); wdComponentAPI.getMessageManager().reportSuccess("27 " + units_Attr); poitem.setPo_Unit_Iso(units_Attr); poitem.setOrderpr_Un(units_Attr); wdComponentAPI.getMessageManager().reportSuccess("28" units_Attr); poitem.setOrderpr_Un_Iso(units_Attr); } poitem.setConv_Den1(new BigDecimal("1")); poitem.setConv_Num1(new BigDecimal("1")); poitem.setInfo_Upd("c"); poitem.setGr_Ind(true); DateFormat df2 = new SimpleDateFormat("MM/dd/yyyy"); wdComponentAPI.getMessageManager().reportSuccess("12"); Date date2 = new Date(System.currentTimeMillis()); Calendar cal1 = Calendar.getInstance(); java.sql.Date sqldate1 =new java.sql.Date(cal1.getTimeInMillis()); poitem.setPrice_Date(sqldate1); poitem.setPeriod_Ind_Expiration_Date("D"); bapiPoCreate1Input.addPoitem(poitem); wdComponentAPI.getMessageManager().reportSuccess("29"); //code for Bapimepoitemx Bapimepoitemx(); Bapimepoitemx poitemX = new +
"")
wdComponentAPI.getMessageManager().reportSuccess("31 " +po_itemx); poitemX.setPo_Itemx(true); poitemX.setShort_Text(true); poitemX.setMaterial(true); poitemX.setEmaterial(true); poitemX.setPlant(true); poitemX.setMatl_Group(true); poitemX.setInfo_Rec(true); poitemX.setQuantity(true); //poitemX.setPo_Unit(true); //poitemX.setPo_Unit_Iso(true); poitemX.setOrderpr_Un(true); poitemX.setOrderpr_Un_Iso(true); poitemX.setConv_Den1(true); poitemX.setConv_Num1(true); poitemX.setPrice_Unit(true); poitemX.setGr_Ind(true); poitemX.setUntil_Date(true); wdComponentAPI.getMessageManager().reportSuccess("32"); bapiPoCreate1Input.addPoitemx(poitemX); //code for schedule new Bapimeposchedule(); Bapimeposchedule bapimeposchedule=
wdComponentAPI.getMessageManager().reportSuccess("33"); String po_items =wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getITEM(); if(po_items != null && po_items != "") bapimeposchedule.setPo_Item(po_items); wdComponentAPI.getMessageManager().reportSuccess("34"); bapimeposchedule.setSched_Line("0001"); Date date3 = new Date(System.currentTimeMillis()); wdComponentAPI.getMessageManager().reportSuccess("35"); Calendar cal2 = Calendar.getInstance(); java.sql.Date sqldate2 =new java.sql.Date(cal2.getTimeInMillis()); bapimeposchedule.setDelivery_Date(sqldate2.toString());
int squantity = wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getQUANTITY().intV alue(); if(squantity >0) bapimeposchedule.setQuantity(new BigDecimal(squantity)); wdComponentAPI.getMessageManager().reportSuccess("36 " + squantity); bapimeposchedule.setStat_Date(sqldate2); bapimeposchedule.setPo_Date(sqldate2); wdComponentAPI.getMessageManager().reportSuccess("36"); //int squantity = wdContext.nodeItemTable().getItemTableElementAt(i).getQuantityattr(); //if(squantity >0)
wdComponentAPI.getMessageManager().reportSuccess("37"); String delivery_date = wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getDELIVERYDATE(). toString(); //if(delivery_date != null && delivery_date != "") Calendar cal3 = Calendar.getInstance(); java.sql.Date sqldate3 =new java.sql.Date(cal2.getTimeInMillis()); //bapimeposchedule.setDelivery_Date (sqldate3); bapiPoCreate1Input.addPoschedule(bapimeposchedule); wdComponentAPI.getMessageManager().reportSuccess("38"); //code for schedulex new Bapimeposchedulx(); Bapimeposchedulx bapimeposchedulx=
wdComponentAPI.getMessageManager().reportSuccess("39"); String spo_itemx = wdContext.nodeSFITEMLIST().getSFITEMLISTElementAt(i).getITEM(); if(spo_itemx != null && spo_itemx ! ="") bapimeposchedulx.setPo_Item(spo_itemx); wdComponentAPI.getMessageManager().reportSuccess("39 spo_itemx); bapimeposchedulx.setSched_Line("0001"); " +
Number
IContextElement contextElement = wdContext.currentContextElement(); wdComponentAPI.getMessageManager().reportSuccess("43"); IGPExecutionContext executionContext = contextElement.getExecutioncontext(); // define Output Structure wdComponentAPI.getMessageManager().reportSuccess("44"); IGPStructure output = executionContext.getOutputStructure(); try { // set output wdComponentAPI.getMessageManager().reportSuccess("45"); output.setAttributeValue("PR_NUMBER",wdContext.currentOutput1Element(). getExppurchaseorder()); // success Vector resulrState = new Vector(); resulrState.add("APPROVED"); executionContext.setResultState(resulrState.toString()); // executionContext.setResultState("APPROVED");
// wdComponentAPI.getMessageManager().reportSuccess("46"); executionContext.processingComplete(); } catch (GPInvocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (GPEngineException e) { // TODO Auto-generated catch block e.printStackTrace(); } wdComponentAPI.getMessageManager().reportSuccess("47"); // wdContext.currentCONFORMATIONVIEWElement().setMESSAGEATTR("PurchaseRequ isition "+ wdContext.currentOutput1Element().getExppurchaseorder() + "created successfully"); wdComponentAPI.getMessageManager().reportSuccess("48"); bapiPoCreate1Input.execute(); wdComponentAPI.getMessageManager().reportSuccess("49"); wdContext.nodeOutput().invalidate(); } catch(Exception e) { e.printStackTrace(); wdComponentAPI.getMessageManager().reportException("Exception during Approve the Process-->" + e.getMessage(), true); wdComponentAPI.getMessageManager().reportException( +e.getCause(),true); ""
wdComponentAPI.getMessageManager().reportException("" + e.getMessage(),true); wdComponentAPI.getMessageManager().reportException( e.getLocalizedMessage(),true); } catch (Throwable e) { wdComponentAPI.getMessageManager().reportSuccess("40exe"); wdComponentAPI.getMessageManager().reportException("Exception during Approve the Proces-->" + e.getMessage(), true); wdComponentAPI.getMessageManager().reportException("" + e.getMessage(),true); StackTraceElement[] stackTrace = e.getStackTrace();
for (int i {
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
wdComponentAPI.getMessageManager().reportException("Error occurred while reading form template.", false); e.printStackTrace(); } finally { try { if (fis != null) fis.close(); } catch (IOException e) { wdComponentAPI.getMessageManager().reportException("Application error occurred in getTemplate.", false); e.printStackTrace(); } } return b; } private boolean startWorkFlow() { try { wdComponentAPI.getMessageManager().reportSuccess("1sw"); IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager(); wdComponentAPI.getMessageManager().reportSuccess("2sw"); IUser initiator = WDClientUser.getLoggedInClientUser().getSAPUser();
wdComponentAPI.getMessageManager().reportSuccess("3sw"); IGPContextManager contextManager = GPContextFactory.getContextManager(); wdComponentAPI.getMessageManager().reportSuccess("4sw"); IGPUserContext userContext = contextManager.createUserContext(initiator,initiator.getLocale()); wdComponentAPI.getMessageManager().reportSuccess("5sw"); IGPProcess process = GPProcessFactory.getDesigntimeManager().getActiveTemplate("BD6DC9FB6A6C 11E082A700137285C4E4",userContext); wdComponentAPI.getMessageManager().reportSuccess("6sw"); IGPStructure input=GPStructureFactory.getStructure(process.getInputParameters()); wdComponentAPI.getMessageManager().reportSuccess("7sw");
input.setAttributeValue("LINE_ITEM_COUNT",wdContext.currentSFSUBMITFORA PPROVELElement().getLINEITEM()); String PROCESS_DESC = "Process Description"; IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList(); IGPProcessInstance instance = rtm.startProcess(process,"Process Name",PROCESS_DESC, initiator, roles, input,initiator);
wdContext.currentCONFORMATIONVIEWElement().setMESSAGEATTR("Purchase Requisition Submited Successfully"); } catch (Throwable e) { //logger.logT(Severity.ERROR, Category.APPLICATIONS,e.getMessage()); wdComponentAPI.getMessageManager().reportException("Exception -->" + e.getMessage(), true); StackTraceElement[] stackTrace = e.getStackTrace(); wdComponentAPI.getMessageManager().reportSuccess("10"); for (int i = 0; i < stackTrace.length; i++) {