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

Selection according

Former Member
0 Likes
765

Hi experts,

I want to modify the selection below.

v_repid is the program name, tvarv-name is tvarv variable name. I need the record from tvarv only if the t_varv-name contains the string of v_repid. How can I check for example the first eight characters of the name, during the selection. I hope I was clear.

SELECT name

type

numb

sign

opti

low

high

FROM tvarv

INTO TABLE i_tvarv

WHERE name EQ v_repid

AND type EQ i_type.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
740

HI,

you can use the selction like below

concatenate v_repid(8) '%' into v_repid1.

SELECT SINGLE parva INTO v_kokrs FROM usr05

WHERE parid = 'CAC'

  • AND bname like v_repid1. *

i hope this slves ur probelm.

6 REPLIES 6
Read only

Former Member
0 Likes
740

here what you can do is use string operations.

1>select the records as per your need.

2>check if t_varv-name CA v_repid

hope it helps and i guess ths is what 1 of the option that can be done

regards

bhanu

Read only

Former Member
0 Likes
741

HI,

you can use the selction like below

concatenate v_repid(8) '%' into v_repid1.

SELECT SINGLE parva INTO v_kokrs FROM usr05

WHERE parid = 'CAC'

  • AND bname like v_repid1. *

i hope this slves ur probelm.

Read only

Former Member
0 Likes
740

Hi,

Try this:

Data: lv_repid(9) type c,

lv_repid = 'abcdefg%' (your repid with %).

SELECT name

type

numb

sign

opti

low

high

FROM tvarv

INTO TABLE i_tvarv

WHERE name like lv_repid

*WHERE name EQ v_repid

AND type EQ i_type.

Kind Regards

Read only

Former Member
0 Likes
740

hi friend ,

put a loop and use offset.

loop at i_tvarv into wa_tvarv.

if tvarv-name0(7) = v_repid0(7).

  • do your operation

else.

exit

endif.

endloop.

regards

sandeep

Read only

Former Member
0 Likes
740

U can use LIKE in the select to search the name from TVARV table.

Check this sample code:

REPORT zdemo LINE-SIZE 180 LINE-COUNT 60(10) NO STANDARD PAGE

HEADING.

data: i_tvarv type standard table of tvarv.

data: l_search_text(10) type c.

data: v_repid like sy-repid.

v_repid = sy-repid.

concatenate v_repid+0(8) '%' into l_search_text in character mode.

SELECT name

type

numb

sign

opti

low

high

FROM tvarv

INTO TABLE i_tvarv

WHERE name like l_search_text.

AND type EQ i_type.

check sy-subrc = 0.

Regards,

Joy.

Read only

Former Member
0 Likes
740

Thanks for the answers.