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

Select statement

Former Member
0 Likes
574

HI,

This select statement showing an error 'coz type of vbeln and XBLNR is different. Hw to correct this error. PLz help

SELECT vbeln

posnr

matnr

FROM lips

INTO TABLE t_lips

FOR ALL ENTRIES IN t_mkpf

WHERE vbeln EQ t_mkpf-xblnr.

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
553

Hi Anu,

Check below mandatory conditions when u r using for all entries.

1. Have to check driver table is initial or not before using for all entries(IF NOT t_mkpf[] IS INTIAL). Other wise if driver table is initial then the select will select all the entries of the data base.

2. At least one condition from for all entries table has to be there in the where clause.

3. Field type and length of driver and driven tables must be same(Error in ur case is because of this)

Sort the driver table and delete the adjacent duplicates from the driver table by the fields in the where clause for improving the performance.

In this case to solve ur problem u have to take one more internal table. In this u have to declare the field vbeln as mkpf-xblnr.

check below code.

TYPES: BEGIN OF t_lipstemp,

vbeln type mkpf-vbeln,

END OF t_lipstemp.

DATA: i_lipstemp TYPE STANDARD TABLE OF t_lipstemp,

wa_lipstemp TYPE t_lipstemp.

REFRESH i_lipstemp[].

LOOP AT t_mkpf INTO wa_mkpf.

CLEAR wa_lipstemp.

wa_lipstemp-vbeln = wa_mkpf-xblnr.

APPEND wa_lipstemp TO i_lipstemp.

CLEAR wa_mkpf.

ENDLOOP.

IF NOT i_lipstemp[] IS INITIAL.

SORT i_lipstemp BY vbeln.

DELETE ADJACENT DUPLICATES FROM i_lipstemp COMPARING vbeln.

SELECT vbeln

posnr

matnr

FROM lips

INTO TABLE t_lips

FOR ALL ENTRIES IN t_lipstemp

WHERE vbeln EQ t_lipstemp-vbeln.

ENDIF.

Thanks,

Vinod.

4 REPLIES 4
Read only

Former Member
0 Likes
553

You could create an intermediate table in which xblnr has the same type of belnr...

Then you can do the for all entries in new_table

Read only

Former Member
0 Likes
553

While creating internal tables for both tables

declare XBLNR and VBELN of 16 characters in size.

xblnr(16) type c

vbeln(16) type c

Read only

vinod_vemuru2
Active Contributor
0 Likes
554

Hi Anu,

Check below mandatory conditions when u r using for all entries.

1. Have to check driver table is initial or not before using for all entries(IF NOT t_mkpf[] IS INTIAL). Other wise if driver table is initial then the select will select all the entries of the data base.

2. At least one condition from for all entries table has to be there in the where clause.

3. Field type and length of driver and driven tables must be same(Error in ur case is because of this)

Sort the driver table and delete the adjacent duplicates from the driver table by the fields in the where clause for improving the performance.

In this case to solve ur problem u have to take one more internal table. In this u have to declare the field vbeln as mkpf-xblnr.

check below code.

TYPES: BEGIN OF t_lipstemp,

vbeln type mkpf-vbeln,

END OF t_lipstemp.

DATA: i_lipstemp TYPE STANDARD TABLE OF t_lipstemp,

wa_lipstemp TYPE t_lipstemp.

REFRESH i_lipstemp[].

LOOP AT t_mkpf INTO wa_mkpf.

CLEAR wa_lipstemp.

wa_lipstemp-vbeln = wa_mkpf-xblnr.

APPEND wa_lipstemp TO i_lipstemp.

CLEAR wa_mkpf.

ENDLOOP.

IF NOT i_lipstemp[] IS INITIAL.

SORT i_lipstemp BY vbeln.

DELETE ADJACENT DUPLICATES FROM i_lipstemp COMPARING vbeln.

SELECT vbeln

posnr

matnr

FROM lips

INTO TABLE t_lips

FOR ALL ENTRIES IN t_lipstemp

WHERE vbeln EQ t_lipstemp-vbeln.

ENDIF.

Thanks,

Vinod.

Read only

chaouki_akir
Contributor
0 Likes
553

Hello,

try :

SELECT vbeln posnr matnr FROM lips INTO TABLE t_lips

FOR ALL ENTRIES IN t_mkpf

WHERE vbeln EQ t_mkpf-xblnr+0(10).

Cordialement,

Chaouki.