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

why this query does not work????

Former Member
0 Likes
1,477

I found a record in the lips table with the parameters given below. Why this query is not fetching any value from the table. Please help me to resolver this issue.

SELECT vbeln

posnr

vgbel

vgpos

FROM lips

INTO TABLE lt_lips

WHERE VGBEL = '170000122'

AND VGPOS = '100'.

1 ACCEPTED SOLUTION
Read only

santhosh_patil
Contributor
0 Likes
1,417

Hi,

Try with this

SELECT vbeln

posnr

vgbel

vgpos

FROM lips

INTO TABLE lt_lips

<b>WHERE VGBEL = '0170000122'

AND VGPOS = '000100'.</b>

-


Patil

11 REPLIES 11
Read only

Former Member
0 Likes
1,417

could anyone tellme what is the problem to retrieve. I am not using select single and also i am not refering to the primary keys of the table. Please help me to resolve this issue.

Relevant answers will be highly rewarded...

______________________________________________________

Ramineni

Read only

Former Member
0 Likes
1,417

Hai,

i also faced the same problem like this,then i changed the query to

select * from table into table it_table of table where condition.

try this.

Read only

santhosh_patil
Contributor
0 Likes
1,418

Hi,

Try with this

SELECT vbeln

posnr

vgbel

vgpos

FROM lips

INTO TABLE lt_lips

<b>WHERE VGBEL = '0170000122'

AND VGPOS = '000100'.</b>

-


Patil

Read only

0 Likes
1,417

thankx Santhosh....it is working fine.

Read only

Former Member
0 Likes
1,417

OMG you always will get an error like this.

EIther do

SELECT vbeln

posnr

vgbel

vgpos

FROM lips

INTO

**START INSERT**

Corresponding fields of

**END INSERT**

TABLE lt_lips

WHERE VGBEL = '170000122'

AND VGPOS = '100'.

or do it like this:

Data: lv_vbeln type vbak-vbeln,

lv_posnr type vbap-posnr,

lv_vbgel type vbak-vbeln,

lv_vgpos type vbap-posnr.

SELECT

**START INSERT**

SINGLE

**END INSERT**

vbeln

posnr

vgbel

vgpos

FROM lips

**START INSERT**

INTO (lv_vbeln, lv_posnr, lv_vgbel, lv_vgpos )

**END INSERT**

WHERE VGBEL = '170000122'

AND VGPOS = '100'.

if you are selecting Single fields out of a database table you HAVE to use INTO CORRESPONDING FIELDS OF, when you want to move them ot a structure or an internal table.

there´s no way round it, besides declaring yourself a structure containing just THOSE fields.

Message was edited by:

Florian Kemmer

Read only

Former Member
0 Likes
1,417

the query which i had posted above is working fine if i pad 0's . But i want to replace this charecter set with a work area variable. i mean to say like the following query:-

SELECT vbeln

posnr

vgbel

vgpos

FROM lips

INTO TABLE lt_lips

WHERE VGBEL = wa_disp-vbeln

AND VGPOS = wa_disp-posnr.

Read only

0 Likes
1,417

Hi,

Wht is the issue?

--Patil

Read only

0 Likes
1,417

thanks Santhosh...i had rewarded you and waiting for one more issue (what i had mentioned above)to be resolved.

Read only

0 Likes
1,417
try this..

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
          input   = wa_disp-vbeln
    IMPORTING
        OUTPUT  =  wa_disp-vbeln.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
          input   = wa_disp-posnr
    IMPORTING
        OUTPUT  =  wa_disp-posnr.
          

SELECT vbeln
posnr
vgbel
vgpos
FROM lips
INTO TABLE lt_lips
WHERE VGBEL = wa_disp-vbeln
AND VGPOS = wa_disp-posnr.
Read only

0 Likes
1,417

you can use the FM :for Conversion Exits which will add the necessary paddings that are required.

FM like CONVERSION_EXIT_ALPHA_INPUT may be useful.

Pass wa_disp-vbeln and wa_disp-posnr to the FM and save the output in a variable.

Then use these in your select query.

regards,

Read only

0 Likes
1,417

thanks sachin....awarded points for you.thnx