cancel
Showing results for 
Search instead for 
Did you mean: 

Select Query

Former Member
0 Kudos

Hi

I have a table field SWWWIHEAD-WI_TEXT

the values for the field are for eg.

Travel Request: 2846 for Employee: 18472

Travel Request: 353 for Employee: 1525

Travel Request: 42134 for Employee: 8855

Now when user gives Travel request number in selection screen as 2846

i need to fetch the above record. User wont input the key field.

Basically I need to look into each fields text and find if the travel request number is there in the text field.

How do we fram the select query on this.

Any help will be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Define the field as Ranges and write a select statement to get the desired record.

Do it as below.

IF SWWWIHEAD-WI_TEXT IS NOT INITIAL.

CONCATENATE '*'

SWWWIHEAD-WI_TEXT

'*'

INTO l_text.

r_text-sign = 'I'.

r_text-option = 'CP'.

r_text-low = l_text.

APPEND r_text.

ENDIF.

Now write a select statement to get the desired record.

Select WI_TEXT from <table> into table itab

where WI_TEXT in r_text.

Regards,

Ram

Answers (3)

Answers (3)

Former Member
0 Kudos

PARAMETERS : P1(4).

DATA : PAT(6).

CONCATENATE '%' P1 '%' INTO PAT.

SELECT * FROM DBTAB WHERE F1 LIKE PAT.

REGARDS

SHIBA DUTTA

Former Member
0 Kudos

hi Syed,

pl create one search help of type elementary search help.

in selection method type the table name,

in search help parameter write the fields which u want to select on selection sreen,

click on IMP checkbox.

and call this search help from ur program.

OR

Tyr to use AT SELECTION-SCREEN OUTPUT event in that event u fetch data from db and assign that data to the paramenter or selct option.

it will also resolve ur problem

Regards,

kapil Soni

Message was edited by:

Kapil Soni

Former Member
0 Kudos

Hi,

Just try like this:


  SELECT WI_TEXT 
  INTO [Your Table]
  FROM SWWWIHEAD
  WHERE WI_TEXT LIKE '%2846%'.

or if You have more than one Travel request number:


  DATA: BEGIN OF LIT_WHERE OCCURS 1,
          LINE(256) TYPE C,
        END OF LIT_WHERE.

  CONCATENATE 'WI_TEXT LIKE ''' '%' P_TEXT '''' 
  INTO LIT_WHERE-LINE.
  APPEND LIT_WHERE.
* loop above statement to add more Travel request number

  SELECT WI_TEXT 
  INTO [Your Table]
  FROM SWWWIHEAD
  WHERE (LIT_WHERE).

add you can add more then just one Travel request number.

P_TEXT > Travel request number.

Regards,