Application Development 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: 

How to display name of the employees start with any letter?

Former Member
0 Kudos

Hi Developer,

Please guide me in solving the issues, that i need to display names of the employee starting with any letter.

example:

if i provide name of the employee starting letter 'A' it should display only those name in the database table with starting letter.

parameters:  a*

it should display name with starting letter a.

example:

abdi

akbar

akash

akilesh

thanks,

ravi.

5 REPLIES 5

former_member201275
Active Contributor
0 Kudos

Could you at least provide some detail! where do you want to do this? in a program or in PA20? Why do you want this? etc....

Former Member
0 Kudos

Hello,

you mean like this?


SELECT * FROM xyz

  WHERE name LIKE A%

          OR name LIKE a%

Regards

Michael

former_member202818
Active Contributor
0 Kudos

Hi Ravinder,

DATA: it_name type table of name1.

PARAMETER pa_name type name1.

REPLACE '*' IN pa_name WITH '%'.

SELECT name FROM table_name INTO TABLE it_name WHERE name LIKE pa_name.

Regards

Sreekanth

rajkumarnarasimman
Active Contributor
0 Kudos

Hi ravi,

Please find the below code.


"Data Declarations

PARAMETERS: p_ename TYPE pa0001-ename.

TYPES: BEGIN OF ty_pa0001,

                     pernr TYPE pernr_d,

                      ename TYPE pa0001-ename,

              END OF ty_pa0001.

DATA: it_pa0001 TYPE TABLE OF ty_pa0001.

"Merge the Percentage symbol to Employee name

CONCATENATE p_ename '%' INTO p_ename.

"Retrieve the value from database

SELECT pernr

        ename

    FROM pa0001

   INTO TABLE it_pa0001

WHERE ename LIKE p_ename.



Regards


Rajkumar Narasimman

former_member204264
Participant
0 Kudos

Hi Ravinder,

You can use Ranges for this purpose:


RANGES: r_name FOR type_name.

r_name-sign = 'I'.

r_name-option = 'CP'.

r_name-low = 'a*'.

INSERT r_name.

SELECT name FROM table_name INTO TABLE it_name WHERE name IN r_name.


Regards.