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

Pattern search with an internal table in select

Former Member
0 Likes
754

Hi Experts,

I am facing error the following code, when I tried to user like %.

SELECT OBJNR "Object Number

LMVRG "Confirmed Qty.

XMVRG "Scrapped Qty.

AGRND "Reason Code

BLDAT "Document date

VORNE "Reporting Point

FROM CEZP

INTO TABLE TCEZP

for all entries in tmdks

WHERE <b>objnr like %tmdks-aufnr</b>

and PLNKN <> '99999999'

AND WERKS IN S_WERKS

AND BLDAT IN S_BUDAT

AND STFLG = SPACE " Identifier for reversal document

AND STOKZ = SPACE. " Identifier for "document was reversed

Please advise.

Thanks in advance,

Viven

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
664

Hello Chander,

Do like this.

DATA: RA_OBJNR TYPE RANGE OF OBJNR WITH HEADER LINE.

DATA: LV_OBJNR(10).

LOOP AT TMDKS.

RA_OBJNR-SIGN = 'I'.

RA_OBJNR-OPTION = 'CP'.

CONCATENATE TMDKS-AUFNR '*' INTO V_OBJNR.

RA_OBJNR-LOW = LV_OBJNR.

APPEND RA_OBJNR.

CLEAR RA_OBJNR.

ENDLOOP.

<b>IF NOT RA_OBJNR[] IS INITIAL.</b>

SELECT OBJNR "Object Number

LMVRG "Confirmed Qty.

XMVRG "Scrapped Qty.

AGRND "Reason Code

BLDAT "Document date

VORNE "Reporting Point

FROM CEZP

INTO TABLE TCEZP

<b>WHERE objnr in RA_OBJNR</b>

and PLNKN <> '99999999'

AND WERKS IN S_WERKS

AND BLDAT IN S_BUDAT

AND STFLG = SPACE " Identifier for reversal document

AND STOKZ = SPACE. " Identifier for "document was reversed

ENDIF.

Vasanth

4 REPLIES 4
Read only

Former Member
0 Likes
664

Put the entries from table tmdks into a range using the option value of 'CP'. You will also need the wildcard symbol on the values in the range table.

Ranges r_aufnr for tmdks-aufnr.

r_aufnr-option = 'CP'.

r_aufnr-sign = 'I'.

loop at tmdks.

concatenate '' tmdks-aufnr '' into r_aufnr-low.

append r_aufnr.

endloop.

Message was edited by:

Martin Shinks

Read only

Former Member
0 Likes
664

take this inot a variable as follows -

d_var = tmdks-aufnr.

concatenate % d_var into d_var.

then write ur select query liek this -

SELECT OBJNR "Object Number

LMVRG "Confirmed Qty.

XMVRG "Scrapped Qty.

AGRND "Reason Code

BLDAT "Document date

VORNE "Reporting Point

FROM CEZP

INTO TABLE TCEZP

for all entries in tmdks

WHERE objnr like d_var

and PLNKN <> '99999999'

AND WERKS IN S_WERKS

AND BLDAT IN S_BUDAT

AND STFLG = SPACE " Identifier for reversal document

AND STOKZ = SPACE. " Identifier for "document was reversed

Read only

Former Member
0 Likes
665

Hello Chander,

Do like this.

DATA: RA_OBJNR TYPE RANGE OF OBJNR WITH HEADER LINE.

DATA: LV_OBJNR(10).

LOOP AT TMDKS.

RA_OBJNR-SIGN = 'I'.

RA_OBJNR-OPTION = 'CP'.

CONCATENATE TMDKS-AUFNR '*' INTO V_OBJNR.

RA_OBJNR-LOW = LV_OBJNR.

APPEND RA_OBJNR.

CLEAR RA_OBJNR.

ENDLOOP.

<b>IF NOT RA_OBJNR[] IS INITIAL.</b>

SELECT OBJNR "Object Number

LMVRG "Confirmed Qty.

XMVRG "Scrapped Qty.

AGRND "Reason Code

BLDAT "Document date

VORNE "Reporting Point

FROM CEZP

INTO TABLE TCEZP

<b>WHERE objnr in RA_OBJNR</b>

and PLNKN <> '99999999'

AND WERKS IN S_WERKS

AND BLDAT IN S_BUDAT

AND STFLG = SPACE " Identifier for reversal document

AND STOKZ = SPACE. " Identifier for "document was reversed

ENDIF.

Vasanth

Read only

Former Member
0 Likes
664

WHERE objnr like '%tmdks-aufnr'

regards

shiba dutta