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 in db table

Former Member
0 Likes
1,423

i want to select VPOSN from VEDA

most of the field are empty,000000,12,20

how i select it

i made vposn = '000000'

or vposn = ' '.

and it's not work do you have any idea,

14 REPLIES 14
Read only

Former Member
0 Likes
1,356

Hi yehiel,

I think VPOSN = '000000' would be working.

Are you getting any error?

I have tried this

REPORT YRT_TEST.

tables: veda.

start-of-selection.

select single *

from veda

into veda

where vposn = '000000'.

if sy-subrc = 0.

write:/ veda-posnr.

endif.

Thanks,

Ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,356


data: xveda type veda.

parameters: p_vbeln type veda-vbeln.


* If the values for VPOSN are not filled, then you should
* be able to get them using  VPOSN = '000000'.
select single * from veda into xveda
                 where  vbeln =  p_vbeln
                   and  vposn = '000000'.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,356

vposn = '000000' did not work for those

that are initial, so i made '' with 6 spaces

and it's not work

Read only

0 Likes
1,356

Can you please post your exact code.

Thanks.

Regards,

Rich Heilman

Read only

0 Likes
1,356

try VPOSN EQ SPACE

Also post ur code so that we can findout wat exactly is going wrong

Message was edited by: Nandha Kumar Raju

Read only

0 Likes
1,356

REPORT YRT_TEST.

tables: veda.

start-of-selection.

select single * from veda

into veda

where vposn = '000000'

OR VPOSN IS NULL.

if sy-subrc = 0.

write:/ veda-vposn.

endif.

Read only

0 Likes
1,356

How about this, does this work?



select venddat vbegdat
   from veda
       into (veda-venddat , veda-vbegdat)
          where  vbeln = mdcw-zs_vbeln
            and ( vposn = mdcw-zs_posnr
             or   vposn = '000000' )
            and venddat = ( select max( venddat )
                               from veda
                                   where vbeln = mdcw-zs_vbeln
                                     and ( vposn = mdcw-zs_posnr
                                      or   vposn = '000000' ) ).
  if sy-subrc = 0.
    mdcw-zs_venddat = veda-venddat.
    mdcw-zs_vbegdat = veda-vbegdat.
  else.
    modify mdcw.
  endif.
endselect.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,356

SELECT venddat vbegdat

FROM veda

INTO (veda-venddat , veda-vbegdat)

WHERE vbeln = mdcw-zs_vbeln

AND ( vposn = mdcw-zs_posnr )

OR

( VPOSN = ' ').

AND venddat = ( SELECT MAX( venddat )

FROM veda

WHERE vbeln = mdcw-zs_vbeln

AND ( vposn = mdcw-zs_posnr )

OR

( VPOSN = ' ' ) ).

IF sy-subrc = 0.

mdcw-zs_venddat = veda-venddat.

mdcw-zs_vbegdat = veda-vbegdat.

else.

MODIFY mdcw.

ENDIF.

ENDSELECT.

i tried '000000' too

Read only

0 Likes
1,356

It has to be '000000'. I think your select statement is not working because of the positioning of the '(' and ')'. Here is the modified one.


  SELECT venddat vbegdat
    FROM veda
    INTO (veda-venddat , veda-vbegdat)
   WHERE vbeln = mdcw-zs_vbeln
     AND ( vposn = mdcw-zs_posnr OR
           vposn = '000000' )
     AND venddat = ( SELECT MAX( venddat )
                       FROM veda
                      WHERE vbeln = mdcw-zs_vbeln
                        AND ( vposn = mdcw-zs_posnr OR
                              vposn = '000000' ) ).

Please let me know if this is what you are looking for.

Srinivas

Read only

Former Member
0 Likes
1,356

the pointer '.' is wrong dont look at her

Read only

Former Member
0 Likes
1,356

SELECT venddat vbegdat

FROM veda

INTO (veda-venddat , veda-vbegdat)

WHERE vbeln = mdcw-zs_vbeln

AND ( vposn = mdcw-zs_posnr )

OR

( VPOSN EQ SPACE )

OR

( VPOSN = '000000' )

AND venddat = ( SELECT MAX( venddat )

FROM veda

WHERE vbeln = mdcw-zs_vbeln

AND ( vposn = mdcw-zs_posnr )

OR

( VPOSN EQ SPACE )

OR

( VPOSN = '000000' ) ).

IF sy-subrc = 0.

mdcw-zs_venddat = veda-venddat.

mdcw-zs_vbegdat = veda-vbegdat.

else.

MODIFY mdcw.

ENDIF.

ENDSELECT.

i tried this too and is not giving me the right data

Read only

0 Likes
1,356

"OR VPOSN IS NULL" should detect this on an Oracle DB... not sure what DB system you are running.

Read only

Former Member
0 Likes
1,356

thank rich

Read only

0 Likes
1,356

So is it working now? If so, please make sure to mark your post as solved and award points to your fellow SNDers who have helped you.. Thanks.

Regards,

Rich Heilman