I have to apply/attach a Journal Entry to the VendorPayment for voiding, so that I've tried 2 ways:
First is update the (RecordRef)createdFrom of Journal Entry = (recordRef)vendorPayment
Here is my code:
RecordRef vPaymentRef = new RecordRef();
vPaymentRef.internalId = "7850";
vPaymentRef.type = RecordType.vendorPayment;
vPaymentRef.typeSpecified = true;
RecordRef currency = new RecordRef();
currency.internalId = "1";
currency.type = RecordType.currency;
RecordRef mySubsidiary = new RecordRef();
mySubsidiary.internalId = "3";
mySubsidiary.type = RecordType.subsidiary;
JournalEntry newJournalEntry = new JournalEntry();
newJournalEntry.subsidiary = mySubsidiary;
newJournalEntry.createdFrom = vPaymentRef;
//newJournalEntry.reversalEntry = "99";
newJournalEntry.reversalDate = DateTime.Now;
newJournalEntry.reversalDateSpecified = true;
//newJournalEntry.reversalDefer = true;
//newJournalEntry.reversalDeferSpecified = true;
RecordRef myCurrency = new RecordRef();
myCurrency.internalId = "1";
newJournalEntry.currency = myCurrency;
newJournalEntry.exchangeRate = .911;
newJournalEntry.exchangeRateSpecified = true;
RecordRef myDebitAccount = new RecordRef();
myDebitAccount.internalId = "290"; //account
RecordRef myCreditAccount = new RecordRef();
myCreditAccount.internalId = "25"; //a/p account
newJournalEntry.lineList = new JournalEntryLineList();
newJournalEntry.lineList.line = new JournalEntryLine[2];
newJournalEntry.lineList.line[0] = new JournalEntryLine();
newJournalEntry.lineList.line[0].account = myDebitAccount;
newJournalEntry.lineList.line[0].debit = 3333;
newJournalEntry.lineList.line[0].debitSpecified = true;
newJournalEntry.lineList.line[0].entity = vPayment.entity;
newJournalEntry.lineList.line[1] = new JournalEntryLine();
newJournalEntry.lineList.line[1].account = myCreditAccount;
newJournalEntry.lineList.line[1].credit = 3333;
newJournalEntry.lineList.line[1].creditSpecified = true;
newJournalEntry.lineList.line[1].entity = vPayment.entity;
WriteResponse wr = _service.add(newJournalEntry);
As you see, I have added a VendorPayment to CreatedFrom, the WriteResponse status return true with StatusDetail = null. But when I access the Journal Entry have just created on Netsuite site, the VOID OF is empty (not display). And the type of Journal Entry is "Journal", It have to be "Voiding Journal", and don't have "Reversal Payments Applied" beside the Entry No.
Then, I try the second way : Update the voidJournal of VendorPayment to use the Journal Entry have just created.
Here is my code :
RecordRef recordRef = new RecordRef();
recordRef.internalId = "7850";
recordRef.type = RecordType.vendorPayment;
recordRef.typeSpecified = true;
ReadResponse response2 = _service.get(recordRef);
VendorPayment vPayment = (VendorPayment)response2.record;
RecordRef recordRefJournal = new RecordRef();
recordRefJournal.internalId = "8356";
recordRefJournal.type = RecordType.journalEntry;
recordRefJournal.typeSpecified = true;
vPayment.voidJournal = recordRefJournal;
vPayment.status = "VOIDED";
WriteResponse wr2 = _service.update(vPayment);
With this way, the WriteResponse status still true, and the StatusDetail still null. When I refresh this vendorPayment on Netsuite site, nothing change, the VOIDED ON and the Status not change.
My Point is Voiding the VendorPayment by SuiteTalk.
I'm really stuck here, please help. Many thanks !!
Create From field is a field that can only be set by the system. It will only be populate when transforming transactions.
Created From field of the Invoice will only be populated when you click the Bill button of the sales order and another scenario is when you click the Receive button on the PO the Created From field of the Item Receipt.
In suitescirpt
nlapiTransformRecord('salesorder', 1, 'invoice');
What you are trying to do is not possible using the standard Created From field.
Indeed, the previous comment is right.
What you need to do is two step:
Create the journal entry and reference the Vendor in the entity lines.
Apply it as a payment against the bill.
Consider the code pattern to the article I wrote about writing off Customer Invoices with a Journal Entry.
Marty Zigman, Founder
Prolecto Resources, Inc.
NetSuite Systems Integration
Southern California's Leading Innovation and Implementation Practice
Related
I programmatically create a credit memo and then i release by ARDocumentRelease.ReleaseDoc(rebateRelease, false); and i got this error.
{"Error: Another process has updated the 'ARRegister' record. Your changes will be lost."}.
The effect of this error is in the journal transaction, the created journal transaction is having a unposted status. Please check the images thanks.
Unposted Journal Transaction, Closed Credit Memo, Error in code, Suggestion 1
MY CODE BELOW:
`ARInvoice arInvoice = new ARInvoice();
arInvoice.DocType = "CRM";
arInvoice.CustomerID = loan.BAccountID;
arInvoice.CustomerLocationID = loan.CustomerLocation;
arInvoice.DocDesc = "";
arInvoice.OpenDoc = true;
arInvoice.Released = false;
arInvoice.Hold = false;
arInvoice.Status = "B";
if (arSetup.RequireControlTotal == true)
{
arInvoice.CuryOrigDocAmt = amount;
}
arInvoice = ARGraph.Document.Update(arInvoice);
ARGraph.Actions.PressSave();
ARTran arTran = new ARTran();
arTran.RefNbr = arInvoice.RefNbr;
arTran.LineNbr = 1;
arTran.SortOrder = 1;
arTran.TranDesc = description;
arTran.AccountID = accountID;
arTran.SubID = subID;
arTran.Qty = 1;
arTran.TaxCategoryID = other.TaxCategoryID;
arTran.CuryExtPrice = amount;
arTran.Released = false;
ARGraph.Transactions.Insert(arTran);
ARGraph.Actions.PressSave();
rebateRelease.Add(arInvoice);
ARDocumentRelease.ReleaseDoc(rebateRelease, false);`
Try to change the last few lines to this...
rebateRelease.Add(ARGraph.Document.Current);
ARDocumentRelease.ReleaseDoc(rebateRelease, false);
My guess your issue is that you saved the graph which updated your arInvoice record and you are still using the old arInvoice record through that object. You need the updated value after you did the press save.
Also to save some overhead you can just save once before you send the doc to release. No need to save after the ARGraph.Document.Update(arInvoice) line.
I am updating journal entry on Net suite using suite talk API.
I can add new lines for the record. but on updating existing line using line ID in am getting below error.
You do not have permissions to set a value for element line.line due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.
i can update lines using GUI but not using API
NetSuiteServiceBridge nsServiceBridge = NetSuiteServiceBridge.serviceInstance;
JournalEntry j = new JournalEntry();
//j.subsidiary =new RecordRef {internalId="2",type=RecordType.subsidiary };
j.internalId = "115939";
JournalEntryLineList jl = new JournalEntryLineList();
JournalEntryLine line1 = new JournalEntryLine();
line1.startDate = DateTime.Now;
line1.startDateSpecified = true;
line1.line = 5;
line1.lineSpecified = true;
line1.account = new RecordRef { internalId = "206", type = RecordType.account };
line1.department = new RecordRef { internalId = "1", type = RecordType.department };
line1.credit = 100;
line1.creditSpecified = true;
jl.line = new JournalEntryLine[] {line1};
jl.replaceAll = false;
j.lineList = jl;
WriteResponse r= nsServiceBridge.UpdateRecords(j);
Web Services has its own permissions separate the the native GUI
This is by design
I am trying to create a drop list, haven't had any luck finding similar sample code or documentation to follow so I'm flying solo
When I run this sample code I created
static void Main(string[] args)
{
using (FileStream filename = new FileStream(#"INSERTYOUROWNPATH.xlsx", FileMode.Create))
{
var workbook = new XSSFWorkbook();
XSSFSheet xsheet = (XSSFSheet)workbook.CreateSheet("Validation");
CT_DataValidation valid = new CT_DataValidation();
valid.showDropDown = true;
valid.allowBlank = true;
var constraint = new XSSFDataValidationConstraint(new string[] { "0064", "0061" }); //to be used in list
var range = new CellRangeAddressList(11, 14, 13, 13); //apply to row 12:14 starting at column N finishing at column N
var addingconstraint = new XSSFDataValidation(constraint, range, valid);
addingconstraint.EmptyCellAllowed = true;
addingconstraint.SuppressDropDownArrow = false;
xsheet.AddValidationData(addingconstraint);
workbook.Write(filename);
}
}
I get the following errors when I open the spreadsheet:
"We found a problem with some content in "Validations.xlsx" do you
want use to try to recover as much as we can? If you trust the source
of this workbook, click Yes"
Then I get the following repair message:
"Repaired Part: /xl/worksheets/sheet1.xml part with XML error. Load
error. Line 1 column 684"
Could I please get some insight in to where this is failing?
your issue seems to be very similar to this problem about data validation and data constraint.
XSSFDataValidation dataValidation = null;
XSSFDataValidationConstraint dvConstraint = null;
XSSFDataValidationHelper validationHelper = null;
int DVRowLimit = (Int16.MaxValue);
XSSFCellStyle numberCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFDataFormat numberDataFormat = (XSSFDataFormat)workbook.CreateDataFormat();
numberCellStyle.SetDataFormat(numberDataFormat.GetFormat("#,###,###"));
CellRangeAddressList cellRangeFieldsType1 = new CellRangeAddressList(1, DVRowLimit, headerCount, headerCount);
dvConstraint = (XSSFDataValidationConstraint)validationHelper.CreateintConstraint(OperatorType.BETWEEN, "0", Int64.MaxValue.ToString());
dataValidation = (XSSFDataValidation)validationHelper.CreateValidation(dvConstraint, cellRangeFieldsType1);
dataValidation.ShowErrorBox = true;
dataValidation.SuppressDropDownArrow = true;
dataValidation.ErrorStyle = 0;
dataValidation.CreateErrorBox("InvalidValue", "Number Should be a integer.");
dataValidation.ShowErrorBox = true;
dataValidation.CreatePromptBox("Number Data Validation", "Enter Number.");
dataValidation.ShowPromptBox = true;
sheet.AddValidationData(dataValidation);
sheet.SetDefaultColumnStyle(column, numberCellStyle);
From my WCF Service, I need to create a purchase order in SAP system and it's creating. But when I tried to commit the transaction it's not effecting in SAP system.
I am getting PONumber from SAP and it's not committing.
Can any one help me on this issue.
Here is my code:
NFCLMasters.ZMASTERDATA zmobj = new NFCLMasters.ZMASTERDATA();
NFCLMasters.ZMASTERDATAResponse zmresponse = new NFCLMasters.ZMASTERDATAResponse();
NFCLMasters.ZSM_WH_MST[] zmwarehousemaster = new NFCLMasters.ZSM_WH_MST[10];
NFCLMasters.zws_mst mst = new NFCLMasters.zws_mst();
zmobj.IWHMST = "X";
zmobj.WHMST_LINES = zmwarehousemaster;
zmresponse = mst.ZMASTERDATA(zmobj);
NFCLTransactions.BAPI_PO_CREATE1 Zpo = new NFCLTransactions.BAPI_PO_CREATE1();
NFCLTransactions.BAPI_PO_CREATE1Response Zporesponse = new NFCLTransactions.BAPI_PO_CREATE1Response();
NFCLTransactions.zws_lo SapTrasactions = new NFCLTransactions.zws_lo ();
// Data objects
NFCLTransactions.BAPIMEPOHEADER poheader = new NFCLTransactions.BAPIMEPOHEADER();
NFCLTransactions.BAPIMEPOHEADERX poheaderx = new NFCLTransactions.BAPIMEPOHEADERX();
NFCLTransactions.BAPIMEPOITEM[] poitem = new NFCLTransactions.BAPIMEPOITEM[1];
NFCLTransactions.BAPIMEPOITEMX[] poitemx = new NFCLTransactions.BAPIMEPOITEMX[1];
NFCLTransactions.BAPIMEPOSCHEDULE[] poschedule = new NFCLTransactions.BAPIMEPOSCHEDULE[1];
NFCLTransactions.BAPIMEPOSCHEDULX[] poschedulex = new NFCLTransactions.BAPIMEPOSCHEDULX[1];
NFCLTransactions.BAPIITEMSHIP[] poitemship = new NFCLTransactions.BAPIITEMSHIP[1];
NFCLTransactions.BAPIITEMSHIPX[] poitemshipx = new NFCLTransactions.BAPIITEMSHIPX[1];
NFCLTransactions.BAPIRET2[] Bapireturn = new NFCLTransactions.BAPIRET2[100];
// ASSIGNING VALUES TO EACH OBJECT AND ADDING MAIN BAPI
poheader.COMP_CODE = "NFCL"; poheader.DOC_TYPE = "ZPPS"; poheader.PURCH_ORG = "MKTG"; poheader.PUR_GROUP = "M13"; poheader.DOC_DATE = "2015-02-06";
poheader.SUPPL_PLNT = "1311"; poheader.OUR_REF = "R006";
Zpo.POHEADER = poheader;
poheaderx.COMP_CODE = "X"; poheaderx.DOC_TYPE = "X"; poheaderx.PMNTTRMS = "X"; poheaderx.PURCH_ORG = "X"; poheaderx.PUR_GROUP = "X";
poheaderx.SUPPL_PLNT = "X"; poheaderx.OUR_REF = "X";
Zpo.POHEADERX = poheaderx;
poitem[0] = new NFCLTransactions.BAPIMEPOITEM();
poitem[0].PO_ITEM = "00001"; poitem[0].MATERIAL = "U01016501F"; poitem[0].PLANT = "1311"; poitem[0].STGE_LOC = "K038"; poitem[0].QUANTITY = 10;
poitem[0].PERIOD_IND_EXPIRATION_DATE = "D";
Zpo.POITEM = poitem;
poitemx[0] = new NFCLTransactions.BAPIMEPOITEMX();
poitemx[0].PO_ITEM = "00001"; poitemx[0].MATERIAL = "X"; poitemx[0].PLANT = "X"; poitemx[0].STGE_LOC = "X"; poitemx[0].QUANTITY = "X";
poitemx[0].VAL_TYPE = "X"; poitemx[0].BATCH = "X";
Zpo.POITEMX = poitemx;
poschedule[0] = new NFCLTransactions.BAPIMEPOSCHEDULE();
poschedule[0].PO_ITEM = "00001"; poschedule[0].DELIVERY_DATE = "06.02.2015"; poschedule[0].QUANTITY = 10;
//poschedule[0].DELIV_TIME = 'X';
// poschedule[0].GR_END_TIME
Zpo.POSCHEDULE = poschedule;
poschedulex[0] = new NFCLTransactions.BAPIMEPOSCHEDULX();
poschedulex[0].PO_ITEM = "00001"; poschedulex[0].PO_ITEMX = "X"; poschedulex[0].DELIVERY_DATE = "X"; poschedulex[0].QUANTITY = "X";
Zpo.POSCHEDULEX = poschedulex;
poitemship[0] = new NFCLTransactions.BAPIITEMSHIP();
poitemship[0].PO_ITEM = "00001"; poitemship[0].SHIP_POINT = "R006";
Zpo.POSHIPPING = poitemship;
poitemshipx[0] = new NFCLTransactions.BAPIITEMSHIPX();
poitemshipx[0].PO_ITEM = "00001"; poitemshipx[0].SHIP_POINT = "X";
Zpo.POSHIPPINGX = poitemshipx;
Zpo.RETURN = Bapireturn;
NFCLTransactions.BAPI_TRANSACTION_COMMIT transcommit = new NFCLTransactions.BAPI_TRANSACTION_COMMIT();
transcommit.WAIT = "X";
Zporesponse = SapTrasactions.BAPI_PO_CREATE1(Zpo);
response = Zporesponse.EXPPURCHASEORDER;
NFCLTransactions.BAPI_TRANSACTION_COMMITResponse resp = SapTrasactions.BAPI_TRANSACTION_COMMIT(transcommit);
Your two BAPI calls are currently executed in individual contexts. Therefore the second call to BAPI_TRANSACTION_COMMIT won't work because the second call context doesn't know anything about the results from the first call. You need to execute both calls within the same context. I don't know how to do that with the old, deprecated SAP .Net Connector, but with the current SAP Nco 3 you can achive it by using the methods RfcSessionManager.BeginContext() and RfcSessionManager.EndContext().
If the BAPIs are only exposed as web services, a commit probably won't succeed because all calls to those web services are executed in their own context, so you have the same problem again. A workaround for using web services and BAPI_TRANSACTION_COMMIT would be to create a custom function module in the SAP system that first calls your BAPI and if that call succeeds, calls BAPI_TRANSACTION_COMMIT. That function module would have to be RFC capable and could be exposed as a web service for you. The parameters for that custom function module would (at least) be the same as for the BAPI you need, maybe an additional "COMMIT" parameter to allow you calling it without committing anything. Creating such a function module is relatively easy and shouldn't be a problem for a company familiar with SAP ERP.
I'm using the .net payflow sdk (Payfolow_dotNET.dll). I have code that allows the customer to use EC but the paypal review page doesn't show the item detail. It just says "You'll be able to see your order details before you pay"
UserInfo creds = new UserInfo(user, vendor, partner, pwd);
string url = "";
if (paypalObj.Testing) {
url = ConfigurationManager.AppSettings.Get("PayflowTest");
} else {
url = ConfigurationManager.AppSettings.Get("PayflowLive");
}
PayflowConnectionData connection = new PayflowConnectionData(url);
Invoice inv = new Invoice();
inv.Amt = new Currency(1.01, "USD");
inv.OrderDesc = "test item";
inv.Comment1 = "test item";
// so far this next bit is not helping
LineItem item = new LineItem();
item.Amt = new Currency(1.01, "USD");
item.Desc = "test item";
item.Qty = 1;
item.Type = "DIGITAL";
item.Name = "test item";
item.ItemNumber = "1";
inv.AddLineItem(item);
ECSetRequest setRequest = new ECSetRequest(websiteBase + "Donate/PayPalConfirmPayment", websiteBase + "Donate/Donate");
setRequest.PaymentType = "instantonly";
setRequest.NoShipping = "1";
//setRequest.AddrOverride = "1";
PayPalTender tender = new PayPalTender(setRequest);
SaleTransaction trans = new SaleTransaction(creds, connection, inv, tender, PayflowUtility.RequestId);
Response resp = trans.SubmitTransaction();
TransactionResponse transResp = resp.TransactionResponse;
Any thoughts on how to get the item details on the review page? Thx
Per the Express Checkout for Payflow guide:
You can pass:
L_NAMEn
L_DESCn
L_COSTn
L_TAXAMTn
L_QTYn
See page 57 of the guide for info on how to implement these.
These variables will allow you to display line item details on the PayPal checkout page.
Turns out I was missing one property - the item cost.
item.Cost = new Currency(1.01, "USD");
It's a little bit strange that everywhere else in the Paypal APIs the amount is AMOUNT or AMT, but for line items, it's COST.