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

Select options , Parameters

Former Member
0 Likes
796

Guy , if I write N* in a parameter or select option field , and I want the system to bring me all coincidences with N in a select , How can I do that ?. How it works , thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
724

Hi Jose,

I have done the following successfully:


    CONCATENATE '''' '%' LN_INPUT '%' '''' INTO LN_COND.
    CONCATENATE 'NCHMC LIKE' LN_COND INTO condition SEPARATED BY SPACE.
    SELECT PERNR
      INTO CORRESPONDING FIELDS OF TABLE ITAB
      FROM PA0002
      WHERE (condition).

Good luck.

SL

7 REPLIES 7
Read only

Former Member
0 Likes
724

Hi

U should obtain automatically what you need for select-options, for parameters u should replace * with % before doing the select.

PARAMETERS: P_PARAM(10).

REPLACE '*' WITH '%' INTO P_PARAM.
IF SY-SUBRC = 0.
  SELECT * FROM <TABLE> WHERE <FIELD> LIKE P_PARAM
  ..............................................
ELSE.
  SELECT * FROM <TABLE> WHERE <FIELD> = P_PARAM

Max

Read only

0 Likes
724

Even this exampled code must works, I passed sales organization first one letter with '*' and it returned all the records which satisfies.

tables: tvko.

select-options: s_vkorg for tvko-vkorg.

data: t_tvko like standard table of tvko with header line.

select * into table t_tvko

from tvko

where vkorg in s_vkorg.

Read only

Former Member
0 Likes
725

Hi Jose,

I have done the following successfully:


    CONCATENATE '''' '%' LN_INPUT '%' '''' INTO LN_COND.
    CONCATENATE 'NCHMC LIKE' LN_COND INTO condition SEPARATED BY SPACE.
    SELECT PERNR
      INTO CORRESPONDING FIELDS OF TABLE ITAB
      FROM PA0002
      WHERE (condition).

Good luck.

SL

Read only

0 Likes
724

thank you guys ,bout i ve forgotten to mention that i´m working with field afvc-projn, in a select option , so in order to have it like character i have to pass it for a function first CONVERSION_EXIT_ABPSP_OUTPUT, and just then i got it like a string of character , the things is if I try to put N* it gave me the message 'PEP element doesnt exist' . so I need it like string before do replaces , any iidea ?

Read only

0 Likes
724

Hi Jose,

I am not familiar with the field you are working with, but as I can recall, the part that gave me the most difficulty when creating the "dynamic select" condition was getting the correct quotation marks included in the statement. Debug your program and make sure you are creating the correct condition, to ensure that the select statement will be executed correctly.

Thx

SL

Read only

0 Likes
724

I think you're making this too complicated. Rather than trying to solve this with code, it would probably be better to educate your users so that they understand what they need to enter in the parameter in order to get the results they want.

Rob

Read only

0 Likes
724

If you really need a wildcard for parameters, then instead of using parameters use Select-Options with

no-extension no intervals options. That will make the field look loke parameter with just one single value but you can use wild cards easily there

select-options : so_matnr for mara-matnr no extension no intervals.