cancel
Showing results for 
Search instead for 
Did you mean: 

join two queries to obtain a report

oscar_ips
Explorer
0 Kudos

Hola ,

tengo dos consultas hechas

La primera convocatoria de movimientos bursátiles:

SELECCIONE T0."DocNum", T0."DocDate", T1."ItemCode", T1."FromWhsCod", T1."WhsCode", T1."Cantidad" DESDE OWTR T0 INNER JOIN WTR1 T1 EN T0."DocEntry" = T1."EntradaDoc"

y la segunda llamada hu asignada a de:

SELECCIONE T0."DocEntry", T0."DocNum", T0."CreateDate", T0."CreateTime", T0."U_HUCode", T2."ItemCode", T0."U_Quantity", T0."U_ObjDocNum", T2 ."BaseRef" FROM "SBO_IPS"."@INFO21AWMSHUTRANS" T0, OIGE T1 UNIÓN INTERNA IGE1 T2 EN T1."DocEntry" = T2."DocEntry" DONDE T0."U_ObjDocNum" = T1."DocNum" AND T2."BaseRef "NO ES UN ORDEN NULO POR T0."CreateDate"

Lo que quiero hacer es que en la primera consulta también obtenga el número hu utilizado (T0."U_HUCode)

 

oscar_ips
Explorer
0 Kudos

I have two queries made

The first call stock movements:

SELECT T0."DocNum", T0."DocDate", T1."ItemCode", T1."FromWhsCod", T1."WhsCode", T1."Quantity" FROM OWTR T0 INNER JOIN WTR1 T1 ON T0."DocEntry" = T1."DocEntry"

and the second call hu assigned to of :

SELECT T0."DocEntry", T0."DocNum", T0."CreateDate", T0."CreateTime", T0."U_HUCode", T2."ItemCode", T0."U_Quantity", T0."U_ObjDocNum", T2 ."BaseRef" FROM "SBO_IPS"."@INFO21AWMSHUTRANS" T0 , OIGE T1 INNER JOIN IGE1 T2 ON T1."DocEntry" = T2."DocEntry" WHERE T0."U_ObjDocNum" = T1."DocNum" AND T2."BaseRef "IS NOT NULL ORDER BY T0."CreateDate"

What I want to do is that in the first query I also get the hu number used (T0."U_HUCode)

thank you so much

JimSpath
Active Contributor
0 Kudos

Could you locate the "code" control button on the posting menu here and format your content to be more human readable? I will show an example below, copying and pasting one of your statements.

 

SELECT 
  T0."DocEntry", 
  T0."DocNum", 
  T0."CreateDate", 
  T0."CreateTime", 
  T0."U_HUCode", 
  T2."ItemCode", 
  T0."U_Quantity", 
  T0."U_ObjDocNum", 
  T2 ."BaseRef" 
FROM 
  "SBO_IPS"."@INFO21AWMSHUTRANS" T0 ,
  OIGE T1 INNER JOIN 
    IGE1 T2 ON 
      T1."DocEntry" = T2."DocEntry" 
    WHERE 
      T0."U_ObjDocNum" = T1."DocNum" 
    AND 
      T2."BaseRef" IS NOT NULL 
ORDER BY 
  T0."CreateDate"

 

insert-code-sample.png

 

 

(I would try to test the inner join by itself to understand it, if I could).

What SAP product runs this code?

Accepted Solutions (0)

Answers (0)