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 QUERY

Former Member
0 Likes
1,190

Hi,

i am geting some problem with one select query, by using that select query what i am trying to do is retrieving material details related to multiple deliveies.But i am not able to find any values in internal table when i am debbuging this select query i am mentioned that query below please tell me the problem?

Query:

select vbeln matnr lfimg from lips

into corresponding fields of table l_t_matdet

for all entries in g_t_dochdr

where vbeln = g_t_dochdr-b_doc_number.

g_t_dochdr contains multiple delivery numbers.

11 REPLIES 11
Read only

Former Member
0 Likes
1,157

hi

good

as you have mentioned as for all entries, so you check what is the value of g_t_dochdr table and wheather condition vbeln = g_t_dochdr-b_doc_number is satisfying or not.

thanks

mrutyun^

Read only

Former Member
0 Likes
1,157

Hi Srinivas,

First of all check at table level whether do you have any entires in the table lips for the records that you are passing.

Regards,

Kiran I

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,157

Hi,

I hope your internal table l_t_matdet will be of following structure.

data : begin of l_t_matdet occurs 0,

vbeln ..

matnr..

lfimg...

...

end of l_t_matdet.

select ...from ...into table g_t_dochdr...

if sy-subrc eq 0.

select vbeln matnr lfimg from lips

into corresponding fields of table l_t_matdet

for all entries in g_t_dochdr

where vbeln = g_t_dochdr-b_doc_number.

endif.

If your coding is like as mentioned above,I don't think there is a problem in your coding.

Better check in SE11,for lips table entries.Whatever values you are getting in internal table g_t_dochdr,just pass the doc_number to lips and find out correspoding entry exists.

Read only

0 Likes
1,157

hi jayanthi,

while debbuging this select statement i have checked the g_t_donhdr it contains the value but when i checked in l_t_matdet internal table field content is showing as "Non charlike structure" . But when i check the structure and length both of them are of same structure and type.

Read only

0 Likes
1,157

Hi Srinivasa,

I think the problem is not in your query, but when defining table l_t_matdet or g_t_donhdr.

Can you please show us the codes where you define the table...

Regrads,

Hendy

Read only

0 Likes
1,157

Hi

Data: Begin of g_t_dochdr occurs 0,

b_doc_number type zdef_stp_shp-b_doc_number,

end of g_t_dochdr.

Data: begin of l_t_matdet occurs 0,

vbeln like lips-vbeln,

matnr like lips-matnr,

lfimg like lips-lfimg,

end of l_t_matdet.

Read only

0 Likes
1,157

Hi Srini,

I think the problem is in 'b_doc_number type zdef_stp_shp-b_doc_number'.

Can you change it to b_doc_number like LIPS-VBELN?

I knew both of them have same type CHAR(10).

But if you check LIPS-VBELN this field has a conversion routine and zdef_stp_shp-b_doc_number (I guest) does not have it.

By using conversion routine, for example document number '10002' will be converted to '0000010002'.

I guest your data in 'b_doc_number type zdef_stp_shp-b_doc_number'

is '10002' and your data in LIPS table is '0000010002'.

'10002' is not equal with '0000010002'.

Regards,

Hendy.

Read only

Former Member
0 Likes
1,157

Hi srinivas,

1.Sort the table g_t_dochdr by doc_number.

2.check if the length of vbeln and doc_number are equal , may be the leading zeroes are missing in doc_number while equating

Read only

Former Member
0 Likes
1,157

hi sri,

The problem is while equating they are not equal so do the following steps..

  • sort ur internal tables

  • check the entries in both the tables might be the value of vbeln is not the same in both...

Read only

Former Member
0 Likes
1,157

Check Table whether you are having any records which meets your selection condition.. Whenever you will use for all entries check whether that table is having any records or not... Like <b>if not g_t_dochd is initial</b> contnue else <b>exit</b>.'

Reward if usefull...

Read only

Former Member
0 Likes
1,157

select vbeln matnr lfimg from lips

into corresponding fields of table l_t_matdet

for all entries in g_t_dochdr

where vbeln = g_t_dochdr-b_doc_number

whats this <b>b_doc_number</b> .. ???

is it billing document number ...

cause this will be VBRK-VBELN.

and this will be different from LIKP-VBELN and LIPS_VBELN.

in short u cannot equate VBRK-VBELN = LIKP/LIPS -VBELN.

i hope this is the case ..

it will be

VBRK-VBELN = VBRP-VBELN

VBRP-VGBEL = LIPS-VBELN

VBRP-VGPOS = LIPS-VGPOS

just check the flow in the tables first for a billing document number and then change the code accordingly.