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

Read stmt

Former Member
0 Likes
1,030

hi all,

i want to retrive the data of particular material for eg : starting with ' D '

using READ statement.

iam using like this:

READ TABLE IT_PROP INTO WA_PROP WITH KEY MATNR = 'C%'.

it s not working.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,010

Hi,

use 'D%'

in place of 'C%'

Reward points, if helpful,

Sandeep Kaushik

Message was edited by:

Sandeep Kaushik

9 REPLIES 9
Read only

Former Member
0 Likes
1,010

loop at it_prop where matnr cp 'D*'.

exit.

endloop.

if sy-subrc = 0.

write:/ it_prop-matnr 'starts with D'.

endif.

Regards,

Ravi

Read only

Former Member
0 Likes
1,010

Hi try this :

DATA : V1(3) VALUE '25%',

V2(3) VALUE '45%',

V3(3) VALUE '55%'.

SELECT EBELN EBELP MATNR WERKS PSTYP MENGE MEINS NETPR MWSKZ NAVNW

INCO1 INCO2 LGORT UNTTO UEBTO LOEKZ KNTTP WEPOS REPOS

WEUNB PEINH INFNR BANFN BNFPO ANFNR ANFPS TXZ01 WEBRE

from ekpo into table i_ekpo

where ( ebeln like v1 or

ebeln like v2 or

EBELN LIKE V3 )

AND WERKS NOT IN ('ADMM','LGHS','XO01','NGM1','ADMN')

AND LOEKZ EQ SPACE

AND ELIKZ EQ SPACE.

Reward points if helpful

Srikanta Gope

Read only

Former Member
0 Likes
1,010

It is not possible with read.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'C%'.

append s_matnr.

loop at itab where matnr in s_matnr.

*-Here you get the record.

endloop.

regards

Vijay

Read only

Former Member
0 Likes
1,010

define in range for material like below

ranges: r_matnr for mara-matnr.

r_matnr-sign = 'EQ'.

r_matnr-option = 'CP'.

r_matnr-low = 'C%'. "The material code letters which are looking for

append r_matnr.

clear r_matnr.

READ TABLE IT_PROP INTO WA_PROP WITH KEY MATNR in r_matnr.

check sy-subrc = 0.

Read only

Former Member
0 Likes
1,010

Hi,

in ABAP the symbol % is * but however the READ statement doesn't work with a partial key.

Try with

loop at it_prop into wa_prop where matnr CP 'C*'.

bye

Read only

0 Likes
1,010

if you are interested in a single record put an exit in the loop...

loop at .....

....

....

....

exit.

endloop.

Read only

Pawan_Kesari
Active Contributor
0 Likes
1,010

LOOP AT IT_PROP INTO WA_PROP WHERE MATNR = 'C%'.
* Do you stuff here
ENDLOOP.
Read only

Former Member
0 Likes
1,011

Hi,

use 'D%'

in place of 'C%'

Reward points, if helpful,

Sandeep Kaushik

Message was edited by:

Sandeep Kaushik

Read only

VXLozano
Active Contributor
0 Likes
1,010

ouch, I didn't see those answers when posting -

-


You cannot use masks with READ TABLE. Maybe you can try with something like

LOOP AT it_prop INTO wa_prop WHERE matnr LIKE 'D%'.
  EXIT.
ENDLOOP.

If you cannot use the LIKE option, try to make a RANGES for matnr and use "matnr IN range".

Message was edited by:

Vicenç Lozano