Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with structure and sql

Former Member
0 Likes
1,749

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.

16 REPLIES 16
Read only

Former Member
0 Likes
1,672

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

Read only

0 Likes
1,672

Thanks for your answer Prasanth Maddela.

The fields pedido and posnr belong to t_pedidos table and I need use this.

Read only

0 Likes
1,672

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!

Read only

0 Likes
1,672

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.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,672

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

Read only

0 Likes
1,672

I try your code I039643 but I receibe the same error.

Thank you very much.

Read only

former_member222860
Active Contributor
0 Likes
1,672

Hi Jose,

As there's no field with PEDIDO in the table LIPS , so is the error

thanks

Read only

0 Likes
1,672

Hello Mahesh Reddy, I want use fields of my internal table t_pedidos. Pedido and posnr belong to this table.

Read only

0 Likes
1,672

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.

Read only

Former Member
0 Likes
1,672

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

Read only

Former Member
0 Likes
1,672

similar thing for POSNR also Ex: VBAP~POSNR

Read only

Former Member
0 Likes
1,672

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

Read only

0 Likes
1,672

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.

Read only

Former Member
0 Likes
1,672

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.

Read only

Former Member
0 Likes
1,672

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

Read only

0 Likes
1,672

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.