Mr. Martin is right..
I actually found the solution.. it's simple.
If you wanna join a datasource you have to add a selection field for it and map that field. If the field isn't selected or not mapped it won't work. So, the solution would look like this:
XDSSalesTable xDSSalesTable;
Query q;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds_Joined;
QueryBuildFieldList qbfl;
Map fieldMapping;
q = new Query();
qbds = q.addDataSource(tableNum(SalesTable));
qbds.addSelectionField(fieldNum(SalesTable,SalesId));
qbds.addRange(fieldNum(SalesTable,SalesStatus)).value('3');
qbfl = qbds.fields();
qbfl.dynamic(QueryFieldListDynamic::No);
qbds_Joined = q.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(XDSCustTable));
qbds_Joined.addSelectionField(fieldNum(XDSCustTable,UserId));
qbds_Joined.addLink(fieldNum(SalesTable,InvoiceAccount),fieldNum(XDSCustTable,CustAccount));
qbds_Joined.addRange(fieldNum(XDSCustTable,UserId)).value('TestUser');
fieldMapping = new Map(Types::String,Types::Container);
ttsBegin;
fieldMapping.insert(fieldStr(XDSSalesTable,SalesId) ,[qbds.uniqueId(),fieldStr(SalesTable,SalesId)]);
fieldMapping.insert(fieldStr(XDSSalesTable,UserId) ,[qbds.uniqueId(),fieldStr(XDSCustTable,UserId)]);
Query::insert_recordset(xDSSalesTable,fieldMapping,q);
but what if you want to join a datasource but you don't want to get the value in the target table? like, in my example for my target table (XDSSalesTable) it has 2 fields (SalesId and UserId), I get SalesId from SalesTable and UserId from the joined datasource... But what if I want to get the SalesId only and keep UserId empty??
the solution is to specify the join mode between the joined datasource and the parent datasource like that:
qbds_Joined = q.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(XDSCustTable));
qbds_Joined.addSelectionField(fieldNum(XDSCustTable,UserId));
qbds_Joined.addLink(fieldNum(SalesTable,InvoiceAccount),fieldNum(XDSCustTable,CustAccount));
qbds_Joined.joinMode(JoinMode::ExistJoin);
qbds_Joined.addRange(fieldNum(XDSCustTable,UserId)).value('TestUser');
ExistJoin will not retrieve any value from the joined datasource!