ugh... you guys are right... i was thinking very wrong way of the method...
basicaly it looks this way:
// 2D array declaration logic
QVector<QVector<QString>> CreateTableau(int sizeX, int sizeY) {
.... code in initial post
return result;
}
void SAP::materials(QString lageort, QString werk)
{
... not important code
table_Quantities(tableHandle);
}
QVector<QVector<QString>> SAP::table_Quantities(RFC_TABLE_HANDLE returnTable)
{
for (i=0; i<tabLen; i++) {
int colLen = 10;
if (i==0) { result = CreateTableau(tabLen, colLen); } //by first row we find out how many columns are there, and will declare 2D array accordingly
// loop throught columns
for (int j = 0; j < colLen; j++) {
result[i][j] = something;
//qDebug() << result[i][j]; // works fine
}
}
return result;
}
and when calling it from QML:
Component.onCompleted: {
let table = [];
table = sap.tablePopulate("5506", "6104");
console.log(table.length); // TypeError: Cannot read property 'length' of undefined
}
then it obviously is undefined when im calling sub method which creates no data unless its called from materials() :D
so I need the SAP::materials() declare also as QVector<QVector<QString>>
so now it works as expected...
Thank you guys