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

search help method

Former Member
0 Likes
363

Hi friends i have a write a method where in the impoting parameter could be

firstname, lastname and empid and exporting parameter should be a table which would contain the employee name and his manger name.

I have to write a search method. I would search an employee using wildcard characters (in paramter) for eg if i input 'Chris*' and press f4 or enter it has to show all the name starting with 'Chris......' .

How to do that pls help me

John

2 REPLIES 2
Read only

Former Member
0 Likes
338

Hi John,

Assuming u define the internal table for returning as this .

Types: begin of ty_wa_result,

empname type z_john_table-empname,

manager type z_john_table-manager,

End of ty_wa_result.

types: ty_it_result type standard table of ty_wa_result with default key.

method definition.

methods f4_for_employee importing f_name type z_john_table-fname

l_name type z_john_table-lname

emp_id type z_john_table-empid

returning value(result) type ty_it_result.

method Implementation:

method f4_for_employee.

data : l_f_name type z_john_table-fname.

data : l_where_cond type c length 60.

l_f_name = z_john_table-fname.

replace all occurences of '*' in l_f_name with '%'.

if sy-subrc ne 0.

concatenate l_f_name '%' into l_where_cond.

endif.

select empname manager from z_john_table

into corresponding fields of table it_result

where fname like l_where_cond.

endmethod.

Read only

Former Member
0 Likes
338

Hi John,

Execute the following Code

data: cucol like sy-cucol,

curow like sy-curow,

select_string like help_info-fldvalue,

matchcode_id like dd23l-mcid,

matchcode_object like dd23l-mconame,

select_value(79) type c.

parameters : p_matnr like mara-matnr.

at selection-screen on value-request for p_matnr.

move 'MAT1' to matchcode_object.

select_string = '1*'. "help_info-fldvalue.

call function 'HELP_VALUES_GET_WITH_MACO'

exporting

cucol = cucol

curow = curow

mc_id = matchcode_id

mc_object = matchcode_object

selstr = select_string

importing

selectvalue = select_value

exceptions

no_selection = 01

no_values = 02

no_values_selected = 03.

place the cursor at material No on the selection screen and press F4 button

then you will find the 3rd text box is your Search item. "1*"

Regards

Sreeni