‎2009 May 06 8:34 AM
Hi,
I only speak a little englis so I wait that you can understand me.
I have two structures. When I use the first structure in a sql I have an error: Unknown column name PEDIDO. field list. field list. field list. field list.
DATA: BEGIN OF t_pedidos OCCURS 0,
pedido TYPE VBAP-VBElN,
posnr TYPE VBAP-POSNR,
matnr TYPE VBAP-MATNR,
pstyv TYPE VBAP-PSTYV,
kwmeng TYPE VBAP-KWMENG,
vrkme TYPE VBAP-VRKME,
werks TYPE VBAP-WERKS,
factura TYPE VBRP-VBELN,
posicion TYPE VBRP-POSNR,
END OF t_pedidos.
DATA: BEGIN OF t_entregas OCCURS 0,
pedido TYPE VBAP-VBElN,
posnr TYPE VBAP-POSNR,
entrega LIKE LIPS-VBELN,
lfimg LIKE LIPS-LFIMG,
meins LIKE LIPS-MEINS,
END OF t_entregas.
SELECT
pedido
posnr
LIPS~VBELN AS entrega
LIPS~LFIMG
LIPS~MEINS AS meinsEntrega
FROM
LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN
t_pedidos
WHERE
LIPS~VGBEL = t_pedidos-pedido AND
LIPS~VGPOS = t_pedidos-posnr.
I can't see what's the problem.
Thank you very much.
‎2009 May 06 8:38 AM
Hi Jose,
try below
SELECT
VBELN "you need to use like this...use the refefecnec filed of table not the internal table
posnr
LIPS~VBELN AS entrega
LIPS~LFIMG
LIPS~MEINS AS meinsEntrega
FROM
LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN
t_pedidos
WHERE
LIPS~VGBEL = t_pedidos-pedido AND
LIPS~VGPOS = t_pedidos-posnr.Thanks!
Edited by: Prasanth Maddela on May 6, 2009 1:10 PM
Edited by: Prasanth Maddela on May 6, 2009 1:13 PM
‎2009 May 06 8:45 AM
Thanks for your answer Prasanth Maddela.
The fields pedido and posnr belong to t_pedidos table and I need use this.
‎2009 May 06 8:51 AM
HI Jose,
While fetching data from the Data base level you need to use the referecnce fileds of the data base table not the internal table.
after fetching you t_pedidos-pedidos fills automatically as it is the referece field of VGBEL in the LIPS.
hope these info helps you .
Thanks!
‎2009 May 06 9:34 AM
I understand it, but, if I want to use a field of t_pedidos that is owner of t_pedidos and itsn't in the tables of data base how LIPS, ¿how can I use it?.
Thank you very much.
‎2009 May 06 8:39 AM
Try this:
SELECT
vgbel as pedido
posnr
VBELN AS entrega
LFIMG
MEINS
FROM LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN t_pedidos
WHERE
VGBEL = t_pedidos-pedido AND
VGPOS = t_pedidos-posnr.
Edited by: I039643 on May 6, 2009 1:09 PM
Edited by: I039643 on May 6, 2009 1:12 PM
‎2009 May 06 8:46 AM
I try your code I039643 but I receibe the same error.
Thank you very much.
‎2009 May 06 8:40 AM
Hi Jose,
As there's no field with PEDIDO in the table LIPS , so is the error
thanks
‎2009 May 06 8:47 AM
Hello Mahesh Reddy, I want use fields of my internal table t_pedidos. Pedido and posnr belong to this table.
‎2009 May 06 8:49 AM
can you try again with this:
SELECT
vgbel as pedido
posnr
VBELN AS entrega
LFIMG
MEINS
FROM LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN t_pedidos
WHERE
VGBEL = t_pedidos-pedido AND
VGPOS = t_pedidos-posnr.
‎2009 May 06 9:44 AM
SELECT
pedido
posnr
LIPS~VBELN AS entrega
LIPS~LFIMG
LIPS~MEINS AS meinsEntrega
FROM
LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN
t_pedidos
WHERE
LIPS~VGBEL = t_pedidos-pedido AND
LIPS~VGPOS = t_pedidos-posnr.
In the above query PEDIDO should be given with table reference
Ex: VBAP~PEDIDO
‎2009 May 06 9:45 AM
‎2009 May 06 9:54 AM
hi,
> DATA: BEGIN OF t_pedidos OCCURS 0,
> pedido TYPE VBAP-VBElN,
>
> DATA: BEGIN OF t_entregas OCCURS 0,
> pedido TYPE VBAP-VBElN,
write like this..
DATA: BEGIN OF t_pedidos OCCURS 0,
pedido TYPE VBAP-VBELN,
DATA: BEGIN OF t_entregas OCCURS 0,
pedido TYPE VBAP-VBELN,
hope this helps
Regards
Ritesh Jha
‎2009 May 06 10:10 AM
Thank you for your answers.
Ajay kumar, in my code I have a first sql that put tha data in t_pedidos. This sql use VBAP for get the data.
Hello Ritesh Jha, sorry, but in the code, i put the L in lower case and is similar to i, but i have VBELN.
‎2009 May 06 10:18 AM
Is it possible for u to change the PEDIDOS field to VBELN in your table t_entregas definition.
And also in the SELECT statement replace PEDIDOS with VBELN.
‎2009 May 06 10:19 AM
Hi..
Your Code is below.
SELECT
pedido
posnr
LIPS~VBELN AS entrega
LIPS~LFIMG
LIPS~MEINS AS meinsEntrega
FROM
LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN
t_pedidos
WHERE
LIPS~VGBEL = t_pedidos-pedido AND
LIPS~VGPOS = t_pedidos-posnr.
Instead of this you use below code.
SELECT
LIPS~VGBEL as pedido
LIPS~VGPOS as posnr
LIPS~VBELN AS entrega
LIPS~LFIMG
LIPS~MEINS AS meinsEntrega
FROM
LIPS
INTO TABLE t_entregas
FOR ALL ENTRIES IN
t_pedidos
WHERE
LIPS~VGBEL = t_pedidos-pedido AND
LIPS~VGPOS = t_pedidos-posnr.
Instead of pedido use VGBEL and instead of posnr use VGPOS in select query as in LIPS table no such fields exsist(pedido or posnr).And as you are passing pedido and posnr in where clause the values will be same with this query.
Hope it helps you.
Vidhi
‎2009 May 06 11:48 AM
Perhaps, I can't use the fields of a internal table like fields of a sql. I can use this fields to filter the registers but I can't put in the select of sql.