on ‎2024 Feb 16 7:10 PM
SELECT
bukrs
gjahr
budat
lifnr
waers
FROM vsak INTO TABLE lt_blg
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr ( AND ) lifnr LIKE 'OOOO9%' *******************************
AND budat IN s_budat.
HI,
*************How can I use the lifnr field in the select statement with both IN and LIKE?
What is the correct combined code?
Many Thanks for any help..!!!!
Request clarification before answering.
Is the number range selection related to some vendor account group (e.g. non employee vendor) in this case consider a more dynamic code using a join with LFA1 to get the group and filter on its value.
Else just remove the parenthesis ( )
AND lifnr IN s_lifnr AND lifnr LIKE '00009%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I changed the code to fit my system data model, but the idea is the same, here is an example of the SQL Statement working:
TABLES: bsak, t001.
SELECT-OPTIONS: s_bukrs FOR t001-bukrs,
s_lifnr FOR bsak-lifnr,
s_budat FOR bsak-budat.
SELECT bukrs,
gjahr,
budat,
lifnr,
waers
FROM bsak
INTO TABLE @DATA(lt_data)
WHERE bukrs IN @s_bukrs
AND ( lifnr IN @s_lifnr AND lifnr LIKE '%61%' )
AND budat IN @s_budat.
LOOP AT lt_data INTO DATA(ls_data).
WRITE: / ls_data.
ENDLOOP.I´ve changed the wildcard to %61% just to get some records in the result.
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 36 | |
| 26 | |
| 20 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.