Hello SAP experts,
I'm currently engaged in a project where my objective is to extract data using the Accounting Document API in Hana Cloud. The user provides certain query parameters, one of which is the date. However, I'm facing an issue with sending the date parameter, given that the API format is as follows: "DocumentDate": "/Date(1451001600000)/". I've tried several approaches, but to no avail.
Below is the code I've been working with:
this.on("getCXP", async (req) => {
let d = { "sociedad": "1010", "ejercicio": "2017", "partidas_abiertas_a": "2015-12-25", "fechadeproceso": "2015-12-25", "textoproceso": "prueba", "PA/CM": "PA" } let grupo = "CXP"; let sociedad = d.sociedad; let ejercicio = d.ejercicio let nombre = d.textoproceso; let fecha = d.fechadeproceso; let estado = "en proceso";
proceso(nombre, fecha, estado)
let query = SELECT.from`GRUPOSVSCUENTAS`.where`EJERCICIO = ${ejercicio} AND SOCIEDAD = ${sociedad} AND GRUPO = ${grupo}`; const SRV = await cds.connect.to('catalog'); let gruposvscuentas = await SRV.run(query);
let result = []; for (let index = 0; index < gruposvscuentas.length; index++) { const sg = gruposvscuentas[index]; let filter = `FiscalYear eq '${sg.EJERCICIO}' and CompanyCode eq '${sg.SOCIEDAD}' and GLAccount eq '${sg.CUENTAI}' and IsCleared eq false`; let url2 = `https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_OPLACCTGDOCITEMCUBE_SRV/A_OperationalAcctgDocItemCube?%24top=100&%24filter=${encodeURIComponent(filter)}&%24inlinecount=allpages`; let response = await axios.get(url2, { headers: { apikey: process.env.apikey, } }); let R = response.data.d.results; result = result.concat(R); } try { guardar(result, grupo, fecha, nombre) return result;
} catch (error) { estado = 'Error' proceso(nombre, fecha, estado) console.error(error); } });
I'd greatly appreciate any insights or guidance on this matter. Thank you in advance for your time and expertise.
Best regards,
Luis Henao