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

Where condition

radhushankar
Participant
0 Likes
864

Hi all

i am working in a object tat is smartform.

In that i have to retrieve the Drawing number based upon the description.

In the table the Description stored like this.

DKTXT = GA W MATERIAL DRAWING.

My problem is i have to compare the first three letters of the description. For example 'GAW'.

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT = 'GAW' ( MY PROBLEM IS HOW TO COMAPRE THE FIRST THREE LETTERS AND RETRIEVE THE DATA.

Thanks in advance,

arun.j.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
825

hi

Shankar

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT = 'GAW'

first u do like this

data:

w_char(4) type c.

concatenate 'GAW' ' * ' into w_char.

then write u r select statement..

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT like w_char.

plzz reward if it usefull...

plzz dont forget to reward...

6 REPLIES 6
Read only

Former Member
0 Likes
827

hi

Shankar

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT = 'GAW'

first u do like this

data:

w_char(4) type c.

concatenate 'GAW' ' * ' into w_char.

then write u r select statement..

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT like w_char.

plzz reward if it usefull...

plzz dont forget to reward...

Read only

0 Likes
825

concatenate 'GA'' * ' into ZGDRAWING.

SELECT SINGLE DOKNR

FROM DRAD

INTO ZDES

WHERE OBJKY = WA_VBAP-MATNR AND

DOKAR = 'GAD' AND

DOKVR = '00'.

SELECT SINGLE DKTXT

FROM DRAT

INTO ZDES1

WHERE DOKNR = ZDES AND

DOKAR = 'GAD' AND

DOKVR = '00' AND

DKTXT IN ZGDRAWING.

Hi i did like this but i am getting a error like this unable to interpret GA*.

Can u plz help me out in this??

Read only

0 Likes
825

Hi Radhu,

concatenate 'GA' ' * ' into ZGDRAWING.

There has to be space between the two inverted comas.Because GA is one string and * is another one.

Please check with that once again.

That is the reason why your getting an error.

Rest of the code is fine.

Revert for any other querries.

Regards,

Kaushik

Read only

Former Member
0 Likes
825

Hi Radhu,

Try this.

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT LIKE 'GAW%'

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
825

Hi Radhu,

The select querry that you have writen is fine.The only change that you need to do is in the WHERE condition.

Here in the where condition DKTXT is checking for all those values which start with GAW.

If the % is given in this way,then the select querry will retrieve all the DOKNR for the values of DKTXT starting with GAW.

SELECT SINGLE DOKNR

FROM DRAT

INTO ZDOKNR

WHERE DKTXT like 'GAW%'

Plese revert for any querries.

Reward points if helpfull.

Regards,

Srikanth Tulasi

Read only

radhushankar
Participant
0 Likes
825

Thanks for ur answers.