Skip to Content
0

How can i add more than 1 lines in the accountingdocument.wsdl

Feb 05 at 08:23 PM

23

avatar image
Former Member

Hello everyone

I am consuming the wsld of accounting entries from SAP By Design but when I want to add several lines, I only add the last one.

Here is my code


private void btnAplicar_Click(object sender, EventArgs e)
{
NetworkCredential objCredencial = new NetworkCredential();

objCredencial.UserName = "zzzzzzz";

objCredencial.Password = "ccccc";

objCredencial.Domain = "";

service objService = new service();

BOAccountingEntryCreateRequestMessage_sync objRequestMess = new BOAccountingEntryCreateRequestMessage_sync();

BOAccountingEntryCreateConfirmationMessage_sync objResponse = new BOAccountingEntryCreateConfirmationMessage_sync();

objService.Url = "https://my.sapbydesign.com/sap/bc/srt/scs/sap/yyr5x48jqy_manageboaccountinge?sap-vhost=my.sapbydesign.com";

objService.Credentials = objCredencial;

objService.Timeout = 600000;

BOAccountingEntryCreateRequest objHeader = new BOAccountingEntryCreateRequest();

BOAccountingEntryCreateRequest pItem = new BOAccountingEntryCreateRequest();

pItem.CompanyID = "ROCO";

SetOfBooksID pCodSetOfBook = new SetOfBooksID();

pCodSetOfBook.Value = "COGA";

pItem.SetOfBooksID = pCodSetOfBook;

AccountingDocumentTypeCode pCodDocTypeCode = new AccountingDocumentTypeCode();

pCodDocTypeCode.Value = "00047";

pItem.AccountingDocumentTypeCode = pCodDocTypeCode;

pItem.AccountingBusinessTransactionTypeCode = "601";

pItem.CurrencyCode = "COP";

pItem.AccountingClosingStepCode = "010";

pItem.EntryDateV2 = "2018-01-01";

pItem.PostingDateV2 = "2018-01-01";

SHORT_Note pNota = new SHORT_Note();

pNota.Value = "NOMINA 3 ";

pItem.Note = pNota;

//detalle

BOAccountingEntryCreateRequestDetails[] objDetalle = new BOAccountingEntryCreateRequestDetails[46];

BOAccountingEntryCreateRequestDetails pDetalle = new BOAccountingEntryCreateRequestDetails();


Conexion cdb = new Conexion();
cdb.obtenerconexion();
DataTable DtUsuario1;
DataSet ds1 = new DataSet();
DtUsuario1 = cdb.fSqlSelect("SELECT * from T_Aux_Rep_Contabilidad order by clave");
ds1.Tables.Add(DtUsuario1);
int largo6 = ds1.Tables[0].Rows.Count;

for (int i = 0; i < largo6; i++)
{

if (ds1.Tables[0].Rows[i]["TIPO"].ToString() == "H")
{
pDetalle.DebitCreditCode = "2";
}
else
{
pDetalle.DebitCreditCode = "1";
}

pDetalle.ChartOfAccountsCode = "COGA";

ChartOfAccountsItemCode ListIDVal = new ChartOfAccountsItemCode();

ListIDVal.Value = ds1.Tables[0].Rows[i]["CUENTA"].ToString();

pDetalle.ChartOfAccountsItemCode = ListIDVal;

Amount pMonto = new Amount();

pMonto.currencyCode = "COP";

pMonto.Value = 20000;

pDetalle.TransactionCurrencyAmount = pMonto;

pDetalle.CostCenter = ds1.Tables[0].Rows[i]["CENTRO_COSTO"].ToString();

objDetalle[i] = pDetalle;



}

pItem.Details = objDetalle;

objHeader = pItem;

objRequestMess.BOAccountingEntry = objHeader;

Log objLog = new Log();

LogItem[] objLogItem = new LogItem[2];

objResponse = objService.Create(objRequestMess);

objLog = objResponse.Log;

objLogItem = objLog.Item;

if (objLog.MaximumLogItemSeverityCode == "3")
{

for (int i = 0; i < objLogItem.Length; i++)
{
lblConectado.Text = objLogItem[i].Note;
}
}
else
{

lblConectado.Text = "Registro Cargado...";
}

}

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers