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
508

hi all,

SELECT SINGLE bktxt "Document header text

FROM bkpf

INTO l_bktxt

WHERE bktxt = r_bktxt "Document header text - by user

and bukrs = c_comapny "Company Code

AND blart = 'PA' "Document Type

OR blart = 'PB'

OR blart = 'PC'

OR blart = 'PD'

OR blart = 'PE'

OR blart = 'PF'

OR blart = 'PH'

OR blart = 'CA'

OR blart = 'CB'

OR blart = 'CD'

OR blart = 'CE'

OR blart = 'CF'

OR blart = 'CK'

OR blart = 'CM'

OR blart = 'CN'.

i am checking the BKTXT against BKPF with r_bktxt, Whether it is there or not.

but the problem is, if the bktxt is not matched then it should not get any value.

but it is getting some other value matching with blart.

Please give me any suggestion.

Regards,

Sri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
441

Hi,

Try to use brackets in ur select querry as belwo.



SELECT SINGLE bktxt "Document header text
FROM bkpf INTO l_bktxt
WHERE bktxt = r_bktxt "Document header text - by user
and bukrs = c_comapny "Company Code
AND ( blart = 'PA' "Document Type
OR blart = 'PB'
OR blart = 'PC'
OR blart = 'PD'
OR blart = 'PE'
OR blart = 'PF'
OR blart = 'PH'
OR blart = 'CA'
OR blart = 'CB'
OR blart = 'CD'
OR blart = 'CE'
OR blart = 'CF'
OR blart = 'CK'
OR blart = 'CM'
OR blart = 'CN' )

3 REPLIES 3
Read only

Former Member
0 Likes
442

Hi,

Try to use brackets in ur select querry as belwo.



SELECT SINGLE bktxt "Document header text
FROM bkpf INTO l_bktxt
WHERE bktxt = r_bktxt "Document header text - by user
and bukrs = c_comapny "Company Code
AND ( blart = 'PA' "Document Type
OR blart = 'PB'
OR blart = 'PC'
OR blart = 'PD'
OR blart = 'PE'
OR blart = 'PF'
OR blart = 'PH'
OR blart = 'CA'
OR blart = 'CB'
OR blart = 'CD'
OR blart = 'CE'
OR blart = 'CF'
OR blart = 'CK'
OR blart = 'CM'
OR blart = 'CN' )

Read only

syed_ibrahim5
Active Participant
0 Likes
441

hi,

try to use IN ..


SELECT SINGLE bktxt "Document header text
FROM bkpf
INTO l_bktxt
WHERE bktxt = r_bktxt "Document header text - by user
and bukrs = c_comapny "Company Code
AND blart in ('PA','PB','PC','PD'.......).

regards,

syed

Read only

Former Member
0 Likes
441

Hi Sri,

you are checking multiple document type. so you have to mention in brackets. Pls try below code.

SELECT SINGLE bktxt "Document header text

FROM bkpf

INTO l_bktxt

WHERE bktxt = r_bktxt "Document header text - by user

and bukrs = c_comapny "Company Code

AND ( blart = 'PA' "Document Type

OR blart = 'PB'

OR blart = 'PC'

OR blart = 'PD'

OR blart = 'PE'

OR blart = 'PF'

OR blart = 'PH'

OR blart = 'CA'

OR blart = 'CB'

OR blart = 'CD'

OR blart = 'CE'

OR blart = 'CF'

OR blart = 'CK'

OR blart = 'CM'

OR blart = 'CN' ).

Rgds,

Arun