PDA

Ver la Versión Completa : consulta SQL en SAP B1


antonio de sanchez
19/05/15, 22:13:32
Buenas tardes

estoy trabajando con el sistema SAP como ERP en el cual estoy realizando la sigueinte busqueda formateada con una consulta que me tiene que sumar las cantidades de los articulos iguales y multipricarlos por la cantidad que se tiene que fabricar.

tengo 5 campos de usuarios donde se capturan

PT LH :-Producto terminado 1 = OWTQ.U_RSG_PT
PT RH :.- producto terminado 2 = OWTQ.U_PT_RH
CANTIDA Producto terminado 1 = OWTQ.U_RSG_CANT
CANTIDA Producto terminado 2= OWTQ.U_RSG_CANT_RH
MOLDE

en el cual tengo la siguente consulta.

SELECT SUM(MP.INPUT_QTY) * ISNULL($[OWTQ.U_RSG_CANT],0)+
SUM(MP.INPUT_QTY) * ISNULL($[OWTQ.U_RSG_CANT_RH],0)
FROM BEAS_STL MP WHERE MP.ItemCode = $[OWTQ.U_RSG_PT]
or MP.ItemCode = $[OWTQ.U_PT_RH] AND MP.ART1_ID = $[$23.1.0]
GROUP BY MP.INPUT_QTY,MP.ItemCode

si me realiza la operacion pero me arroja los dos resultadoscuando yo solo quiero que me mande el dato dependiendo del articulo el cual selecciono